已合并
v2.9.0 enable internal format by default for hccl tests on A3 #27477
freezee创建于 2025年12月4日
v2.9.0 enable internal format by default for hccl tests on A3 #27477
已合并
freezee创建于 2025年12月4日
9 个文件变更+14-0
@@ -64,6 +64,7 @@ class HcclAlltoAllTest(TestCase):
64 64 
65 @classmethod65 @classmethod
66 def _test_alltoall_2p_size_with_input_internal_format_and_offset(cls, rank, world_size, init_pg):66 def _test_alltoall_2p_size_with_input_internal_format_and_offset(cls, rank, world_size, init_pg):
67+ torch_npu.npu.config.allow_internal_format = True
67 pg = init_pg(rank, world_size)68 pg = init_pg(rank, world_size)
68 input_list = [(torch.zeros(rank + 1 + world_size, rank + 1) + rank).float().npu() for i in range(2)]69 input_list = [(torch.zeros(rank + 1 + world_size, rank + 1) + rank).float().npu() for i in range(2)]
69 input_list = [torch_npu.npu_format_cast(i, 29)[world_size:] for i in input_list]70 input_list = [torch_npu.npu_format_cast(i, 29)[world_size:] for i in input_list]
@@ -75,6 +76,7 @@ class HcclAlltoAllTest(TestCase):
75 76 
76 @classmethod77 @classmethod
77 def _test_alltoall_2p_size_with_output_internal_format_and_offset(cls, rank, world_size, init_pg):78 def _test_alltoall_2p_size_with_output_internal_format_and_offset(cls, rank, world_size, init_pg):
79+ torch_npu.npu.config.allow_internal_format = True
78 pg = init_pg(rank, world_size)80 pg = init_pg(rank, world_size)
79 input_list = [(torch.zeros(rank + 1, rank + 1) + rank).float().npu() for i in range(2)]81 input_list = [(torch.zeros(rank + 1, rank + 1) + rank).float().npu() for i in range(2)]
80 output_list = [torch.empty(i + 1 + world_size, i + 1).float().npu() for i in range(2)]82 output_list = [torch.empty(i + 1 + world_size, i + 1).float().npu() for i in range(2)]
@@ -119,6 +119,7 @@ class HcclAllGatherTest(HcclAllGatherTestBase):
119 119 
120 @classmethod120 @classmethod
121 def _test_all_gather_with_input_internal_format_and_offset(cls, rank, input1, world_size, init_pg):121 def _test_all_gather_with_input_internal_format_and_offset(cls, rank, input1, world_size, init_pg):
122+ torch_npu.npu.config.allow_internal_format = True
122 pg = init_pg(rank, world_size)123 pg = init_pg(rank, world_size)
123 first_dim = input1.shape[0]124 first_dim = input1.shape[0]
124 other_dims = input1.shape[1:]125 other_dims = input1.shape[1:]
@@ -132,6 +133,7 @@ class HcclAllGatherTest(HcclAllGatherTestBase):
132 133 
133 @classmethod134 @classmethod
134 def _test_all_gather_with_output_internal_format_and_offset(cls, rank, input1, world_size, init_pg):135 def _test_all_gather_with_output_internal_format_and_offset(cls, rank, input1, world_size, init_pg):
136+ torch_npu.npu.config.allow_internal_format = True
135 pg = init_pg(rank, world_size)137 pg = init_pg(rank, world_size)
136 first_dim = input1.shape[0]138 first_dim = input1.shape[0]
137 other_dims = input1.shape[1:]139 other_dims = input1.shape[1:]
@@ -31,6 +31,7 @@ class HcclAllGatherIntoTensorTest(HcclAllGatherTestBase):
31 31 
32 @classmethod32 @classmethod
33 def _test_all_gather_into_tensor_with_input_internal_format_and_offset(cls, rank, input1, world_size, init_pg):33 def _test_all_gather_into_tensor_with_input_internal_format_and_offset(cls, rank, input1, world_size, init_pg):
34+ torch_npu.npu.config.allow_internal_format = True
34 pg = init_pg(rank, world_size)35 pg = init_pg(rank, world_size)
35 input1 = input1.npu()36 input1 = input1.npu()
36 first_dim = input1.shape[0]37 first_dim = input1.shape[0]
@@ -46,6 +47,7 @@ class HcclAllGatherIntoTensorTest(HcclAllGatherTestBase):
46 47 
47 @classmethod48 @classmethod
48 def _test_all_gather_into_tensor_with_output_internal_format_and_offset(cls, rank, input1, world_size, init_pg):49 def _test_all_gather_into_tensor_with_output_internal_format_and_offset(cls, rank, input1, world_size, init_pg):
50+ torch_npu.npu.config.allow_internal_format = True
49 pg = init_pg(rank, world_size)51 pg = init_pg(rank, world_size)
50 input1 = input1.npu()52 input1 = input1.npu()
51 shape = list(input1.size())53 shape = list(input1.size())
@@ -37,6 +37,7 @@ class HcomAllReduceTest(TestCase):
37 @classmethod37 @classmethod
38 # pylint:disable=huawei-too-many-arguments38 # pylint:disable=huawei-too-many-arguments
39 def _test_all_reduce_with_internal_format_and_offset(cls, rank, input1, world_size, init_pg, reduce_op=dist.ReduceOp.SUM):39 def _test_all_reduce_with_internal_format_and_offset(cls, rank, input1, world_size, init_pg, reduce_op=dist.ReduceOp.SUM):
40+ torch_npu.npu.config.allow_internal_format = True
40 dist_group = init_pg(rank, world_size)41 dist_group = init_pg(rank, world_size)
41 dst = 042 dst = 0
42 first_dim = input1.shape[0]43 first_dim = input1.shape[0]
@@ -46,6 +46,7 @@ class HcomBatchIsendIrecvTest(TestCase):
46 46 
47 @classmethod47 @classmethod
48 def _test_batch_isend_irecv_with_internal_format_and_offset(cls, rank, world_size, init_pg):48 def _test_batch_isend_irecv_with_internal_format_and_offset(cls, rank, world_size, init_pg):
49+ torch_npu.npu.config.allow_internal_format = True
49 _ = init_pg(rank, world_size)50 _ = init_pg(rank, world_size)
50 recv_tensors = [None for _ in range(world_size)]51 recv_tensors = [None for _ in range(world_size)]
51 p2p_op_list = []52 p2p_op_list = []
@@ -25,6 +25,7 @@ class HcclBroadcastTest(TestCase):
25 25 
26 @classmethod26 @classmethod
27 def _test_broadcast_with_internal_format_and_offset(cls, rank, input1, world_size, init_pg):27 def _test_broadcast_with_internal_format_and_offset(cls, rank, input1, world_size, init_pg):
28+ torch_npu.npu.config.allow_internal_format = True
28 pg = init_pg(rank, world_size)29 pg = init_pg(rank, world_size)
29 first_dim = input1.shape[0]30 first_dim = input1.shape[0]
30 other_dims = input1.shape[1:]31 other_dims = input1.shape[1:]
@@ -85,6 +85,7 @@ class HcclReduceScatterTest(HcclReduceScatterTestBase):
85 @classmethod85 @classmethod
86 # pylint:disable=huawei-too-many-arguments86 # pylint:disable=huawei-too-many-arguments
87 def _test_reduce_scatter_with_input_internal_format_and_offset(cls, rank, input_list, world_size, init_pg):87 def _test_reduce_scatter_with_input_internal_format_and_offset(cls, rank, input_list, world_size, init_pg):
88+ torch_npu.npu.config.allow_internal_format = True
88 pg = init_pg(rank, world_size)89 pg = init_pg(rank, world_size)
89 input_list_npu = []90 input_list_npu = []
90 for inp in input_list:91 for inp in input_list:
@@ -101,6 +102,7 @@ class HcclReduceScatterTest(HcclReduceScatterTestBase):
101 @classmethod102 @classmethod
102 # pylint:disable=huawei-too-many-arguments103 # pylint:disable=huawei-too-many-arguments
103 def _test_reduce_scatter_with_output_internal_format_and_offset(cls, rank, input_list, world_size, init_pg):104 def _test_reduce_scatter_with_output_internal_format_and_offset(cls, rank, input_list, world_size, init_pg):
105+ torch_npu.npu.config.allow_internal_format = True
104 pg = init_pg(rank, world_size)106 pg = init_pg(rank, world_size)
105 input_list_npu = [input.npu() for input in input_list]107 input_list_npu = [input.npu() for input in input_list]
106 output = torch.empty_like(input_list_npu[rank])108 output = torch.empty_like(input_list_npu[rank])
@@ -31,6 +31,7 @@ class HcclReduceScatterTensorTest(HcclReduceScatterTestBase):
31 @classmethod31 @classmethod
32 # pylint:disable=huawei-too-many-arguments32 # pylint:disable=huawei-too-many-arguments
33 def _test_reduce_scatter_tensor_with_input_internal_format_and_offset(cls, rank, input_list, world_size, init_pg):33 def _test_reduce_scatter_tensor_with_input_internal_format_and_offset(cls, rank, input_list, world_size, init_pg):
34+ torch_npu.npu.config.allow_internal_format = True
34 pg = init_pg(rank, world_size)35 pg = init_pg(rank, world_size)
35 input_list_npu = [input.npu() for input in input_list]36 input_list_npu = [input.npu() for input in input_list]
36 input_tensor = torch.cat(input_list_npu)37 input_tensor = torch.cat(input_list_npu)
@@ -46,6 +47,7 @@ class HcclReduceScatterTensorTest(HcclReduceScatterTestBase):
46 @classmethod47 @classmethod
47 # pylint:disable=huawei-too-many-arguments48 # pylint:disable=huawei-too-many-arguments
48 def _test_reduce_scatter_tensor_with_output_internal_format_and_offset(cls, rank, input_list, world_size, init_pg):49 def _test_reduce_scatter_tensor_with_output_internal_format_and_offset(cls, rank, input_list, world_size, init_pg):
50+ torch_npu.npu.config.allow_internal_format = True
49 pg = init_pg(rank, world_size)51 pg = init_pg(rank, world_size)
50 input_list_npu = [input.npu() for input in input_list]52 input_list_npu = [input.npu() for input in input_list]
51 input_tensor = torch.cat(input_list_npu)53 input_tensor = torch.cat(input_list_npu)
@@ -48,6 +48,7 @@ class HcclSendRecvDistTest(TestCase):
48 48 
49 @classmethod49 @classmethod
50 def _test_send_recv_dist_with_internal_format_and_offset(cls, rank, shared_tensors, world_size, init_pg):50 def _test_send_recv_dist_with_internal_format_and_offset(cls, rank, shared_tensors, world_size, init_pg):
51+ torch_npu.npu.config.allow_internal_format = True
51 pg = init_pg(rank, world_size)52 pg = init_pg(rank, world_size)
52 first_dim = shared_tensors.shape[0]53 first_dim = shared_tensors.shape[0]
53 other_dims = shared_tensors.shape[1:]54 other_dims = shared_tensors.shape[1:]