|
32 | 32 | ) |
33 | 33 |
|
34 | 34 |
|
35 | | -@pytest.mark.parametrize("mkn", [64, 256, 1024, 4096]) |
| 35 | +@pytest.mark.parametrize("mkn", [64, 256, 1024]) |
36 | 36 | @pytest.mark.parametrize( |
37 | 37 | "dtype_to_test", |
38 | 38 | [ |
|
43 | 43 | torch.float8_e5m2, |
44 | 44 | ], |
45 | 45 | ) |
| 46 | +@pytest.mark.skipif( |
| 47 | + not torch.cuda.is_available(), |
| 48 | + reason="test_triton_matmul_fp can only when GPU is available", |
| 49 | +) |
46 | 50 | def test_triton_matmul_fp(mkn, dtype_to_test): |
47 | 51 | """Parametric tests for triton matmul kernel using variety of tensor sizes and dtypes.""" |
48 | | - if not torch.cuda.is_available(): |
49 | | - # only run the test when GPU is available |
50 | | - return |
51 | 52 |
|
52 | 53 | torch.manual_seed(23) |
53 | 54 | m = n = k = mkn |
@@ -81,12 +82,13 @@ def test_triton_matmul_fp(mkn, dtype_to_test): |
81 | 82 | assert torch.norm(diff_trun_8b) / torch.norm(torch_output) < 1e-3 |
82 | 83 |
|
83 | 84 |
|
84 | | -@pytest.mark.parametrize("mkn", [64, 256, 1024, 4096]) |
| 85 | +@pytest.mark.parametrize("mkn", [64, 256, 1024]) |
| 86 | +@pytest.mark.skipif( |
| 87 | + not torch.cuda.is_available(), |
| 88 | + reason="test_triton_matmul_int8 can only when GPU is available", |
| 89 | +) |
85 | 90 | def test_triton_matmul_int8(mkn): |
86 | 91 | """Parametric tests for triton imatmul kernel using variety of tensor sizes.""" |
87 | | - if not torch.cuda.is_available(): |
88 | | - # only run the test when GPU is available |
89 | | - return |
90 | 92 |
|
91 | 93 | torch.manual_seed(23) |
92 | 94 | m = n = k = mkn |
@@ -123,13 +125,14 @@ def test_triton_matmul_int8(mkn): |
123 | 125 |
|
124 | 126 | @pytest.mark.parametrize("feat_in_out", [(64, 128), (256, 1024), (1024, 4096)]) |
125 | 127 | @pytest.mark.parametrize("trun_bits", [0, 8, 12, 16]) |
| 128 | +@pytest.mark.skipif( |
| 129 | + not torch.cuda.is_available(), |
| 130 | + reason="test_linear_fpx_acc can only when GPU is available", |
| 131 | +) |
126 | 132 | def test_linear_fpx_acc(feat_in_out, trun_bits): |
127 | 133 | """Parametric tests for LinearFPxAcc. This Linear utilizes triton kernel hence can only be run |
128 | 134 | on CUDA. |
129 | 135 | """ |
130 | | - if not torch.cuda.is_available(): |
131 | | - # only run the test when GPU is available |
132 | | - return |
133 | 136 |
|
134 | 137 | torch.manual_seed(23) |
135 | 138 | feat_in, feat_out = feat_in_out |
|
0 commit comments