Skip to content

igla race: repair ternary_mac and ternary_gemm (compile, pass under t27c and t27b, resealed) - #10375

Merged
gHashTag merged 19 commits into
masterfrom
igla-race-ternary-repair
Oct 18, 2026
Merged

gHashTag merged 19 commits into
masterfrom
igla-race-ternary-repair

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

Closes #10371

Repairs the two RACE reference specs so both compile and pass under t27c and t27b. Everything ran on the Railway lab (t27c from master, t27b under qemu-aarch64); nothing was built or tested on the Mac. The change is .t27 plus tool-written data (seals, ratchet baseline).

ternary_mac.t27

  • ternary_mul_wide / ternary_mac_wide: exact i32 product. The negation is done after widening, so -128 * -1 = +128 with no trap.
  • ternary_mul keeps the documented i8 wrap (128 -> -128) and stays self-contained, because tools/verify_igla_race.py lifts it out of the generated C and Rust by signature.
  • The bad bench (acc >= 0 named a variable that did not exist) is gone; tests state true arithmetic.

ternary_gemm.t27

  • Kernels call ternary_mac_wide(acc, a, w) in the order of the signature (they passed (a, w, acc)).
  • Output is i32, returned as fixed arrays ([4]i32, [16]i32, [64]i32). The old []i8 could not hold 255, and a slice of run-time values returned from a function dangles.
  • 8x8 added without array concatenation (ternary_dot_nxn, ternary_gemm_8x8_elem, ternary_gemm_8x8).
  • Accessors get_elem_{2x2,4x4,8x8} are bounds-checked per axis ((0, 4) used to read the next row).
  • Every expected value is now the true matrix product. The 2x2 hand case [5,3,7,2] against codes [2,1,1,2] gives [-2,2,-5,5]; the 8x8 all-ones case gives 8 and the all -128 / all -1 case 1024, mirroring the GPU oracle (ternary_gemm_gpu.t27, igla-coder: ternary x int8 GPU GEMM kernel spec, bit-exact in three modes (Closes #10361) #10362).
  • Removed: tests for functions that never existed (ternary_gemm_8x8_cols, the ternary_gemm dispatcher and its .len() invariants), the struct wrappers over the dangling slices, out-of-range-input tests that assumed a silent zero, and tests whose expectation was wrong on a meaningless input.

Measured on the lab (head 38ab8dc)

t27c test-report t27b trap t27b wrap
ternary_mac 341 pass, 0 fail, 0 blocked 341/341 341/341
ternary_gemm 270 pass, 0 fail, 0 blocked 270/270 270/270
  • t27c seal --verify: all hashes MATCH; neither seal carries a blocked entry any more.
  • tools/verify_igla_race.py --require: OK.
  • tools/check_assertionless_spec_tests.py: ratchet re-blessed in the same commit, ternary_gemm 144 -> 142.
  • Negative control (lab, reverted): one expected value mutated in each spec. t27c and t27b fail exactly that one test and nothing else.

Not done (follow-up)

Both files still carry about 142-144 empty { /* verify baseline */ } wave-loop tests that cannot fail; the ratchet pins them. Out of scope here.

🤖 Generated with Claude Code

gHashTag and others added 18 commits October 18, 2026 16:47
…e bench (refs #10371)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ature order (refs #10371)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…eight::plus/minus/zero (refs #10371)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…(refs #10371)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…in as i8 (refs #10371)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… (refs #10371)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…dispatcher ternary_gemm (refs #10371)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…efs #10371)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…_cols test (refs #10371)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…p struct wrappers and dispatcher (refs #10371)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ights, drop negative u32 index test (refs #10371)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… (refs #10371)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…unds-checked accessors (refs #10371)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ses mirror the GPU oracle (refs #10371)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…refs #10371)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… entry (refs #10371)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ternary_mac; seal to be re-verified on the lab)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ary_logic 1 -> 0, ternary_tree 2 -> 0) (refs #10371)

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

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-18 10:14:23 UTC

Summary

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

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=fad12492937a != 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).

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.

igla race: repair ternary_mac.t27 and ternary_gemm.t27 so both compile and pass under t27c and t27b

1 participant