mirror of
https://github.com/tile-ai/tilelang.git
synced 2026-10-22 06:50:25 +08:00
* Refactor kernel launch materialization * [Refactor] Improve git commit ID retrieval and version labeling logic * Enhance the get_git_commit_id function to check for the existence of the .git directory before attempting to retrieve the commit hash, ensuring more robust behavior. * Update the dynamic_metadata function to conditionally set the NO_VERSION_LABEL environment variable based on the presence of the .git directory. * Modify the GitHub Actions workflow to unset the NO_VERSION_LABEL environment variable during the installation and version check of the package, allowing for accurate version labeling in SDist builds. * [Refactor] Update WebGPU backend registration * Import the WebGPU package to automatically register its pass pipeline. * Remove the explicit registration of the WebGPU pass pipeline, streamlining the backend setup process.
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
import tilelang
|
|
import tilelang.language as T
|
|
|
|
|
|
def test_cpu_kernel_source_generation_with_while() -> None:
|
|
"""Regression test: CPU `T.While` kernels should compile without errors.
|
|
|
|
See: https://github.com/tile-ai/tilelang/issues/2202
|
|
|
|
Historically, a CPU kernel containing `T.While(...)` inside
|
|
`T.Kernel(...)` could leak the synthetic fallback thread
|
|
variable `v_thread` into host/device splitting. That in turn caused CPU
|
|
compilation to fail during packed-API generation or later C wrapper
|
|
generation.
|
|
|
|
This test follows the existing compile-only regression style used in the
|
|
repository: success is defined by `tilelang.compile(..., target="c")`
|
|
completing without raising an exception.
|
|
"""
|
|
|
|
@T.prim_func
|
|
def main(flag: T.Buffer((1,), "int32"), out: T.Buffer((1,), "int32")):
|
|
with T.Kernel(1):
|
|
state = T.alloc_fragment((1,), "int32")
|
|
state[0] = 0
|
|
|
|
with T.While(state[0] == 0):
|
|
state[0] = flag[0]
|
|
|
|
out[0] = state[0]
|
|
|
|
compiled = tilelang.compile(main, target="c")
|
|
assert compiled is not None
|