MCPcopy Create free account
hub / github.com/apache/tvm / run_test

Function run_test

tests/python/codegen/test_target_codegen_cuda.py:676–700  ·  view source on GitHub ↗
(tvm_intrin, np_func, dtype)

Source from the content-addressed store, hash-verified

674 ]
675
676 def run_test(tvm_intrin, np_func, dtype):
677 if dtype == "float16" and not have_fp16(tvm.cuda(0).compute_version):
678 print("Skip because gpu does not have fp16 support")
679 return
680 # set of intrinsics does not support fp16 yet.
681 skip_set = {
682 tvm.tirx.abs,
683 tvm.tirx.round,
684 tvm.tirx.tan,
685 tvm.tirx.atan,
686 tvm.tirx.tanh,
687 tvm.tirx.cosh,
688 tvm.tirx.sinh,
689 }
690 if dtype == "float16" and tvm_intrin in skip_set:
691 print(f"Skip because '{tvm_intrin.__name__}' does not support fp16 yet")
692 return
693
694 n = 128
695 f = sched(tvm_intrin, dtype, n)
696 dev = tvm.cuda(0)
697 a = tvm.runtime.tensor(np.random.uniform(0, 1, size=n).astype(dtype), dev)
698 b = tvm.runtime.tensor(np.zeros(shape=(n,)).astype(dtype), dev)
699 f(a, b)
700 tvm.testing.assert_allclose(b.numpy(), np_func(a.numpy()), atol=1e-3, rtol=1e-3)
701
702 for func in test_funcs:
703 run_test(*func, "float32")

Callers 3

test_vectorized_intrin1Function · 0.70
test_vectorized_intrin2Function · 0.70
test_vectorized_popcountFunction · 0.70

Calls 11

have_fp16Function · 0.90
printFunction · 0.85
schedFunction · 0.85
np_funcFunction · 0.85
uniformMethod · 0.80
numpyMethod · 0.80
vectorizeMethod · 0.80
fFunction · 0.50
cudaMethod · 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…