Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
4de007e
Add SM120 NVFP4 blockscaled GEMM support
Jul 3, 2026
be805b1
Address SM120 NVFP4 review cleanup
Jul 8, 2026
0ce22e8
Remove SM120 private C-fragment store helpers
Jul 8, 2026
2bdaffb
Unify SM120 blockscaled MMA TIR helper
Jul 8, 2026
e84c318
Clean SM120 NVFP4 blockscaled fast path
Jul 8, 2026
c450de2
Prune SM120 NVFP4 debug lowering paths
Jul 8, 2026
850ebe2
Simplify SM120 NVFP4 blockscaled example
Jul 8, 2026
d4c646e
Remove SM120 fulltile debug macros and compile flags
Jul 9, 2026
1a1062d
Fix TensorCoreIntrinEmitter.mma base signature regression
Jul 9, 2026
66c8a30
Pin scale layout byte-compat with CuTeDSL blocked SF layout
Jul 9, 2026
3e4984e
Remove unreachable SM120 blockscale exploration code
Jul 10, 2026
be668c6
Scope shared-memory bit-exact sizing to packed scalar NVFP4
Jul 10, 2026
9c673b5
Add T.copy_ue4m3_scale_tile scale staging helper
Jul 10, 2026
790a3f0
Support M or N tail tiles in the SM120 NVFP4 example
Jul 10, 2026
f681a83
Slim tilelang/quantize/nvfp4.py
Jul 10, 2026
831652e
Converge quantizer kernels and drop example debug input modes
Jul 10, 2026
87d99c2
Keep tilelang.quantize to device helpers and format contract
Jul 10, 2026
cb81c7e
Import layout oracle from the nvfp4 submodule in the language test
Jul 10, 2026
c48e373
Group SM120 NVFP4 maint files and use native target API
Jul 21, 2026
c1ae801
Keep NVFP4 scale staging out of the tilelang.language surface
Jul 21, 2026
d3de762
Merge origin/main into nvf4-block-scale-sm120
Jul 21, 2026
1784d83
Drop stale scale-load metadata from the SM120 WS benchmark
Jul 21, 2026
317455c
Strip trailing blank lines left in gemm_op.py
Jul 21, 2026
b6f70a4
Trim the SF staging comment to the load-bearing caveat
Jul 21, 2026
c34e750
Consolidate NVFP4 tests into a single file
Jul 24, 2026
fceddda
Merge origin/main (language dialect split) into nvf4-block-scale-sm120
Jul 24, 2026
4ceee6c
Evaluate emitter dtype defaults lazily under the dialect facade
Jul 24, 2026
1fce4e9
Restore the scale-layout contract tests; keep the example CLI file fo…
Jul 24, 2026
97abc1f
Merge remote-tracking branch 'origin/main' into pr-2364-main-merge
LeiWang1999 Jul 28, 2026
70dec36
refactpr example
LeiWang1999 Jul 28, 2026
679f5f2
[SM120] Simplify NVFP4 benchmark
LeiWang1999 Jul 28, 2026
3c6cecc
[SM120] Simplify NVFP4 correctness comparison
LeiWang1999 Jul 28, 2026
5933fc9
[SM120] Inline NVFP4 quantizer pass configs
LeiWang1999 Jul 28, 2026
3e774df
[SM120] Move block-scaled MMA helper to instruction headers
LeiWang1999 Jul 28, 2026
53e3f20
[CUDA] Fix packed FP4 address codegen
LeiWang1999 Jul 28, 2026
2d69257
[SM120] Simplify NVFP4 lowering internals
LeiWang1999 Jul 28, 2026
d6a230d
[SM120] Generalize NVFP4 block-scaled MMA lowering
Rachmanino Jul 29, 2026
f29a144
[SM120] Fix package macro source test
LeiWang1999 Jul 30, 2026
bef4aff
Merge origin/main into nvf4-block-scale-sm120-pr-clean
LeiWang1999 Jul 30, 2026
9a8d1fc
[SM120] Remove redundant local FP4 access pointer test
LeiWang1999 Jul 30, 2026
a1b21a7
[SM120] Split block-scaled MMA emitter
LeiWang1999 Jul 30, 2026
ddd1098
Merge branch 'main' of https://github.com/tile-ai/tilelang into nvf4-…
LeiWang1999 Jul 30, 2026
11dae61
[SM120] Split block-scaled GEMM lowering
LeiWang1999 Jul 30, 2026
a0996a8
[SM120] Isolate block-scaled GEMM plumbing
LeiWang1999 Jul 30, 2026
acdd66b
Merge branch 'main' of https://github.com/tile-ai/tilelang into nvf4-…
LeiWang1999 Jul 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[SM120] Split block-scaled MMA emitter
  • Loading branch information
LeiWang1999 committed Jul 30, 2026
commit a1b21a7ee7dfae12b6ff71b8963999a53cf99196
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import torch
import tilelang
import tilelang.language as T
from tilelang.intrinsics import TensorCoreIntrinEmitter, make_mma_swizzle_layout
from tilelang.intrinsics import TensorCoreIntrinEmitterSM120, make_mma_swizzle_layout
from tilelang.transform import simplify_prim_func


Expand Down Expand Up @@ -53,7 +53,7 @@ def _make_tilelang_nvf4_kernel(m: int, n: int, k: int, micro_k: int, sf_vec_size
warp_rows = warp_row_tiles // micro_size_x
warp_cols = warp_col_tiles // micro_size_y

mma_emitter = TensorCoreIntrinEmitter(
mma_emitter = TensorCoreIntrinEmitterSM120(
is_blockscaled=True,
a_dtype=in_dtype,
b_dtype=in_dtype,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import tilelang.testing
from tilelang import tvm
from tilelang.cuda.intrinsics.layout.mma_layout import mma_load_a_32x32_to_shared_16x64_layout
from tilelang.cuda.intrinsics.macro.mma_macro_generator import SM120BlockScaleTile
from tilelang.intrinsics import TensorCoreIntrinEmitter, get_swizzle_layout
from tilelang.cuda.intrinsics.macro.mma_sm120_macro_generator import SM120BlockScaleTile
from tilelang.intrinsics import TensorCoreIntrinEmitterSM120, get_swizzle_layout
from examples.dequantize_gemm.quantize.nvfp4 import blockscaled_chunk_kmajor_word_offset
from tilelang.transform import simplify_prim_func

Expand All @@ -36,7 +36,7 @@


def _make_blockscale_emitter(**kwargs):
return TensorCoreIntrinEmitter(
return TensorCoreIntrinEmitterSM120(
is_blockscaled=True,
kind="mxf4nvf4",
scale_vec_size=4,
Expand Down Expand Up @@ -101,15 +101,25 @@ def test_tensor_core_intrin_emitter_mma_keeps_base_positional_signature():
"""
import inspect

from tilelang.cuda.intrinsics.macro.mma_macro_generator import _TensorCoreIntrinEmitterBase
from tilelang.cuda.intrinsics.macro.mma_macro_generator import TensorCoreIntrinEmitter as MMAIntrinEmitter

base = list(inspect.signature(_TensorCoreIntrinEmitterBase.mma).parameters.values())
override = list(inspect.signature(TensorCoreIntrinEmitter.mma).parameters.values())
base = list(inspect.signature(MMAIntrinEmitter.mma).parameters.values())
override = list(inspect.signature(TensorCoreIntrinEmitterSM120.mma).parameters.values())
assert [p.name for p in override[: len(base)]] == [p.name for p in base]
for extra in override[len(base) :]:
assert extra.kind == inspect.Parameter.KEYWORD_ONLY, extra.name


def test_default_tensor_core_intrin_emitter_stays_arch_neutral():
from tilelang.cuda.intrinsics.macro.mma_macro_generator import TensorCoreIntrinEmitter as MMAIntrinEmitter
from tilelang.cuda.op.gemm.gemm_mma import GemmMMA
from tilelang.intrinsics import TensorCoreIntrinEmitter

assert TensorCoreIntrinEmitter is MMAIntrinEmitter
assert GemmMMA.intrin_emitter_cls is MMAIntrinEmitter
assert issubclass(TensorCoreIntrinEmitterSM120, MMAIntrinEmitter)


def test_sm120_mma_blockscaled_strategy_helpers_are_not_public_api():
# NVFP4-specific staging helpers stay out of the general T.* surface; the
# scale-tile addressing lives in examples.dequantize_gemm.quantize.nvfp4.
Expand Down Expand Up @@ -319,8 +329,8 @@ def test_nvf4_mma_block_scale_fragment_layouts_match_cute():


def test_nvf4_mma_block_scale_lane_scale_mapping_matches_cute():
sfa_rows = [TensorCoreIntrinEmitter._sfa_row_in_atom(tx) for tx in range(32)]
sfb_cols = [TensorCoreIntrinEmitter._sfb_col_in_atom(tx) for tx in range(32)]
sfa_rows = [TensorCoreIntrinEmitterSM120._sfa_row_in_atom(tx) for tx in range(32)]
sfb_cols = [TensorCoreIntrinEmitterSM120._sfb_col_in_atom(tx) for tx in range(32)]

assert sfa_rows == [
0,
Expand Down Expand Up @@ -402,7 +412,7 @@ def test_nvf4_mma_block_scale_lane_scale_mapping_matches_cute():
)
def test_nvf4_mma_block_scale_rejects_unsupported_configs(kwargs):
with pytest.raises(ValueError, match="Unsupported SM120 block-scale MMA config"):
TensorCoreIntrinEmitter(
TensorCoreIntrinEmitterSM120(
is_blockscaled=True,
a_dtype=T.float4_e2m1fn,
b_dtype=T.float4_e2m1fn,
Expand All @@ -428,7 +438,7 @@ def test_nvf4_mma_block_scale_rejects_unsupported_configs(kwargs):
)
def test_nvf4_mma_block_scale_rejects_incompatible_dtypes(dtype_kwargs):
with pytest.raises(ValueError, match="mxf4nvf4 expects"):
TensorCoreIntrinEmitter(
TensorCoreIntrinEmitterSM120(
is_blockscaled=True,
a_transposed=False,
b_transposed=True,
Expand Down Expand Up @@ -766,10 +776,6 @@ def test_nvf4_mma_block_scale_varying_scale_correctness():
torch.testing.assert_close(C, ref, rtol=0.0, atol=0.0)


if __name__ == "__main__":
tilelang.testing.main()


# ---------------------------------------------------------------------------
# Example tail-tile behavior (moved from test_tilelang_sm120_nvfp4_example_cli).
# ---------------------------------------------------------------------------
Expand Down Expand Up @@ -823,3 +829,7 @@ def test_sm120_nvfp4_example_kernel_rejects_unsupported_tails(monkeypatch):
# bf16 output rows must stay 16-byte aligned
with pytest.raises(AssertionError, match="multiple of 8"):
module.sm120_nvfp4_blockscaled_gemm(128, 130, 256)


if __name__ == "__main__":
tilelang.testing.main()
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ def test_compact_package_issue_table_matches_cpp_macro_issue_order():


def test_frontend_package_macro_keeps_compact_selector_issue_order():
macro = Path(__file__).resolve().parents[3] / "tilelang/cuda/intrinsics/macro/mma_macro_generator.py"
macro = Path(__file__).resolve().parents[3] / "tilelang/cuda/intrinsics/macro/mma_sm120_macro_generator.py"
source = macro.read_text()
issue_loop = source[source.index(" def _mma_kblock") : source.index(" def _warp_mma_blockscaled_fulltile")]

Expand Down Expand Up @@ -984,3 +984,7 @@ def test_swizzle_blockscaled_chunk_kmajor_pads_rows_to_full_tiles():
back = unswizzle_blockscaled_chunk_kmajor_scale_words(swizzled)
assert torch.equal(back[:rows], words)
assert bool((back[rows:] == 0).all())


if __name__ == "__main__":
tilelang_testing.main()
1 change: 1 addition & 0 deletions tilelang/cuda/intrinsics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
TensorCoreIntrinEmitter,
TensorCoreIntrinEmitterWithLadderTransform,
)
from .macro.mma_sm120_macro_generator import TensorCoreIntrinEmitterSM120 # noqa: F401

from .layout.mma_layout import get_swizzle_layout # noqa: F401
from .layout.mma_layout import make_mma_swizzle_layout # noqa: F401
1 change: 1 addition & 0 deletions tilelang/cuda/intrinsics/macro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
TensorCoreIntrinEmitter,
TensorCoreIntrinEmitterWithLadderTransform,
)
from .mma_sm120_macro_generator import TensorCoreIntrinEmitterSM120 # noqa: F401

from .mma_sp_macro_generator import SparseTensorCoreIntrinEmitter # noqa: F401
Loading