Repository navigation
feat(tt-blockfloat): checkpoint/module format for out-axis exponent blocks - #3994
Merged
Merged
Conversation
…nt blocks
TTBlockfloatLinear/Embedding take block_axis ("in" default, "out"). With
"out" the module stores W^T [in, out] codes (code_shape is the stored shape,
exponents [in, out/16]); dequantize() still returns [out, in]. CUDA/HIP
dispatch stays gated to "in" until those kernels index the other axis, so an
out-axis module takes the exact torch path there.
save_blockfloat_model(block_axis=...) writes out-axis checkpoints, infers the
axis from packed modules, refuses mixed or contradicting axes, and records
quantization_config.block_axis only when it is "out" so in-axis checkpoints
are byte-identical. build_blockfloat_model and the shipped modeling file read
it; geometry validation checks the stored orientation.
scripts/tt_quantize_blockfloat.py: --block-axis {in,out} and --act-order.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 14, 2026
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.
Follow-up to #3992 (out-axis solver), so this is the piece that makes those weights saveable and loadable.
Change
TTBlockfloatLinear/TTBlockfloatEmbedding/swap_blockfloat_modulestakeblock_axis("in"default,"out"). With"out"the module storesW^T [in, out]:code_shapeis the stored shape,exponentsis[in, out/16], anddequantize()still returns[out, in].pack()andload_codes_from()quantize/decompose along the stored axis."in", because both kernels index one exponent per 16 inputs of a row. An out-axis module takes the exact torch path on GPU until those kernels learn the other axis.save_blockfloat_model(..., block_axis=None): dense weights are decomposed along the requested axis; the axis is inferred from already-packed modules; mixed or contradicting axes are refused.quantization_config.block_axisis written only when it is"out", so in-axis checkpoints stay byte-identical.build_blockfloat_modeland the shippedmodeling_tt_blockfloat.pyreadblock_axis;_validate_restored_geometrychecks the stored orientation, so a swappedcode_shapeis still rejected.scripts/tt_quantize_blockfloat.py:--block-axis {in,out},--act-order(requiresout).Why
On Tenstorrent, the out-axis layout is the one that uploads to
ttnn.linear(x, W^T)without re-quantization (#3992). Llama-3.2-1B-Instruct, CPU fp32, 40×512-token windows on text disjoint from calibration:Tests
tests/test_tt_blockfloat_out_axis.py: 19 passed. Added: module stores the transpose and matchesF.linear; out_features multiple-of-16 check; out-axis checkpoint round trip gives bit-identical logits; re-save is byte-identical and keeps the axis; in-axis config has noblock_axiskey; a swappedcode_shapeis rejected; contradicting axes are refused.test_tenstorrent_support.py,test_tt_blockfloat_precision.py,test_tt_blockfloat_cuda_*,test_tt_blockfloat_hip.py: 128 passed, 92 skipped (no GPU), 1 failed. The failure is the pre-existingtest_calibration_hessian_strides_through_the_text, which also fails onmainwithout this change.ruff checkclean.🤖 Generated with Claude Code