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

Function check_runtime

tests/python/codegen/test_target_codegen_cuda_fastmath.py:267–282  ·  view source on GitHub ↗

Check the runtime for the given dtype and case.

(dtype: str, case: MathCase, executable: Executable)

Source from the content-addressed store, hash-verified

265
266
267def check_runtime(dtype: str, case: MathCase, executable: Executable):
268 """Check the runtime for the given dtype and case."""
269 dev = tvm.cuda(0)
270
271 np_inputs = make_numpy_inputs(dtype, case)
272 expected = case.np_ref(*[arr.astype(dtype) for arr in np_inputs]).astype(dtype)
273
274 tvm_inputs = [tvm.runtime.tensor(arr, device=dev) for arr in np_inputs]
275 output = tvm.runtime.empty((VECTOR_N_INPUTS,), dtype, dev)
276
277 executable(*tvm_inputs, output)
278 dev.sync()
279
280 actual = output.numpy()
281
282 np.testing.assert_allclose(actual, expected, rtol=case.rtol, atol=case.atol)
283
284
285@pytest.mark.parametrize("enable_fast_math", [False, True], ids=["default", "fast_math"])

Calls 6

make_numpy_inputsFunction · 0.85
numpyMethod · 0.80
cudaMethod · 0.45
astypeMethod · 0.45
emptyMethod · 0.45
syncMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…