Skip to content

Commit

Permalink
Fix a out-of-bounds accessing bug.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
txwhqq committed Dec 31, 2024
1 parent c2bddb4 commit c5ab0ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bench/packw-benchmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ static void qs8_qc4w_packw(benchmark::State& state,

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

std::random_device random_device;
auto rng = std::mt19937(random_device());
Expand Down

0 comments on commit c5ab0ea

Please sign in to comment.