Skip to content

Commit 56db0a1

Browse files
committed
Fix a out-of-bounds accessing bug.
Before applying this modification, when executing the benchmark listed below, a segment fault will be reported because of the out-of-bounds accessing to the packed_weights buffer: ./x16-packw-bench --benchmark_filter=qs8_qc4w_packw_x8c8__reference/sd1x_diffusion/B:8/M:4096/N:4096/K:40/real_time --benchmark_min_time=0.1 Here, the packed_weights buffer is resized to a reasonable size and the error will not be reported.
1 parent c2bddb4 commit 56db0a1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bench/packw-benchmark.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ static void qs8_qc4w_packw(benchmark::State& state,
271271
const size_t dim_k = state.range(3); // dim_k is kc parameter
272272

273273
const size_t rounded_n = benchmark::utils::RoundUp(dim_n, nr);
274-
const size_t rounded_k = benchmark::utils::RoundUp(dim_k, kr * sr);
274+
const size_t rounded_k = round_up_po2(dim_k, 2 * kr * sr);
275275
const size_t rounded_size = rounded_n * rounded_k / 2 + rounded_n * sizeof(uint32_t);
276276

277277
std::random_device random_device;

0 commit comments

Comments
 (0)