fix: convert weight scale shape[N, K/128] to [ceil(N/128), ceil(K/128)]#1353
Draft
JiaoliangYu wants to merge 1 commit into
Draft
fix: convert weight scale shape[N, K/128] to [ceil(N/128), ceil(K/128)]#1353JiaoliangYu wants to merge 1 commit into
JiaoliangYu wants to merge 1 commit into
Conversation
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.
Motivation
per_block_fp8 online quantization in ATOM can produce degenerate generation (all-f outputs or immediate EOS) because the weight-scale layout emitted by the online quant path does not match the layout expected by the existing linear FP8 blockscale GEMM backend.
Technical Details
In LinearBase.online_quantize_weight for online_quant_type == QuantType.per_1x128, we no longer
use the generic per-group quant output directly (weight_scale shaped like [N, K/128]). Instead,
we explicitly quantize weights into 128x128 blockscale format and emit:
This aligns online-quantized weights with the current linear compute path
(gemm_a8w8_blockscale*), which consumes 128x128 block scales.
Additional fix included:
Added float8_e4m3fnuz compatibility in online quant dtype checks and avoided redundant normalize
marking when quant output is already fnuz (relevant on gfx942).
Test Plan
Test Result
Submission Checklist