Commit 26b0013
Specialize non-reducing kernel: drop reduction-only iszero hoist
The dim-1 inner core in `_mapreduce_kernel_expr` carried an
`iszero(stride_1_1)` branch that hoists `A1[I1]` out of the `@simd`
loop. That hoist only matters for reductions, where the destination
stride along the inner dim is zero. For the non-reducing path
(`op === nothing`: map!/permute/copy!/fill!/...) every destination
element is written exactly once, so the branch is dead and the loop
body was needlessly generated twice.
Emit the plain `@simd` loop (one body, no runtime branch) for
`op === nothing`, keeping the hoist for reductions. Runtime-neutral
(no permute regression) and trims a bit of non-reducing compile time.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 5baa949 commit 26b0013
1 file changed
Lines changed: 30 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
| 343 | + | |
343 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
344 | 348 | | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
| 349 | + | |
| 350 | + | |
362 | 351 | | |
363 | 352 | | |
364 | 353 | | |
| |||
368 | 357 | | |
369 | 358 | | |
370 | 359 | | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
371 | 384 | | |
372 | 385 | | |
373 | 386 | | |
| |||
0 commit comments