Possible heap corruption in qs8-dwconv-bench with primary_tile=25
- Dominant language
- C
- Stars
- 2.5k
- Forks
- 560
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 163
Description
While implementing https://github.com/google/XNNPACK/pull/7638 and attempting to run qs8-dwconv-bench with xnn_qs8_dwconv_minmax_fp32_ukernel_25p8vc the benchmark encounters a malloc error after several tests. Running with 9p8vc is fine.
I noticed that the current qs8-dwconv-bench only uses primary_tile = 9 for its scalar benchmarks. Adding a benchmark test to include the scalar primary_tile=25 kernel results in the same apparent heap corruption.
Add to bench/qs8-dwconv.cc
```
static void qs8_dwconv_25p4c__scalar_lrintf(benchmark::State& state, const char* net) {
DWConvBenchmark(state,
xnn_qs8_dwconv_minmax_fp32_ukernel_25p4c__scalar_lrintf,
xnn_init_qs8_conv_minmax_fp32_scalar_params,
4 /* channel tile */, 25 /* primary tile */);
}
BENCHMARK_DWCONV(qs8_dwconv_25p4c__scalar_lrintf);
```
Test result.
```
./qs8-dwconv-bench --benchmark_filter=qs8_dwconv_25p4c__scalar_lrintf
2025-01-07T18:34:14-08:00
Running ./qs8-dwconv-bench
Run on (8 X 1600 MHz CPU s)
CPU Caches:
L1 Instruction 32 KiB (x8)
L1 Data 32 KiB (x8)
L2 Unified 512 KiB (x2)
Load Average: 2.04, 1.65, 0.80
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
qs8_dwconv_25p4c__scalar_lrintf/mobilenet_v1/H:112/W:112/KH:3/KW:3/PH:2/PW:2/S:1/D:1/G:32/real_time 45615502 ns 45204284 ns 15 OPS=158.397M/s bytes=17.6088M/s cpufreq=1.6G
malloc(): invalid size (unsorted)
Aborted
```
I'm not clear if the test case is invalid here, or if there is a bug within DWConvBenchmark.
Contributor guide
Assessment
This issue has not been assessed yet.