Commit Graph
3 Commits
Author SHA1 Message Date
a2b992e72f [Tool] Add official compile-only CLI (#3045)
* feat(tools): add official no-GPU compile-only entry (#2913)

TileLang has no first-class compile-only path for CPU-only CI.
This adds the official entry so later CE work can emit inspectable
kernel source without a GPU.

Signed-off-by: Oliver Zhang <zhiyuanzhang0904@163.com>

* feat(tools): strengthen optional compile-only CUDA target (#2913)

`--target cuda` should emit real CUDA C when the wheel has codegen FFI,
and soft-fail clearly on Metal-style wheels instead of an AttributeError.

Signed-off-by: Oliver Zhang <zhiyuanzhang0904@163.com>

* fix(tools): honor module order and CUDA target options (#2913)

discover_prim_func skipped an earlier PrimFunc when a later @jit existed,
and option-bearing CUDA strings skipped the FFI soft-fail.

Signed-off-by: Oliver Zhang <zhiyuanzhang0904@163.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(tools): drop stale --output_file when compile-only fails (#2913)

CE reuses the same output path; a failed run must not leave yesterday's
assembly. Unlink before compile, matching the CuTe wrapper.

Signed-off-by: Oliver Zhang <zhiyuanzhang0904@163.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(tools): reject JSON auto and pin bare CUDA JSON (#2913)

CodeRabbit: '{"kind":"auto"}' bypassed the auto ban, and
'{"kind":"cuda"}' skipped the sm_80 pin. Apply the same rules as
string targets.

Signed-off-by: Oliver Zhang <zhiyuanzhang0904@163.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(tools): refuse --output_file when it is the input (#2913)

Unlink-before-compile deleted example.py if someone passed the same
path twice. Compare resolved/samefile paths first.

Signed-off-by: Oliver Zhang <zhiyuanzhang0904@163.com>

* fix(tools): emit #line from compile-only when the pass exists (#2913)

Pass TL_EMIT_LINE_DIRECTIVES so CE can map generated C back to the
example. Older wheels do not register the key; skip it there.

Signed-off-by: Oliver Zhang <zhiyuanzhang0904@163.com>

* test(tools): require #line to name the input file and store line (#2913)

CodeRabbit: a bare "#line" token can pass on an unrelated directive.
Parse `#line N "file"` and match the example path plus the marked store.

Signed-off-by: Oliver Zhang <zhiyuanzhang0904@163.com>

* test(tools): give in-process #line lookup its own marker (#2913)

_marker_line scans the test file, so a shared line_marker_store hit the
example string (line 37) instead of _add (line 50). ROCm CI asserted that.

Signed-off-by: Oliver Zhang <zhiyuanzhang0904@163.com>

* docs(tools): document the compile-only CLI (#2913)

Co-authored-by: Oliver Zhang <LibertychaserUS@users.noreply.github.com>

* docs(tools): document remaining compile-only helpers (#2913)

Co-authored-by: Oliver Zhang <LibertychaserUS@users.noreply.github.com>

---------

Signed-off-by: Oliver Zhang <zhiyuanzhang0904@163.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Oliver Zhang <LibertychaserUS@users.noreply.github.com>
2026-08-25 14:11:20 +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
Tong WUandLeiWang1999 228c7c0486 [Feature] Support iket profiler for CUDA backend (#2515)
* Add experimental IKET CUDA backend hooks

* Keep IKET APIs under namespace

* Use real Perfetto screenshot for IKET example

* Show IKET events in Perfetto timeline screenshot

* Add IKET validation overhead example

* Remove IKET validation overhead example

* Fix IKET lint issues

* Move IKET integration to CUDA tools

* Add tools documentation and fix workflow regressions

---------

Co-authored-by: LeiWang1999 <leiwang1999@outlook.com>
2026-07-12 20:03:30 +08:00