Files
tilelang/testing/python/language
19236b44c0 [Feature] Add TIR builtins for warp-level vote and block-level predicate sync (#1858)
* [Feature] Add TIR builtins for warp-level vote and block-level predicate sync

* [Refactor] Lower warp-level intrinsics through tl.* ops

Convert the warp-vote, warp-shuffle, predicated block-sync, and warp-match
builtins from raw `tir.call_extern` wrappers to proper TIR ops registered
under `tl.*` and lowered in `codegen_cuda` / `codegen_hip`. This removes
Python-side `_IS_HIP_AVAILABLE` branching and pushes the CUDA/HIP split
into codegen, where it belongs.

* Register new tl ops: any_sync, all_sync, ballot_sync, ballot,
  activemask, syncthreads_count/and/or, shfl_sync, shfl_xor_sync,
  shfl_down_sync, shfl_up_sync, match_any_sync, match_all_sync.
* Codegen lowering on both CUDA and HIP. uint32->uint64 zero-extension
  for ballot/activemask now happens in codegen. HIP drops the mask
  argument for shfl/vote and emits LOG(FATAL) for match_*_sync.
* `__match_all_sync`'s int* pred output is hidden behind an
  immediately-invoked lambda so the wrapper stays expression-form.
* Python wrappers normalize Python int masks to uint32 TIR consts via
  `_as_uint32_mask`, so the emitted source prints `(uint)0xFFFFFFFF`
  instead of `(int64_t)4294967295`.
* Unify `shfl_xor/down/up` signatures to `(mask, value, delta, width=32)`,
  matching CUDA convention and `shfl_sync`. No in-tree callers existed.
* Add tests for match_any_sync and match_all_sync.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: LeiWang1999 <leiwang1999@outlook.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 23:35:03 +08:00
..