(
x_shape,
y_shape,
transpose_y,
epilogue,
residual_block,
dtype,
)
| 385 | ], |
| 386 | ) |
| 387 | def test_matmul_offload( |
| 388 | x_shape, |
| 389 | y_shape, |
| 390 | transpose_y, |
| 391 | epilogue, |
| 392 | residual_block, |
| 393 | dtype, |
| 394 | ): |
| 395 | with_bias, activation = _epilogue_table[epilogue] |
| 396 | var_table = {} |
| 397 | concrete_x_shape = _to_concrete_shape(x_shape, var_table) |
| 398 | concrete_y_shape = _to_concrete_shape(y_shape, var_table) |
| 399 | x = np.random.randn(*concrete_x_shape).astype(dtype) |
| 400 | y = np.random.randn(*concrete_y_shape).astype(dtype) |
| 401 | |
| 402 | if transpose_y: |
| 403 | y = np.swapaxes(y, -2, -1) |
| 404 | y_shape = (*y_shape[:-2], y_shape[-1], y_shape[-2]) |
| 405 | |
| 406 | if with_bias: |
| 407 | bias = np.random.randn(concrete_y_shape[-1]).astype(dtype) |
| 408 | args = (x, y, bias) |
| 409 | else: |
| 410 | bias = None |
| 411 | args = (x, y) |
| 412 | |
| 413 | residual_bin_op, residual_activation = _residual_block_table[residual_block] |
| 414 | |
| 415 | mod = get_relax_matmul_module( |
| 416 | x_shape, |
| 417 | y_shape, |
| 418 | dtype, |
| 419 | bias_shape=bias.shape if with_bias else None, |
| 420 | transposed_y=transpose_y, |
| 421 | activation=activation, |
| 422 | residual_bin_op=residual_bin_op, |
| 423 | residual_activation=residual_activation, |
| 424 | ) |
| 425 | out = get_result_with_relax_cutlass_offload(mod, *args) |
| 426 | ref = build_and_run(mod, args, "llvm") |
| 427 | |
| 428 | tvm.testing.assert_allclose(out, ref, rtol=1e-2, atol=1e-2) |
| 429 | |
| 430 | |
| 431 | def test_matmul_with_3d_bias_offload(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…