[Common/PyTorch] Fused grouped MXFP8 requantization - #3359
Conversation
Replace the group_dequantize -> group_quantize(columnwise) -> grouped_swizzle(rowwise scales) chain in group_requantize_inplace with a single kernel (NVTE_FUSED_GROUP_REQUANTIZE=0 restores the unfused path). Co-authored-by: Oleg Goncharov <ogoncharov@nvidia.com> Signed-off-by: YangFei1990 <feiw@nvidia.com>
Greptile SummaryThis PR adds a Blackwell-only fused path for converting rowwise grouped MXFP8 tensors into GEMM-ready rowwise and columnwise representations, while retaining the existing unfused path behind an environment-variable fallback.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains within the provided follow-up-review scope. No blocking failure remains. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Rowwise grouped MXFP8 input] --> B{Fused path supported?}
B -->|Yes| C[Fused grouped requantization kernel]
C --> D[Swizzled rowwise scales]
C --> E[Columnwise E4M3 data and scales]
C --> F[Optional BF16 output]
B -->|No or disabled| G[Existing dequantize, quantize, and swizzle chain]
G --> D
G --> E
G --> F
Reviews (2): Last reviewed commit: "Merge branch 'fused_group_requantize' of..." | Re-trigger Greptile |
Signed-off-by: YangFei1990 <feiw@nvidia.com>
…90/TransformerEngine into fused_group_requantize
Oleg-Goncharov
left a comment
There was a problem hiding this comment.
Hi @YangFei1990, I’ve done some further optimization work on this implementation, and the version in this GitLab branch is ~10% faster than the current implementation in this PR:
https://gitlab-master.nvidia.com/ogoncharov/transformerengine/-/tree/pr_requantize_mxfp8
The main improvements came from using data swizzling in the TMA descriptor and the redux.sync instruction, which reduces the number of reads/writes to the shared buffer holding intermediate results.
Could you please update the PR to incorporate the corresponding changes before merging?
Description
Replace the group_dequantize -> group_quantize(columnwise) -> grouped_swizzle(rowwise scales) chain in group_requantize_inplace with a single kernel (NVTE_FUSED_GROUP_REQUANTIZE=0 restores the unfused path).
Fixes # (issue)
Type of change
Changes
Please list the changes introduced in this PR:
Checklist: