Skip to content

feat(math): complete SIMD distance kernels - #96

Merged
zhenghaoz merged 1 commit into
mainfrom
feat/complete-math-simd
Sep 28, 2026
Merged

zhenghaoz merged 1 commit into
mainfrom
feat/complete-math-simd

Conversation

@zhangzhenghao

Copy link
Copy Markdown
Collaborator

Summary

  • add AVX-512 FP32 batch dot-product and squared-L2 kernels
  • add dedicated FP16 batch kernels for AVX-512, NEON, and LASX
  • add LASX FP16 single-vector L2, dot-product, and fused dot/norm kernels
  • consolidate math_batch FP16 scalar APIs and tests into distance.go and distance_test.go
  • keep RVV FP16 on the scalar path because the current CPU feature source exposes base V but not the optional Zvfhmin extension required for safe dispatch

Verification

  • go test -p 1 ./...
  • go test -p 1 -tags noasm ./...
  • go vet ./...
  • make test-neon in internal/ailego/math_batch
  • make test-lasx in internal/ailego/math and internal/ailego/math_batch
  • make test-rvv in internal/ailego/math and internal/ailego/math_batch
  • regenerated affected GoAT outputs twice and verified identical SHA-256 hashes
  • inspected generated assembly for AVX-512 ZMM, NEON FP16, and LASX FP16 instructions

Notes

The architecture-specific tests skip when the required CPU features are unavailable. FP16 NEON dispatch requires both HasFPHP and HasASIMDHP.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying xvec with  Cloudflare Pages  Cloudflare Pages

Latest commit: 10ca6ed
Status: ✅  Deploy successful!
Preview URL: https://62ead15d.xvec.pages.dev
Branch Preview URL: https://feat-complete-math-simd.xvec.pages.dev

View logs

@codecov

codecov Bot commented Sep 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 24.17582% with 69 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.23%. Comparing base (6c235ed) to head (10ca6ed).

Files with missing lines Patch % Lines
internal/ailego/math_batch/distance_amd64.go 2.70% 36 Missing ⚠️
internal/ailego/math_batch/distance_fp16_amd64.go 2.94% 33 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #96      +/-   ##
==========================================
- Coverage   81.41%   81.23%   -0.18%     
==========================================
  Files         150      149       -1     
  Lines       30672    30743      +71     
==========================================
+ Hits        24971    24974       +3     
- Misses       5699     5767      +68     
  Partials        2        2              

☔ 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 5d9b8f5 into main Sep 28, 2026
8 of 9 checks passed
@zhenghaoz
zhenghaoz deleted the feat/complete-math-simd branch September 28, 2026 00:22
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