MCPcopy Index your code
hub / github.com/apache/tvm / test_rocm_vectorized_exp

Function test_rocm_vectorized_exp

tests/python/codegen/test_target_codegen_rocm.py:141–161  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

139@pytest.mark.gpu
140@pytest.mark.skipif(not env.has_rocm(), reason="need rocm")
141def test_rocm_vectorized_exp():
142 @T.prim_func(s_tir=True)
143 def func(
144 A_handle: T.handle,
145 B_handle: T.handle,
146 ):
147 A = T.match_buffer(A_handle, (4,), dtype="float32")
148 B = T.match_buffer(B_handle, (4,), dtype="float32")
149
150 for bx in T.thread_binding(1, thread="blockIdx.x"):
151 for tx in T.thread_binding(1, thread="threadIdx.x"):
152 with T.sblock("test"):
153 for i in T.vectorized(0, 4):
154 B[i] = T.exp2(A[i])
155
156 mod = tvm.compile(func, target="rocm")
157 dev = tvm.rocm(0)
158 a = tvm.runtime.tensor(np.ones((4,)).astype("float32"), dev)
159 b = tvm.runtime.tensor(np.zeros((4,)).astype("float32"), dev)
160 mod(a, b)
161 tvm.testing.assert_allclose(b.numpy(), np.exp2(a.numpy()))
162
163
164@pytest.mark.gpu

Callers

nothing calls this directly

Calls 7

rocmMethod · 0.80
onesMethod · 0.80
numpyMethod · 0.80
modClass · 0.50
compileMethod · 0.45
astypeMethod · 0.45
zerosMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…