Skip to content

feat(ternary): 2-neuron spec-first BitNet layer with packed trit output - #1754

Merged
gHashTag merged 1 commit into
masterfrom
feat/spec-first-bitnet-layer
Aug 6, 2026
Merged

gHashTag merged 1 commit into
masterfrom
feat/spec-first-bitnet-layer

Conversation

@gHashTag

@gHashTag gHashTag commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Composes the parameterized N-chunk neuron (#1752) into a spec-first BitNet layer.

Closes #1753

specs/ternary/bitnet_layer.t27:

pub fn layer2(acts: [8]u64, w0: [8]u64, w1: [8]u64, nchunks: u32, threshold: i16) -> u8 {
    var t0 : u8 = neuronN(acts, w0, nchunks, threshold);
    var t1 : u8 = neuronN(acts, w1, nchunks, threshold);
    return (t1 << 2) | t0;
}

Two neuronN units over shared activations + per-neuron weights; the two output trits pack into a byte (trit0 in bits[1:0], trit1 in bits[3:2]). Array params pass straight through to neuronN — no new backend work.

Verification

  • typecheck: 0 errors; icarus-simulate: 4/4 scalar dot27/quantize test blocks; seal: 3 backends MATCH.
  • New integration test tests/bitnet_layer.rs — drives layer2 over uniform chunks packed directly into 512-bit vectors: w0=P,w1=N→2, P,P→10, N,P→8, allZ→5, 0-chunks→5 = ALL_PASS.

The first spec-first BitNet layer producing multiple output trits — completing the spec-first stack quantizer(#1738) → MAC(#1743) → neuron(#1747/#1752) → layer. A ternary-native spec-first RTL flow no competitor (Ternary-NanoCore) has.

🤖 Generated with Claude Code

specs/ternary/bitnet_layer.t27: layer2(acts, w0, w1, nchunks, threshold) runs
two neuronN units over shared activations and per-neuron weights, packing the
two output trits into a byte ((t1<<2)|t0). Array params pass straight through
to neuronN -- no new backend work. First spec-first BitNet layer producing
multiple output trits, composing quantizer (#1738) + MAC (#1743) + N-chunk
neuron (#1752).

Verified: typecheck 0 err; icarus-simulate 4/4 scalar test blocks; seal 3
backends MATCH; new tests/bitnet_layer.rs drives layer2 over direct-packed
uniform chunks (ALL_PASS). No compiler change, no reseal.

Closes #1753

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@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 09:03:13 UTC

Summary

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

Seal Status

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

feat: 2-neuron spec-first BitNet layer (.t27) with packed trit output

1 participant