Skip to content

fix(specs): ternary_model dot27 takes u64 lanes; test checks Python values - #5975

Merged
gHashTag merged 1 commit into
masterfrom
claude/ternary-model-dot27-u64
Oct 4, 2026
Merged

gHashTag merged 1 commit into
masterfrom
claude/ternary-model-dot27-u64

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Summary

specs/port/tools/ternary_model.t27 ports tools/ternary_model.py. Its dot27 packed 27 two-bit trit lanes into an i32 and shifted it by i * 2, up to 52. Python integers are unbounded; an i32 is not.

  • dot27(a: u64, b: u64): 27 lanes need 54 bits. Each extracted lane is cast to i32 before tmul.
  • dot27_test had wrong expected values. They had never been checked, because the test panicked on its first line. Its comments assumed tmul(1, 1) = 1, but the spec's own tmul_test asserts tmul(1, 1) == 0. The expected values now come from tools/ternary_model.py:
call old assert Python new assert
dot27(0, 0) 0 27 27
dot27(5, 5) 27 25 25
dot27(1, 2) 0 26 26
  • Three new cases use the high lanes: every lane holds trit 2 (27 and -27), and only lane 26 (bits 52..53) holds trit 2 (25).

Before / after (t27c from master)

path before after
t27c gen + zig test test 4/8 panics, "integer does not fit in destination type"; tests 5-8 never run 8/8 pass
t27c gen-c + clang -O0, -DT27_TEST_MAIN exit 134 exit 0
t27c gen-c + clang -O2, -DT27_TEST_MAIN exit 134 exit 0

No seal exists for this spec, and the number of let statements is unchanged (specs/RUST_DIALECT.json counts them).

Found by the t27b differential backend, which reported "shift amount out of range at line 40 (>> on i32)".

Closes #5972. Part of #5905.

🤖 Generated with Claude Code

…alues

dot27 packed 27 two-bit trits into an i32 and shifted by up to 52, so
the Zig test panicked on its first assertion and the C test exited 134.
The test's expected values were also wrong (they assumed tmul(1, 1) = 1)
and are now taken from tools/ternary_model.py, with three new cases that
use lanes up to bit 52.

Closes #5972

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-04 09:16:52 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 43
PRs with All Checks Green 7
READY 3
FAILING 43
PENDING 0
NO CHECKS YET 0

These columns do not partition: 3 + 43 + 0 + 0 = 46, and there are 50 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=f4a1fbade08e != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@gHashTag
gHashTag merged commit 986b190 into master Oct 4, 2026
31 of 32 checks passed
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.

ternary_model.t27: dot27 shifts an i32 by up to 52 bits, and its test expects wrong values

1 participant