| Files | Last commit | Last update |
|---|---|---|
fix: FeedsRepeat 修复功能、精度与资料问题 Co-authored-by: xuxiao59<xuxiao59@huawei.com> # message auto-generated for no-merge-commit merge: !6754 merge fix/feeds_repeat into master fix: FeedsRepeat 修复功能、精度与资料问题 Created-by: gcw_xYUkRrAH Commit-by: xuxiao59 Merged-by: cann-robot Description: ## 描述 修复 FeedsRepeat 算子经全量验证(Ascend950PR,静态检查 + 用例生成 + 上板执行)发现的功能、精度与资料问题,共 13 个文件、5 类缺陷根因: **Kernel 侧(op_kernel/feeds_repeat.h)** - 为 Sum/InitOutput 的 PopStackBuffer 预留 UB 栈空间(8KB),防止 TPipe 占满 UB 后 PopStackBuffer 断言失败(设备表现为 VEC_ERROR / NO_OUTPUT / 静默错误数值) - 负 feeds_repeat_times 钳 0、Repeat 循环按剩余输出截断( write_times = min(repeat_times, row_remain)),消除 sum(repeats) > output_feeds_size 时的块内越界写 - ClearOutputSpace 清零起点 end_index 钳制到 [0, empty_size],消除负数经 uint32 回绕导致的块外越界写 - 循环计数器 int 转 int64_t,防大 shape 溢出 **Tiling 侧(op_host/feeds_repeat_tiling.cpp)** - feeds 秩校验前移至 GetDim(0) 之前(rank-0 不再越界读) - feeds_repeat_times 容量上限按平台 UB 动态计算(含 8KB 栈预留),A2/A3 约 92KB、950 约 120KB - 空 tensor(dim0<1 / batch_num<=0)明确拒绝 - feeds_repeat_times 逐维溢出保护(累乘前检查 INT64_MAX) - output_feeds_size 负值拒绝 **InferShape 侧(op_host/feeds_repeat_infershape.cpp)** - 必选属性 output_feeds_size 判空与取值域校验前移至未知 Rank 早退之前 - 逐维判定 feeds_repeat_times 元素总数未知性(含偶数个 -1 维时 GetShapeSize 返回正积的边界),未知时跳过计数校验、由执行阶段 tiling 完成 **Proto(op_graph/feeds_repeat_proto.h)** - feeds/y dtype 从 TensorType::BasicType() 收紧为 {FP16, FP32, BF16}(与 def.cpp/InferDataType 同口径) **样例(examples/test_geir_feeds_repeat.cpp)** - 修复宏内 "placeholder" + int 指针偏移 bug(实际生成 "laceholder1" 而非 "placeholder1") - 输入缓冲 new[] 后补 delete[](Tensor 构造拷贝数据后即释放) - 输出按 dtype 打印而非逐字节 uint8 - 提前返回路径补 GEFinalize() - WriteDataToFile 增加fwrite 结果检查 **测试资产** - golden.py 入仓 tests/assets/(双键注册 feeds_repeat/FeedsRepeat、截断语义、mix_tolerance、多维展平、设备跟随) - UT 扩容:tiling 15 例(含秩 0/溢出/UB 贴界拒绝)、infershape 8 例(含 [-2] 传播/负属性/动态维)、kernel 若干 - gen_data.py 重写(原版 import tensorflow 且 argv 传参有误无法运行);删除不可运行的 gen_tiling.py **README** - UB 容量口径由固定 48KB/64KB 改为按平台动态推导(A2/A3 约 92KB、950 约 120KB) - 动态 shape 与 -1/-2 语义、output_feeds_size 取值域、空 tensor 约束声明 - feeds_repeat_times 元素总数定义与秩不限说明 ## 关联的Issue - https://gitcode.com/wangyueting/changwei_liuyi/issues/119 (GOLDEN_FAILURE:golden 语义不一致) - https://gitcode.com/wangyueting/changwei_liuyi/issues/121 (EE9999:UB 占满致设备崩溃) - https://gitcode.com/wangyueting/changwei_liuyi/issues/122 (E90003:容量门误拒合法输入 + 空 tensor 未声明) - https://gitcode.com/wangyueting/changwei_liuyi/issues/176 (ClearOutputSpace 清零长度负数 uint32 回绕越界写) - https://gitcode.com/wangyueting/changwei_liuyi/issues/177 (Repeat 循环未按剩余输出截断覆写) ## 测试 - Host UT:23/23 PASSED(tiling 15 + infershape 8,含新增秩 0/溢出/UB 贴界/[-2]/负属性/动态维守卫用例) - Kernel 路由:全量 571 例 + 34 条原失败复测全 PASS(三模式 dyn/cst/bin 100% 精度) - GEIR 路由:全量四模式(source/binary × const/dynamic)各 58 例全 PASS - 确定性路由:56 例 × 10 次重复全部 deterministic PASS - 异常路由:21 条 L2 负例中 15 条受控拒绝(拒绝消息含具体参数值)、6 条契约未建立 - ST 自验证:56 条 L0 输入检查 + 1 条真机 smoke PASS(100.0%) - 构建验证:ascend950/ascend910b kernel + ophost 全部编译通过 - 静态检查:87 项检查 0 发现(含 canndev 兼容基线对比 PASS) ## 文档更新 - README.md:UB 容量口径、动态 shape 语义、output_feeds_size 取值域、空 tensor 约束 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!6754 | 12 days ago | |
fix: FeedsRepeat 修复功能、精度与资料问题 Co-authored-by: xuxiao59<xuxiao59@huawei.com> # message auto-generated for no-merge-commit merge: !6754 merge fix/feeds_repeat into master fix: FeedsRepeat 修复功能、精度与资料问题 Created-by: gcw_xYUkRrAH Commit-by: xuxiao59 Merged-by: cann-robot Description: ## 描述 修复 FeedsRepeat 算子经全量验证(Ascend950PR,静态检查 + 用例生成 + 上板执行)发现的功能、精度与资料问题,共 13 个文件、5 类缺陷根因: **Kernel 侧(op_kernel/feeds_repeat.h)** - 为 Sum/InitOutput 的 PopStackBuffer 预留 UB 栈空间(8KB),防止 TPipe 占满 UB 后 PopStackBuffer 断言失败(设备表现为 VEC_ERROR / NO_OUTPUT / 静默错误数值) - 负 feeds_repeat_times 钳 0、Repeat 循环按剩余输出截断( write_times = min(repeat_times, row_remain)),消除 sum(repeats) > output_feeds_size 时的块内越界写 - ClearOutputSpace 清零起点 end_index 钳制到 [0, empty_size],消除负数经 uint32 回绕导致的块外越界写 - 循环计数器 int 转 int64_t,防大 shape 溢出 **Tiling 侧(op_host/feeds_repeat_tiling.cpp)** - feeds 秩校验前移至 GetDim(0) 之前(rank-0 不再越界读) - feeds_repeat_times 容量上限按平台 UB 动态计算(含 8KB 栈预留),A2/A3 约 92KB、950 约 120KB - 空 tensor(dim0<1 / batch_num<=0)明确拒绝 - feeds_repeat_times 逐维溢出保护(累乘前检查 INT64_MAX) - output_feeds_size 负值拒绝 **InferShape 侧(op_host/feeds_repeat_infershape.cpp)** - 必选属性 output_feeds_size 判空与取值域校验前移至未知 Rank 早退之前 - 逐维判定 feeds_repeat_times 元素总数未知性(含偶数个 -1 维时 GetShapeSize 返回正积的边界),未知时跳过计数校验、由执行阶段 tiling 完成 **Proto(op_graph/feeds_repeat_proto.h)** - feeds/y dtype 从 TensorType::BasicType() 收紧为 {FP16, FP32, BF16}(与 def.cpp/InferDataType 同口径) **样例(examples/test_geir_feeds_repeat.cpp)** - 修复宏内 "placeholder" + int 指针偏移 bug(实际生成 "laceholder1" 而非 "placeholder1") - 输入缓冲 new[] 后补 delete[](Tensor 构造拷贝数据后即释放) - 输出按 dtype 打印而非逐字节 uint8 - 提前返回路径补 GEFinalize() - WriteDataToFile 增加fwrite 结果检查 **测试资产** - golden.py 入仓 tests/assets/(双键注册 feeds_repeat/FeedsRepeat、截断语义、mix_tolerance、多维展平、设备跟随) - UT 扩容:tiling 15 例(含秩 0/溢出/UB 贴界拒绝)、infershape 8 例(含 [-2] 传播/负属性/动态维)、kernel 若干 - gen_data.py 重写(原版 import tensorflow 且 argv 传参有误无法运行);删除不可运行的 gen_tiling.py **README** - UB 容量口径由固定 48KB/64KB 改为按平台动态推导(A2/A3 约 92KB、950 约 120KB) - 动态 shape 与 -1/-2 语义、output_feeds_size 取值域、空 tensor 约束声明 - feeds_repeat_times 元素总数定义与秩不限说明 ## 关联的Issue - https://gitcode.com/wangyueting/changwei_liuyi/issues/119 (GOLDEN_FAILURE:golden 语义不一致) - https://gitcode.com/wangyueting/changwei_liuyi/issues/121 (EE9999:UB 占满致设备崩溃) - https://gitcode.com/wangyueting/changwei_liuyi/issues/122 (E90003:容量门误拒合法输入 + 空 tensor 未声明) - https://gitcode.com/wangyueting/changwei_liuyi/issues/176 (ClearOutputSpace 清零长度负数 uint32 回绕越界写) - https://gitcode.com/wangyueting/changwei_liuyi/issues/177 (Repeat 循环未按剩余输出截断覆写) ## 测试 - Host UT:23/23 PASSED(tiling 15 + infershape 8,含新增秩 0/溢出/UB 贴界/[-2]/负属性/动态维守卫用例) - Kernel 路由:全量 571 例 + 34 条原失败复测全 PASS(三模式 dyn/cst/bin 100% 精度) - GEIR 路由:全量四模式(source/binary × const/dynamic)各 58 例全 PASS - 确定性路由:56 例 × 10 次重复全部 deterministic PASS - 异常路由:21 条 L2 负例中 15 条受控拒绝(拒绝消息含具体参数值)、6 条契约未建立 - ST 自验证:56 条 L0 输入检查 + 1 条真机 smoke PASS(100.0%) - 构建验证:ascend950/ascend910b kernel + ophost 全部编译通过 - 静态检查:87 项检查 0 发现(含 canndev 兼容基线对比 PASS) ## 文档更新 - README.md:UB 容量口径、动态 shape 语义、output_feeds_size 取值域、空 tensor 约束 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!6754 | 12 days ago | |
fix: FeedsRepeat 修复功能、精度与资料问题 Co-authored-by: xuxiao59<xuxiao59@huawei.com> # message auto-generated for no-merge-commit merge: !6754 merge fix/feeds_repeat into master fix: FeedsRepeat 修复功能、精度与资料问题 Created-by: gcw_xYUkRrAH Commit-by: xuxiao59 Merged-by: cann-robot Description: ## 描述 修复 FeedsRepeat 算子经全量验证(Ascend950PR,静态检查 + 用例生成 + 上板执行)发现的功能、精度与资料问题,共 13 个文件、5 类缺陷根因: **Kernel 侧(op_kernel/feeds_repeat.h)** - 为 Sum/InitOutput 的 PopStackBuffer 预留 UB 栈空间(8KB),防止 TPipe 占满 UB 后 PopStackBuffer 断言失败(设备表现为 VEC_ERROR / NO_OUTPUT / 静默错误数值) - 负 feeds_repeat_times 钳 0、Repeat 循环按剩余输出截断( write_times = min(repeat_times, row_remain)),消除 sum(repeats) > output_feeds_size 时的块内越界写 - ClearOutputSpace 清零起点 end_index 钳制到 [0, empty_size],消除负数经 uint32 回绕导致的块外越界写 - 循环计数器 int 转 int64_t,防大 shape 溢出 **Tiling 侧(op_host/feeds_repeat_tiling.cpp)** - feeds 秩校验前移至 GetDim(0) 之前(rank-0 不再越界读) - feeds_repeat_times 容量上限按平台 UB 动态计算(含 8KB 栈预留),A2/A3 约 92KB、950 约 120KB - 空 tensor(dim0<1 / batch_num<=0)明确拒绝 - feeds_repeat_times 逐维溢出保护(累乘前检查 INT64_MAX) - output_feeds_size 负值拒绝 **InferShape 侧(op_host/feeds_repeat_infershape.cpp)** - 必选属性 output_feeds_size 判空与取值域校验前移至未知 Rank 早退之前 - 逐维判定 feeds_repeat_times 元素总数未知性(含偶数个 -1 维时 GetShapeSize 返回正积的边界),未知时跳过计数校验、由执行阶段 tiling 完成 **Proto(op_graph/feeds_repeat_proto.h)** - feeds/y dtype 从 TensorType::BasicType() 收紧为 {FP16, FP32, BF16}(与 def.cpp/InferDataType 同口径) **样例(examples/test_geir_feeds_repeat.cpp)** - 修复宏内 "placeholder" + int 指针偏移 bug(实际生成 "laceholder1" 而非 "placeholder1") - 输入缓冲 new[] 后补 delete[](Tensor 构造拷贝数据后即释放) - 输出按 dtype 打印而非逐字节 uint8 - 提前返回路径补 GEFinalize() - WriteDataToFile 增加fwrite 结果检查 **测试资产** - golden.py 入仓 tests/assets/(双键注册 feeds_repeat/FeedsRepeat、截断语义、mix_tolerance、多维展平、设备跟随) - UT 扩容:tiling 15 例(含秩 0/溢出/UB 贴界拒绝)、infershape 8 例(含 [-2] 传播/负属性/动态维)、kernel 若干 - gen_data.py 重写(原版 import tensorflow 且 argv 传参有误无法运行);删除不可运行的 gen_tiling.py **README** - UB 容量口径由固定 48KB/64KB 改为按平台动态推导(A2/A3 约 92KB、950 约 120KB) - 动态 shape 与 -1/-2 语义、output_feeds_size 取值域、空 tensor 约束声明 - feeds_repeat_times 元素总数定义与秩不限说明 ## 关联的Issue - https://gitcode.com/wangyueting/changwei_liuyi/issues/119 (GOLDEN_FAILURE:golden 语义不一致) - https://gitcode.com/wangyueting/changwei_liuyi/issues/121 (EE9999:UB 占满致设备崩溃) - https://gitcode.com/wangyueting/changwei_liuyi/issues/122 (E90003:容量门误拒合法输入 + 空 tensor 未声明) - https://gitcode.com/wangyueting/changwei_liuyi/issues/176 (ClearOutputSpace 清零长度负数 uint32 回绕越界写) - https://gitcode.com/wangyueting/changwei_liuyi/issues/177 (Repeat 循环未按剩余输出截断覆写) ## 测试 - Host UT:23/23 PASSED(tiling 15 + infershape 8,含新增秩 0/溢出/UB 贴界/[-2]/负属性/动态维守卫用例) - Kernel 路由:全量 571 例 + 34 条原失败复测全 PASS(三模式 dyn/cst/bin 100% 精度) - GEIR 路由:全量四模式(source/binary × const/dynamic)各 58 例全 PASS - 确定性路由:56 例 × 10 次重复全部 deterministic PASS - 异常路由:21 条 L2 负例中 15 条受控拒绝(拒绝消息含具体参数值)、6 条契约未建立 - ST 自验证:56 条 L0 输入检查 + 1 条真机 smoke PASS(100.0%) - 构建验证:ascend950/ascend910b kernel + ophost 全部编译通过 - 静态检查:87 项检查 0 发现(含 canndev 兼容基线对比 PASS) ## 文档更新 - README.md:UB 容量口径、动态 shape 语义、output_feeds_size 取值域、空 tensor 约束 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!6754 | 12 days ago | |
fix: FeedsRepeat 修复功能、精度与资料问题 Co-authored-by: xuxiao59<xuxiao59@huawei.com> # message auto-generated for no-merge-commit merge: !6754 merge fix/feeds_repeat into master fix: FeedsRepeat 修复功能、精度与资料问题 Created-by: gcw_xYUkRrAH Commit-by: xuxiao59 Merged-by: cann-robot Description: ## 描述 修复 FeedsRepeat 算子经全量验证(Ascend950PR,静态检查 + 用例生成 + 上板执行)发现的功能、精度与资料问题,共 13 个文件、5 类缺陷根因: **Kernel 侧(op_kernel/feeds_repeat.h)** - 为 Sum/InitOutput 的 PopStackBuffer 预留 UB 栈空间(8KB),防止 TPipe 占满 UB 后 PopStackBuffer 断言失败(设备表现为 VEC_ERROR / NO_OUTPUT / 静默错误数值) - 负 feeds_repeat_times 钳 0、Repeat 循环按剩余输出截断( write_times = min(repeat_times, row_remain)),消除 sum(repeats) > output_feeds_size 时的块内越界写 - ClearOutputSpace 清零起点 end_index 钳制到 [0, empty_size],消除负数经 uint32 回绕导致的块外越界写 - 循环计数器 int 转 int64_t,防大 shape 溢出 **Tiling 侧(op_host/feeds_repeat_tiling.cpp)** - feeds 秩校验前移至 GetDim(0) 之前(rank-0 不再越界读) - feeds_repeat_times 容量上限按平台 UB 动态计算(含 8KB 栈预留),A2/A3 约 92KB、950 约 120KB - 空 tensor(dim0<1 / batch_num<=0)明确拒绝 - feeds_repeat_times 逐维溢出保护(累乘前检查 INT64_MAX) - output_feeds_size 负值拒绝 **InferShape 侧(op_host/feeds_repeat_infershape.cpp)** - 必选属性 output_feeds_size 判空与取值域校验前移至未知 Rank 早退之前 - 逐维判定 feeds_repeat_times 元素总数未知性(含偶数个 -1 维时 GetShapeSize 返回正积的边界),未知时跳过计数校验、由执行阶段 tiling 完成 **Proto(op_graph/feeds_repeat_proto.h)** - feeds/y dtype 从 TensorType::BasicType() 收紧为 {FP16, FP32, BF16}(与 def.cpp/InferDataType 同口径) **样例(examples/test_geir_feeds_repeat.cpp)** - 修复宏内 "placeholder" + int 指针偏移 bug(实际生成 "laceholder1" 而非 "placeholder1") - 输入缓冲 new[] 后补 delete[](Tensor 构造拷贝数据后即释放) - 输出按 dtype 打印而非逐字节 uint8 - 提前返回路径补 GEFinalize() - WriteDataToFile 增加fwrite 结果检查 **测试资产** - golden.py 入仓 tests/assets/(双键注册 feeds_repeat/FeedsRepeat、截断语义、mix_tolerance、多维展平、设备跟随) - UT 扩容:tiling 15 例(含秩 0/溢出/UB 贴界拒绝)、infershape 8 例(含 [-2] 传播/负属性/动态维)、kernel 若干 - gen_data.py 重写(原版 import tensorflow 且 argv 传参有误无法运行);删除不可运行的 gen_tiling.py **README** - UB 容量口径由固定 48KB/64KB 改为按平台动态推导(A2/A3 约 92KB、950 约 120KB) - 动态 shape 与 -1/-2 语义、output_feeds_size 取值域、空 tensor 约束声明 - feeds_repeat_times 元素总数定义与秩不限说明 ## 关联的Issue - https://gitcode.com/wangyueting/changwei_liuyi/issues/119 (GOLDEN_FAILURE:golden 语义不一致) - https://gitcode.com/wangyueting/changwei_liuyi/issues/121 (EE9999:UB 占满致设备崩溃) - https://gitcode.com/wangyueting/changwei_liuyi/issues/122 (E90003:容量门误拒合法输入 + 空 tensor 未声明) - https://gitcode.com/wangyueting/changwei_liuyi/issues/176 (ClearOutputSpace 清零长度负数 uint32 回绕越界写) - https://gitcode.com/wangyueting/changwei_liuyi/issues/177 (Repeat 循环未按剩余输出截断覆写) ## 测试 - Host UT:23/23 PASSED(tiling 15 + infershape 8,含新增秩 0/溢出/UB 贴界/[-2]/负属性/动态维守卫用例) - Kernel 路由:全量 571 例 + 34 条原失败复测全 PASS(三模式 dyn/cst/bin 100% 精度) - GEIR 路由:全量四模式(source/binary × const/dynamic)各 58 例全 PASS - 确定性路由:56 例 × 10 次重复全部 deterministic PASS - 异常路由:21 条 L2 负例中 15 条受控拒绝(拒绝消息含具体参数值)、6 条契约未建立 - ST 自验证:56 条 L0 输入检查 + 1 条真机 smoke PASS(100.0%) - 构建验证:ascend950/ascend910b kernel + ophost 全部编译通过 - 静态检查:87 项检查 0 发现(含 canndev 兼容基线对比 PASS) ## 文档更新 - README.md:UB 容量口径、动态 shape 语义、output_feeds_size 取值域、空 tensor 约束 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!6754 | 12 days ago | |
fix: FeedsRepeat 修复功能、精度与资料问题 Co-authored-by: xuxiao59<xuxiao59@huawei.com> # message auto-generated for no-merge-commit merge: !6754 merge fix/feeds_repeat into master fix: FeedsRepeat 修复功能、精度与资料问题 Created-by: gcw_xYUkRrAH Commit-by: xuxiao59 Merged-by: cann-robot Description: ## 描述 修复 FeedsRepeat 算子经全量验证(Ascend950PR,静态检查 + 用例生成 + 上板执行)发现的功能、精度与资料问题,共 13 个文件、5 类缺陷根因: **Kernel 侧(op_kernel/feeds_repeat.h)** - 为 Sum/InitOutput 的 PopStackBuffer 预留 UB 栈空间(8KB),防止 TPipe 占满 UB 后 PopStackBuffer 断言失败(设备表现为 VEC_ERROR / NO_OUTPUT / 静默错误数值) - 负 feeds_repeat_times 钳 0、Repeat 循环按剩余输出截断( write_times = min(repeat_times, row_remain)),消除 sum(repeats) > output_feeds_size 时的块内越界写 - ClearOutputSpace 清零起点 end_index 钳制到 [0, empty_size],消除负数经 uint32 回绕导致的块外越界写 - 循环计数器 int 转 int64_t,防大 shape 溢出 **Tiling 侧(op_host/feeds_repeat_tiling.cpp)** - feeds 秩校验前移至 GetDim(0) 之前(rank-0 不再越界读) - feeds_repeat_times 容量上限按平台 UB 动态计算(含 8KB 栈预留),A2/A3 约 92KB、950 约 120KB - 空 tensor(dim0<1 / batch_num<=0)明确拒绝 - feeds_repeat_times 逐维溢出保护(累乘前检查 INT64_MAX) - output_feeds_size 负值拒绝 **InferShape 侧(op_host/feeds_repeat_infershape.cpp)** - 必选属性 output_feeds_size 判空与取值域校验前移至未知 Rank 早退之前 - 逐维判定 feeds_repeat_times 元素总数未知性(含偶数个 -1 维时 GetShapeSize 返回正积的边界),未知时跳过计数校验、由执行阶段 tiling 完成 **Proto(op_graph/feeds_repeat_proto.h)** - feeds/y dtype 从 TensorType::BasicType() 收紧为 {FP16, FP32, BF16}(与 def.cpp/InferDataType 同口径) **样例(examples/test_geir_feeds_repeat.cpp)** - 修复宏内 "placeholder" + int 指针偏移 bug(实际生成 "laceholder1" 而非 "placeholder1") - 输入缓冲 new[] 后补 delete[](Tensor 构造拷贝数据后即释放) - 输出按 dtype 打印而非逐字节 uint8 - 提前返回路径补 GEFinalize() - WriteDataToFile 增加fwrite 结果检查 **测试资产** - golden.py 入仓 tests/assets/(双键注册 feeds_repeat/FeedsRepeat、截断语义、mix_tolerance、多维展平、设备跟随) - UT 扩容:tiling 15 例(含秩 0/溢出/UB 贴界拒绝)、infershape 8 例(含 [-2] 传播/负属性/动态维)、kernel 若干 - gen_data.py 重写(原版 import tensorflow 且 argv 传参有误无法运行);删除不可运行的 gen_tiling.py **README** - UB 容量口径由固定 48KB/64KB 改为按平台动态推导(A2/A3 约 92KB、950 约 120KB) - 动态 shape 与 -1/-2 语义、output_feeds_size 取值域、空 tensor 约束声明 - feeds_repeat_times 元素总数定义与秩不限说明 ## 关联的Issue - https://gitcode.com/wangyueting/changwei_liuyi/issues/119 (GOLDEN_FAILURE:golden 语义不一致) - https://gitcode.com/wangyueting/changwei_liuyi/issues/121 (EE9999:UB 占满致设备崩溃) - https://gitcode.com/wangyueting/changwei_liuyi/issues/122 (E90003:容量门误拒合法输入 + 空 tensor 未声明) - https://gitcode.com/wangyueting/changwei_liuyi/issues/176 (ClearOutputSpace 清零长度负数 uint32 回绕越界写) - https://gitcode.com/wangyueting/changwei_liuyi/issues/177 (Repeat 循环未按剩余输出截断覆写) ## 测试 - Host UT:23/23 PASSED(tiling 15 + infershape 8,含新增秩 0/溢出/UB 贴界/[-2]/负属性/动态维守卫用例) - Kernel 路由:全量 571 例 + 34 条原失败复测全 PASS(三模式 dyn/cst/bin 100% 精度) - GEIR 路由:全量四模式(source/binary × const/dynamic)各 58 例全 PASS - 确定性路由:56 例 × 10 次重复全部 deterministic PASS - 异常路由:21 条 L2 负例中 15 条受控拒绝(拒绝消息含具体参数值)、6 条契约未建立 - ST 自验证:56 条 L0 输入检查 + 1 条真机 smoke PASS(100.0%) - 构建验证:ascend950/ascend910b kernel + ophost 全部编译通过 - 静态检查:87 项检查 0 发现(含 canndev 兼容基线对比 PASS) ## 文档更新 - README.md:UB 容量口径、动态 shape 语义、output_feeds_size 取值域、空 tensor 约束 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!6754 | 12 days ago | |
增加A2 A3新算子支持 Co-authored-by: slx2008<shaolixin@huawei.com> # message auto-generated for no-merge-commit merge: !448 merge master into master 增加A2 A3新算子支持 Created-by: songkai111 Commit-by: slx2008 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!448 | 10 months ago | |
fix: FeedsRepeat 修复功能、精度与资料问题 Co-authored-by: xuxiao59<xuxiao59@huawei.com> # message auto-generated for no-merge-commit merge: !6754 merge fix/feeds_repeat into master fix: FeedsRepeat 修复功能、精度与资料问题 Created-by: gcw_xYUkRrAH Commit-by: xuxiao59 Merged-by: cann-robot Description: ## 描述 修复 FeedsRepeat 算子经全量验证(Ascend950PR,静态检查 + 用例生成 + 上板执行)发现的功能、精度与资料问题,共 13 个文件、5 类缺陷根因: **Kernel 侧(op_kernel/feeds_repeat.h)** - 为 Sum/InitOutput 的 PopStackBuffer 预留 UB 栈空间(8KB),防止 TPipe 占满 UB 后 PopStackBuffer 断言失败(设备表现为 VEC_ERROR / NO_OUTPUT / 静默错误数值) - 负 feeds_repeat_times 钳 0、Repeat 循环按剩余输出截断( write_times = min(repeat_times, row_remain)),消除 sum(repeats) > output_feeds_size 时的块内越界写 - ClearOutputSpace 清零起点 end_index 钳制到 [0, empty_size],消除负数经 uint32 回绕导致的块外越界写 - 循环计数器 int 转 int64_t,防大 shape 溢出 **Tiling 侧(op_host/feeds_repeat_tiling.cpp)** - feeds 秩校验前移至 GetDim(0) 之前(rank-0 不再越界读) - feeds_repeat_times 容量上限按平台 UB 动态计算(含 8KB 栈预留),A2/A3 约 92KB、950 约 120KB - 空 tensor(dim0<1 / batch_num<=0)明确拒绝 - feeds_repeat_times 逐维溢出保护(累乘前检查 INT64_MAX) - output_feeds_size 负值拒绝 **InferShape 侧(op_host/feeds_repeat_infershape.cpp)** - 必选属性 output_feeds_size 判空与取值域校验前移至未知 Rank 早退之前 - 逐维判定 feeds_repeat_times 元素总数未知性(含偶数个 -1 维时 GetShapeSize 返回正积的边界),未知时跳过计数校验、由执行阶段 tiling 完成 **Proto(op_graph/feeds_repeat_proto.h)** - feeds/y dtype 从 TensorType::BasicType() 收紧为 {FP16, FP32, BF16}(与 def.cpp/InferDataType 同口径) **样例(examples/test_geir_feeds_repeat.cpp)** - 修复宏内 "placeholder" + int 指针偏移 bug(实际生成 "laceholder1" 而非 "placeholder1") - 输入缓冲 new[] 后补 delete[](Tensor 构造拷贝数据后即释放) - 输出按 dtype 打印而非逐字节 uint8 - 提前返回路径补 GEFinalize() - WriteDataToFile 增加fwrite 结果检查 **测试资产** - golden.py 入仓 tests/assets/(双键注册 feeds_repeat/FeedsRepeat、截断语义、mix_tolerance、多维展平、设备跟随) - UT 扩容:tiling 15 例(含秩 0/溢出/UB 贴界拒绝)、infershape 8 例(含 [-2] 传播/负属性/动态维)、kernel 若干 - gen_data.py 重写(原版 import tensorflow 且 argv 传参有误无法运行);删除不可运行的 gen_tiling.py **README** - UB 容量口径由固定 48KB/64KB 改为按平台动态推导(A2/A3 约 92KB、950 约 120KB) - 动态 shape 与 -1/-2 语义、output_feeds_size 取值域、空 tensor 约束声明 - feeds_repeat_times 元素总数定义与秩不限说明 ## 关联的Issue - https://gitcode.com/wangyueting/changwei_liuyi/issues/119 (GOLDEN_FAILURE:golden 语义不一致) - https://gitcode.com/wangyueting/changwei_liuyi/issues/121 (EE9999:UB 占满致设备崩溃) - https://gitcode.com/wangyueting/changwei_liuyi/issues/122 (E90003:容量门误拒合法输入 + 空 tensor 未声明) - https://gitcode.com/wangyueting/changwei_liuyi/issues/176 (ClearOutputSpace 清零长度负数 uint32 回绕越界写) - https://gitcode.com/wangyueting/changwei_liuyi/issues/177 (Repeat 循环未按剩余输出截断覆写) ## 测试 - Host UT:23/23 PASSED(tiling 15 + infershape 8,含新增秩 0/溢出/UB 贴界/[-2]/负属性/动态维守卫用例) - Kernel 路由:全量 571 例 + 34 条原失败复测全 PASS(三模式 dyn/cst/bin 100% 精度) - GEIR 路由:全量四模式(source/binary × const/dynamic)各 58 例全 PASS - 确定性路由:56 例 × 10 次重复全部 deterministic PASS - 异常路由:21 条 L2 负例中 15 条受控拒绝(拒绝消息含具体参数值)、6 条契约未建立 - ST 自验证:56 条 L0 输入检查 + 1 条真机 smoke PASS(100.0%) - 构建验证:ascend950/ascend910b kernel + ophost 全部编译通过 - 静态检查:87 项检查 0 发现(含 canndev 兼容基线对比 PASS) ## 文档更新 - README.md:UB 容量口径、动态 shape 语义、output_feeds_size 取值域、空 tensor 约束 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!6754 | 12 days ago |
FeedsRepeat
产品支持情况
| 产品 | 是否支持 |
|---|---|
| Ascend 950PR&950DT系列产品 | √ |
| Atlas A3系列产品 | √ |
| Atlas A2系列产品 | √ |
| Atlas 200I/500 A2推理产品 | × |
| Atlas推理系列产品 | × |
| Atlas训练系列产品 | × |
| Kirin X90处理器系列产品 | √ |
| Kirin 9030处理器系列产品 | √ |
功能说明
-
算子功能:
对于输入feeds,根据输入feeds_repeat_times,将对应的feeds的第0维上的数据复制对应的次数,并将输出y的第0维padding到output_feeds_size的大小;未填充部分(超过实际复制行数的部分)置0。
参数说明
| 参数名 | 输入/输出/属性 | 描述 | 数据类型 | 数据格式 |
|---|---|---|---|---|
| feeds | 输入 | 等待处理的对象。 | BFLOAT16、FLOAT16、FLOAT32 | ND |
| feeds_repeat_times | 输入 | 描述对feeds每行的repeat次数。 | INT32、INT64 | ND |
| y | 输出 | repeat完成后的张量,dtype与feeds保持一致。 | BFLOAT16、FLOAT16、FLOAT32 | ND |
| output_feeds_size | 属性 | 输出的第0维的数值等于该数值。 | INT | - |
- Kirin X90/Kirin 9030处理器系列产品:不支持BFLOAT16。
约束说明
- feeds的秩(维度数)范围为1~8,第0维N必须与feeds_repeat_times的元素个数相同,且N≥1(不支持空Tensor,即N=0);feeds第1维起各维的乘积(每行元素个数)必须≥1。
- feeds与feeds_repeat_times的数据类型分别为FLOAT/BFLOAT16/FLOAT16与INT32/INT64,其他类型不支持。
- feeds_repeat_times的元素总数必须等于feeds的第0维N(其秩不限,通常为一维)。构图期其维度允许为动态维(-1)或未知标记(此时元素总数无法校验,校验顺延至执行阶段);执行阶段其具体维度值必须为非负整数。
- feeds_repeat_times中的负值按0处理。
- 当feeds_repeat_times各元素之和大于output_feeds_size时,超出output_feeds_size的重复行会被丢弃(输出按output_feeds_size截断)。
- 属性output_feeds_size必须为非负整数;负值会在算子执行准备阶段(tiling)被拒绝。
- 支持动态shape:GEIR图模式下构图时输入维度可使用-1(动态维),执行时以运行时下发的具体shape为准;feeds为[-2](未知Rank)时,输出y传播为未知Rank[-2]。执行阶段要求feeds与feeds_repeat_times的具体维度值非负。
- 说明:-1/-2标记仅在构图与shape推导阶段生效——InferShape对含标记的输入跳过数值校验(或按未知Rank传播),而执行阶段由tiling以运行时下发的具体shape完成校验,具体维度值非负才会放行执行。
- 算子实现过程中,feeds_repeat_times需搬入UB并做精度转换和累加,其字节数受片上UB容量限制:tiling按2倍字节占用加约8 KB预留与UB容量比较,超出即拒绝。当前实现下,feeds_repeat_times占用的字节数在Atlas A2/A3系列产品不能超过约92 KB,在Ascend 950PR&950DT系列产品不能超过约120 KB。
- 行偏移量(各行的复制起点与清零位置)由feeds_repeat_times经float32累加得到;当单个或前缀累计的重复次数超过2^24时,行偏移可能出现偏差,请避免使用超过该量级的重复次数。
调用说明
| 调用方式 | 样例代码 | 说明 |
|---|---|---|
| GE图模式 | test_geir_feeds_repeat | 通过feeds_repeat_proto接口方式调用feeds_repeat算子。 |