Commit Graph
109 Commits
Author SHA1 Message Date
Rishabh Sinha 11ec2397fe [Cache] Store cached kernel params as JSON instead of cloudpickle (#3143)
The kernel cache and the autotuner result cache loaded params.pkl with
cloudpickle.load(), so a writable cache directory allowed arbitrary code
execution on the next cache hit. Kernel params are plain data, so store
them as JSON via TVM's reflection (tvm.ir.save_json / load_json), which
rebuilds IR nodes without executing code. Entries without params.json are
treated as incomplete and rebuilt.

Fixes #2817
2026-09-06 16:06:20 +08:00
Chaofan LinandLeiWang1999 1a1df62e94 [Language] Remove deprecated T.symbolic alias (#3122)
* [Cleanup] Remove stale deprecation deadlines

* [Language] Remove deprecated T.symbolic alias

---------

Co-authored-by: LeiWang1999 <leiwang1999@outlook.com>
2026-09-04 23:56:52 +08:00
Rishabh Sinha bdbf32acf9 [Bugfix][Language] Support unary plus on PrimExpr in the eager frontend (#3141)
PrimExpr overloads unary minus and invert but not unary plus, so
`Out[i] = +A[i]` raised TypeError at trace time. Route unary plus through
the builder, the same way `not` already is, and return PrimExpr operands
unchanged; Python values keep their native unary plus.

Fixes #2991
2026-09-04 14:49:09 +08:00
Lei Wang e07bd1d009 [Refactor][CUDA] Replace per-lane-count vector constructors with variadic packers (#3158)
* [BugFix][Blackwell] Fix 256-bit vectorized codegen for fp4/int4/fp16

256-bit vectorization (sm_100+) broke nvcc compilation for several
packed dtypes because every (dtype x lanes) combination relied on
hand-written per-type glue:

- fp4 x 64 lanes: predicated copy materializes a typed vector temporary,
  which needs `fp4_e2_64_t::operator=(ulonglong4)` (never defined; the
  operator was copy-pasted onto the 128-bit fp4_e2_32_t with a broken
  body) and `make_fp4_e2_64_t` (constructors stop at 32 lanes).
- int4/uint4 x 64 lanes: PrintType emitted the nonexistent CUDA type
  `(u)int8`, and the packed-nibble broadcast only handled 16/32 lanes.
- fp16 x 16 lanes: broadcast calls tl::pack_float16x4 whose parameters
  were `__half`, but codegen prints fp16 scalars as cutlass::half_t
  (the bf16 variant already took bfloat16_t).

Instead of patching each cell, make the contracts generic:

- tl::load_global_256 / _conditional now return the pointee type
  (static_assert sizeof == 32) and bit-cast internally, so assignment
  type-checks for any 32-byte vector struct. The hand-written
  operator=(ulonglong4) on fp8_e{4,5,8}_32_t become dead and are
  removed, along with the misplaced fp4_e2_32_t one. The T.ldg256
  builtin keeps its uint32x8 result via an explicit ulonglong4 cast.
- New tl::broadcast<V>(unit) replicates a packed unit across any vector
  width; fp4 broadcast now emits one packed fp4x2 byte + tl::broadcast
  for every lane count instead of a 64-arg make_ call.
- int4x64 maps to (u)longlong4 (like int8x32) and its broadcast packs
  two 8-nibble fields per 64-bit component.

Adds a compile matrix test (12 dtypes x {copy, predicated copy, fill}
x {128b, 256b}) plus numeric checks for the previously broken cells, so
the next dtype/width gap fails in CI instead of on a user's machine.
On < sm_100 targets the 256b params compile at 128 bits and stay green.

* [Refactor][CUDA] Replace per-lane-count vector constructors with variadic packers

Follow-up to #3153: the make_<type>_<N>_t constructor ladders (5 for fp4,
15 for fp8) and several BroadcastNode special cases enumerated the same
(dtype x lanes) matrix by hand, so every new dtype or vector width needed
more glue. Replace the enumeration with two generic templates:

- tl::make_vec<V>(e0, e1, ...): builds a vector struct from one scalar
  element per lane (byte-sized or larger elements).
- tl::make_fp4_vec<V>(e0, e1, ...): same for nibble-packed fp4.

and route the codegen through them:

- PrintVecConstructor emits tl::make_fp4_vec<V> / tl::make_vec<V> for
  fp4/fp8 vectors, covering the Shuffle and element-wise assembly paths
  (whose previous output for these types did not even compile).
- fp8 and int8 broadcasts of side-effect-free values emit
  tl::broadcast<carrier>(byte) instead of per-lane make_ calls; the int4
  16/32/64-lane packed broadcasts collapse into a single
  tl::broadcast branch.
- Side-effecting broadcast values (e.g. casts of rng calls) keep their
  evaluate-once-per-lane semantics: they fall through to the generic
  per-lane path, guarded via tirx::SideEffect. The int32 rng broadcast
  path and the fp16/bf16/f32x8 paths are intentionally untouched.

The make_fp4_e2_{2..32}_t and make_fp8_{e4,e5,e8}_{2..32}_t ladders are
deleted; the char-packing make_int* overloads in common.h stay because
the int8 Shuffle path still assembles vectors element-wise.

Verified on sm_103a: the 12-dtype x 3-op x 2-width compile matrix stays
green, new numeric tests cover non-constant fp4/fp8/int8 scalar fills,
and the ldg/ldst/vectorize/vectorized_cast/quantize suites pass
(228 tests) with TILELANG_DISABLE_CACHE=1.

* [Test] Update issue #2480 assertions for the tl::broadcast emission

The int8x32 broadcast is now emitted as tl::broadcast<(u)longlong4>(byte)
instead of make_(u)longlong4 with 32 scalar args; the exact-value checks
that guard the original issue (upper 32 bits of each field zeroed) are
unchanged.
2026-09-03 23:01:35 +08:00
Rishabh Sinha e155c440b3 [Bugfix][Language] Reject loop else clauses in the eager frontend (#3142)
`for ... else` and `while ... else` inside a kernel traced without error
while the `else` body was silently dropped from the IR. Raise a clear
NotImplementedError from the AST rewriter instead; `if ... else` is
unaffected.

Fixes #2946
2026-09-03 13:44:09 +08:00
Yongqi ZhuoandClaude Fable 5 a0a131908d [Refactor] Restore LoopUnswitching test altered by #3121 (#3124)
Refactor issue-1734 test: pin row-chunk layout to keep C_local[i] loop-invariant

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-02 16:24:45 +08:00
Yongqi ZhuoandClaude Fable 5 2169b925ae [BugFix] Always vectorize T.Parallel loops (#3121)
* [BugFix] Always vectorize `T.Parallel` loops

* Fix CI failures

* Restore always-vectorize accidentally reverted by the CI-fix commit

f447919b captured a transient working-tree state from a concurrent
baseline-vs-patched benchmark flip, reverting the gate removal in src/
while keeping the new-policy tests: CI then ran the old gated compiler
against them (scalar var-loop -> no float2; positional if/for check
broken by the copy loops the larger tile introduces).

Bring back the parameter-less LowerParallelLoop and rewrite the issue
1734 assertion as containment: the guarded loop must sit inside the
hoisted if block, which holds on both sm90 and sm100 regardless of how
many copy loops precede it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-31 23:33:42 +08:00
Jinpeng Wang 9f6cab208c [BugFix][CUDA][HIP] Handle logical not for vectorized bool (#3117) 2026-08-31 16:15:49 +08:00
Jinpeng Wang 09a9101f57 [Bugfix] Reject symbolic T.gemm tile dimensions with a clear message (#3113) 2026-08-31 14:54:21 +08:00
J.W (Jun) 25908d48a6 [Bugfix][Quantize] Fix unsigned zero-point decode underflow (#2947) (#3118)
_tir_packed_to_unsigned_convert_with_zeros performed the zero-point subtraction in the unsigned packed storage dtype before casting to the requested output dtype. Values below the zero-point therefore wrapped modulo the storage width.

Cast the unpacked field and zero-point to the output dtype before subtraction so asymmetric dequantization preserves negative values.

Add CUDA regression coverage for uint32-packed 4-bit values decoded with a non-zero zero-point.

Fixes #2947
2026-08-31 14:12:46 +08:00
YYDHandSiriusNEO a2e02cc5cd [Bugfix][CUDA] Fix UB in packed 8-bit vector stores (#3092)
* [Bugfix][CUDA] Fix UB in packed 8-bit vector stores

* test(cuda): check int8x32 field initialization

---------

Co-authored-by: SiriusNEO <chaofan@deepseek.com>
2026-08-27 19:47:41 +08:00
Wenzhe WangandSiriusNEO 469c5d5cb8 [Bugfix] Validate T.gemm k_pack arguments (#3094)
* [Bugfix] Validate T.gemm k_pack arguments

* [Bugfix] Improve T.gemm k_pack diagnostic

* [Bugfix] Accept integral T.gemm k_pack values

* [Bugfix] Simplify T.gemm k_pack validation

---------

Co-authored-by: SiriusNEO <chaofan@deepseek.com>
2026-08-27 19:33:26 +08:00
Sam Sui e8b9da92d2 [BugFix][CUDA] Support int4x2 and uint4x2 codegen (#3036)
* fix(cuda): support int4x2 and uint4x2 codegen (#2994, #2995)

* fix(cuda): handle packed int4 lane access

* fix(cuda): handle packed 4-bit x2 construction

* fix(cuda): load packed x2 gathers by logical index

* fix(cuda): validate packed int4 vector alignment

* fix(cuda): preserve packed vector load fallback
2026-08-25 14:48:53 +08:00
Zupeng Wang f436610f7d [Language] Honor declared strides in pointer helpers (#3073)
Signed-off-by: Zupeng Wang <71580390+zupengwang@users.noreply.github.com>
2026-08-24 01:16:09 +08:00
Diao Han 78a4ff6587 [BugFix][Hopper] Select the widest legal WGMMA N instead of gcd (#2931)
* [BugFix][Hopper] Select the widest legal WGMMA N instead of gcd

block_N extents that are legal single WGMMA widths but not powers of two
(96, 112, 160, 176) were decomposed into n32 / n16 instructions, because
the instruction width came from gcd(warp_col_tiles, 256). wgmma.h already
instantiates every multiple of 8 up to 256, so only the width selection
was the constraint.

Select the widest legal width that tiles warp_col_tiles exactly, keeping
gcd as the fallback. Widening is restricted to multiples of 16: the
N % 16 == 8 class already miscomputes (#2593), and the integer instruction
tables only instantiate multiples of 16 (plus 8 and 24). The result is
never narrower than before, so no existing shape regresses.

The sparse generator carried the same line and now shares the helper.

* [Testing] Cover T.gemm_sp at the widened WGMMA N values

The width selector is shared with the sparse generator, so assert the emitted
wgmma_sp instruction and the sparse numeric result for block_N in {96, 112,
160} as well. Verified as a real regression: with the selector reverted the
sparse path emits n32 / n16 / n32 exactly like the dense one.
2026-08-11 17:20:51 +08:00
edragainandSiriusNEO 7cabeed7c9 [BugFix] Fix failed ties-away-from-zero round compile on bfloat16/float8 (#2873)
* [BugFix] Fix failed ties-away-from-zero round compile on bfloat16/float8

* add helper function on hip

* [Test] Check ties-away rounding helper codegen

---------

Co-authored-by: SiriusNEO <chaofan@deepseek.com>
2026-08-10 16:44:34 +08:00
Yuxi Chi 7fc47066cd [CuTeDSL] Port backend intrinsics to CUTLASS DSL primitives (#2871)
* Port CuTeDSL backend to CUTLASS primitives

* Update CuTeDSL dependency to CUTLASS DSL 4.7.0

* Fix CuTeDSL dynamic-shape wrapper generation
2026-08-08 18:00:57 +08:00
Chaofan Lin 27224884f9 [Testing] Run portable regression tests on auto targets (#2914)
[Testing] Remove stale CUDA gates from portable tests
2026-08-07 15:07:26 +08:00
andyluo7 02cf41f178 [Testing] Gate the issue #2883 regression test on CUDA (#2908)
The test added in #2899 lowers with an explicit `tvm.target.Target("cuda")`, which
reaches `tilelang/cuda/transform/__init__.py`. In a `USE_CUDA=OFF` build only the
"ALWAYS" CUDA sources compile, so `AnnotateDeviceBoundTmaCopies` is never registered
and the test fails on ROCm:

    AttributeError: module 'tilelang.cuda._ffi_api' has no attribute
                    'AnnotateDeviceBoundTmaCopies'

Same pattern as #2863. `requires_cuda` is the weakest sufficient gate: the test is
compile-only (`enable_device_compile=False`), so it needs no particular GPU
generation and keeps running on the NVIDIA leg.

Verified in CI: SKIPPED on the gfx942 leg, PASSED on CUDA-auto.
2026-08-06 19:25:53 -07:00
Chaofan Lin f779a4ef8c [Test] Add regression test for issue #2883 (#2899) 2026-08-06 16:52:03 +08:00
Jinpeng Wang 6873e19da2 [BugFix] Handle vectorized SelectNode in codegen_cuda (#2843)
* [BugFix] Handle vectorized SelectNode in codegen_cuda

* address review comments

* [BugFix] Fix cuda codegen vectorized SelectNode when condition is a scalar
2026-08-05 13:51:31 +08:00
andyluo7 dd9c20dbf7 [Testing] Gate CUDA-only tests so non-CUDA backends can run the suite (#2863)
A large number of tests import CUDA-only internals directly (for example
`tilelang.cuda.pipeline.CUDAPassPipelineBodyPrologue`) or exercise
NVIDIA-specific features such as TMA, LDGSTG, mbarrier, warp specialization,
tcgen05 and tfloat32. `src/cuda/CMakeLists.txt` only compiles a small
"ALWAYS" subset when `USE_CUDA=OFF`, so those FFI symbols are never
registered and the tests fail with:

    AttributeError: module 'tilelang.cuda._ffi_api' has no attribute
                    'AnnotateDeviceBoundTmaCopies'

This is not ROCm-specific -- the same tests fail on any build without the
CUDA backend, including Metal and CPU-only.

Add `@tilelang.testing.requires_cuda` to those tests, plus three
portability fixes that keep coverage on non-CUDA backends instead of
skipping it:

* `test_tilelang_transform_layout_inference.py`: CUDA emits
  `__launch_bounds__(N, 1)` while HIP emits `__launch_bounds__(N)`.
  Match both.
* `test_tilelang_transform_pipeline_planning.py`: PipelinePlanning
  deliberately strips pipeline annotations on ROCm targets other than
  gfx950 (see the guard in src/transform/pipeline_planning.cc), so assert
  the documented sequential fallback there.
* `test_tilelang_kernel_gemm.py`: the two f32f32f32 cases use `T.tfloat32`,
  which is NVIDIA-only, so narrow `requires_cuda_or_cdna` to
  `requires_cuda`.

Also refresh three stale RDNA tests: gfx12 is now a supported generation
(`get_arch` accepts 11 and 12), so they can no longer assert that gfx1200
is rejected. Force an unsupported generation instead, which is the only
way to reach the guard now that `target_is_rdna` reports only gfx11/gfx12.

Verified on 8x MI300X (gfx942, ROCm 7.2 container, torch nightly rocm7.2):
the ROCm suite goes from 105 failures to 0 with no loss of passing tests.
2026-08-04 18:22:40 +08:00
jpwang 03645a6483 [BugFix] Use masked warpsync in in-warp allreduce (#2865)
* [BugFix] Use masked warpsync in in-warp allreduce

* Add more tests to make coderabbit happy
2026-08-04 17:51:23 +08:00
jpwang 4be24b75bc [BugFix] Fix absmax and abssum for uint dtypes (#2845)
* [BugFix] Fix absmax and abssum for uint dtypes

* use parametrize tests

* Resolve review comments
2026-08-03 17:16:55 +08:00
Ruinan LiandClaude Fable 5 5b1f321847 [BugFix] Reject uncovered warp partitions in T.gemm instead of producing silently wrong results (#2724)
* fix: resolve issue 2537

* test: pin default-search regression tests to the MMA backend

On sm_90 SelectInst reroutes M>=64 / warps%4==0 shapes to the WGMMA
search, so two tests written against the default search exercised the
wrong code path on Hopper CI. The FullCol M=192 N=104 numeric test
additionally hit a pre-existing, partition-independent WGMMA
descriptor-layer limitation (N=104 fits no canonical GMMA swizzle atom).
Pin both to the MMA path via tl.disable_wgmma; the WGMMA search keeps
its own dedicated tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-30 13:53:03 +08:00
Tong WU 32e02e6c72 [Fix] Refine architecture guards (#2790)
* fix: refine TCGEN05 architecture guards

* test: consolidate CUDA intrinsic architecture guards

* test: remove CUDA device helper architecture guard tests
2026-07-29 15:21:50 +08:00
Tong WU b5e3eb93ef [Enhancement] More compile-time guards for architecture-specific CUDA intrinsics (#2781)
fix: guard architecture-specific CUDA intrinsics
2026-07-27 21:11:59 +08:00
Chaofan Lin 8bb3300d60 [BugFix] Preserve if condition evaluation during fan-out (#2764)
* [BugFix] Preserve if condition evaluation during fan-out

* [BugFix] Avoid snapshotting replayable if conditions
2026-07-25 14:30:13 +08:00
Chaofan Lin e9240d6816 [Refactor] Move example-only helpers out of tilelang package (#2761) 2026-07-24 18:03:34 +08:00
Zheng YuandZheng Yu 1591d368db [BugFix] Preserve re-evaluation of mutable if conditions (#2744)
Avoid merging ifs with mutable conditions

Co-authored-by: Zheng Yu <17133261+cla7aye15I4nd@users.noreply.github.com>
2026-07-24 17:09:08 +08:00
xiaoyouPREG 192ddea60f [BugFix] Gate TMEM and TMA builtins by CUDA architecture (#2743) 2026-07-23 14:22:05 +08:00
ChennesandLeiWang1999 a443dde926 [BugFix] Reject contracting shared-buffer layouts in T.annotate_layout (#2719)
* [BugFix] Reject contracting shared-buffer layouts in T.annotate_layout

T.annotate_layout could accept a contracting many-to-one forward map on a
shared buffer. makeBufferWithLayout then misread the smaller output extent as
a replication factor, rewrote the buffer to a higher rank, and eventually
failed with an unrelated BufferStore dimensionality ICHECK.

Add a pigeonhole check for static layout shapes before the replication branch.
When the layout output extent is smaller than its input extent, raise a
user-facing ValueError that identifies the buffer and reports both extents.
Keep identity, permutation, and output-growing layouts unchanged.

This check intentionally targets contracting maps; general injectivity
analysis for maps with larger output bounding boxes is outside this change.

Fixes #2632

* [Layout] Enforce injective shared-buffer annotations

Add a LayoutNode injectivity check with an exact fallback for static domains, and reuse it for FragmentNode thread and replication coordinates. Validate shared-buffer annotations after layout reshaping so sparse many-to-one maps are rejected with a useful collision diagnostic while padded injective maps remain valid.

---------

Co-authored-by: LeiWang1999 <leiwang1999@outlook.com>
2026-07-23 11:21:48 +08:00
Lei Wang dff136d4da [CUDA][Pipeline] Fix 1D TMA selection for versioned layouts (#2737)
Fix pipelined 1D TMA layout detection
2026-07-22 21:38:18 +08:00
Liu Yunuo f8d8cd4b14 [BugFix] Use blockDim as workspace stride in batch AllReduce (#2621)
* fix: use blockDim as workspace stride in batch AllReduce

* add test
2026-07-21 18:46:14 +08:00
lianjinfeng2003 ac576c6356 [BugFix] Fix FP4 dequant symbolic exponent clamp (#2656)
* [BugFix] Fix FP4 dequant symbolic exponent clamp

* [BugFix] Align quantization regression
2026-07-21 18:23:49 +08:00
xiaoyouPREG ffeda9f394 [BugFix] Pack 32-lane 8-bit CUDA vectors correctly (#2701)
* [BugFix] Pack 32-lane 8-bit CUDA vectors correctly

* [Test] Avoid SM100-only store in int8 broadcast regression

* [BugFix] Move int8x32 packing into CUDA templates
2026-07-21 13:36:03 +08:00
wcxandLeiWang1999 8cdd4d62f3 [BugFix] Prevent partial 1-D TMA stores from bypassing bounds checks (#2716)
* [BugFix] Prevent partial 1-D TMA stores from bypassing bounds checks

Signed-off-by: UnsettingGalaxy <chenxuw641@gmail.com>

* [BugFix] Prevent partial 1-D TMA stores from bypassing bounds checks

Signed-off-by: UnsettingGalaxy <chenxuw641@gmail.com>

* [BugFix] Derive TMA copy bounds during selection

Remove buffer_oob from generic layout inference arguments and derive copy-region containment from the active analyzer in both inference and lowering. Use descriptor TMA for partial tiles and add rank-1 tail regression coverage.

---------

Signed-off-by: UnsettingGalaxy <chenxuw641@gmail.com>
Co-authored-by: LeiWang1999 <leiwang1999@outlook.com>
2026-07-20 19:42:49 +08:00
Liu Yunuo 0c7f14c3f9 [BugFix] Fix WGMMA C-store layout for multiple warpgroups along M (#2663)
* fix wgmma store layout

* fix wgmma_sp the same way, update testing requirements
2026-07-17 17:09:22 +08:00
xiaoyouPREG 9754ac4471 [BugFix] Preserve bf16 NaN and Inf during RNE packing (#2690) 2026-07-17 13:50:39 +08:00
Lyscoria 31755e7138 [BugFix] Support runtime-dependent vector negative indices (#2654) 2026-07-16 18:30:46 +08:00
Chennes c8c49d5025 [BugFix] Reject invalid dtypes in T.dp4a (#2652)
T.dp4a previously accepted arbitrary buffer dtypes and passed them to backend DP4A implementations, which could silently reinterpret the operand bytes and produce incorrect results.

Require both inputs to use int8 and the accumulator to use int32. Add regression coverage for valid Buffer and BufferLoad forms and for invalid input and accumulator dtypes.

Fixes #2600
2026-07-13 17:13:24 +08:00
Chennes e2c2c207e6 [BugFix] Sign-extend packed uint32 signed decode (#2500)
_tir_u32_to_int_to_float decoded signed sub-word fields from uint32 storage as unsigned values because it only masked the selected field before casting. As a result, negative encodings such as signed int4 `0xF` decoded as `15.0` instead of `-1.0`.

Sign-extend the extracted field through int32 before casting to the requested float dtype, matching the existing packed signed-int decode helper.

Add CUDA regression coverage for signed int2, int4, and int8 values decoded from uint32 storage.

Fixes #2482
2026-07-02 13:12:56 +08:00
Chennes ed00dfcd7f [BugFix] Improve diagnostic for T.serial fragment access (#2462)
* [BugFix] Reject unsupported T.serial access to thread-distributed fragments with clear diagnostics

A T.serial loop runs sequentially inside each CUDA thread, but a fragment's
elements are distributed across threads, so indexing a fragment by a serial
loop variable has no valid thread-ownership mapping. Three fuzzer reports share
this root cause:

- #2393: serial reduce of a GEMM-output fragment -> unhelpful internal error
  ("contains inner var j").
- #2395: serial write into a fragment then T.copy out -> nvcc "identifier
  undefined" (an owner-thread guard built from serial loop vars was emitted
  outside the loop that binds them).
- #2396: serial write of a fragment to global -> silently wrong (threads
  race-write each cell).

AddWrapperForSingleBufStore wraps bare fragment stores in a degenerate
T.parallel(1) and only rejected constant non-zero fragment indices, so a
dynamic (e.g. serial-loop) index slipped through and lowered to broken code
(#2395/#2396). Reject any fragment index that is not the constant all-zero
index in this fallback path, with a message pointing to T.Parallel /
T.reduce_sum. Rephrase the existing inner-var layout check (#2393) to explain
the cause instead of dumping "contains inner var".

Also collect every access to a buffer in a statement (not just the last) so the
diagnostic is not bypassed when one fragment is accessed at both a constant and
a variable index in the same statement; without it such a case falls through to
a cryptic downstream StructuralEqual internal error. This is a completeness
hardening only, not required by the three issues above.

Fixes #2393
Fixes #2395
Fixes #2396

* Generalize fragment diagnostic to non-parallel loops

inner_vars_ is populated for every non-parallel For (serial, unroll,
vectorized), so the message must not hard-code T.serial. Reword to
"non-parallel loop variable" per review feedback.

* Narrow fix scope to #2393 only

Remove fragment index validation from AddWrapperForSingleBufStore and
delete tests for #2395/#2396. These issues cannot be caught at this pass
stage because T.grid and T.serial are indistinguishable (both appear as
ForKind.SERIAL before LowerTileOp).

Keep only the ParallelOpNode diagnostic improvement which successfully
catches #2393.
2026-06-28 13:05:51 +08:00
Ftoandcoderabbitai[bot] ab083cb3c6 [BugFix] Fix T.Persistent dropping tiles when last dim is not a multiple of group_size (#2455)
* [BugFix] Fix T.Persistent dropping tiles when last dim is not a multiple of group_size (#2433)

* Update src/ir.cc

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-06-26 14:12:53 +08:00
Lei Wang dfc7e953ed [Pipeline] Simplify async copy lowering (#2444)
* Clean up async copy pipeline lowering

* FIX

* enhance

* refactor pipeline
2026-06-24 15:11:05 +08:00
Chaofan Lin 2913ad3f00 [Backend] Cleanup Metal Codegen, split AsyncCopy lowering and common target utils (#2361)
* [Backend] Cleanup Metal Codegen and split common target utils

* [Backend] Preserve PTX async copy pass docs

* [Backend] Split backend CMake source ownership

* [Backend] Split target warp size helpers
2026-06-09 20:20:25 +08:00
Lei Wang 66ef211815 [TIR][Transform] Partition parallel loops with fragment access (#2340)
Fix fragment parallel loop partitioning
2026-06-05 14:37:46 +08:00
Tong WUandLeiWang1999 c2998920cc [BugFix] Fix eager JIT sub-btye shape binding (#2334)
* Fix eager JIT packed FP4 shape binding

* Add logical shape and stride calculations for buffers in eager builder

This update introduces helper functions to compute logical shape and stride values for buffers, enhancing the handling of packed storage factors. The changes streamline the process of determining dimensions and strides in the context of tensor operations, improving overall efficiency and clarity in the eager execution flow.

---------

Co-authored-by: LeiWang1999 <leiwang1999@outlook.com>
2026-06-05 13:53:12 +08:00
Lei Wang d988dd0491 [Transform] Place auto WS producers in first warp group (#2315)
* Place auto WS producers in first warp group

* [Transform] Update layout inference to bind thread range for fully replicated fragments; add tests for TMA fragment mask copy and producer-consumer warp specialization

* [Refactor] Update thread variable calculation to use zero-based indexing across GEMM operations

* [Transform] Enhance simplification process with ContextSingletonFloorDivFolder and add tests for floor division simplification

* [Refactor] Simplify tensor conversion in dequantization functions and improve performance in GEMM examples
2026-06-04 14:47:52 +08:00
Chaofan Lin 8d315be580 [Backend][Transform] Move backend-specific transforms into separate namespaces (#2297)
* [Backend][Transform] Move backend-specific transforms into separate namespaces

* cleanup

* fix

* Restore transform pass docstrings
2026-06-02 11:25:10 +08:00