mirror of
https://github.com/tile-ai/tilelang.git
synced 2026-10-24 07:04:00 +08:00
* reimplement ThreadSync pass * fix bugs * remove old storage_access * remove deadcode for debugging * format * add WhileOp & expose MakeGuard in constr_visitor * bugfix * bugfix * bugfix * bugfix * trigger ci * add try for checking * bugfix * update tvm with better analyzer * update tvm * Log for debugging in thread_storage_sync * format * consider let node * typo * remove debugging log * consider while op in thread_sync & fix bug sbout letnode * add testing for thread_sync issues * update testing for thread_sync * format * consider T.Ramp expr * remove useless header * format --------- Co-authored-by: LeiWang1999 <leiwang1999@outlook.com>
37 lines
803 B
Python
37 lines
803 B
Python
import tilelang
|
|
import tilelang.testing
|
|
import tilelang.language as T
|
|
import re
|
|
|
|
|
|
@tilelang.jit
|
|
def qwq():
|
|
dtype = "float32"
|
|
|
|
@T.prim_func
|
|
def main(out: T.Tensor[(512,), dtype]):
|
|
with T.Kernel(1, threads=512):
|
|
A = T.alloc_shared((32,), dtype)
|
|
B = T.alloc_shared((32,), dtype)
|
|
|
|
tid = T.get_thread_binding()
|
|
if tid < 32:
|
|
A[tid] = tid
|
|
B[tid] = tid
|
|
|
|
out[tid] = A[tid % 32]
|
|
|
|
return main
|
|
|
|
|
|
def test_issue_1604():
|
|
kernel = qwq()
|
|
print(kernel.get_kernel_source())
|
|
target = "__syncthreads"
|
|
pattern = r"if [^{]*{[^}]*\b" + re.escape(target) + r"\b[^}]*}"
|
|
assert len(re.findall(pattern, kernel.get_kernel_source())) == 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
tilelang.testing.main()
|