Skip to content

feat: GF-T exp2 primitive + 4-neuron layer + AX7203 classifier synth runbook (Refs #1764) - #1803

Closed
gHashTag wants to merge 3 commits into
masterfrom
feat/gft-exp2-layer4-synth
Closed

feat: GF-T exp2 primitive + 4-neuron layer + AX7203 classifier synth runbook (Refs #1764)#1803
gHashTag wants to merge 3 commits into
masterfrom
feat/gft-exp2-layer4-synth

Conversation

@gHashTag

@gHashTag gHashTag commented Aug 6, 2026

Copy link
Copy Markdown
Owner

"все три параллельно" — three deliverables in one PR (batched to avoid docs/NOW.md conflict churn during the ongoing GitHub Actions incident that still blocks merging #1801 + #1802).

A² — gft_exp2.t27: a GF-T exp2 primitive (the softmax building block)

2^x for a signed GF-T16 input → positive GF-T16. Softmax in base 2 is 2^logit / Σ 2^logit, so exp2 is the missing primitive.

Method (all integer, hardware-shaped): |x|→Q16.16 (positive shifts only, no signed-shift ambiguity) → sign-aware floor into integer k + fraction f2^x = 2^k·2^f; 2^k is an exact GF-T offset, the 2^f mantissa comes from a Q16 quartic with rounded Horner shifts (coeffs 354,123,29,6).

Prototype-first (debugging doctrine): the poly was fitted + local-searched in Python against the exact mantissa — ≤1 ULP over all 2¹⁶ fractions — and the whole pipeline against true round_to_GFT(2^x)≤1 ULP over the logit sweepbefore transcribing to .t27. Bit-exact to the committed integer oracle 606/606 (iverilog). Spot-checks exact: 2⁰=1, 2¹=2, 2⁻¹=0.5, 2²=4.

B — gft_layer4.t27: 4-neuron BitNet×GF-T layer

Extends gft_layer3 to 4 neurons (M→N=4): 4 shared GF-T16 activations → 4 trits packed 2 bits each. Doubly-grounded oracle (int-vs-float), iverilog 500/500 bit-exact.

C — docs/synth/CLASSIFIER_AX7203.md: owner-gated flash runbook

Copy-paste flow: gft_classifier4 spec → yosys (synth_xilinx -family xc7) → nextpnr-xilinx → openFPGALoader on ALINX AX7203 (XC7A200T). The final JTAG flash is owner-gated (needs the user at the board). On-silicon "done" = replay gft_classifier4_vectors.txt, class index bit-exact 1500/1500 on-air (mirrors the gft_dot2 #185 proof).


Fresh seals for GftExp2 + GftLayer4 (seal --verify → MATCH). No compiler change.

Refs #1764

⚠️ GitHub Actions infra incident ongoing (jobs stuck queued repo-wide). If gates stall, it is the same infra issue — all three parts are verified locally (iverilog 606/500, seals MATCH).

🤖 Generated with Claude Code

gHashTag and others added 2 commits August 6, 2026 23:27
Three parallel deliverables ("все три"):

A2 - specs/ternary/gft_exp2.t27 (GftExp2): a GF-T exp2 primitive, 2^x for a
signed GF-T16 -> positive GF-T16. The missing building block for a GF-T softmax
(softmax = 2^logit / sum 2^logit). |x|->Q16.16 (positive shifts only),
sign-aware floor into k+f, 2^x = 2^k * 2^f; 2^k is an exact GF-T offset, 2^f
mantissa via a Q16 quartic with rounded Horner shifts (coeffs 354,123,29,6).
Prototyped + fitted in Python vs the exact mantissa (<=1 ULP over all 2^16
fractions) and vs true round_to_GFT(2^x) (<=1 ULP) before transcribing. Bit-exact
to the committed oracle 606/606 (iverilog).

B - specs/ternary/gft_layer4.t27 (GftLayer4): extends gft_layer3 to 4 neurons
(M->N=4), 4 trits packed 2 bits each. Doubly-grounded oracle, iverilog 500/500.

C - docs/synth/CLASSIFIER_AX7203.md: owner-gated flow to take gft_classifier4
spec -> yosys -> nextpnr-xilinx -> openFPGALoader on ALINX AX7203 (XC7A200T).
Final JTAG flash needs the user at the board; everything up to the bitstream is
scripted. On-silicon done = replay the conformance vectors, bit-exact on-air.

Fresh seals for GftExp2 + GftLayer4 (seal --verify MATCH). No compiler change.

Refs #1764

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
gft_recip.t27 (GftRecip): 1/x for a signed GF-T16 -- the last missing softmax
primitive. Closed form (no polynomial): 512+m' = round(524288/(512+m)),
off' = 79-o (+renorm). One rounded integer divide -> EXACT (0 ULP) vs true 1/x.
iverilog 506/506 bit-exact.

gft_softmax4.t27 (GftSoftmax4): the complete GF-T softmax over 4 signed GF-T16
logits, base-2, max-stabilized: p_i = 2^(l_i-M) / sum 2^(l_j-M), returns p_sel.
Composes the verified primitives -- max (gt), subtract (sadd+neg), exp2 (<=1 ULP),
sum (sadd), reciprocal (exact), multiply (RNE). Bit-exact to the integer oracle
2000/2000 (iverilog); accuracy <=0.0017 abs probability vs true float softmax
(sum-of-probs in [0.9982,1.0018]; uniform -> 0.25 exact).

Completes the GF-T classifier head: activations -> MLP -> logits ->
{argmax -> class} or {softmax -> calibrated probabilities}.

Fresh seals for GftRecip + GftSoftmax4 (seal --verify MATCH). No compiler change.

Refs #1764

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
feat(spec): GF-T reciprocal + complete GF-T softmax (Refs #1764)
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

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

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-08-06 22:21:55 UTC

Summary

Status Count
Total Open PRs 7
PRs with Failing Checks 0
PRs with All Checks Green 7
READY 1
FAILING 0
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=4c1aaad5309a != 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 Aug 6, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-08-06 22:22:01 UTC

Summary

Status Count
Total Open PRs 7
PRs with Failing Checks 0
PRs with All Checks Green 7
READY 1
FAILING 0
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=4c1aaad5309a != 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 Aug 6, 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 commented Aug 6, 2026

Copy link
Copy Markdown
Owner Author

Superseded: this branch's content (gft_layer4.t27 + docs/synth/CLASSIFIER_AX7203.md) already landed in master via the integration merge #1809, together with the full GF-T train+infer stack. Closing as redundant.

@gHashTag gHashTag closed this Aug 6, 2026
auto-merge was automatically disabled August 6, 2026 23:06

Pull request was closed

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