| Files | Last commit | Last update |
|---|---|---|
fix(confusion_matrix): 转测验证轮修复——输入校验加固 + golden 按 TTK 三方比对规范收敛 Co-authored-by: SeanDictionary<b24081019@njupt.edu.cn> # message auto-generated for no-merge-commit merge: !6337 merge feat/confusion-matrix into master fix(confusion_matrix): 转测验证轮修复——输入校验加固 + golden 按 TTK 三方比对规范收敛 Created-by: SeanDictionary Commit-by: SeanDictionary Merged-by: cann-robot Description: ## 描述 上一轮合入(!5444,squash 529263d53)后转测验证发现的修复,共 5 个提交: 1. **kernel ResetBins 越界守卫**(956061214): confusion_matrix_simt_not_full_load_ub.h 的 ResetBins 补 blockIdx_ >= resetBinsCoreNum_ 早退,与另两策略对齐,消除核数关系变化时的越界零写风险。 2. **InferShape 输入校验**(956061214):labels/predictions 一维 + shape 一致 + weights shape 一致校验,非法输入报 GRAPH_FAILED;proto 注释同步修正(y 为 2D [nc,nc],dtype 由 dtype/weights 映射决定,原注释继承了 canndev 历史笔误)。 3. **GEIR.02**(b72e7ab57):weights dtype 校验从 InferDataType 移到 tiling CheckDtype——仅非空 weights 校验与输出 dtype 一致,空张量豁免(空 weights 任何 dtype 合法,与 A2 语义一致)。 4. **INFER-EXC-001**(6b5f7f962):tiling CheckDtype 独立校验 labels/predictions 输入 dtype(五类合法集 + 两两一致),堵住非法 dtype 组合静默进内核。 5. **golden 规范化**(0081d4af5):出口零 cast(_compute 已按 TTK 下发的 output_dtypes 决定累加/窄回精度,去除 Promote 下为 no-op 的二次 astype);@staticmethod 加固;修正 _Compose 与模块 docstring 中与代码不符的描述。等价性验证:新旧 golden 全 dtype×weights×两方/三方 20/20 逐位一致。 6. **clang-format**(d628520fe):3 个文件按 CI 同版本 clang-format 18.1.8 重排,纯换行调整无语义变化。 ## 关联的Issue [#3578](https://gitcode.com/cann/ops-math/issues/3578) ## 测试 Ascend950DT_9592 真机(TTK 2.8.0,Rev d628520fe): - **UT**:build.sh -u --ophost --ops=confusion_matrix --soc=ascend950 **20/20 PASS**(tiling 12 含新增 empty_weights_dtype_exempt / weights_dtype_mismatch / input_dtype_mismatch / input_dtype_unsupported;infershape 8 含 shape_mismatch / rank2_rejected / weights_shape_mismatch)。 - **ST 真机**:仓内 12 例(5 f32 + 2 f16 + 5 整数)**12/12 PASS**。 - **GEIR 通路**:55 例**全部通过**——整数 32/32 binary_equal(原判据);浮点 23/23 两方比对 close PASS(三方 cross_check 因当前环境 GPU 竞品端点缺失以两方比对替代,判据声明不变)。 - **golden 等价性**:新旧实现 5 输出 dtype × 有无 weights × 两方/三方 20 组逐位一致;TTK TestSpecManager validate PASS。 ## 文档更新 - README.md 约束说明同步(weights==y dtype 一致性声明)。 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!6337 | 27 days ago | |
feat: ConfusionMatrix 算子下一代实现 Co-authored-by: SeanDictionary<b24081019@njupt.edu.cn> # message auto-generated for no-merge-commit merge: !5444 merge feat/confusion-matrix into master feat: ConfusionMatrix 算子下一代实现 Created-by: SeanDictionary Commit-by: SeanDictionary Merged-by: cann-robot Description: ## 描述 新增 ConfusionMatrix 算子 Ascend950(arch35)实现。 - **功能**:对每个索引 i,将 weights[i](缺省为 1)累加到输出矩阵 y[labels[i], predictions[i]],输出 num_classes×num_classes 混淆矩阵,兼容 TF tf.math.confusion_matrix。 - **kernel 侧**:SIMT 范式(参照 bincount 骨架),2D scatter-add;按输出矩阵与 UB 容量关系分四种调度策略(full_load / batch_load / not_full_load / determine),determine 模式按输出行切核保证确定性,int8/uint8 输出固定走 determine(窄整型不走原子加)。 - **host 侧**:arch35 tiling(策略选择 + 结构化宏校验 shape/dtype/num_classes);op_graph 双挂 InferShape + InferDataType(输出 dtype 由属性 dtype 字符串白名单映射)。 - **dtype 组合**:labels/predictions(dtype 相同)× weights/output(dtype 相同)共 25 种组合,输出 dtype 由属性 dtype 决定;1 ≤ num_classes ≤ 4096。 - **原型去重**:common/inc/op_graph/op_math_proto_extend.h 中移除 ConfusionMatrix 的 REG_OP 声明——本算子目录 op_graph/confusion_matrix_proto.h 已提供带 OPS_PROTO_DEF_CONFUSIONMATRIX 去重宏保护的版本,避免同 TU 重复注册。 - **tf-plugin**:由 common/src/framework/confusion_matrix_tf_plugin.cpp 统一提供(#5653 已合入),本 PR 不重复交付。 ## 关联的Issue [#3211](https://gitcode.com/cann/ops-math/issues/3211) ## 测试 - 泛化:kernel 模式 1000 例(25 dtype 组合 × num_classes 1~4096 探顶 × N 0~100000 × 4 调度分支),REAL_FAIL=0(995 PASS + 5 例 fp16 深累加顺序舍入差异,与 built-in TBE 同数值行为)。 - 通路:GEIR 55 例全连通,浮点输出 23/23 三方比对(NPU / CPU golden / GPU)PASS;tf 通路经 pb 解析验证。 - 精度:三方 12/12 PASS(含 int8/uint8 饱和回绕、inf/nan 传播,NPU-GPU bitwise 一致)。 - 性能:150 例对标 A100(torch scatter_add 拼接基准),NPU 中位快约 2.6×,按 shape 分布如实呈现。 - UT:tiling(arch35)+ infershape 单测随包;ST:tests/st/arch35/ttk_kernel_confusion_matrix_st.csv。 ## 文档更新 - 新增 math/confusion_matrix/README.md(产品支持情况/功能说明/参数说明/约束说明/调用说明)。 - docs/zh/op_list.md 登记 confusion_matrix 条目。 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!5444 | 1 month ago |
| Files | Last commit | Last update |
|---|---|---|
| 27 days ago | ||
| 1 month ago |