Skip to content

Commit c5ab0ea

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 Now, the packed_weights buffer is resized and the bug is fixed.
1 parent c2bddb4 commit c5ab0ea

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
@@ -272,7 +272,7 @@ static void qs8_qc4w_packw(benchmark::State& state,
272272

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

277277
std::random_device random_device;
278278
auto rng = std::mt19937(random_device());

0 commit comments

Comments
 (0)