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] Simplify NVFP4 lowering internals
  • Loading branch information
LeiWang1999 committed Jul 28, 2026
commit 2d692571b38afd59afea4cab58d4d101633f25fe
Comment thread
LeiWang1999 marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ def run_tilelang(args: argparse.Namespace) -> tuple[float, float]:
kernel.export_sass(str(sass_path))
kernel.compile_flags = saved_compile_flags
print(f"TileLang SASS: {sass_path}")
if "sm120_mma_blockscaled_kblock_fulltile_package_pingpong" not in source:
if "sm120_mma_blockscaled_fulltile" not in source:
raise RuntimeError("TileLang source did not lower to the SM120 full-tile MMA helper")

if args.input_mode == "ones":
Expand Down
13 changes: 5 additions & 8 deletions src/cuda/codegen/codegen_cuda.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3270,9 +3270,7 @@ void CodeGenTileLangCUDA::VisitExpr_(const CallNode *op, std::ostream &os) {
replacer.register_rule("(scale_b_byte_id)", scale_b_byte_id);
replacer.register_rule("(scale_b_thread_id)", scale_b_thread_id);
this->stream << replacer.rewrite(mma_call);
} else if (
op->op.same_as(
tl::sm120_mma_blockscaled_kblock_fulltile_package_pingpong())) {
} else if (op->op.same_as(tl::sm120_mma_blockscaled_fulltile())) {
need_mma_block_scale_instruction_h_ = true;
// arg 0: C fragment pointer
// arg 1: C fragment offset
Expand All @@ -3293,11 +3291,10 @@ void CodeGenTileLangCUDA::VisitExpr_(const CallNode *op, std::ostream &os) {
};

this->PrintIndent();
this->stream
<< "tl::sm120_mma_blockscaled_kblock_fulltile_package_pingpong("
<< "reinterpret_cast<float*>((" << c_ref << ") + (" << c_offset
<< ")), " << void_ptr_arg(2) << ", " << void_ptr_arg(3) << ", "
<< uint32_ptr_arg(4) << ", " << uint32_ptr_arg(5) << ");\n";
this->stream << "tl::sm120_mma_blockscaled_fulltile("
<< "reinterpret_cast<float*>((" << c_ref << ") + (" << c_offset
<< ")), " << void_ptr_arg(2) << ", " << void_ptr_arg(3) << ", "
<< uint32_ptr_arg(4) << ", " << uint32_ptr_arg(5) << ");\n";
} else if (op->op.same_as(builtin::ptx_mma_sp())) {
// arg 0: shape: mXnXkX
// arg 1: A layout: row/col
Expand Down
19 changes: 5 additions & 14 deletions src/cuda/op/copy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1647,21 +1647,12 @@ Stmt Copy::LowerBulk(const CopyNode &op, const LowerArgs &lower_args,
"to normal copy";
return fallback_to_normal("undecodable shared swizzle layout");
}
// Recast the swizzle atom into byte-address space because CuTe/TMA
// swizzles are based on byte addresses. For scalar NVFP4, only the swizzle
// atom can be recast cleanly from 4-bit logical elements; the plain layout
// may contain half-byte contiguous strides and remains in element space for
// offset/coordinate analysis below.
// Recast element-space layout into byte-address space.
// Because CuTe swizzle are based on byte addresses.
int elem_bits = shared_tensor->dtype.bits();
cute::Swizzle swizzle_bytes;
if (shared_tensor->dtype.is_float4_e2m1fn() &&
shared_tensor->dtype.is_scalar()) {
swizzle_bytes = composed.value()->swizzle.Recast(elem_bits, /*new_bits=*/8);
} else {
// E.g., composed_bytes = Sw<3,4,3> o 0 o (64,64,8):(128,2,8192)
swizzle_bytes = composed.value().Recast(elem_bits, /*new_bits=*/8)->swizzle;
}
const auto *sw = swizzle_bytes.get();
// E.g., composed_bytes = Sw<3,4,3> o 0 o (64,64,8):(128,2,8192)
auto composed_bytes = composed.value().Recast(elem_bits, /*new_bits=*/8);
const auto *sw = composed_bytes->swizzle.get();
int b_bits = sw->b_bits, m_base = sw->m_base, s_shift = sw->s_shift;
if (!sw->IsSwizzled()) {
desc.swizzle = static_cast<int>(CU_TENSOR_MAP_SWIZZLE_NONE);
Expand Down
17 changes: 8 additions & 9 deletions src/op/builtin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ DataType CuTensorMapType() { return DataType::UInt(8, 128); }
TVM_REGISTER_OP("tl." #OpName) \
.set_attr<TScriptPrinterName>("TScriptPrinterName", #OpName)

#define TIR_DEFINE_TL_OPAQUE_BUILTIN(OpName, NumInputs) \
TIR_DEFINE_TL_BUILTIN(OpName) \
.set_num_inputs(NumInputs) \
.set_attr<TCallEffectKind>("TCallEffectKind", \
Integer(CallEffectKind::kOpaque))

// Pointer access metadata op (frontend-only, lowered later).
TIR_DEFINE_TL_BUILTIN(access_ptr)
.set_num_inputs(3)
Expand Down Expand Up @@ -258,10 +252,15 @@ TIR_DEFINE_TL_BUILTIN(ptx_wgmma_sp_rs)
.set_attr<TCallEffectKind>("TCallEffectKind",
Integer(CallEffectKind::kOpaque));

TIR_DEFINE_TL_OPAQUE_BUILTIN(ptx_mma_block_scale, 21);
TIR_DEFINE_TL_BUILTIN(ptx_mma_block_scale)
.set_num_inputs(21)
.set_attr<TCallEffectKind>("TCallEffectKind",
Integer(CallEffectKind::kOpaque));

TIR_DEFINE_TL_OPAQUE_BUILTIN(
sm120_mma_blockscaled_kblock_fulltile_package_pingpong, 6);
TIR_DEFINE_TL_BUILTIN(sm120_mma_blockscaled_fulltile)
.set_num_inputs(6)
.set_attr<TCallEffectKind>("TCallEffectKind",
Integer(CallEffectKind::kOpaque));

TIR_DEFINE_TL_BUILTIN(ptx_tcgen05_mma_ss)
.set_num_inputs(14)
Expand Down
4 changes: 2 additions & 2 deletions src/op/builtin.h
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,9 @@ TVM_DLL const Op &ptx_wgmma_sp_rs();
TVM_DLL const Op &ptx_mma_block_scale();

/*!
* \brief Private SM120a NVF4 full-tile package-lifecycle helper.
* \brief Private SM120a NVF4 full-tile MMA helper.
*/
TVM_DLL const Op &sm120_mma_blockscaled_kblock_fulltile_package_pingpong();
TVM_DLL const Op &sm120_mma_blockscaled_fulltile();

/*!
* \brief tvm intrinsic for tcgen05 mma shared-shared instructions.
Expand Down
7 changes: 4 additions & 3 deletions src/tl_templates/cuda/instruction/mma_block_scale.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,10 @@ TL_DEVICE void sm120_gemm_fulltile_ab_owner_wide_package(
#undef TL_SM120_PKG_C_OFFSET
}

TL_DEVICE void sm120_mma_blockscaled_kblock_fulltile_package_pingpong(
float *c, const void *a_smem_base, const void *b_smem_base,
const uint32_t *sfa_smem_base, const uint32_t *sfb_smem_base) {
TL_DEVICE void sm120_mma_blockscaled_fulltile(float *c, const void *a_smem_base,
const void *b_smem_base,
const uint32_t *sfa_smem_base,
const uint32_t *sfb_smem_base) {
const char *a_base = static_cast<const char *>(a_smem_base);
const char *b_base = static_cast<const char *>(b_smem_base);
SM120FulltileABOwnerWidePackage pkg0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def test_sm120_mma_blockscaled_strategy_helpers_are_not_public_api():
T,
"sm120_mma_blockscaled_kblock_fulltile_afull_bpanel_owner_wide",
)
assert not hasattr(T, "sm120_mma_blockscaled_kblock_fulltile_package_pingpong")
assert not hasattr(T, "sm120_mma_blockscaled_fulltile")
assert not hasattr(T, "sm120_mma_blockscaled_cute_consumer_bridge")


Expand Down Expand Up @@ -617,7 +617,7 @@ def test_nvf4_mma_block_scale_package_pingpong_contract_lowers_fulltile():
)

src = kernel.get_kernel_source()
assert "sm120_mma_blockscaled_kblock_fulltile_package_pingpong" in src
assert "sm120_mma_blockscaled_fulltile" in src


@tilelang.testing.requires_cuda
Expand Down
2 changes: 1 addition & 1 deletion tilelang/cuda/intrinsics/macro/mma_macro_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2017,7 +2017,7 @@ def _warp_backend_package_pingpong(
)
T.call_intrin(
"handle",
tirx.op.Op.get("tl.sm120_mma_blockscaled_kblock_fulltile_package_pingpong"),
tirx.op.Op.get("tl.sm120_mma_blockscaled_fulltile"),
C_local_buf.data,
0,
a_base,
Expand Down
Loading