已合并
del 910_95 #30638
MrMC-创建于 2月9日
del 910_95 #30638
已合并
从已删除 :2.8.0-del-91095合入到Ascend/pytorchv2.8.0
共 10 个文件变更+86-28
| @@ -72,7 +72,7 @@ class TestLinearWeightQuant(TestCase): | |||
| 72 | npu_out = npu_out.cpu() | 72 | npu_out = npu_out.cpu() |
| 73 | self.assertRtolEqual(cpu_out, npu_out.numpy(), 0.01) | 73 | self.assertRtolEqual(cpu_out, npu_out.numpy(), 0.01) |
| 74 | 74 | ||
| 75 | - @SupportedDevices(['Ascend910_95', 'Ascend950']) | 75 | + @SupportedDevices(['Ascend950']) |
| 76 | def test_npu_linear_weight_quant_weight_dtype_hif8(self): | 76 | def test_npu_linear_weight_quant_weight_dtype_hif8(self): |
| 77 | m = 2 | 77 | m = 2 |
| 78 | k = 64 | 78 | k = 64 |
| @@ -385,7 +385,7 @@ class TestViewOps(TestCase): | |||
| 385 | 385 | ||
| 386 | 386 | ||
| 387 | class TestTensorDtype(TestCase): | 387 | class TestTensorDtype(TestCase): |
| 388 | - @SupportedDevices(['Ascend910_95', 'Ascend950']) | 388 | + @SupportedDevices(['Ascend950']) |
| 389 | def test_fp8(self): | 389 | def test_fp8(self): |
| 390 | tensor1 = torch.randn([2, 2], dtype=torch.float32).npu() | 390 | tensor1 = torch.randn([2, 2], dtype=torch.float32).npu() |
| 391 | tensor2 = torch.randn([2, 2], dtype=torch.float32).npu() | 391 | tensor2 = torch.randn([2, 2], dtype=torch.float32).npu() |
| @@ -394,7 +394,7 @@ class TestTensorDtype(TestCase): | |||
| 394 | self.assertEqual(tensor_f8e5m2.dtype, torch.float8_e5m2) | 394 | self.assertEqual(tensor_f8e5m2.dtype, torch.float8_e5m2) |
| 395 | self.assertEqual(tensor_f8e4m3fn.dtype, torch.float8_e4m3fn) | 395 | self.assertEqual(tensor_f8e4m3fn.dtype, torch.float8_e4m3fn) |
| 396 | 396 | ||
| 397 | - @SupportedDevices(['Ascend910_95', 'Ascend950']) | 397 | + @SupportedDevices(['Ascend950']) |
| 398 | def test_hif8(self): | 398 | def test_hif8(self): |
| 399 | tensor = torch.randn([2, 2], dtype=torch.float16).npu() | 399 | tensor = torch.randn([2, 2], dtype=torch.float16).npu() |
| 400 | hif8_tensor = torch_npu.HiFloat8Tensor.to_hifloat8(tensor) | 400 | hif8_tensor = torch_npu.HiFloat8Tensor.to_hifloat8(tensor) |
| @@ -188,7 +188,7 @@ class TestOnnxOps(TestCase): | |||
| 188 | class Model(torch.nn.Module): | 188 | class Model(torch.nn.Module): |
| 189 | def __init__(self): | 189 | def __init__(self): |
| 190 | super(Model, self).__init__() | 190 | super(Model, self).__init__() |
| 191 | - | 191 | + |
| 192 | def forward(self, x): | 192 | def forward(self, x): |
| 193 | return torch_npu.npu_geglu(x) | 193 | return torch_npu.npu_geglu(x) |
| 194 | 194 | ||
| @@ -197,12 +197,13 @@ class TestOnnxOps(TestCase): | |||
| 197 | model = Model().to("npu") | 197 | model = Model().to("npu") |
| 198 | model(x) | 198 | model(x) |
| 199 | self.onnx_export(model, x, onnx_model_name, ["input"], ["output1", "output2"]) | 199 | self.onnx_export(model, x, onnx_model_name, ["input"], ["output1", "output2"]) |
| 200 | - | 200 | + |
| 201 | onnx_model_name = "model_npu_geglu.onnx" | 201 | onnx_model_name = "model_npu_geglu.onnx" |
| 202 | export_onnx(onnx_model_name) | 202 | export_onnx(onnx_model_name) |
| 203 | assert(os.path.isfile(os.path.join(TestOnnxOps.test_onnx_path, | 203 | assert(os.path.isfile(os.path.join(TestOnnxOps.test_onnx_path, |
| 204 | onnx_model_name))) | 204 | onnx_model_name))) |
| 205 | 205 | ||
| 206 | + | ||
| 206 | def test_wrapper_npu_multi_head_attention(self): | 207 | def test_wrapper_npu_multi_head_attention(self): |
| 207 | class Model(torch.nn.Module): | 208 | class Model(torch.nn.Module): |
| 208 | def __init__(self): | 209 | def __init__(self): |
| @@ -386,6 +387,7 @@ class TestOnnxOps(TestCase): | |||
| 386 | assert (os.path.isfile(os.path.join(TestOnnxOps.test_onnx_path, | 387 | assert (os.path.isfile(os.path.join(TestOnnxOps.test_onnx_path, |
| 387 | onnx_model_name))) | 388 | onnx_model_name))) |
| 388 | 389 | ||
| 390 | + | ||
| 389 | def test_wrapper_npu_format_cast(self): | 391 | def test_wrapper_npu_format_cast(self): |
| 390 | class Model(torch.nn.Module): | 392 | class Model(torch.nn.Module): |
| 391 | def __init__(self): | 393 | def __init__(self): |
| @@ -904,7 +906,7 @@ class TestOnnxOps(TestCase): | |||
| 904 | export_onnx(onnx_model_name) | 906 | export_onnx(onnx_model_name) |
| 905 | assert (os.path.isfile(os.path.join(TestOnnxOps.test_onnx_path, | 907 | assert (os.path.isfile(os.path.join(TestOnnxOps.test_onnx_path, |
| 906 | onnx_model_name))) | 908 | onnx_model_name))) |
| 907 | - | 909 | + @unittest.skip |
| 908 | def test_wrapper_npu_lstm_cell(self): | 910 | def test_wrapper_npu_lstm_cell(self): |
| 909 | class Model(torch.nn.Module): | 911 | class Model(torch.nn.Module): |
| 910 | def __init__(self): | 912 | def __init__(self): |
| @@ -956,6 +958,7 @@ class TestOnnxOps(TestCase): | |||
| 956 | assert (os.path.isfile(os.path.join(TestOnnxOps.test_onnx_path, | 958 | assert (os.path.isfile(os.path.join(TestOnnxOps.test_onnx_path, |
| 957 | onnx_model_name))) | 959 | onnx_model_name))) |
| 958 | 960 | ||
| 961 | + | ||
| 959 | def test_wrapper_npu_lstm(self): | 962 | def test_wrapper_npu_lstm(self): |
| 960 | class Model(torch.nn.Module): | 963 | class Model(torch.nn.Module): |
| 961 | def __init__(self): | 964 | def __init__(self): |
| @@ -1012,6 +1015,7 @@ class TestOnnxOps(TestCase): | |||
| 1012 | assert (os.path.isfile(os.path.join(TestOnnxOps.test_onnx_path, | 1015 | assert (os.path.isfile(os.path.join(TestOnnxOps.test_onnx_path, |
| 1013 | onnx_model_name))) | 1016 | onnx_model_name))) |
| 1014 | 1017 | ||
| 1018 | + | ||
| 1015 | def test_wrapper_npu_gru(self): | 1019 | def test_wrapper_npu_gru(self): |
| 1016 | class Model(torch.nn.Module): | 1020 | class Model(torch.nn.Module): |
| 1017 | def __init__(self): | 1021 | def __init__(self): |
| @@ -1061,7 +1065,7 @@ class TestOnnxOps(TestCase): | |||
| 1061 | export_onnx(onnx_model_name) | 1065 | export_onnx(onnx_model_name) |
| 1062 | assert (os.path.isfile(os.path.join(TestOnnxOps.test_onnx_path, | 1066 | assert (os.path.isfile(os.path.join(TestOnnxOps.test_onnx_path, |
| 1063 | onnx_model_name))) | 1067 | onnx_model_name))) |
| 1064 | - | 1068 | + |
| 1065 | def test_wrapper_npu_dropout_with_add_softmax(self): | 1069 | def test_wrapper_npu_dropout_with_add_softmax(self): |
| 1066 | class Model(torch.nn.Module): | 1070 | class Model(torch.nn.Module): |
| 1067 | def __init__(self): | 1071 | def __init__(self): |
| @@ -1108,7 +1112,7 @@ class TestOnnxOps(TestCase): | |||
| 1108 | export_onnx(onnx_model_name) | 1112 | export_onnx(onnx_model_name) |
| 1109 | assert (os.path.isfile(os.path.join(TestOnnxOps.test_onnx_path, | 1113 | assert (os.path.isfile(os.path.join(TestOnnxOps.test_onnx_path, |
| 1110 | onnx_model_name))) | 1114 | onnx_model_name))) |
| 1111 | - | 1115 | + |
| 1112 | 1116 | ||
| 1113 | def test_wrapper_npu_moe_compute_expert_tokens(self): | 1117 | def test_wrapper_npu_moe_compute_expert_tokens(self): |
| 1114 | class Model(torch.nn.Module): | 1118 | class Model(torch.nn.Module): |
| @@ -1116,8 +1120,8 @@ class TestOnnxOps(TestCase): | |||
| 1116 | super(Model, self).__init__() | 1120 | super(Model, self).__init__() |
| 1117 | 1121 | ||
| 1118 | def forward(self, sorted_experts): | 1122 | def forward(self, sorted_experts): |
| 1119 | - return torch_npu.npu_moe_compute_expert_tokens(sorted_experts=5) | 1123 | + return torch_npu.npu_moe_compute_expert_tokens(sorted_experts=sorted_experts) |
| 1120 | - | 1124 | + |
| 1121 | def export_onnx(onnx_model_name): | 1125 | def export_onnx(onnx_model_name): |
| 1122 | data = list(range(20)) | 1126 | data = list(range(20)) |
| 1123 | experts = torch.tensor(data, dtype=torch.int32).npu() | 1127 | experts = torch.tensor(data, dtype=torch.int32).npu() |
| @@ -1184,7 +1188,7 @@ class TestOnnxOps(TestCase): | |||
| 1184 | epsilon = 1e-6 | 1188 | epsilon = 1e-6 |
| 1185 | x = torch_npu.npu_rms_norm(x, gamma, epsilon) | 1189 | x = torch_npu.npu_rms_norm(x, gamma, epsilon) |
| 1186 | return x | 1190 | return x |
| 1187 | - | 1191 | + |
| 1188 | def export_onnx(onnx_model_name): | 1192 | def export_onnx(onnx_model_name): |
| 1189 | x = torch.rand(10, 1024).uniform_(-3, 3).npu().half() | 1193 | x = torch.rand(10, 1024).uniform_(-3, 3).npu().half() |
| 1190 | gamma = torch.rand(1024).uniform_(-3, 3).npu().half() | 1194 | gamma = torch.rand(1024).uniform_(-3, 3).npu().half() |
| @@ -1206,7 +1210,7 @@ class TestOnnxOps(TestCase): | |||
| 1206 | epsilon = 1e-6 | 1210 | epsilon = 1e-6 |
| 1207 | x = torch_npu.npu_add_rms_norm(x1, x2, gamma, epsilon) | 1211 | x = torch_npu.npu_add_rms_norm(x1, x2, gamma, epsilon) |
| 1208 | return x | 1212 | return x |
| 1209 | - | 1213 | + |
| 1210 | def export_onnx(onnx_model_name): | 1214 | def export_onnx(onnx_model_name): |
| 1211 | x1 = torch.rand(10, 1024).uniform_(-3, 3).npu().half() | 1215 | x1 = torch.rand(10, 1024).uniform_(-3, 3).npu().half() |
| 1212 | x2 = torch.rand(10, 1024).uniform_(-3, 3).npu().half() | 1216 | x2 = torch.rand(10, 1024).uniform_(-3, 3).npu().half() |
| @@ -1272,7 +1276,7 @@ class TestOnnxOps(TestCase): | |||
| 1272 | def forward(self, input_dummy, smooth_scales_dummy): | 1276 | def forward(self, input_dummy, smooth_scales_dummy): |
| 1273 | output, scale = torch_npu.npu_dynamic_quant(input_dummy, smooth_scales=smooth_scales_dummy) | 1277 | output, scale = torch_npu.npu_dynamic_quant(input_dummy, smooth_scales=smooth_scales_dummy) |
| 1274 | return output, scale | 1278 | return output, scale |
| 1275 | - | 1279 | + |
| 1276 | def export_onnx(onnx_model_name): | 1280 | def export_onnx(onnx_model_name): |
| 1277 | input_dummy = torch.rand(4, 1024, 512).uniform_(-3, 3).npu().to(torch.float16) | 1281 | input_dummy = torch.rand(4, 1024, 512).uniform_(-3, 3).npu().to(torch.float16) |
| 1278 | smooth_scales_dummy = torch.rand(512).uniform_(-3, 3).npu().to(torch.float16) | 1282 | smooth_scales_dummy = torch.rand(512).uniform_(-3, 3).npu().to(torch.float16) |
| @@ -1293,7 +1297,7 @@ class TestOnnxOps(TestCase): | |||
| 1293 | def forward(self, input_dummy, smooth_scales_dummy, group_index_dummy): | 1297 | def forward(self, input_dummy, smooth_scales_dummy, group_index_dummy): |
| 1294 | output, scale = torch_npu.npu_dynamic_quant(input_dummy, smooth_scales=smooth_scales_dummy, group_index=group_index_dummy) | 1298 | output, scale = torch_npu.npu_dynamic_quant(input_dummy, smooth_scales=smooth_scales_dummy, group_index=group_index_dummy) |
| 1295 | return output, scale | 1299 | return output, scale |
| 1296 | - | 1300 | + |
| 1297 | def export_onnx(onnx_model_name): | 1301 | def export_onnx(onnx_model_name): |
| 1298 | input_dummy = torch.rand(4, 1024, 512).uniform_(-3, 3).npu().to(torch.float16) | 1302 | input_dummy = torch.rand(4, 1024, 512).uniform_(-3, 3).npu().to(torch.float16) |
| 1299 | group_num = 10 | 1303 | group_num = 10 |
| @@ -1312,7 +1316,7 @@ class TestOnnxOps(TestCase): | |||
| 1312 | onnx_model_name = "model_npu_dynamic_quant.onnx" | 1316 | onnx_model_name = "model_npu_dynamic_quant.onnx" |
| 1313 | export_onnx(onnx_model_name) | 1317 | export_onnx(onnx_model_name) |
| 1314 | assert (os.path.isfile(os.path.join(TestOnnxOps.test_onnx_path, onnx_model_name))) | 1318 | assert (os.path.isfile(os.path.join(TestOnnxOps.test_onnx_path, onnx_model_name))) |
| 1315 | - | 1319 | + |
| 1316 | 1320 | ||
| 1317 | def test_wrapper_npu_dynamic_quant_asymmetric(self): | 1321 | def test_wrapper_npu_dynamic_quant_asymmetric(self): |
| 1318 | class Model(torch.nn.Module): | 1322 | class Model(torch.nn.Module): |
| @@ -1322,7 +1326,7 @@ class TestOnnxOps(TestCase): | |||
| 1322 | def forward(self, input_dummy, smooth_scales_dummy, group_index_dummy): | 1326 | def forward(self, input_dummy, smooth_scales_dummy, group_index_dummy): |
| 1323 | output, scale, offset = torch_npu.npu_dynamic_quant_asymmetric(input_dummy, smooth_scales=smooth_scales_dummy, group_index=group_index_dummy) | 1327 | output, scale, offset = torch_npu.npu_dynamic_quant_asymmetric(input_dummy, smooth_scales=smooth_scales_dummy, group_index=group_index_dummy) |
| 1324 | return output, scale, offset | 1328 | return output, scale, offset |
| 1325 | - | 1329 | + |
| 1326 | def export_onnx(onnx_model_name): | 1330 | def export_onnx(onnx_model_name): |
| 1327 | input_dummy = torch.rand(4, 1024, 512).uniform_(-3, 3).npu().to(torch.float16) | 1331 | input_dummy = torch.rand(4, 1024, 512).uniform_(-3, 3).npu().to(torch.float16) |
| 1328 | group_num = 10 | 1332 | group_num = 10 |
| @@ -1525,4 +1529,4 @@ class TestOnnxOps(TestCase): | |||
| 1525 | onnx_model_name))) | 1529 | onnx_model_name))) |
| 1526 | 1530 | ||
| 1527 | if __name__ == '__main__': | 1531 | if __name__ == '__main__': |
| 1528 | - run_tests() | 1532 | + run_tests() |
| @@ -1,4 +1,59 @@ | |||
| 1 | -{ | 1 | +{ |
| 2 | + "test_resnext101_32x8d (__main__.TestQuantizedModelsONNXRuntime_is_script_False)": ["", [""]], | ||
| 3 | + "test_resnext101_32x8d (__main__.TestQuantizedModelsONNXRuntime_is_script_True)": ["", [""]], | ||
| 4 | + "test_resnet18 (__main__.TestQuantizedModelsONNXRuntime_is_script_True)": ["", [""]], | ||
| 5 | + "test_resnet18 (__main__.TestQuantizedModelsONNXRuntime_is_script_False)": ["", [""]], | ||
| 6 | + "test_resnet50 (__main__.TestQuantizedModelsONNXRuntime_is_script_True)": ["", [""]], | ||
| 7 | + "test_resnet50 (__main__.TestQuantizedModelsONNXRuntime_is_script_False)": ["", [""]], | ||
| 8 | + "test_resnet101 (__main__.TestQuantizedModelsONNXRuntime_is_script_True)": ["", [""]], | ||
| 9 | + "test_resnet101 (__main__.TestQuantizedModelsONNXRuntime_is_script_False)": ["", [""]], | ||
| 10 | + "test_mobilenet_v3 (__main__.TestQuantizedModelsONNXRuntime_is_script_True)": ["", [""]], | ||
| 11 | + "test_mobilenet_v3 (__main__.TestQuantizedModelsONNXRuntime_is_script_False)": ["", [""]], | ||
| 12 | + "test_models_quantized_onnxruntime (__main__.TestQuantizedModelsONNXRuntime)": ["", [""]], | ||
| 13 | + "test_verbose (__main__.TestUtilityFuns_opset_9)": ["", [""]], | ||
| 14 | + "test_verbose (__main__.TestUtilityFuns_opset_10)": ["", [""]], | ||
| 15 | + "test_verbose (__main__.TestUtilityFuns_opset_11)": ["", [""]], | ||
| 16 | + "test_verbose (__main__.TestUtilityFuns_opset_12)": ["", [""]], | ||
| 17 | + "test_verbose (__main__.TestUtilityFuns_opset_13)": ["", [""]], | ||
| 18 | + "test_verbose (__main__.TestUtilityFuns_opset_14)": ["", [""]], | ||
| 19 | + "test_verbose (__main__.TestUtilityFuns_opset_15)": ["", [""]], | ||
| 20 | + "test_verbose (__main__.TestUtilityFuns_opset_16)": ["", [""]], | ||
| 21 | + "test_verbose (__main__.TestUtilityFuns_opset_17)": ["", [""]], | ||
| 22 | + "test_verbose (__main__.TestUtilityFuns_opset_18)": ["", [""]], | ||
| 23 | + "test_verbose (__main__.TestUtilityFuns_opset_19)": ["", [""]], | ||
| 24 | + "test_verbose (__main__.TestUtilityFuns_opset_20)": ["", [""]], | ||
| 25 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_13_is_script_False_keep_initializers_as_inputs_False)": ["", [""]], | ||
| 26 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_13_is_script_False_keep_initializers_as_inputs_True)": ["", [""]], | ||
| 27 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_13_is_script_True_keep_initializers_as_inputs_False)": ["", [""]], | ||
| 28 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_13_is_script_True_keep_initializers_as_inputs_True)": ["", [""]], | ||
| 29 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_14_is_script_False_keep_initializers_as_inputs_False)": ["", [""]], | ||
| 30 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_14_is_script_False_keep_initializers_as_inputs_True)": ["", [""]], | ||
| 31 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_14_is_script_True_keep_initializers_as_inputs_False)": ["", [""]], | ||
| 32 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_14_is_script_True_keep_initializers_as_inputs_True)": ["", [""]], | ||
| 33 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_15_is_script_False_keep_initializers_as_inputs_False)": ["", [""]], | ||
| 34 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_15_is_script_False_keep_initializers_as_inputs_True)": ["", [""]], | ||
| 35 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_15_is_script_True_keep_initializers_as_inputs_False)": ["", [""]], | ||
| 36 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_15_is_script_True_keep_initializers_as_inputs_True)": ["", [""]], | ||
| 37 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_16_is_script_True_keep_initializers_as_inputs_True)": ["", [""]], | ||
| 38 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_16_is_script_False_keep_initializers_as_inputs_False)": ["", [""]], | ||
| 39 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_16_is_script_False_keep_initializers_as_inputs_True)": ["", [""]], | ||
| 40 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_16_is_script_True_keep_initializers_as_inputs_False)": ["", [""]], | ||
| 41 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_17_is_script_False_keep_initializers_as_inputs_False)": ["", [""]], | ||
| 42 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_17_is_script_False_keep_initializers_as_inputs_True)": ["", [""]], | ||
| 43 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_17_is_script_True_keep_initializers_as_inputs_False)": ["", [""]], | ||
| 44 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_17_is_script_True_keep_initializers_as_inputs_True)": ["", [""]], | ||
| 45 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_18_is_script_True_keep_initializers_as_inputs_True)": ["", [""]], | ||
| 46 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_18_is_script_False_keep_initializers_as_inputs_False)": ["", [""]], | ||
| 47 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_18_is_script_False_keep_initializers_as_inputs_True)": ["", [""]], | ||
| 48 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_18_is_script_True_keep_initializers_as_inputs_False)": ["", [""]], | ||
| 49 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_19_is_script_True_keep_initializers_as_inputs_True)": ["", [""]], | ||
| 50 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_19_is_script_False_keep_initializers_as_inputs_False)": ["", [""]], | ||
| 51 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_19_is_script_False_keep_initializers_as_inputs_True)": ["", [""]], | ||
| 52 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_19_is_script_True_keep_initializers_as_inputs_False)": ["", [""]], | ||
| 53 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_20_is_script_True_keep_initializers_as_inputs_True)": ["", [""]], | ||
| 54 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_20_is_script_False_keep_initializers_as_inputs_False)": ["", [""]], | ||
| 55 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_20_is_script_False_keep_initializers_as_inputs_True)": ["", [""]], | ||
| 56 | + "test_arithmetic_bfp16 (__main__.TestONNXRuntime_npu_opset_version_20_is_script_True_keep_initializers_as_inputs_False)": ["", [""]], | ||
| 2 | "test_grad_fn_with_kwargs_dynamic_shapes (__main__.DynamicShapesFuncTorchHigherOrderOpTests)": ["", [""]], | 57 | "test_grad_fn_with_kwargs_dynamic_shapes (__main__.DynamicShapesFuncTorchHigherOrderOpTests)": ["", [""]], |
| 3 | "test_mismatching_device_no_check_npu (__main__.TestAssertCloseMultiDevicePRIVATEUSE1)": ["", [""]], | 58 | "test_mismatching_device_no_check_npu (__main__.TestAssertCloseMultiDevicePRIVATEUSE1)": ["", [""]], |
| 4 | "test_ops_decorator_applies_op_and_param_specific_decorators_npu (__main__.TestTestParametrizationDeviceTypePRIVATEUSE1)": ["", [""]], | 59 | "test_ops_decorator_applies_op_and_param_specific_decorators_npu (__main__.TestTestParametrizationDeviceTypePRIVATEUSE1)": ["", [""]], |
| @@ -49,13 +49,12 @@ void SetSocVersion(const char* const socVersion) | |||
| 49 | 49 | ||
| 50 | SocVersion curSocVersion = SocVersion::UnsupportedSocVersion; | 50 | SocVersion curSocVersion = SocVersion::UnsupportedSocVersion; |
| 51 | std::string inputVersion = socVersion; | 51 | std::string inputVersion = socVersion; |
| 52 | - std::string ascend91095 = "Ascend910_95"; | ||
| 53 | std::string ascend950 = "Ascend950"; | 52 | std::string ascend950 = "Ascend950"; |
| 53 | + | ||
| 54 | auto const& iter = socVersionMap.find(socVersion); | 54 | auto const& iter = socVersionMap.find(socVersion); |
| 55 | if (iter != socVersionMap.end()) { | 55 | if (iter != socVersionMap.end()) { |
| 56 | curSocVersion = iter->second; | 56 | curSocVersion = iter->second; |
| 57 | - } else if ((inputVersion.compare(0, ascend91095.size(), ascend91095) == 0 || | 57 | + } else if (inputVersion.compare(0, ascend950.size(), ascend950) == 0) { |
| 58 | - inputVersion.compare(0, ascend950.size(), ascend950) == 0)) { | ||
| 59 | curSocVersion = SocVersion::Ascend950; | 58 | curSocVersion = SocVersion::Ascend950; |
| 60 | } else { | 59 | } else { |
| 61 | std::string unsupported_soc(socVersion); | 60 | std::string unsupported_soc(socVersion); |
| @@ -108,7 +107,7 @@ bool IsBF16Supported() | |||
| 108 | 107 | ||
| 109 | bool IsAclnnOnly() | 108 | bool IsAclnnOnly() |
| 110 | { | 109 | { |
| 111 | - return GetSocVersion() >= SocVersion::Ascend910_95; | 110 | + return GetSocVersion() >= SocVersion::Ascend950; |
| 112 | } | 111 | } |
| 113 | } // namespace c10_npu | 112 | } // namespace c10_npu |
| 114 | 113 | ||
| @@ -31,8 +31,7 @@ enum class SocVersion { | |||
| 31 | Ascend910_9382, | 31 | Ascend910_9382, |
| 32 | Ascend910_9372, | 32 | Ascend910_9372, |
| 33 | Ascend910_9362, | 33 | Ascend910_9362, |
| 34 | - Ascend910_95 = 260, | 34 | + Ascend950 = 260 |
| 35 | - Ascend950 = Ascend910_95 | ||
| 36 | }; | 35 | }; |
| 37 | 36 | ||
| 38 | void SetSocVersion(const char* const socVersion); | 37 | void SetSocVersion(const char* const socVersion); |
| @@ -1248,7 +1248,7 @@ bool AclrtMallocHostWithCfgExist() | |||
| 1248 | if (func != nullptr) { | 1248 | if (func != nullptr) { |
| 1249 | ASCEND_LOGI("Successfully to find function aclrtMallocHostWithCfg"); | 1249 | ASCEND_LOGI("Successfully to find function aclrtMallocHostWithCfg"); |
| 1250 | return c10_npu::GetSocVersion() >= c10_npu::SocVersion::Ascend910B1 && | 1250 | return c10_npu::GetSocVersion() >= c10_npu::SocVersion::Ascend910B1 && |
| 1251 | - c10_npu::GetSocVersion() < c10_npu::SocVersion::Ascend910_95; | 1251 | + c10_npu::GetSocVersion() < c10_npu::SocVersion::Ascend950; |
| 1252 | } | 1252 | } |
| 1253 | return false; | 1253 | return false; |
| 1254 | }(); | 1254 | }(); |
| @@ -4822,7 +4822,7 @@ c10::intrusive_ptr<c10d::Work> ProcessGroupHCCL::_reduce_oop( | |||
| 4822 | constexpr int64_t ADDRESS_ALIGNMENT_BYTE = 512; | 4822 | constexpr int64_t ADDRESS_ALIGNMENT_BYTE = 512; |
| 4823 | at::Tensor ProcessGroupHCCL::byte_alignment(at::Tensor& tensors) const | 4823 | at::Tensor ProcessGroupHCCL::byte_alignment(at::Tensor& tensors) const |
| 4824 | { | 4824 | { |
| 4825 | - static bool no_need_padding = c10_npu::GetSocVersion() >= c10_npu::SocVersion::Ascend910_95; | 4825 | + static bool no_need_padding = c10_npu::GetSocVersion() >= c10_npu::SocVersion::Ascend950; |
| 4826 | at::Tensor inter_tensors = at::reshape(tensors, {1, tensors.numel()}); | 4826 | at::Tensor inter_tensors = at::reshape(tensors, {1, tensors.numel()}); |
| 4827 | if (tensors.element_size() == 0 || no_need_padding) { | 4827 | if (tensors.element_size() == 0 || no_need_padding) { |
| 4828 | return inter_tensors; | 4828 | return inter_tensors; |
| @@ -1287,8 +1287,7 @@ def _wrapper_npu_moe_finalize_routing(expanded_permuted_rows, skip1, skip2, bias | |||
| 1287 | scales, expanded_src_to_dst_row, export_for_source_row, drop_pad_mode=0): | 1287 | scales, expanded_src_to_dst_row, export_for_source_row, drop_pad_mode=0): |
| 1288 | if skip1 is not None and bias is not None and scales is not None and \ | 1288 | if skip1 is not None and bias is not None and scales is not None and \ |
| 1289 | export_for_source_row is not None and drop_pad_mode == 0 and \ | 1289 | export_for_source_row is not None and drop_pad_mode == 0 and \ |
| 1290 | - ("Ascend910_95" not in torch_npu.npu.get_device_name() and | 1290 | + ("Ascend950" not in torch_npu.npu.get_device_name()): |
| 1291 | - "Ascend950" not in torch_npu.npu.get_device_name()): | ||
| 1292 | return _NPUMoeFinalizeRoutingOP.apply(expanded_permuted_rows, skip1, skip2, bias, | 1291 | return _NPUMoeFinalizeRoutingOP.apply(expanded_permuted_rows, skip1, skip2, bias, |
| 1293 | scales, expanded_src_to_dst_row, export_for_source_row) | 1292 | scales, expanded_src_to_dst_row, export_for_source_row) |
| 1294 | return _NPUMoeFinalizeRoutingV2OP.apply(expanded_permuted_rows, skip1, skip2, bias, | 1293 | return _NPUMoeFinalizeRoutingV2OP.apply(expanded_permuted_rows, skip1, skip2, bias, |
| @@ -200,6 +200,8 @@ class SupportedDevices: | |||
| 200 | device_name = torch_npu.npu.get_device_name(0)[:10] | 200 | device_name = torch_npu.npu.get_device_name(0)[:10] |
| 201 | if device_name == "Ascend910_": | 201 | if device_name == "Ascend910_": |
| 202 | device_name = torch_npu.npu.get_device_name(0)[:12] | 202 | device_name = torch_npu.npu.get_device_name(0)[:12] |
| 203 | + elif device_name.startswith("Ascend950"): | ||
| 204 | + device_name = torch_npu.npu.get_device_name(0)[:9] | ||
| 203 | if device_name not in self.supported_devices: | 205 | if device_name not in self.supported_devices: |
| 204 | reason = f"Only run on {repr(self.supported_devices)}, current device is {device_name}." | 206 | reason = f"Only run on {repr(self.supported_devices)}, current device is {device_name}." |
| 205 | raise unittest.SkipTest(reason) | 207 | raise unittest.SkipTest(reason) |