Skip to content
Merged
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
Scope shared-memory bit-exact sizing to packed scalar NVFP4
The exact-bits shared storage sizing previously applied to every dtype
with element_bits % 8 != 0 (int4/uint4/uint2/...), halving e.g. int4
shared allocations while SharedByteOffsetToLogicalIndexOffset kept the
legacy bytes-per-element conversion for those dtypes — an inconsistent
size/index pair for any non-FP4 sub-byte buffer in a merged arena.

Restrict the new sizing to float4_e2m1fn scalar so it mirrors the
byte-offset -> logical-index special case exactly: NVFP4 buffers get
packed two-per-byte sizing and indexing, every other dtype keeps
bit-exact upstream behavior. This pass now changes nothing outside the
NVFP4 path.

Validated after rebuilding libtilelang.so: nvf4 language + example CLI +
quantize layout + access_ptr codegen + atom mma tests (129 passed),
example and WS benchmark --verify pass with a fresh JIT cache.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
  • Loading branch information
qutao and claude committed Jul 10, 2026
commit be668c615705a3d009526f595df799a159e8c6b8
25 changes: 18 additions & 7 deletions src/transform/merge_shared_memory_allocations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,30 @@ static DataType GetStorageSizeExprDType(const Buffer &buffer) {
return size_dtype;
}

// Scalar packed NVFP4 stores two logical elements per byte, and its buffer
// shapes are expressed in logical elements. It is the only dtype whose
// storage sizing and byte-offset -> logical-index conversion deviate from the
// legacy DataType::bytes() rule; all other (sub-)byte dtypes keep the
// upstream semantics so this pass changes behavior for NVFP4 buffers only.
static bool IsPackedScalarFp4(DataType dtype) {
return dtype.is_float4_e2m1fn() && dtype.is_scalar();
}

static int64_t GetSharedStorageBitsPerLogicalElement(DataType dtype) {
return static_cast<int64_t>(dtype.bits()) * dtype.lanes();
if (IsPackedScalarFp4(dtype)) {
return 4;
}
return static_cast<int64_t>(dtype.bytes()) * dtype.lanes() * 8;
}

static PrimExpr GetSharedStorageSizeBytes(const Buffer &buffer) {
DataType size_dtype = GetStorageSizeExprDType(buffer);
int64_t element_bits = GetSharedStorageBitsPerLogicalElement(buffer->dtype);

// Buffer shapes are expressed in logical elements. Do not use
// DataType::bytes() here: it rounds sub-byte scalar types up per element, so
// scalar packed FP4 would be charged as one byte per value instead of two
// values per byte. Compute total bits first, then round the whole allocation
// up to bytes.
// Do not use DataType::bytes() for packed FP4: it rounds sub-byte scalar
// types up per element, so scalar packed FP4 would be charged as one byte
// per value instead of two values per byte. Compute total bits first, then
// round the whole allocation up to bytes.
PrimExpr size_bits = make_const(size_dtype, element_bits);
for (const PrimExpr &extent : buffer->shape) {
PrimExpr e = extent;
Expand All @@ -118,7 +129,7 @@ static PrimExpr SharedByteOffsetToLogicalIndexOffset(PrimExpr byte_offset,
// the non-alias rewrite still indexes the original typed buffer. Convert the
// byte offset back to that buffer's logical element index. Packed scalar
// NVFP4 has two logical elements per byte.
if (dtype.is_float4_e2m1fn() && dtype.is_scalar()) {
if (IsPackedScalarFp4(dtype)) {
return byte_offset * make_const(byte_offset.dtype(), 2);
}
return indexdiv(byte_offset, dtype.bytes() * dtype.lanes());
Expand Down
Loading