Skip to content

perf(math): accelerate FHT with SIMD - #33

Merged
zhenghaoz merged 2 commits into
mainfrom
perf/fht-simd
Aug 31, 2026
Merged

perf(math): accelerate FHT with SIMD#33
zhenghaoz merged 2 commits into
mainfrom
perf/fht-simd

Conversation

@zhangzhenghao

Copy link
Copy Markdown
Collaborator

Summary

  • keep the FHT implementation in internal/ailego/math and add runtime-dispatched AVX2, AVX-512, and NEON kernels
  • generate pure-Go assembly with GoAT from C sources under internal/ailego/math/src, following the layout used by internal/floats
  • retain scalar fallbacks for noasm, unsupported CPUs, short inputs, and architecture-safe AVX-512 fallback paths
  • add SIMD-vs-scalar coverage for sign flips, Kac walks, inverse walks, and in-place transforms, including tails and odd lengths

Verification

  • go test ./... -count=1
  • go test -tags noasm ./... -count=1
  • go vet ./...
  • GODEBUG=cpu.avx2=off go test ./internal/ailego/math -run '^TestFHTAVX512ScalarFallback$' -count=1
  • ARM64 test binary under QEMU: TestFHTNEON
  • Windows amd64 cross-compilation for internal/ailego/math and internal/core/algorithm
  • make -C internal/ailego/math generate followed by a clean generated diff

Benchmark (1024 floats, amd64 AVX2 host)

  • FHTInPlace: ~3.76 µs SIMD vs ~7.51 µs scalar (noasm)
  • FHTKacWalk: ~72.7 ns SIMD vs ~550 ns scalar (noasm)

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 31, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
xvec e41b494 Aug 31 2026, 10:28 AM

@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.59701% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.38%. Comparing base (69c503e) to head (e41b494).

Files with missing lines Patch % Lines
internal/ailego/math/fht_amd64.go 74.50% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #33      +/-   ##
==========================================
- Coverage   82.39%   82.38%   -0.01%     
==========================================
  Files         121      122       +1     
  Lines       26011    26066      +55     
==========================================
+ Hits        21431    21474      +43     
- Misses       4580     4592      +12     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zhenghaoz
zhenghaoz merged commit d488a95 into main Aug 31, 2026
8 of 9 checks passed
@zhenghaoz
zhenghaoz deleted the perf/fht-simd branch August 31, 2026 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants