You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Performance #727] Vectorize transcendental math and RBF-style elementwise kernels across C/MLIR backends #751
Many ML/scientific loops are not only multiply/add: they contain exp/log/sqrt/trig used in RBF kernels, likelihoods and transforms. Scalar libm calls can cap SIMD throughput even after loop vectorization.
Audit target/compiler vector-math capabilities and lower eligible bulk operations through vectorizable forms/libraries/intrinsics while preserving documented IEEE/accuracy semantics. Provide strict and relaxed policies only if the semantic difference is explicit.
Acceptance: RBF distance->exp, GaussianNB likelihood and representative scientific elementwise kernels show vector-math evidence; error bounds are tested; strict mode never silently changes NaN/Inf/rounding semantics; performance is tracked on x86-64 and arm64.
Worked through the strict-semantics boundary for RBF SVC vector transcendental lowering and archived the full derivation + Flow semantic witness in godofecht/OpenProjects as ml/decision-certified-vector-exp-for-rbf-svc.{md,flow}.
Key result: a generic approximate vector exp cannot silently replace scalar exp in strict mode merely because its error is small. For an RBF binary decision f = b + Σ β_i k_i, if a vector exp provides |k̃_i/k_i - 1| <= ε < 1, then
|f - f̃| <= [ε/(1-ε)] Σ |β_i| k̃_i = B.
So abs(f̃) > B certifies that the approximate vector path has exactly the same decision sign as the strict scalar implementation. Low-margin queries can selectively recompute exact scalar exponentials; after recomputing subset E, remove their uncertainty contributions and stop once the corrected score exceeds the remaining bound. Recomputing terms in descending |β_i| * ε/(1-ε) * k̃_i order is optimal for minimizing the remaining bound after any fixed number of exact refinements.
The concrete 6-support witness certifies a large-margin query with 0 scalar fallbacks and a deliberately tiny-margin (+0.002 strict score) query after exactly 3/6 exact exp recomputations. An independent local oracle tested 100,000 randomized decisions with no certified sign flips and exhaustively verified the greedy uncertainty-removal rule on randomized 6-term systems.
This suggests a useful split for #751: keep generic strict exp bit-semantics unchanged; add target vector-math providers with explicit error envelopes; allow domain-aware kernels such as RBF SVC to use speculative vector transcendental evaluation plus decision certificates/fallback. Apple’s current SIMD docs describe precise variants as accurate to a few ULPs, which reinforces that the vector provider needs an explicit numerical contract rather than being assumed bit-identical.
Activity
godofecht commentedon Aug 27, 2026
Worked through the strict-semantics boundary for RBF SVC vector transcendental lowering and archived the full derivation + Flow semantic witness in
godofecht/OpenProjectsasml/decision-certified-vector-exp-for-rbf-svc.{md,flow}.Key result: a generic approximate vector
expcannot silently replace scalarexpin strict mode merely because its error is small. For an RBF binary decisionf = b + Σ β_i k_i, if a vector exp provides|k̃_i/k_i - 1| <= ε < 1, then|f - f̃| <= [ε/(1-ε)] Σ |β_i| k̃_i = B.So
abs(f̃) > Bcertifies that the approximate vector path has exactly the same decision sign as the strict scalar implementation. Low-margin queries can selectively recompute exact scalar exponentials; after recomputing subset E, remove their uncertainty contributions and stop once the corrected score exceeds the remaining bound. Recomputing terms in descending|β_i| * ε/(1-ε) * k̃_iorder is optimal for minimizing the remaining bound after any fixed number of exact refinements.The concrete 6-support witness certifies a large-margin query with 0 scalar fallbacks and a deliberately tiny-margin (+0.002 strict score) query after exactly 3/6 exact exp recomputations. An independent local oracle tested 100,000 randomized decisions with no certified sign flips and exhaustively verified the greedy uncertainty-removal rule on randomized 6-term systems.
This suggests a useful split for #751: keep generic strict
expbit-semantics unchanged; add target vector-math providers with explicit error envelopes; allow domain-aware kernels such as RBF SVC to use speculative vector transcendental evaluation plus decision certificates/fallback. Apple’s current SIMD docs describe precise variants as accurate to a few ULPs, which reinforces that the vector provider needs an explicit numerical contract rather than being assumed bit-identical.No hosted workflow/CI work was used.
perf(#751): RBF-style vectorization codegen and elementwise benchmark (…
feat(mlir): Vectorize transcendental math and RBF-style elementwise k…