Commit b223e7d
Fix overflow and stride>1 fallback in cadence::quantized_conv1d HiFi kernels
Summary:
Fixes two correctness issues in the HiFi backend kernels for
cadence::quantized_conv1d_ncl.out and quantized_conv1d_nlc.out that
were surfaced while writing C++ unit tests:
1. out_multiplier32 overflow: the expression
`bias_scale * (1. / output_scale) * 2147483648`
overflows a 32-bit signed integer when `bias_scale / output_scale`
is >= 1.0. Clamp to INT32_MAX in that case to preserve correct
numerics for the supported range.
2. uint8 stride>1 fallback: HiFi nnlib `conv1d_std` does not support
stride > 1 in addition to groups > 1. Extend the existing
depthwise-fallback condition to also cover stride > 1, matching
the kernel's actual capabilities.
Differential Revision: D1028212091 parent 8bda9ac commit b223e7d
2 files changed
Lines changed: 10 additions & 7 deletions
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
244 | 247 | | |
245 | 248 | | |
246 | 249 | | |
| |||
419 | 422 | | |
420 | 423 | | |
421 | 424 | | |
422 | | - | |
423 | | - | |
424 | | - | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
425 | 428 | | |
426 | 429 | | |
427 | 430 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
301 | | - | |
302 | | - | |
303 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
| |||
0 commit comments