Commit cedbeaf
* fix(codegen): handle bias formulas in numeric format SSOT (closes #1064)
The bias field in formats_catalog.t27 can carry either a literal int or
a rule-derived formula like 2^N-1. Two formats use the formula form:
gf512: bias = 2^194-1
gf1024: bias = 2^390-1
Both were added by PR #1051 as limit-of-ladder phi-aligned formats. The
parser did int(bias_str) unconditionally, which raised ValueError, so
both rows were silently dropped with a "malformed CATALOG line" warning.
This is why count drifted: committed gen/ JSON shipped 77 (pre-#1051),
post-#1051 SSOT carries 83 raw lines, codegen yielded 81 even after a
fresh re-run, paper #3 (arXiv:2606.09686) claims 84. Four sources of
truth, none matching. See issue #1064 for the full audit.
Fix:
- parse_bias(s) helper: tries int(); falls back to evaluating simple
2^N+offset forms within int64 range; otherwise returns sentinel -2
with the raw string in a new bias_formula field
- Format dataclass: adds bias_formula: str (preserves the raw SSOT
string for every row, including the literal-int cases for symmetry)
- All existing emitters (Rust struct, C header, TS interface, Python,
Markdown table, etc.) continue to render the int bias field as
before; bias_formula appears only in JSON and python emitter where
asdict() picks it up automatically -- non-breaking for the typed
emitters that hardcode their Format schema.
Verification after fix:
$ python3 tools/gen_formats_catalog.py specs/numeric/formats_catalog.t27 gen/numeric/
$ python3 -c "import json; print(json.load(open('gen/numeric/formats_catalog.json'))['count'])"
83
gf512 and gf1024 now appear in the JSON with bias=-2 and the formula
preserved in bias_formula. Downstream tools that need the actual i64
value can carry the string forward and evaluate at use-site (mpmath
or big-int arithmetic) without losing provenance.
This does NOT yet reconcile SSOT 83 vs paper #3 claim of 84; that
delta is the MXFP6 split + standalone E8M0 in Table 1 vs the SSOT's
collapsed mxfp6 row + Microscaling cluster layout. See #1064 for the
follow-up plan. The CI invariant (raw line count == JSON count) will
land in a separate PR.
Refs: #1051 (GF ladder expansion), #1063 (HF Discovery thread), #1064
* fix(codegen): revert auto-generated gen/ artefacts, add NOW.md entry
PR #1065 originally committed regenerated gen/numeric/* outputs alongside
the source fix in tools/gen_formats_catalog.py. Per L2 generation rules,
gen/ artefacts must be auto-regenerated post-merge by ./scripts/tri gen,
not committed in source PRs.
This commit:
- reverts gen/numeric/* back to master state
- keeps the source fix (tools/gen_formats_catalog.py) intact
- adds docs/NOW.md entry per NOW Sync Gate
Closes #1064
---------
Co-authored-by: gHashTag <playra@trinity-s3ai.org>
Co-authored-by: gHashTag <admin@t27.ai>
1 parent 6ecad30 commit cedbeaf
2 files changed
Lines changed: 43 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
4 | 10 | | |
5 | 11 | | |
6 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
73 | 105 | | |
74 | 106 | | |
75 | 107 | | |
76 | 108 | | |
77 | 109 | | |
| 110 | + | |
78 | 111 | | |
79 | 112 | | |
80 | 113 | | |
81 | 114 | | |
82 | 115 | | |
83 | 116 | | |
84 | 117 | | |
85 | | - | |
| 118 | + | |
| 119 | + | |
86 | 120 | | |
87 | 121 | | |
88 | 122 | | |
| |||
0 commit comments