|
74 | 74 | benchmark_model, |
75 | 75 | check_cpu_version, |
76 | 76 | check_xpu_version, |
| 77 | + get_current_accelerator_device, |
77 | 78 | is_fbcode, |
78 | 79 | is_sm_at_least_89, |
79 | 80 | is_sm_at_least_90, |
80 | 81 | torch_version_at_least, |
81 | 82 | unwrap_tensor_subclass, |
82 | | - get_current_accelerator_device, |
83 | 83 | ) |
84 | 84 |
|
85 | 85 | try: |
@@ -1053,7 +1053,11 @@ def test_weight_only_quant_force_mixed_mm(self, device, dtype): |
1053 | 1053 | self.skipTest( |
1054 | 1054 | f"weight_only_quant_force_mixed_mm can't be constructed on {device}" |
1055 | 1055 | ) |
1056 | | - if torch.cuda.is_available() and dtype == torch.bfloat16 and torch.cuda.get_device_capability() < (8, 0): |
| 1056 | + if ( |
| 1057 | + torch.cuda.is_available() |
| 1058 | + and dtype == torch.bfloat16 |
| 1059 | + and torch.cuda.get_device_capability() < (8, 0) |
| 1060 | + ): |
1057 | 1061 | self.skipTest("test requires SM capability of at least (8, 0).") |
1058 | 1062 | from torch._inductor import config |
1059 | 1063 |
|
@@ -1085,7 +1089,11 @@ def test_weight_only_quant_use_mixed_mm(self, device, dtype): |
1085 | 1089 | self.skipTest( |
1086 | 1090 | f"weight_only_quant_force_mixed_mm can't be constructed on {device}" |
1087 | 1091 | ) |
1088 | | - if torch.cuda.is_available() and dtype == torch.bfloat16 and torch.cuda.get_device_capability() < (8, 0): |
| 1092 | + if ( |
| 1093 | + torch.cuda.is_available() |
| 1094 | + and dtype == torch.bfloat16 |
| 1095 | + and torch.cuda.get_device_capability() < (8, 0) |
| 1096 | + ): |
1089 | 1097 | self.skipTest("test requires SM capability of at least (8, 0).") |
1090 | 1098 | torch.manual_seed(0) |
1091 | 1099 | from torch._inductor import config |
@@ -1255,7 +1263,11 @@ class SmoothquantIntegrationTest(unittest.TestCase): |
1255 | 1263 | @unittest.skipIf(not torch.accelerator.is_available(), "Need GPU available") |
1256 | 1264 | @unittest.skip("Seg fault?") |
1257 | 1265 | def test_non_dynamically_quantizable_linear(self): |
1258 | | - if torch.cuda.is_available() and torch.cuda.is_available() and torch.cuda.get_device_capability() < (8, 0): |
| 1266 | + if ( |
| 1267 | + torch.cuda.is_available() |
| 1268 | + and torch.cuda.is_available() |
| 1269 | + and torch.cuda.get_device_capability() < (8, 0) |
| 1270 | + ): |
1259 | 1271 | self.skipTest("test requires SM capability of at least (8, 0).") |
1260 | 1272 | model = ( |
1261 | 1273 | torch.nn.Sequential( |
@@ -1695,7 +1707,10 @@ def test_autoquant_int4wo(self, device, dtype): |
1695 | 1707 | self.assertGreater(compute_error(ref, out), 20) |
1696 | 1708 |
|
1697 | 1709 | @parameterized.expand(COMMON_DEVICE_DTYPE) |
1698 | | - @unittest.skipIf(torch.cuda.is_available() and not is_sm_at_least_90(), "Need cuda arch greater than SM90") |
| 1710 | + @unittest.skipIf( |
| 1711 | + torch.cuda.is_available() and not is_sm_at_least_90(), |
| 1712 | + "Need cuda arch greater than SM90", |
| 1713 | + ) |
1699 | 1714 | @unittest.skipIf( |
1700 | 1715 | True, "Skipping for now, do to lowering bug in inductor" |
1701 | 1716 | ) # TODO unblock when fixed |
@@ -1938,9 +1953,9 @@ def run_benchmark_model(self, device): |
1938 | 1953 | num_runs = 1 |
1939 | 1954 | return benchmark_model(m_bf16, num_runs, example_inputs) |
1940 | 1955 |
|
1941 | | - @unittest.skipIf(not torch.accelerator.is_available(), "Need GPU available") |
| 1956 | + @unittest.skipIf(not torch.cuda.is_available(), "Need CUDA available") |
1942 | 1957 | def test_benchmark_model_cuda(self): |
1943 | | - assert self.run_benchmark_model(_DEVICE) is not None |
| 1958 | + assert self.run_benchmark_model("cuda") is not None |
1944 | 1959 |
|
1945 | 1960 | def test_benchmark_model_cpu(self): |
1946 | 1961 | assert self.run_benchmark_model("cpu") is not None |
|
0 commit comments