已合并
[feat][v2.8.0] set allow_internal_format default value False in Atlas A2 #31602
chengpeng25创建于 3月10日
[feat][v2.8.0] set allow_internal_format default value False in Atlas A2 #31602
已合并
共 3 个文件变更+5-1
| @@ -47,6 +47,7 @@ class TestNPUFormat(TestCase): | |||
| 47 | 47 | ||
| 48 | def test_get_npu_format_weak_ref(self): | 48 | def test_get_npu_format_weak_ref(self): |
| 49 | """test get_npu_format""" | 49 | """test get_npu_format""" |
| 50 | + torch_npu.npu.config.allow_internal_format = True | ||
| 50 | x1 = torch.ones(2, 2).npu() | 51 | x1 = torch.ones(2, 2).npu() |
| 51 | torch_npu.npu_format_cast_(x1, torch_npu.Format.FRACTAL_NZ) | 52 | torch_npu.npu_format_cast_(x1, torch_npu.Format.FRACTAL_NZ) |
| 52 | 53 | ||
| @@ -325,6 +325,7 @@ class TestStorage(TestCase): | |||
| 325 | self.assertIsInstance(getattr(y.float().cpu(), dtype)(), getattr(torch, dtype.title() + "Storage")) | 325 | self.assertIsInstance(getattr(y.float().cpu(), dtype)(), getattr(torch, dtype.title() + "Storage")) |
| 326 | 326 | ||
| 327 | def test_deepcopy(self): | 327 | def test_deepcopy(self): |
| 328 | + torch_npu.npu.config.allow_internal_format = True | ||
| 328 | x = torch.tensor([1]) | 329 | x = torch.tensor([1]) |
| 329 | y = copy.deepcopy(x) | 330 | y = copy.deepcopy(x) |
| 330 | 331 | ||
| @@ -217,7 +217,9 @@ NpuSysCtrl::SysStatus NpuSysCtrl::Initialize(int device_id) | |||
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | // set default allow_internal_format value | 219 | // set default allow_internal_format value |
| 220 | - if (c10_npu::GetSocVersion() >= c10_npu::SocVersion::Ascend910_9391) { | 220 | + if (((c10_npu::GetSocVersion() >= c10_npu::SocVersion::Ascend910B1) && |
| 221 | + (c10_npu::GetSocVersion() < c10_npu::SocVersion::Ascend310B1)) || | ||
| 222 | + (c10_npu::GetSocVersion() >= c10_npu::SocVersion::Ascend910_9391)) { | ||
| 221 | SetDefaultAllowInternalFromatDisable(); | 223 | SetDefaultAllowInternalFromatDisable(); |
| 222 | } | 224 | } |
| 223 | 225 | ||