oraluben commented on issue #281: URL: https://github.com/apache/tvm-ffi/issues/281#issuecomment-3574094827
> I suppose this repo is tested with TVM’s metal backend, and unittests inside tvm main repo should already work out of the box. Could you test and share a case that doesn’t work as expected? Sure. If you checkout code from https://github.com/tile-ai/tilelang/pull/1289 and run the code below, you'll see the tensor not updated. To see expected behavior, change `execution_backend='tvm_ffi'` to `execution_backend='torch'`. ``` import tilelang from tilelang import tvm as tvm import tilelang.language as T import torch @tilelang.jit(execution_backend='tvm_ffi') def add(M, block_M, dtype="float32"): @T.prim_func def add_kernel( A: T.Tensor((M, ), dtype), ): with T.Kernel(T.ceildiv(M, block_M), threads=128) as bx: for i in T.Parallel(block_M): A[bx * block_M + i] = 1 return add_kernel def assert_gemm( M, block_M, dtype="int", atol=1e-8, ): jit_kernel = add(M, block_M, dtype=dtype) torch_dtype = getattr(torch, dtype) a = torch.randint(100, (M, ), dtype=torch_dtype, device='mps') jit_kernel(a) print(a) assert jit_kernel.kernel_source is not None print(jit_kernel.kernel_source) if __name__ == "__main__": assert_gemm(1024, 16) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
