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

Function test_rocm_copy

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

Source from the content-addressed store, hash-verified

62@pytest.mark.gpu
63@pytest.mark.skipif(not env.has_rocm(), reason="need rocm")
64def test_rocm_copy():
65 def check_rocm(dtype, n):
66 dev = tvm.rocm(0)
67 a_np = np.random.uniform(size=(n,)).astype(dtype)
68 a = tvm.runtime.empty((n,), dtype, dev).copyfrom(a_np)
69 b_np = a.numpy()
70 tvm.testing.assert_allclose(a_np, b_np)
71 tvm.testing.assert_allclose(a_np, a.numpy())
72
73 for _ in range(100):
74 dtype = np.random.choice(["float32", "float16", "int8", "int32"])
75 logN = np.random.randint(1, 15)
76 peturb = np.random.uniform(low=0.5, high=1.5)
77 check_rocm(dtype, int(peturb * (2**logN)))
78
79
80@pytest.mark.gpu

Callers

nothing calls this directly

Calls 2

check_rocmFunction · 0.85
uniformMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…