Repository navigation
feat(hpc): Codec8 — compile-time 8-bit codec (phase a, scalar) + ratified plan - #370
Conversation
…paths with endpoint gates
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
Being refactored. Do not merge or review this version. This branch was pushed without being compiled. CI fails because of a missing doc comment (
The edge-case test inputs carry over: signed zero, both saturations, negative half-ties, and all 256 codes. Before the next push I will run Generated by Claude Code |
…runtime-scale prototype - .claude/plans/quantized-codec8-v2.md: one compile-time Codec8<Storage, CodeSpace, Rounding, NanPolicy>, calibration as a marker type, prepare vs execute, certified const tables, edge cases, measured results, checklist, open items, superseded designs named once. Goes through /5plus3 next. - .claude/knowledge/coresearch-2026-10-24-i8-codec8-map.md: the /coresearch exploration map, banked so it survives the container. - the staged prompt is marked superseded (kept for provenance). - src/hpc/quantized.rs: back to master. The per-mode runtime-scale functions contradicted the compile-time ruling and never compiled under -D missing-docs; their edge-case inputs carry over into the v2 checklist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
The plan file keeps its name; its content is now v3. Changes from the council: true division in encode (a precomputed reciprocal changes codes at half-ties), exact scale bits for the byte-identity gate, a concrete compile_fail with a compiling twin, a clippy opt-in in codec8 (pub mod hpc allows clippy::all), the table generator in tools/ instead of a crate, SIMD primitives landing first, XOR storage scoped to Asym/Sym, UnitOdd/UnitMidrise test-only, NativeLane held until its rounding is decided, a per-mode table inventory, separate data and table rounding gates, spoFC byte and three-mode head-to-head gates, and restore conditions for parked arms. Blackboard entry added in the same commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
One `Codec8<Storage, CodeSpace, Rounding, NanPolicy>` over sealed marker types, with calibration as a marker type (plan .claude/plans/quantized-codec8-v2.md, ratified by a 5+3 council). Nothing is selected at run time. - Storage I8 / U8 (u8 = i8 ^ 0x80 for Asym/Sym, raw for UnitFull); code spaces Asym, Sym, UnitFull; rounding TiesAway / TiesEven / Floor; NaNAtMin only for Sym (Asym + NaNAtMin and I8 + UnitFull are E0277, pinned by doctests). - Encode uses a true division (a reciprocal changes codes at half-ties) and adds the zero point as an integer; const assertions reject a bad calibration. - Checked encode/decode validate once per slice; the unchecked bodies are pub(crate) and total. - Aliases: TfliteAct, TfliteWeight, OnnxQ, SpoFcTruth. NativeLane waits for the operator's rounding decision. - codec8.rs opts back into clippy::all (pub mod hpc allows it). Gates: 14 unit tests and 10 doctests pass; G2 byte identity with quantize_f32_to_i8; G13 spoFC floor encoder equality; clippy -D warnings and fmt clean. G5: generic and hand-written kernels compile to identical asm on x86-64-v3 and -v4, negative control differs (scripts/codec8_asm_diff.sh, examples/codec8_asm_probe.rs). G6's 2% timing band is not resolvable on this host (identical code varies up to 17%) and is recorded as not met. Blackboard and plan updated in the same commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c82adf3a5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex review on #370: - The SCALE/ZERO_POINT const asserts lived only in encode_one, so a consumer that only decoded never instantiated them; SCALE = -1.0 compiled and decoded. Both directions now call assert_calibration, pinned by a compile_fail,E0080 doctest on the decode-only path. - TiesAway::div_round computed 2n + d and 2d, TiesEven compared 2r with d; both wrap for large u128 operands. Both now use quotient and remainder with the half test as r vs d - r. Tests at 2^127 and u128::MAX, plus small-operand tie tables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
What
Phase (a) of
.claude/plans/quantized-codec8-v2.md(content v3, ratified by a 5+3 council). The earlier runtime-scale prototype on this branch is gone (backed out in62c43c9).src/hpc/codec8.rsadds one codec,Codec8<Storage, CodeSpace, Rounding, NanPolicy>, built from sealed marker types. The calibration is a marker type passed to each call, and nothing is selected at run time.I8,U8(u8 = i8 ^ 0x80 for Asym/Sym, the raw code for UnitFull)Asym(-128..127),Sym(-127..127),UnitFull(c/255)TiesAway,TiesEven,FloorNoNaN,NaNAtMin(only withSym, where -128 means NaN)Asym + NaNAtMinandI8 + UnitFullare E0277; doctests pin both.compile_fail,E0080doctest pins the decode-only path.div_roundworks from the quotient and remainder, so it does not overflow for anyu128operands.pub(crate)and give a defined result for every input.TfliteAct,TfliteWeight,OnnxQ,SpoFcTruth.NativeLaneis held back until its rounding is decided (plan §8 item 1).codec8.rsopts back intoclippy::all, becausepub mod hpcallows it.Also in this PR:
examples/codec8_asm_probe.rsandscripts/codec8_asm_diff.sh, the assembly and timing probe..claude/knowledge/coresearch-2026-10-24-i8-codec8-map.md.Tests and gates
cargo test --release --lib hpc::codec8: 16 passed.cargo test --release --doc hpc::codec8: 11 passed. This includes twocompile_fail,E0277doctests and onecompile_fail,E0080doctest.(2n + d)/(2d)fails the large-operand test.TfliteActwith the fitted scale bits equalsquantize_f32_to_i8, including NaN and ±inf.encode_ratiowithFloorequals the spoFC encoder over the evidence grid.-D warnings) andcargo fmt --checkare clean.vdivps). The negative control differs.Not in this PR
Plan §8 lists the decisions still open.
🤖 Generated with Claude Code
https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg