Skip to content

Enable 2SM schedule for MXFP4_16 grouped GEMM (#501) - #501

Closed
ghjeong12 wants to merge 1 commit into
meta-pytorch:mainfrom
ghjeong12:export-D101508914
Closed

Enable 2SM schedule for MXFP4_16 grouped GEMM (#501)#501
ghjeong12 wants to merge 1 commit into
meta-pytorch:mainfrom
ghjeong12:export-D101508914

Conversation

@ghjeong12

@ghjeong12 ghjeong12 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary:

Fix the 2SM NvF4 kernel schedule crash for MXFP4_16 (E8M0 scales with
SFVecSize=16) by using non-void EpilogueElementC for 2SM tile configs.

Root cause: the 2SM epilogue (PtrArrayTmaWarpSpecialized2Sm) requires
non-void C type for correct stride layout configuration. With void C,
the epilogue misconfigures memory access patterns, causing illegal
memory access for M >= 192 per expert. NVFP4 worked because it always
uses non-void C (for alpha_ptr_array global_scale support).

Fix: set EpilogueElementC = ElementC (bfloat16) whenever 2SM is
selected, not just for NVFP4. This adds minimal overhead (C tensor
pointer is set but not used for the actual computation when
global_scale is absent).

Also updates MXFP4_16 tile configs to use native 2SM tiles instead
of forcing 1SM fallback, enabling full 2SM performance.

Reviewed By: jwfromm

Differential Revision: D101508914

@meta-cla meta-cla Bot added the cla signed label Aug 24, 2026
@meta-codesync

meta-codesync Bot commented Aug 24, 2026

Copy link
Copy Markdown

@ghjeong12 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D101508914.

Summary:

Fix the 2SM NvF4 kernel schedule crash for MXFP4_16 (E8M0 scales with
SFVecSize=16) by using non-void EpilogueElementC for 2SM tile configs.

Root cause: the 2SM epilogue (PtrArrayTmaWarpSpecialized2Sm) requires
non-void C type for correct stride layout configuration. With void C,
the epilogue misconfigures memory access patterns, causing illegal
memory access for M >= 192 per expert. NVFP4 worked because it always
uses non-void C (for alpha_ptr_array global_scale support).

Fix: set EpilogueElementC = ElementC (bfloat16) whenever 2SM is
selected, not just for NVFP4. This adds minimal overhead (C tensor
pointer is set but not used for the actual computation when
global_scale is absent).

Also updates MXFP4_16 tile configs to use native 2SM tiles instead
of forcing 1SM fallback, enabling full 2SM performance.

Reviewed By: jwfromm

Differential Revision: D101508914
@meta-codesync meta-codesync Bot changed the title Enable 2SM schedule for MXFP4_16 grouped GEMM Enable 2SM schedule for MXFP4_16 grouped GEMM (#501) Aug 25, 2026
@meta-codesync meta-codesync Bot closed this in cd5d44e Aug 26, 2026
@meta-codesync meta-codesync Bot added the Merged label Aug 26, 2026
@meta-codesync

meta-codesync Bot commented Aug 26, 2026

Copy link
Copy Markdown

This pull request has been merged in cd5d44e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant