Skip to content

spec(gft_signed_mac): the four on-die clauses, derived as simulation tests - #5662

Merged
dmitrii-f-t27 merged 1 commit into
Trinity-S-AI-DNA:masterfrom
dmitrii-f-t27:spec/gft-signed-mac-die-clauses-5661
Oct 3, 2026
Merged

dmitrii-f-t27 merged 1 commit into
Trinity-S-AI-DNA:masterfrom
dmitrii-f-t27:spec/gft-signed-mac-die-clauses-5661

Conversation

@dmitrii-f-t27

@dmitrii-f-t27 dmitrii-f-t27 commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Refs #5661
Refs Trinity-S-AI-DNA/trinity-fpga#684

Why

trinity-fpga#684 measured the operator red on silicon — clauses=0011, ok=0 — while the spec passes its own two-test suite. The die check (W839, DESIGN 13) asks four questions; the spec answered the two the die passed (cancel ↔ CANCEL, pp ↔ IND). The two failing clauses had no simulation counterpart, so nothing cheaper than a bitstream load could have asked them.

The derivation

clause die test expectation under the spec
ZERO 0 (as forecast) zero_clause cannot hold: the deliberately unguarded smul returns the operand's magnitude at a shifted offset (T596); mac(0,+1.0,0,+1.0) = 512 (offset 1, mant 0). Simulation now pins the spec's half of W839's registered forecast
COMM 0 (against forecast) comm_clause holds exactly: sign XOR over a symmetric RNE magmul, addition order untouched; 20000-case randomized operand-swap sweep — zero divergences
CANCEL 1 existing cancel already covered
IND 1 existing pp already covered

What the run establishes

All four pass under t27c icarus-simulate — which lowers the spec to the generated Verilog and simulates that. So COMM holds in the simulated RTL, not only in the reference semantics. The die's c_comm=0 therefore diverges from the spec and from the simulated generated Verilog, isolating the remaining fault to the JTAG wrapper's drive pattern, the harness read, or silicon timing — the exact isolation trinity-fpga#684 asked for.

docs/now entry: docs/now/2026-10-03-gft-signed-mac-die-clauses-derived-as-tests.md

— dmitrii-f-t27

On the two red checks (both pre-existing, neither introduced here)

  • spec-guards — "every seal still describes what the compiler emits" fails on layers_Residual, loss_HuberLoss and 10 more seals whose gen hashes predate the current compiler — red on master's own runs of this workflow (2026-10-02 22:43 and 21:51). This PR refreshes the one seal it touches (ternary_GftSignedMac.json, recomputed with t27c 0.4.0 built from this branch); the others are the corpus's existing debt.
  • emit-bitexact — verify_multitarget.py fails as gft_sadd.sadd: Zig backend failed to build/run … exited -6 (signal 6) … m.zig:125:20 in magsub. That is a pre-existing defect in specs/ternary/gft_sadd.t27, not in this PR's spec: sadd calls magsub(ma, mb) before the ma < mb swap, so the discarded call runs with a negative exponent (d = ho − lo_o < 0) and the Zig backend traps on the negative shift while the C/Rust paths happen to tolerate it. The same check was red on master on 2026-08-20 and has not run green since 2026-08-28. Filed separately with the root cause.

…tests

The die check W839 strapped to this operator (DESIGN 13) asks four
questions; the spec answered two -- the two the die passed. The two
failing clauses, ZERO and COMM, had no simulation counterpart, so
nothing cheaper than a bitstream load could have asked them
(trinity-fpga#684: the die check is stronger than the suite the spec
carries).

zero_clause pins the spec's half of W839's registered forecast: with the
deliberately unguarded smul, mac(0, live, 0, live2) returns 512 (offset
1, mant 0) -- the operand's magnitude survives at a shifted offset
(T596) and the two 'vanished' products add, so the clause cannot hold.
The die read c_zero=0 as forecast; simulation agrees.

comm_clause asserts the other half, which the die read 0 AGAINST the
forecast: smul is commutative by construction (sign XOR over a
symmetric RNE magmul, addition order untouched), and a 20000-case
randomized operand-swap sweep against the reference semantics found
zero divergences. The derived tests pass under icarus-simulate, which
lowers to the generated Verilog -- so COMM holds in the simulated RTL
too, and the die's c_comm=0 is isolated to the JTAG wrapper's drive
pattern, the harness read, or silicon timing. Not the arithmetic.

Refs Trinity-S-AI-DNA#5661
Refs Trinity-S-AI-DNA/trinity-fpga#684
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.

1 participant