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

Function test_matmul_fp8_dequantize_offload

tests/python/relax/test_codegen_cublas.py:352–373  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

350@pytest.mark.skipif(not env.has_cuda_compute(9), reason="need cuda compute >= 9.0")
351@pytest.mark.skipif(ml_dtypes is None, reason="requires ml_dtypes to be installed")
352def test_matmul_fp8_dequantize_offload():
353 x_shape = (10, 32)
354 y_shape = (64, 32)
355 in_dtype = "float8_e4m3fn"
356 mod = get_relax_matmul_dequantize_module(
357 x_shape,
358 y_shape,
359 in_dtype,
360 "float16",
361 transposed_y=True,
362 scale_const=0.34786,
363 zero_point_const=0.0,
364 )
365
366 numpytype = "float8_e4m3fn"
367 x = np.random.uniform(low=0, high=5, size=x_shape).astype(numpytype)
368 y = np.random.uniform(low=0, high=5, size=y_shape).astype(numpytype)
369 args = (x, y)
370
371 out = get_result_with_relax_cublas_offload(mod, args, bind_constants=True)
372 ref = build_and_run(mod, args, "llvm", legalize=True)
373 tvm.testing.assert_allclose(out, ref, rtol=1e-3, atol=1e-3)
374
375
376@pytest.mark.gpu

Callers

nothing calls this directly

Calls 5

uniformMethod · 0.80
build_and_runFunction · 0.70
astypeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…