Repository navigation
feat(ternary): spec-first activation quantizer (.t27) for the BitNet layer loop - #1738
Merged
Merged
Conversation
Add specs/ternary/activation_quantizer.t27 -- the first BitNet-relevant
datapath primitive on the spec-first path (the accelerator was all
hand-written Rust emitters). quantize(v: i16, threshold: i16) -> u8
re-ternarizes a signed accumulator to a packed trit {N=00,Z=01,P=10} with a
symmetric threshold: v>+t -> P, v<-t -> N, else Z.
Verified: typecheck 0/0; icarus-simulate 7/7 test blocks pass (incl. both
v==+/-t boundaries -> Z); seal --verify all 3 backends hash-MATCH.
Closes #1737
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
Contributor
This was referenced Aug 5, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The BitNet accelerator is entirely hand-written Rust RTL emitters — off the spec-first path (the project's core differentiator). This adds the first BitNet-relevant datapath primitive as a
.t27spec, and it's a genuinely useful one: the activation re-ternarizer the engine needs to close the layer loop.Closes #1737
specs/ternary/activation_quantizer.t27quantize(v: i16, threshold: i16) -> u8re-ternarizes a signed accumulator to a packed trit{N=0b00, Z=0b01, P=0b10}with a symmetric threshold:v > +t → P,v < -t → N, elseZ. gen-verilog lowers it to a clean signed-compare nested-if function.Verification
t27c typecheck: 0 errors / 0 warnings.t27c icarus-simulate: 7/7 embedded test blocks pass (iverilog) — positive/negative/zero-band, bothv == ±tboundaries (→ Z), just-over/just-under (→ P/N).t27c seal --save/--verify: all three backends (verilog / c / rust) hash-MATCH deterministically.Why it matters
🤖 Generated with Claude Code