Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## perf/scalar-sqrt #153 +/- ##
====================================================
- Coverage 84.22% 81.02% -3.21%
====================================================
Files 6 6
Lines 1249 1249
====================================================
- Hits 1052 1012 -40
- Misses 197 237 +40
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…rToken Automatic, and add mca/dedup tooling - magemath/primitive_neon & primitive_wasm: replace per-lane #[arcane] helper calls, core::array::from_fn closures, and outlined powf_f32_fuses() with inline #[rite] / single-boundary #[arcane] primitives (WASM policy guest hot-loop outlined calls: 1,030 -> 0 across all 219 select_* arms). - magemath/minmax & recip: upgrade ScalarToken ExecutionContext::Automatic to dispatch once per whole SIMD operation via incant! and remove the scalar STD_FMA fmaf@PLT trap. - magetypes backend_gen & backend_gen_w512: replace core::array::from_fn polyfill closures with direct array construction (eliminating 166 WASM try_from_fn calls and 30 instructions / 4 v128 loads + 4 v128 stores per WASM W512 plain wrapper, while shrinking generated arm_neon.rs and wasm128.rs by >1,000 lines). - xtask/mca.py & just mca: static codegen equivalence-class deduplicator (5,256 policy arms -> 1,980 unique machine-code bodies), zero-hot-call auditor, and llvm-mca throughput/latency analyzer across x86-64 and ARM64. - benchmarks/primitive_variants_2026-11-10: bump zenbench to 952dd1f0 (macOS IOHID scan fix + QoS), fix hybrid CPU --cpu-set P-core ordering, and add --filter / --dedup / --iterate fast iteration flags.
…ask and migrate to #[attune]
…_std and run magemath primitive_contracts under SDE
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds const-configured f32/f64 min/max and f32 reciprocal/rsqrt families in Magemath. Stacked on PR152. Existing Magetypes primitives remain unchanged. Checked restricted profiles reject the whole vector and report invalid lanes; AssumeValid removes validation. Builders declare domain, NaN/zero behavior, precision, portability and execution, ending in a const integer
.bits(). Matching-width lane entries retain native vector tail results.Portable LOWP/MIDP use fixed seeds and canonically fused Newton graphs. Complete operations select native FMA, the shared cached relaxed-WASM fusion probe, or exact software FMA. Relaxed selection requires a compiled relaxed module and honors token suppression. Automatic entries dispatch at the operation boundary; std FMA3 support does not fabricate a V3 proof. HIGHP reciprocal is rounded division; HIGHP rsqrt is explicitly sqrt-then-division. Equivalent policy combinations canonicalize away.
The public API option overview, reciprocal preset/combination tables, and min/max policy tables now live in rustdoc, with a checked matching-tail example. They explain valid combinations, canonicalized equivalent flags and the distinction between portable bits and hardware execution. Rustdoc builds with warnings denied; examples pass with and without std.
The contract and ISA reference records bounds, selection, characteristics and measured costs. No blanket faster-than-native legacy replacement is qualified.
The complete permutation reference now compiles the actual builders/validators with and without std: min/max 72 raw combinations → 24 canonical flags, reciprocal/rsqrt 48 raw → 22 supported canonical flags (16 unsupported Full approximations). All five families have complete supported/redirected option tables in Rustdoc. Normal min/max excludes zero; a documented Finite builder supports ordinary zero clamps.
The canonical-cell matrix covers 66 groups / 1,566 arms per context: all supported new primitive configurations, types and logical widths, stream64/4096, chain64 and min/max zero-clamp64. Eight of nine contexts are measured and embedded in Rustdoc: Zen 5 Scalar/V3/V4/V4x, Intel V3, strict/fusing WASM and exploratory M6 NEON. Relaxed nonfusing WASM was stopped at the owner’s wrap-up request: one complete process packet and interrupted-process logs are preserved, with no complete five-process timing result. Pow/exp/log timing expansion is deferred per owner direction.
Nested tables distinguish equal-flag redirects, source graph aliases, numerical bounds, observed fixed-input errors and cell admission. Timings use std+w512+avx512; no_std timing, frontend dispatch, first use, error latency, tail speed, literal-zero specialization and NaN/Inf-heavy streams remain unmeasured. Zero-clamp64 reads an opaque zero-filled operand buffer. Strict Rustdoc and std/no_std doctests pass. The strict WASM module runs with relaxed SIMD disabled, and the relaxed module is rejected specifically for that feature (validation CLI50.0.1, distinct from timed host49.0.5).
The separate bounded-widening / canonical-rounding study adds benchmark-only designs; it does not change public arithmetic:
Dense x4/x8/x16 checks cover every signed normalized mantissa, directed accepted exponents, and MIDP/RN14 matching-width tail spots. Scalar, V3/V4/V4x, physical Intel V3, M6 NEON std/no_std, strict/relaxed/forced-non-FMA WASM std/no_std and i686 Scalar pass their independent targets. Exact scaling arguments support exponent reduction; this is not a literal sweep of every exponent/mantissa pair.
Timing uses zenbench pinned to 73302a1c115836b2646f6a9adc32058c20d1a66f, including observer-affinity and macOS CPU-counter fixes. Both fixed matrices have 13 groups per context: x4/x8/x16 short/long streams and chains, plus x8 bit-distributed and rounding-boundary stress. Strict contexts use five independent processes and 50 paired rounds each. M6 is one unconfined exploratory process. No flagged rounds or outliers are removed. Hosted WASM uses Wasmtime49.0.5 with verified fusion probes 0/1/0; the forced-nonfusing baseline target is not an FMA-only codegen ablation.
All values below are ns per 64-element x8 ordinary stream. These suites failed admission, so the numbers are descriptive, not confirmed promotion claims:
Widening reduces software-path costs but must not replace native FMA. In the separate Scalar repair comparison, RN14 division inline → cold is 107.428 → 13.284 ns; plain HIGHP division is 7.067 ns. Canonical rounding is portable but adds cost here.
The first complete matrix and cold-repair matrix retain all 208 measured groups. Every strict suite fails admission; 10/91 first-study groups and 1/91 corrective groups are individually all-clean. M6 has 0/50 clean rounds in every group. The unchanged promotion rule requires clean mandatory cells and upper95 ratio ≤1.02; no new design passes. The report includes all-retained paired bootstrap diagnostics, independent-process 91-comparison family intervals, raw zenbench bars, codegen, resource peaks and verified NAS manifests for all 204 payload files.
Validation: strict benchmark-package Clippy for std/defaults, no-default w512, optional WASM host and i686; MSRV1.89 default targets; native/hosted-WASM correctness and exact oracle replays; fmt and source-integrity checks. Production arithmetic, existing tests, generators, workspace manifests and workflows are unchanged from complete green CI67dead91. A duplicate worker full-suite run passed its first 14 stages and was stopped in unchanged powf Miri; its partial log is retained and no fresh complete local-suite pass is claimed. The complete research head6ecdfde4 passed all 55 CI jobs. Documentation head edc35cb also passed all 55 CI jobs; the next documentation update runs CI separately.
Earlier patched-harness qualification, fusion evidence, and linear-sRGB inventory remain revision-scoped. Parallel correction and canonical RCP14 emulation also remain benchmark-only. No linear-sRGB source changes; its existing vector/tail discrepancy is tracked separately.