Add mxfp4_block_size parameter to f4f4bf16_grouped_mm for MXFP4_16 support (#496) - #496
Open
ghjeong12 wants to merge 1 commit into
Open
Add mxfp4_block_size parameter to f4f4bf16_grouped_mm for MXFP4_16 support (#496)#496ghjeong12 wants to merge 1 commit into
ghjeong12 wants to merge 1 commit into
Conversation
|
@ghjeong12 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D101478667. |
ghjeong12
added a commit
to ghjeong12/MSLK
that referenced
this pull request
Aug 21, 2026
…pport (meta-pytorch#496) Summary: `f4f4bf16_grouped_mm` hardcoded the MXFP4 scaling-block size to 32. This extends MXFP4 to support block size 16. Adds an `mxfp4_block_size` parameter (default 32, so existing callers are unchanged) threaded from the torch op down through the manifest into the kernel instantiations, plus an `MXFP4_16` quant-type tag alongside the existing `NVFP4` and `MXFP4`. The dispatch rule inside each instantiation is: - `global_scale` present -> `NVFP4` (SfVecSize 16, E4M3 scales) - `mxfp4_block_size == 16` -> `MXFP4_16` (SfVecSize 16, E8M0 scales) - otherwise -> `MXFP4` (SfVecSize 32, E8M0 scales) `MXFP4_16` reuses the NvF4 kernel schedule because it shares NVFP4's SfVecSize of 16 and differs only in scale encoding (E8M0 vs E4M3), which is why this is a schedule-selection change rather than a new kernel family. Also widens `starting_row_after_padding` handling and the scale-layout helpers to cover the 16-wide case. Differential Revision: D101478667
ghjeong12
force-pushed
the
export-D101478667
branch
from
August 21, 2026 19:25
0921562 to
7b000d2
Compare
…pport (meta-pytorch#496) Summary: `f4f4bf16_grouped_mm` hardcoded the MXFP4 scaling-block size to 32. This extends MXFP4 to support block size 16. Adds an `mxfp4_block_size` parameter (default 32, so existing callers are unchanged) threaded from the torch op down through the manifest into the kernel instantiations, plus an `MXFP4_16` quant-type tag alongside the existing `NVFP4` and `MXFP4`. The dispatch rule inside each instantiation is: - `global_scale` present -> `NVFP4` (SfVecSize 16, E4M3 scales) - `mxfp4_block_size == 16` -> `MXFP4_16` (SfVecSize 16, E8M0 scales) - otherwise -> `MXFP4` (SfVecSize 32, E8M0 scales) `MXFP4_16` reuses the NvF4 kernel schedule because it shares NVFP4's SfVecSize of 16 and differs only in scale encoding (E8M0 vs E4M3), which is why this is a schedule-selection change rather than a new kernel family. Also widens `starting_row_after_padding` handling and the scale-layout helpers to cover the 16-wide case. Differential Revision: D101478667
ghjeong12
force-pushed
the
export-D101478667
branch
from
August 21, 2026 21:12
7b000d2 to
2a9fce9
Compare
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.
Summary:
f4f4bf16_grouped_mmhardcoded the MXFP4 scaling-block size to 32. This extends MXFP4 to support block size 16.Adds an
mxfp4_block_sizeparameter (default 32, so existing callers areunchanged) threaded from the torch op down through the manifest into the kernel
instantiations, plus an
MXFP4_16quant-type tag alongside the existingNVFP4and
MXFP4.The dispatch rule inside each instantiation is:
global_scalepresent ->NVFP4(SfVecSize 16, E4M3 scales)mxfp4_block_size == 16->MXFP4_16(SfVecSize 16, E8M0 scales)MXFP4(SfVecSize 32, E8M0 scales)MXFP4_16reuses the NvF4 kernel schedule because it shares NVFP4's SfVecSizeof 16 and differs only in scale encoding (E8M0 vs E4M3), which is why this is a
schedule-selection change rather than a new kernel family.
Also widens
starting_row_after_paddinghandling and the scale-layout helpersto cover the 16-wide case.
Differential Revision: D101478667