MCPcopy Create free account
hub / github.com/tile-ai/tilelang / tensor_null_test

Function tensor_null_test

testing/python/jit/test_tilelang_jit_nullptr.py:9–37  ·  view source on GitHub ↗
(M, N, K, block_M, block_N, block_K, dtype=T.float16, accum_dtype=T.float32, with_bias=False)

Source from the content-addressed store, hash-verified

7
8@tl.jit
9def tensor_null_test(M, N, K, block_M, block_N, block_K, dtype=T.float16, accum_dtype=T.float32, with_bias=False):
10 @T.prim_func
11 def main(
12 A: T.Tensor((M, K), dtype),
13 B: T.Tensor((K, N), dtype),
14 C: T.Tensor((M, N), accum_dtype),
15 Bias: T.Tensor((N), accum_dtype),
16 ):
17 # Initialize Kernel Context
18 with T.Kernel(T.ceildiv(N, block_N), T.ceildiv(M, block_M), threads=128) as (bx, by):
19 A_shared = T.alloc_shared((block_M, block_K), dtype)
20 B_shared = T.alloc_shared((block_N, block_K), dtype)
21 C_local = T.alloc_fragment((block_M, block_N), accum_dtype)
22
23 T.clear(C_local)
24
25 for ko in T.Pipelined(T.ceildiv(K, block_K), num_stages=3):
26 # Copy tile of A
27 T.copy(A[by * block_M, ko * block_K], A_shared)
28 T.copy(B[bx * block_N, ko * block_K], B_shared)
29 T.gemm(A_shared, B_shared, C_local, transpose_B=True)
30
31 if with_bias:
32 for i, j in T.Parallel(block_M, block_N):
33 C_local[i, j] += Bias[bx * block_N + j]
34
35 T.copy(C_local, C[by * block_M, bx * block_N])
36
37 return main
38
39
40def run_test(M, N, K, block_M, block_N, block_K, dtype=T.float16, accum_dtype=T.float32):

Callers 1

run_testFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…