dasLLAMA tests: the rope cross-layout cell bounds the two layouts at one ulp - #3942
Conversation
…one ulp Under -jit the packed row's single loop vectorizes onto the aarch64 polynomial sin/cos rail while the two-tab builder's nested loop stays on scalar libm, so 2 to 7 of 128 elements differ in the last bit; interp and -O0 agree bit for bit. The multiplication-order contract still holds at fscale 1; a 2-ulp poison is the bar's control. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The newly added ulps_apart and poison-control logic compute ULP distance via raw bit subtraction, which is incorrect across negative values and can overflow, making the updated test potentially flaky or misleading.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the dasLLAMA RoPE test suite to account for JIT-only last-bit drift between the packed-row and two-tab table builders by relaxing a cross-layout equality assertion from bit-identical to “within 1 ULP” at fscale=1.
Changes:
- Introduces an
ulps_aparthelper and updatestest_rope_gen_cross_layoutto assertworst <= 1ULP instead of exact equality. - Adds a “2-ULP poison” control assertion intended to ensure the loosened tolerance still rejects a clearly-wrong result.
File summaries
| File | Description |
|---|---|
| modules/dasLLAMA/tests/test_rope.das | Adjusts the cross-layout RoPE test to compare within a ULP tolerance and adds a poison control check. |
Review details
Suppressed comments (1)
modules/dasLLAMA/tests/test_rope.das:144
- The poison control currently bumps the raw IEEE bits (
reinterpret<int>(ct[3]) + 2), which is only guaranteed to be a +2 ULP step for a subset of positive, non-edge values. Once ULP distance is computed in ordered-float space, generate the poison in that same space so it stays a true 2-ULP offset regardless of sign.
//! the bar's control: a cos value 2 ulps off its table twin lands outside it
let poisoned = unsafe(reinterpret<float>(unsafe(reinterpret<int>(ct[3])) + 2))
t |> success(ulps_apart(poisoned, ct[3]) > 1, "a 2-ulp poison lands outside the bar")
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Raw bit subtraction is not a distance across the sign bit and can overflow between far bit patterns; a cos near zero can land on either side between the two builders. The rank mirrors a negative float's bits below zero, so the two zeros coincide and a difference across the sign counts the values it spans; two cells pin both. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The change is confined to test logic and adds a clearly bounded tolerance with explicit controls to prevent masking real regressions.
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0 new
- Review effort level: Lite
test_rope.dashas been red under-jitsince 2026-09-02: its cross-layout cell asserted that the packed rope row and the two-tab tables agree bit for bit at fscale 1. Since the JIT put aarch64 vectorsinandcoson the inline vecmath polynomial, the packed builder's single loop vectorizes onto that rail while the two-tab builder's nested loop stays on scalar libm, and 2 to 7 of 128 elements differ by one ulp. Interp and -O0 are identical. The cell now bounds the difference at 1 ulp, with a 2-ulp poison as the control the checklist asks of a loosened bar. The multiplication-order contract the module header states is untouched, and the frozen CPU parity fixtures pass unchanged (23 of 23 small tier).Where to look:
modules/dasLLAMA/tests/test_rope.das,test_rope_gen_cross_layout.Validation, claims, ledger
Validation
test_rope.das28/28 under-jitand on the interpreter; red before on the one cell under-jit -O3only. The dasLLAMA model-free suite is not a CI step, which is how the red went unseen;preflight --only dasllama-model-freeis its home.Not done
🤖 Generated with Claude Code