Commit 24c6383
committed
Fix fold2 horizontal reduction to use Vector.Sum for performance and correctness
- Replace manual loop accumulation with Vector.Sum() in fold2Unchecked
- Aligns with dot product optimization from PR #33
- Removes hardcoded addition operator, improving both correctness and performance
- All 488 tests pass
This change:
1. Uses hardware-optimized horizontal add instructions (VPHADDPS/VHADD on AVX)
2. Removes unnecessary re-initialization with 'init' during horizontal reduction
3. Provides consistent pattern with other SIMD reductions in the codebase1 parent 390a6e1 commit 24c6383
1 file changed
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
644 | | - | |
645 | | - | |
646 | | - | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
647 | 648 | | |
648 | 649 | | |
649 | 650 | | |
| |||
0 commit comments