Merged
fix(operation): Remove int64/uint64's support for Gather/Full #6069
fix(operation): Remove int64/uint64's support for Gather/Full #6069
Merged
junnyleoAdd on Sep 9
Total: 6 files changed+9-17
@@ -49,7 +49,7 @@ full(size: List[int], fill_value: Union[int, float, Element], dtype: DataType, *
49 49 
503. Tensor数据类型说明:503. Tensor数据类型说明:
51 <!-- npu="950" id4 -->51 <!-- npu="950" id4 -->
52- - Ascend 950PR/Ascend 950DT:DT_FP32,DT_FP16,DT_BF16,DT_INT8,DT_INT16,DT_INT32,DT_UINT8,DT_UINT16,DT_UINT32,DT_BOOL,DT_INT64,DT_UINT64。52+ - Ascend 950PR/Ascend 950DT:DT_FP32,DT_FP16,DT_BF16,DT_INT8,DT_INT16,DT_INT32,DT_UINT8,DT_UINT16,DT_UINT32,DT_BOOL。
53 <!-- end id4 -->53 <!-- end id4 -->
54 <!-- npu="A3" id5 -->54 <!-- npu="A3" id5 -->
55 - Atlas A3 训练系列产品/Atlas A3 推理系列产品:DT_FP32,DT_FP16,DT_BF16,DT_INT8,DT_INT16,DT_INT32,DT_UINT8,DT_UINT16,DT_UINT32,DT_BOOL。55 - Atlas A3 训练系列产品/Atlas A3 推理系列产品:DT_FP32,DT_FP16,DT_BF16,DT_INT8,DT_INT16,DT_INT32,DT_UINT8,DT_UINT16,DT_UINT32,DT_BOOL。
@@ -54,7 +54,7 @@ gather(input: Tensor, dim: int, index: Tensor) -> Tensor
54 54 
555. Tensor数据类型说明:555. Tensor数据类型说明:
56 <!-- npu="950" id4 -->56 <!-- npu="950" id4 -->
57- - Ascend 950PR/Ascend 950DT:DT_INT16,DT_INT32,DT_UINT16,DT_UINT32,DT_FP16,DT_FP32,DT_BF16,DT_INT64,DT_UINT6457+ - Ascend 950PR/Ascend 950DT:DT_INT16,DT_INT32,DT_UINT16,DT_UINT32,DT_FP16,DT_FP32,DT_BF16
58 <!-- end id4 -->58 <!-- end id4 -->
59 <!-- npu="A3" id5 -->59 <!-- npu="A3" id5 -->
60 - Atlas A3 训练系列产品/Atlas A3 推理系列产品:DT_INT16,DT_INT32,DT_UINT16,DT_UINT32,DT_FP16,DT_FP32,DT_BF1660 - Atlas A3 训练系列产品/Atlas A3 推理系列产品:DT_INT16,DT_INT32,DT_UINT16,DT_UINT32,DT_FP16,DT_FP32,DT_BF16
@@ -73,9 +73,8 @@ Tensor Full(const Element& src, DataType dtype, const std::vector<int64_t>& dstS
73 DECLARE_TRACER();73 DECLARE_TRACER();
74 static const std::unordered_set<DataType> FULL_A2A3_TYPES = {DT_FP32, DT_FP16, DT_BF16, DT_INT8, DT_INT16,74 static const std::unordered_set<DataType> FULL_A2A3_TYPES = {DT_FP32, DT_FP16, DT_BF16, DT_INT8, DT_INT16,
75 DT_INT32, DT_UINT8, DT_UINT16, DT_UINT32, DT_BOOL};75 DT_INT32, DT_UINT8, DT_UINT16, DT_UINT32, DT_BOOL};
76- static const std::unordered_set<DataType> FULL_A5_TYPES = {DT_FP32, DT_FP16, DT_BF16, DT_INT8,76+ static const std::unordered_set<DataType> FULL_A5_TYPES = {DT_FP32, DT_FP16, DT_BF16, DT_INT8, DT_INT16,
77- DT_INT16, DT_INT32, DT_UINT8, DT_UINT16,77+ DT_INT32, DT_UINT8, DT_UINT16, DT_UINT32, DT_BOOL};
atomgit-bot

🟡 Medium Priority

变更行(76-77)只修改了第一个重载 Full(const Element& src, ...):将其 FULL_A5_TYPES 中的 DT_INT64/DT_UINT64 移除(本 PR 意图是按文档对齐 A5/910B 上 Full 不支持 64 位整型)。但同文件第二个重载 Full(const SymbolicScalar& dynSrc, ...)(第 96-98 行,未修改)的 FULL_A5_TYPES 仍包含 DT_INT64/DT_UINT64。→ 影响:同一公开算子 Full 的两个重载在 A5(NPUArch::DAV_3510)上支持的 dtype 集合出现分歧——A5 上 Full(Element(DT_INT64,...), DT_INT64, shape) 会在 CheckTensorDataType 处被干净地拒绝,而 Full(SymbolicScalar(...), DT_INT64, shape) 会通过类型检查并继续生成 OP_VEC_DUP(int64) 的 tile 任务。→ 失败模式:若按本修复的前提 A5 内核不支持 int64 dup,则动态标量路径会在编译/运行阶段以晦涩错误失败(比静态路径的清晰拒绝更糟);反之若 A5 实际支持 int64,则本次改动让 Element 重载错误地拒绝合法输入,构成功能回归。无论哪种情况,两个重载对同一算子的类型契约不再一致。→ 修复:将第 96-98 行第二个重载的 FULL_A5_TYPES 同步为与第一个重载一致(移除 DT_INT64/DT_UINT64),使两处支持集合完全相同。

建议:将第 96-98 行(SymbolicScalar 重载)的 FULL_A5_TYPES 同步移除 DT_INT64/DT_UINT64,保持两个重载支持类型完全一致;并确认依赖该重载的调用方(如动态路径下可能以 int64 tensor 调用 Full 的代码)不受影响。

likedislike
Incorrect?
junnyleo
junnyleo
Sep 9 Comments:
likedislike
78- DT_UINT32, DT_BOOL, DT_INT64, DT_UINT64};
79 const auto& supportedTypes = GetSupportedDataTypesByArch(FULL_A2A3_TYPES, FULL_A5_TYPES);78 const auto& supportedTypes = GetSupportedDataTypesByArch(FULL_A2A3_TYPES, FULL_A5_TYPES);
80 CheckTensorDataType(dtype, supportedTypes, "FULL");79 CheckTensorDataType(dtype, supportedTypes, "FULL");
81 CheckDstShapeDimRange(dstShape, 1, NUM_VALUE_4, "FULL");80 CheckDstShapeDimRange(dstShape, 1, NUM_VALUE_4, "FULL");
@@ -94,9 +93,8 @@ Tensor Full(const SymbolicScalar& dynSrc, DataType dtype, const std::vector<int6
94 DECLARE_TRACER();93 DECLARE_TRACER();
95 static const std::unordered_set<DataType> FULL_A2A3_TYPES = {DT_FP32, DT_FP16, DT_BF16, DT_INT8, DT_INT16,94 static const std::unordered_set<DataType> FULL_A2A3_TYPES = {DT_FP32, DT_FP16, DT_BF16, DT_INT8, DT_INT16,
96 DT_INT32, DT_UINT8, DT_UINT16, DT_UINT32, DT_BOOL};95 DT_INT32, DT_UINT8, DT_UINT16, DT_UINT32, DT_BOOL};
97- static const std::unordered_set<DataType> FULL_A5_TYPES = {DT_FP32, DT_FP16, DT_BF16, DT_INT8,96+ static const std::unordered_set<DataType> FULL_A5_TYPES = {DT_FP32, DT_FP16, DT_BF16, DT_INT8, DT_INT16,
98- DT_INT16, DT_INT32, DT_UINT8, DT_UINT16,97+ DT_INT32, DT_UINT8, DT_UINT16, DT_UINT32, DT_BOOL};
99- DT_UINT32, DT_BOOL, DT_INT64, DT_UINT64};
100 const auto& supportedTypes = GetSupportedDataTypesByArch(FULL_A2A3_TYPES, FULL_A5_TYPES);98 const auto& supportedTypes = GetSupportedDataTypesByArch(FULL_A2A3_TYPES, FULL_A5_TYPES);
101 CheckTensorDataType(dtype, supportedTypes, "FULL");99 CheckTensorDataType(dtype, supportedTypes, "FULL");
102 CheckDstShapeDimRange(dstShape, 1, NUM_VALUE_4, "FULL");100 CheckDstShapeDimRange(dstShape, 1, NUM_VALUE_4, "FULL");
@@ -300,8 +300,8 @@ Tensor GatherElements(const Tensor& params, const Tensor& indices, int axis)
300 }300 }
301 static const std::unordered_set<DataType> a2a3Types = {DT_FP32, DT_FP16, DT_BF16, DT_INT32,301 static const std::unordered_set<DataType> a2a3Types = {DT_FP32, DT_FP16, DT_BF16, DT_INT32,
302 DT_UINT32, DT_INT16, DT_UINT16};302 DT_UINT32, DT_INT16, DT_UINT16};
303- static const std::unordered_set<DataType> a5Types = {DT_FP32, DT_FP16, DT_BF16, DT_INT32, DT_UINT32,303+ static const std::unordered_set<DataType> a5Types = {DT_FP32, DT_FP16, DT_BF16, DT_INT32,
304- DT_INT16, DT_UINT16, DT_INT64, DT_UINT64};304+ DT_UINT32, DT_INT16, DT_UINT16};
305 const auto& supportedTypes = GetSupportedDataTypesByArch(a2a3Types, a5Types);305 const auto& supportedTypes = GetSupportedDataTypesByArch(a2a3Types, a5Types);
306 CheckTensorDataType(params.GetStorage(), supportedTypes, "GATHERELEMENTS");306 CheckTensorDataType(params.GetStorage(), supportedTypes, "GATHERELEMENTS");
307 std::unordered_set<DataType> indexSupportedTypes = {DT_INT32, DT_INT64};307 std::unordered_set<DataType> indexSupportedTypes = {DT_INT32, DT_INT64};
@@ -17,7 +17,3 @@ Full_test_14,"[3072, 28672]",fp32,ND,"[-100, 100]","[3072, 28672]",fp32,ND,"[256
17Full_test_15,"[16384, 512]",fp32,ND,"[-10, 10]","[16384, 512]",fp32,ND,"[16384, 512]","[128, 128]",-0.05,fp3217Full_test_15,"[16384, 512]",fp32,ND,"[-10, 10]","[16384, 512]",fp32,ND,"[16384, 512]","[128, 128]",-0.05,fp32
18Full_test_16,"[32, 32]",fp16,ND,"[-100, 100]","[32, 32]",fp16,ND,"[32, 32]","[16, 16]",2,fp1618Full_test_16,"[32, 32]",fp16,ND,"[-100, 100]","[32, 32]",fp16,ND,"[32, 32]","[16, 16]",2,fp16
19Full_test_17,"[32, 32]",bf16,ND,"[-100, 100]","[32, 32]",bf16,ND,"[32, 32]","[16, 16]",2,bf1619Full_test_17,"[32, 32]",bf16,ND,"[-100, 100]","[32, 32]",bf16,ND,"[32, 32]","[16, 16]",2,bf16
20-Full_int64,"[32, 32]",int64,ND,"[-1, 1]","[32, 32]",int64,ND,"[16, 16]","[16, 16]",7,int64
21-Full_uint64,"[32, 32]",uint64,ND,"[-1, 1]","[32, 32]",uint64,ND,"[16, 16]","[16, 16]",7,uint64
22-Full_3d_int64,"[2, 16, 32]",int64,ND,"[-1, 1]","[2, 16, 32]",int64,ND,"[1, 16, 32]","[1, 16, 32]",7,int64
23-Full_3d_uint64,"[2, 16, 32]",uint64,ND,"[-1, 1]","[2, 16, 32]",uint64,ND,"[1, 16, 32]","[1, 16, 32]",7,uint64
@@ -52,6 +52,4 @@ GatherElement_test_49,"[16, 16, 16, 16], [8, 8, 8, 8]","uint16, int32","ND, ND",
52GatherElement_test_50,"[10, 10], [5, 9]","uint32, int32","ND, ND","[0,100], [0, 10]","[5, 9]",uint32,ND,"[10, 8]","[3, 8]",052GatherElement_test_50,"[10, 10], [5, 9]","uint32, int32","ND, ND","[0,100], [0, 10]","[5, 9]",uint32,ND,"[10, 8]","[3, 8]",0
53GatherElement_test_51,"[10, 10], [5, 9]","uint32, int32","ND, ND","[0,100], [0, 10]","[5, 9]",uint32,ND,"[10, 8]","[3, 16]",053GatherElement_test_51,"[10, 10], [5, 9]","uint32, int32","ND, ND","[0,100], [0, 10]","[5, 9]",uint32,ND,"[10, 8]","[3, 16]",0
54GatherElement_test_52,"[16, 16, 16], [8, 8, 8]","uint32, int32","ND, ND","[0,100], [0, 16]","[8, 8, 8]",uint32,ND,"[8, 16, 8]","[5, 16, 8]",154GatherElement_test_52,"[16, 16, 16], [8, 8, 8]","uint32, int32","ND, ND","[0,100], [0, 16]","[8, 8, 8]",uint32,ND,"[8, 16, 8]","[5, 16, 8]",1
55-GatherElement_test_53,"[16, 16, 16, 16], [8, 8, 8, 8]","uint32, int32","ND, ND","[0,100], [0, 16]","[8, 8, 8, 8]",uint32,ND,"[8, 8, 8, 16]","[8, 9, 13, 16]",355+GatherElement_test_53,"[16, 16, 16, 16], [8, 8, 8, 8]","uint32, int32","ND, ND","[0,100], [0, 16]","[8, 8, 8, 8]",uint32,ND,"[8, 8, 8, 16]","[8, 9, 13, 16]",3
56-GatherElement_int64,"[10, 10], [5, 9]","int64, int32","ND, ND","[-100, 100], [0, 10]","[5, 9]",int64,ND,"[10, 8]","[3, 8]",0
57-GatherElement_uint64,"[10, 10], [5, 9]","uint64, int32","ND, ND","[1, 100], [0, 10]","[5, 9]",uint64,ND,"[10, 8]","[3, 8]",0