Commit Graph
3 Commits
Author SHA1 Message Date
LeiWang1999 00a1cee0a0 [Ascend] Rebase onto upstream main (through #3186) and adopt dialect-owned T.Kernel
Merge upstream main (85fd8fc2) into the Ascend comparison snapshot. This brings
in #3177, #3181, #3182, #3185 (AutoSchedule -> AutoWarpSpecialization) and
#3186 (target-neutral T.Kernel with dialect-owned launch annotations).

Conflict resolution:

- AutoSchedule -> AutoWarpSpecialization (#3185) supersedes the snapshot's own
  disambiguation rename to `tl.cuda_auto_schedule`; upstream's name is already
  distinct from Ascend's boolean `tl.enable_auto_schedule`, so the CUDA rename is
  taken wholesale and `TL_ENABLE_AUTO_SCHEDULE` (Ascend-only) is kept.
  `testing/python/backend/test_tilelang_backend_auto_schedule.py` follows.
- `tilelang/language/kernel.py` is now upstream's target-neutral implementation,
  unchanged. The Ascend additions it used to carry (`check_ascend_availability`,
  `_current_target_is_ascend`, the `is_cpu`/`is_ascend` branches in `Kernel`, the
  annotation-sniffing grid/thread split in `KernelLaunchFrame.__enter__`, and the
  SimtVF hooks in the thread accessors) are relocated, not adapted: see below.
- `tilelang/language/__init__.py` keeps the fork's Ascend facade and gains
  upstream's typed `Kernel` re-export.

Ascend now owns its launch surface, so the shared launch path carries no backend
branches and no runtime hardware probe:

- `tilelang/ascend/language/kernel.py` defines the dialect's `Kernel(*blocks,
  prelude=)`: the NPU 1-D core grid, with no `threads=`/`cluster_dims=` to be
  rejected at runtime because Python rejects the keywords. It also owns the
  SimtVF thread-scope state and the `get_thread_binding(s)`/`get_thread_extent(s)`
  accessors that resolve against an active `T.SimtVF` scope.
- `MaterializeKernelLaunch` splits "how a launch dimension is lowered" from
  "whether SIMT threads exist", which the old single `lower_thread_binding` flag
  conflated: Ascend needs the grid materialized as a real block-level
  thread_extent while having no threadIdx at kernel scope. `lower_grid_binding`
  defaults to None and follows `lower_thread_binding`, so every existing caller
  and test keeps its meaning. `launch_dim_tags` lets a backend name extra launch
  dimensions; Ascend passes `cthread` for `T.MixedKernel`'s sub-block-id.
- `MixedKernelLaunch` populates the frame's new grid_vars/thread_vars fields and
  emits the thread placeholders like `KernelLaunch` does, so a body referencing a
  thread index gets the actionable diagnostic instead of an out-of-range lookup.
- `tilelang.is_cpu_kernel_frame` / `tilelang.is_npu_kernel_frame` are dropped from
  `src/transform/common/attr.h`: the explicit grid_vars/thread_vars fields replaced
  every reader the snapshot had added for them.

Combining them also removes the cross-backend landmine where, on any host with
torch_npu available, the shared `T.Kernel(N, threads=...)` raised even for CUDA
targets.
2026-09-10 17:45:32 +08:00
LeiWang1999 0e4ad53c6f [Ascend] Refresh comparison snapshot at upstream #3174
Comparison-only snapshot of Ascend at 925bfbb9aff0fb57a4ed9fecc3591b8dcac21c8f.
Use upstream #3174 (62bba8d20d) as the logical synchronization point.

Preserve the complete tree of the previous comparison head d0d2f40be354cc0a4d6ed037b34278c8746fa031,
including submodule references. No source changes or additional integration
resolutions are introduced. This snapshot is for upstream comparison only.
2026-09-08 15:26:25 +08:00
Chaofan Lin fef9f76092 [Backend] Add unified backend resolution policy (#2318)
* Refactor backend module registration

* Define backends with explicit specs

* Require explicit backend for codegen

* Rename backend spec to backend module

* Keep host codegen on selected backend

* Introduce backend context for compilation

* Remove legacy backend compatibility APIs

* Restore backend API docstrings
2026-08-06 02:41:57 +08:00