| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
master分支alcnn文档英文合入 Co-authored-by: y60124828<yanglou1@h-partners.com> # message auto-generated for no-merge-commit merge: !13019 merge master into master master分支alcnn文档英文合入 Created-by: yanglu-1 Commit-by: y60124828 Merged-by: cann-robot Description: ## 描述 master分支alcnn文档英文合入 ## 关联的Issue 关联Issue [#6089](https://gitcode.com/cann/ops-nn/issues/6089) ## 测试 <!--描述进行了哪些测试来验证你的改动。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!13019 | 4 天前 | |
format cpp Co-authored-by: yang-di52<yangdi52@huawei.com> # message auto-generated for no-merge-commit merge: !6784 merge issue_fix into master format cpp Created-by: yang-di52 Commit-by: yang-di52 Merged-by: cann-robot Description: ## 描述 批量刷新cpp代码格式 ## 关联的Issue [#3791](https://gitcode.com/cann/ops-nn/issues/3791) ## 测试 <!--描述进行了哪些测试来验证你的改动。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:代码格式化 ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!6784 | 3 个月前 | |
grouped_quant_max modified nullptr 161001 Co-authored-by: yin-peng<yinpeng37@huawei.com> # message auto-generated for no-merge-commit merge: !9669 merge grouped_quant_max_issue into master grouped_quant_max modified nullptr 161001 Created-by: yin-peng Commit-by: yin-peng Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 修改aclnn校验roundMode 空指针的报错码为161001 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> 关联Issue [#5375](https://gitcode.com/cann/ops-nn/issues/5375) ## 测试 <!--描述进行了哪些测试来验证你的改动。--> 本地ut验证 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!9669 | 2 个月前 | |
【bugfix】GroupedQuantMax修复 Co-authored-by: yin-peng-hw<yinpeng37@huawei.com> # message auto-generated for no-merge-commit merge: !6949 merge GroupedQuantMaxDTS into master 【bugfix】GroupedQuantMax修复 Created-by: yin-peng Commit-by: yin-peng-hw Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> GroupedQuantMax的输出amax在GM中先进行清零操作; 部分tilingdata格式整改; 原型对部分输入输出添加format的描述; Readme.md文档中添加对num_groups的范围描述。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> 关联Issue [#3877](https://gitcode.com/cann/ops-nn/issues/3877) ## 测试 <!--描述进行了哪些测试来验证你的改动。--> 泛化测试验证 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> 更新了README.md文件 ## 类型标签 <!-- [x] 表示选中 --> - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!6949 | 3 个月前 | |
perf(ge_glu_grad_v2): arch35 VF tiling 分核切分优化并补充 host tiling UT Co-authored-by: TH_HW<taohai2@huawei.com> # message auto-generated for no-merge-commit merge: !12548 merge perf/ge-glu-grad-v2-vf-tiling into master perf(ge_glu_grad_v2): arch35 VF tiling 分核切分优化并补充 host tiling UT Created-by: TH_HW Commit-by: TH_HW Merged-by: cann-robot Description: ## 描述 本次提交针对 arch35(regbase)平台优化 GeGluGradV2 的 VF 计算与 tiling 分核切分,降低 kernel 时延,并补充 host tiling UT; 同时附带 GroupedQuantMax 的 ascend960dt 平台适配与测试 golden/input 资产。 **一、ge_glu_grad_v2 op_host tiling(ge_glu_grad_v2_tiling.cpp)** - Init() 增加 approximate 取值校验,仅允许 0(erf)或 1(tanh),非法值 直接返回失败并给出原因; - CheckParams() 中 dx 的 dtype 改为通过输出描述 GetOutputDesc(DX_INDEX) 获取, 并补充空指针校验,不再从输入描述读取输出 dtype; - ProcessTilingCore() 调整 regbase 分核策略: - perf(pack/transpose)通路增加门槛:regbase 下当 N < totalCoreNum * 2 时关闭 perf 通路、改走 direct 通路,避免为极小 N 支付 transpose 的固定开销; - direct 通路(M <= maxProcCount)不再固定按 maxProcCount / alignM 分组,改为以 每核行预算 ceil(N / totalCoreNum) 为基准,取最小 UB 波次并均衡每波行数; 对 FP32 erf,当行预算单波可容纳但每核 padding 后元素数达到 REGBASE_FP32_PIPELINE_MIN_ELEMENTS = 2048 时仍保留两波,以维持 MTE/VF 双流水 重叠;tanh 保持最小波次,避免额外 task 开销; - 大 M 通路(M > maxProcCount)在 regbase 上对最后一个 M tile 做均衡切分 (tileNum = ceil(M / cap),balancedTile = ceil(M / tileNum) 再向上对齐), 避免 M = 容量 + 1 时出现「满 tile + 极小尾 tile」的负载不均; - 非 regbase 路径行为保持不变。 **二、ge_glu_grad_v2 op_kernel arch35(erf/tanh base 与 FP32 实现)** - ge_glu_grad_v2_erf_base.h / ge_glu_grad_v2_tanh_base.h 新增通用 ProcessFused 与 CopyOutBoth:一次完成左右半部数据的搬入、计算与双路 dx 搬出, 替代原先分别处理左右半部的两段式流程; - ge_glu_grad_v2_erf_fp32.h / ge_glu_grad_v2_tanh_fp32.h 的非 perf 分支由 ProcessLessEqual / ProcessGreater + ComputeLeftHalf / ComputeRightHalf 改为 ProcessFused + ComputeFused:在单个 __VEC_SCOPE__ 内用 RegTensor 一轮完成 gate*dy、CDF/PDF(erf)或 tanh 导数以及左右两路 dx 的计算,减少 VF 循环次数与队列切换;非 __CCE_AICORE__ 编译时回退到原两段式计算。数学表达与原实现 保持一致(erf 的 CDF 近似系数、tanh 的 d = 1/(1+p) 形式均未改变); - erf/tanh base 的大 M 通路 task 映射由跨步分配 (needCoreNum * idx + blockIdx) 改为连续区间分配 firstTask = blockIdx * loopNumPerCore + (blockIdx < tailCoreIndex ? blockIdx : tailCoreIndex), 使行尾 tile 均匀分摊到各核,不再反复落在同一批核上; - FP16 / BF16 的 Process 分支未改动。 **三、ge_glu_grad_v2 host tiling UT(tests/ut/op_host/test_ge_glu_grad_v2_tiling.cpp)** - 新增 regbase_balanced_tiles_do_not_create_an_extra_tail:在 DAV_3510 下覆盖 5 组(fp16/bf16/fp32 × erf/tanh)大 M 场景,校验均衡切分后的 maxProcCount、 groupNum、blockDim,并确认尾 tile 非空、未产生额外 task; - 新增 regbase_direct_group_uses_per_core_budget:覆盖 17 组 dtype / approximate / N / M 组合,校验 direct 通路的 groupNum、blockDim、groupNum * alignedM <= maxProcCount 以及 groupNum 对 N 的完整覆盖关系,并包含 FP32 erf 双波次阈值(2048 元素)的边界用例。 **四、GroupedQuantMax 平台适配与测试资产(附带改动)** - CMakeLists.txt 的 SUPPORT_COMPUTE_UNIT 增加 ascend960dt(复用 arch35 tiling 目录),grouped_quant_max_def.cpp 为 AICore 增加 ascend960dt 配置, 复用 aicoreConfig950; - 新增 tests/assets/golden.py:按 group_list 累积偏移语义(单调不减、 group_list[-1] == x.shape[0])实现参考结果,覆盖空 tensor / 空 group 早退、 分组 amax = max(|x|) 并转回 x dtype、y = SAT-cast(x * scale[g]) 到 hifloat8 / float8_e5m2 / float8_e4m3fn(dst_type 34/35/36);其中 hifloat8 的 hybrid 与 rint 均复用 astype 路径(仓库暂无 hybrid 专用转换),代码注释中已标注为 待跟进项; - 新增 tests/assets/input.py:将随机生成的 group_list 归一化为合法累积偏移 (排序、截断到 [0, x.shape[0]]、末元素置为 x.shape[0]),保证 device 侧与 golden 侧消费同一份合法输入。 ## 关联的Issue 暂无关联 Issue。 ## 测试 - 本地执行 bash build.sh -u --ops=ge_glu_grad_v2 --ut_mode=fast -j16,编译通过: - host UT 共 4 个测试套件 26 个用例全部 PASS,其中包含本次新增的 GeGluGradV2Tiling.regbase_balanced_tiles_do_not_create_an_extra_tail 与 GeGluGradV2Tiling.regbase_direct_group_uses_per_core_budget; - kernel UT 汇总 total=12, pass=12, fail=0, timeout=0(FP32 erf/tanh 等 key 用例 在新 ProcessFused 路径下通过); - 新增 tiling UT 直接断言 tiling data 中的 maxProcCount、groupNum 与 blockDim,并校验 groupNum * alignedM <= maxProcCount、N 覆盖等式与尾 tile 非空; - grouped_quant_max 本次提交仅新增 tests/assets 下的 golden/input 资产与平台配置, 提交中未包含该算子的用例执行结果; - 本次提交未包含上板性能对比数据,性能收益以 CI 或独立性能采集结果为准。 ## 文档更新 本次提交未修改算子使用文档(aclnnGeGluBackward.md、aclnnGeGluV3Backward.md 等均未变更);本文件仅用于补充本次 PR 的变更说明。 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [x] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:host tiling UT 补充;GroupedQuantMax 增加 ascend960dt 平台配置与 测试 golden/input 资产;tiling 参数校验(approximate 取值、dx dtype 取值来源)增强 ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [x] AI辅助编写 See merge request: cann/ops-nn!12548 | 4 天前 | |
【bugfix】GroupedQuantMax修复 Co-authored-by: yin-peng-hw<yinpeng37@huawei.com> # message auto-generated for no-merge-commit merge: !6949 merge GroupedQuantMaxDTS into master 【bugfix】GroupedQuantMax修复 Created-by: yin-peng Commit-by: yin-peng-hw Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> GroupedQuantMax的输出amax在GM中先进行清零操作; 部分tilingdata格式整改; 原型对部分输入输出添加format的描述; Readme.md文档中添加对num_groups的范围描述。 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。例如:关联Issue #000--> 关联Issue [#3877](https://gitcode.com/cann/ops-nn/issues/3877) ## 测试 <!--描述进行了哪些测试来验证你的改动。--> 泛化测试验证 ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> 更新了README.md文件 ## 类型标签 <!-- [x] 表示选中 --> - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!6949 | 3 个月前 | |
perf(ge_glu_grad_v2): arch35 VF tiling 分核切分优化并补充 host tiling UT Co-authored-by: TH_HW<taohai2@huawei.com> # message auto-generated for no-merge-commit merge: !12548 merge perf/ge-glu-grad-v2-vf-tiling into master perf(ge_glu_grad_v2): arch35 VF tiling 分核切分优化并补充 host tiling UT Created-by: TH_HW Commit-by: TH_HW Merged-by: cann-robot Description: ## 描述 本次提交针对 arch35(regbase)平台优化 GeGluGradV2 的 VF 计算与 tiling 分核切分,降低 kernel 时延,并补充 host tiling UT; 同时附带 GroupedQuantMax 的 ascend960dt 平台适配与测试 golden/input 资产。 **一、ge_glu_grad_v2 op_host tiling(ge_glu_grad_v2_tiling.cpp)** - Init() 增加 approximate 取值校验,仅允许 0(erf)或 1(tanh),非法值 直接返回失败并给出原因; - CheckParams() 中 dx 的 dtype 改为通过输出描述 GetOutputDesc(DX_INDEX) 获取, 并补充空指针校验,不再从输入描述读取输出 dtype; - ProcessTilingCore() 调整 regbase 分核策略: - perf(pack/transpose)通路增加门槛:regbase 下当 N < totalCoreNum * 2 时关闭 perf 通路、改走 direct 通路,避免为极小 N 支付 transpose 的固定开销; - direct 通路(M <= maxProcCount)不再固定按 maxProcCount / alignM 分组,改为以 每核行预算 ceil(N / totalCoreNum) 为基准,取最小 UB 波次并均衡每波行数; 对 FP32 erf,当行预算单波可容纳但每核 padding 后元素数达到 REGBASE_FP32_PIPELINE_MIN_ELEMENTS = 2048 时仍保留两波,以维持 MTE/VF 双流水 重叠;tanh 保持最小波次,避免额外 task 开销; - 大 M 通路(M > maxProcCount)在 regbase 上对最后一个 M tile 做均衡切分 (tileNum = ceil(M / cap),balancedTile = ceil(M / tileNum) 再向上对齐), 避免 M = 容量 + 1 时出现「满 tile + 极小尾 tile」的负载不均; - 非 regbase 路径行为保持不变。 **二、ge_glu_grad_v2 op_kernel arch35(erf/tanh base 与 FP32 实现)** - ge_glu_grad_v2_erf_base.h / ge_glu_grad_v2_tanh_base.h 新增通用 ProcessFused 与 CopyOutBoth:一次完成左右半部数据的搬入、计算与双路 dx 搬出, 替代原先分别处理左右半部的两段式流程; - ge_glu_grad_v2_erf_fp32.h / ge_glu_grad_v2_tanh_fp32.h 的非 perf 分支由 ProcessLessEqual / ProcessGreater + ComputeLeftHalf / ComputeRightHalf 改为 ProcessFused + ComputeFused:在单个 __VEC_SCOPE__ 内用 RegTensor 一轮完成 gate*dy、CDF/PDF(erf)或 tanh 导数以及左右两路 dx 的计算,减少 VF 循环次数与队列切换;非 __CCE_AICORE__ 编译时回退到原两段式计算。数学表达与原实现 保持一致(erf 的 CDF 近似系数、tanh 的 d = 1/(1+p) 形式均未改变); - erf/tanh base 的大 M 通路 task 映射由跨步分配 (needCoreNum * idx + blockIdx) 改为连续区间分配 firstTask = blockIdx * loopNumPerCore + (blockIdx < tailCoreIndex ? blockIdx : tailCoreIndex), 使行尾 tile 均匀分摊到各核,不再反复落在同一批核上; - FP16 / BF16 的 Process 分支未改动。 **三、ge_glu_grad_v2 host tiling UT(tests/ut/op_host/test_ge_glu_grad_v2_tiling.cpp)** - 新增 regbase_balanced_tiles_do_not_create_an_extra_tail:在 DAV_3510 下覆盖 5 组(fp16/bf16/fp32 × erf/tanh)大 M 场景,校验均衡切分后的 maxProcCount、 groupNum、blockDim,并确认尾 tile 非空、未产生额外 task; - 新增 regbase_direct_group_uses_per_core_budget:覆盖 17 组 dtype / approximate / N / M 组合,校验 direct 通路的 groupNum、blockDim、groupNum * alignedM <= maxProcCount 以及 groupNum 对 N 的完整覆盖关系,并包含 FP32 erf 双波次阈值(2048 元素)的边界用例。 **四、GroupedQuantMax 平台适配与测试资产(附带改动)** - CMakeLists.txt 的 SUPPORT_COMPUTE_UNIT 增加 ascend960dt(复用 arch35 tiling 目录),grouped_quant_max_def.cpp 为 AICore 增加 ascend960dt 配置, 复用 aicoreConfig950; - 新增 tests/assets/golden.py:按 group_list 累积偏移语义(单调不减、 group_list[-1] == x.shape[0])实现参考结果,覆盖空 tensor / 空 group 早退、 分组 amax = max(|x|) 并转回 x dtype、y = SAT-cast(x * scale[g]) 到 hifloat8 / float8_e5m2 / float8_e4m3fn(dst_type 34/35/36);其中 hifloat8 的 hybrid 与 rint 均复用 astype 路径(仓库暂无 hybrid 专用转换),代码注释中已标注为 待跟进项; - 新增 tests/assets/input.py:将随机生成的 group_list 归一化为合法累积偏移 (排序、截断到 [0, x.shape[0]]、末元素置为 x.shape[0]),保证 device 侧与 golden 侧消费同一份合法输入。 ## 关联的Issue 暂无关联 Issue。 ## 测试 - 本地执行 bash build.sh -u --ops=ge_glu_grad_v2 --ut_mode=fast -j16,编译通过: - host UT 共 4 个测试套件 26 个用例全部 PASS,其中包含本次新增的 GeGluGradV2Tiling.regbase_balanced_tiles_do_not_create_an_extra_tail 与 GeGluGradV2Tiling.regbase_direct_group_uses_per_core_budget; - kernel UT 汇总 total=12, pass=12, fail=0, timeout=0(FP32 erf/tanh 等 key 用例 在新 ProcessFused 路径下通过); - 新增 tiling UT 直接断言 tiling data 中的 maxProcCount、groupNum 与 blockDim,并校验 groupNum * alignedM <= maxProcCount、N 覆盖等式与尾 tile 非空; - grouped_quant_max 本次提交仅新增 tests/assets 下的 golden/input 资产与平台配置, 提交中未包含该算子的用例执行结果; - 本次提交未包含上板性能对比数据,性能收益以 CI 或独立性能采集结果为准。 ## 文档更新 本次提交未修改算子使用文档(aclnnGeGluBackward.md、aclnnGeGluV3Backward.md 等均未变更);本文件仅用于补充本次 PR 的变更说明。 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [x] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:host tiling UT 补充;GroupedQuantMax 增加 ascend960dt 平台配置与 测试 golden/input 资产;tiling 参数校验(approximate 取值、dx dtype 取值来源)增强 ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [x] AI辅助编写 See merge request: cann/ops-nn!12548 | 4 天前 | |
perf(ge_glu_grad_v2): arch35 VF tiling 分核切分优化并补充 host tiling UT Co-authored-by: TH_HW<taohai2@huawei.com> # message auto-generated for no-merge-commit merge: !12548 merge perf/ge-glu-grad-v2-vf-tiling into master perf(ge_glu_grad_v2): arch35 VF tiling 分核切分优化并补充 host tiling UT Created-by: TH_HW Commit-by: TH_HW Merged-by: cann-robot Description: ## 描述 本次提交针对 arch35(regbase)平台优化 GeGluGradV2 的 VF 计算与 tiling 分核切分,降低 kernel 时延,并补充 host tiling UT; 同时附带 GroupedQuantMax 的 ascend960dt 平台适配与测试 golden/input 资产。 **一、ge_glu_grad_v2 op_host tiling(ge_glu_grad_v2_tiling.cpp)** - Init() 增加 approximate 取值校验,仅允许 0(erf)或 1(tanh),非法值 直接返回失败并给出原因; - CheckParams() 中 dx 的 dtype 改为通过输出描述 GetOutputDesc(DX_INDEX) 获取, 并补充空指针校验,不再从输入描述读取输出 dtype; - ProcessTilingCore() 调整 regbase 分核策略: - perf(pack/transpose)通路增加门槛:regbase 下当 N < totalCoreNum * 2 时关闭 perf 通路、改走 direct 通路,避免为极小 N 支付 transpose 的固定开销; - direct 通路(M <= maxProcCount)不再固定按 maxProcCount / alignM 分组,改为以 每核行预算 ceil(N / totalCoreNum) 为基准,取最小 UB 波次并均衡每波行数; 对 FP32 erf,当行预算单波可容纳但每核 padding 后元素数达到 REGBASE_FP32_PIPELINE_MIN_ELEMENTS = 2048 时仍保留两波,以维持 MTE/VF 双流水 重叠;tanh 保持最小波次,避免额外 task 开销; - 大 M 通路(M > maxProcCount)在 regbase 上对最后一个 M tile 做均衡切分 (tileNum = ceil(M / cap),balancedTile = ceil(M / tileNum) 再向上对齐), 避免 M = 容量 + 1 时出现「满 tile + 极小尾 tile」的负载不均; - 非 regbase 路径行为保持不变。 **二、ge_glu_grad_v2 op_kernel arch35(erf/tanh base 与 FP32 实现)** - ge_glu_grad_v2_erf_base.h / ge_glu_grad_v2_tanh_base.h 新增通用 ProcessFused 与 CopyOutBoth:一次完成左右半部数据的搬入、计算与双路 dx 搬出, 替代原先分别处理左右半部的两段式流程; - ge_glu_grad_v2_erf_fp32.h / ge_glu_grad_v2_tanh_fp32.h 的非 perf 分支由 ProcessLessEqual / ProcessGreater + ComputeLeftHalf / ComputeRightHalf 改为 ProcessFused + ComputeFused:在单个 __VEC_SCOPE__ 内用 RegTensor 一轮完成 gate*dy、CDF/PDF(erf)或 tanh 导数以及左右两路 dx 的计算,减少 VF 循环次数与队列切换;非 __CCE_AICORE__ 编译时回退到原两段式计算。数学表达与原实现 保持一致(erf 的 CDF 近似系数、tanh 的 d = 1/(1+p) 形式均未改变); - erf/tanh base 的大 M 通路 task 映射由跨步分配 (needCoreNum * idx + blockIdx) 改为连续区间分配 firstTask = blockIdx * loopNumPerCore + (blockIdx < tailCoreIndex ? blockIdx : tailCoreIndex), 使行尾 tile 均匀分摊到各核,不再反复落在同一批核上; - FP16 / BF16 的 Process 分支未改动。 **三、ge_glu_grad_v2 host tiling UT(tests/ut/op_host/test_ge_glu_grad_v2_tiling.cpp)** - 新增 regbase_balanced_tiles_do_not_create_an_extra_tail:在 DAV_3510 下覆盖 5 组(fp16/bf16/fp32 × erf/tanh)大 M 场景,校验均衡切分后的 maxProcCount、 groupNum、blockDim,并确认尾 tile 非空、未产生额外 task; - 新增 regbase_direct_group_uses_per_core_budget:覆盖 17 组 dtype / approximate / N / M 组合,校验 direct 通路的 groupNum、blockDim、groupNum * alignedM <= maxProcCount 以及 groupNum 对 N 的完整覆盖关系,并包含 FP32 erf 双波次阈值(2048 元素)的边界用例。 **四、GroupedQuantMax 平台适配与测试资产(附带改动)** - CMakeLists.txt 的 SUPPORT_COMPUTE_UNIT 增加 ascend960dt(复用 arch35 tiling 目录),grouped_quant_max_def.cpp 为 AICore 增加 ascend960dt 配置, 复用 aicoreConfig950; - 新增 tests/assets/golden.py:按 group_list 累积偏移语义(单调不减、 group_list[-1] == x.shape[0])实现参考结果,覆盖空 tensor / 空 group 早退、 分组 amax = max(|x|) 并转回 x dtype、y = SAT-cast(x * scale[g]) 到 hifloat8 / float8_e5m2 / float8_e4m3fn(dst_type 34/35/36);其中 hifloat8 的 hybrid 与 rint 均复用 astype 路径(仓库暂无 hybrid 专用转换),代码注释中已标注为 待跟进项; - 新增 tests/assets/input.py:将随机生成的 group_list 归一化为合法累积偏移 (排序、截断到 [0, x.shape[0]]、末元素置为 x.shape[0]),保证 device 侧与 golden 侧消费同一份合法输入。 ## 关联的Issue 暂无关联 Issue。 ## 测试 - 本地执行 bash build.sh -u --ops=ge_glu_grad_v2 --ut_mode=fast -j16,编译通过: - host UT 共 4 个测试套件 26 个用例全部 PASS,其中包含本次新增的 GeGluGradV2Tiling.regbase_balanced_tiles_do_not_create_an_extra_tail 与 GeGluGradV2Tiling.regbase_direct_group_uses_per_core_budget; - kernel UT 汇总 total=12, pass=12, fail=0, timeout=0(FP32 erf/tanh 等 key 用例 在新 ProcessFused 路径下通过); - 新增 tiling UT 直接断言 tiling data 中的 maxProcCount、groupNum 与 blockDim,并校验 groupNum * alignedM <= maxProcCount、N 覆盖等式与尾 tile 非空; - grouped_quant_max 本次提交仅新增 tests/assets 下的 golden/input 资产与平台配置, 提交中未包含该算子的用例执行结果; - 本次提交未包含上板性能对比数据,性能收益以 CI 或独立性能采集结果为准。 ## 文档更新 本次提交未修改算子使用文档(aclnnGeGluBackward.md、aclnnGeGluV3Backward.md 等均未变更);本文件仅用于补充本次 PR 的变更说明。 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [x] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:host tiling UT 补充;GroupedQuantMax 增加 ascend960dt 平台配置与 测试 golden/input 资产;tiling 参数校验(approximate 取值、dx dtype 取值来源)增强 ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [x] AI辅助编写 See merge request: cann/ops-nn!12548 | 4 天前 | |
修改产品名 Co-authored-by: fwx1169505<fengying27@h-partners.com> # message auto-generated for no-merge-commit merge: !11017 merge master into master 修改产品名 Created-by: fengying555682 Commit-by: fwx1169505 Merged-by: cann-robot Description: ## 描述 修改quant和activation文件夹中的md文档涉及的产品名称 ## 关联的Issue [#6056](https://gitcode.com/cann/ops-nn/issues/6056) ## 测试 已经完成文档语法和链接一致性检测 ## 文档更新 quant和activation文件夹中的md文档 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x ] 文档更新 - [ ] 其他,请描述: ## AI/Agent生成声明 <!-- [x] 表示选中 --> - [ ] AI辅助编写 See merge request: cann/ops-nn!11017 | 1 个月前 |
GroupedQuantMax
产品支持情况
| 产品 | 是否支持 |
|---|---|
| Ascend 950PR&950DT系列产品 | √ |
| Atlas A3系列产品 | × |
| Atlas A2系列产品 | × |
| Atlas 200I/500 A2推理产品 | × |
| Atlas推理系列产品 | × |
| Atlas训练系列产品 | × |
功能说明
-
算子功能:根据输入的scale对输入x进行分组量化,并分组计算输入x的绝对值的最大值amax。
-
计算公式:
group_listgroup\_listgroup_list 沿 dim-0 将 xxx 切分为 num_groups 组,group_list[g]group\_list[g]group_list[g] 为前 g+1g+1g+1 组在 dim-0 上的累计大小(单调递增,group_list[−1]=x.shape[0]group\_list[-1]=x.shape[0]group_list[−1]=x.shape[0])。对每个group(g = 0, 1, ..., num_groups - 1):
x_g=x[group_list[g−1]:group_list[g],...]x\_g = x[group\_list[g-1] : group\_list[g], ...] x_g=x[group_list[g−1]:group_list[g],...]
y=Cast(x_g×scale[g],dst_type,round_mode)y = \text{Cast}(x\_g \times scale[g], \text{dst\_type}, \text{round\_mode}) y=Cast(x_g×scale[g],dst_type,round_mode)
amax[g]=max(∣x_g∣)amax[g] = \max(|x\_g|) amax[g]=max(∣x_g∣)
其中,xxx 表示输入张量,x_gx\_gx_g 表示输入张量的第g组数据,g=0 时下界为0;scalescalescale 表示量化缩放因子,amax[g]amax[g]amax[g] 为输入张量对应group组绝对值的最大值,dst_type\text{dst\_type}dst_type指定输出类型,round_mode\text{round\_mode}round_mode指定舍入模式。
参数说明
| 参数名 | 输入/输出/属性 | 描述 | 数据类型 | 数据格式 |
|---|---|---|---|---|
| x | 输入 | 待量化的输入张量,对应公式中的x。支持2-8维任意shape。 | FLOAT、FLOAT16、BFLOAT16 | ND |
| scale | 输入 | 量化缩放因子,对应公式中的scale。shape固定为[num_groups]。 | FLOAT | ND |
| group_list | 输入 | 表示输入x在0轴上每个group的偏移(cumsum模式),对应公式中group_list。shape固定为[num_groups]。 | INT64 | ND |
| y | 输出 | 量化后的输出张量,对应公式中的y。shape与x相同,数据类型由dst_type决定。 | HIFLOAT8、FLOAT8_E5M2、FLOAT8_E4M3 | ND |
| amax | 输出 | x绝对值的最大值,对应公式中的amax。shape固定为[num_groups],数据类型与x一致。 | FLOAT、FLOAT16、BFLOAT16 | ND |
| round_mode | 属性 | 取值需为Cast API支持的有效舍入模式。 | string | - |
| dst_type | 属性 | 指定输出量化数据类型。34=HIFLOAT8,35=FLOAT8_E5M2,36=FLOAT8_E4M3。 | int | - |
约束说明
round_mode与dst_type的匹配关系:- 当
dst_type为35或36时,round_mode必须为"rint"。 - 当
dst_type为34时,round_mode必须为"round"或"hybrid"。
- 当
- num_groups的范围目前仅支持1-384。
调用说明
| 调用方式 | 调用样例 | 说明 |
|---|---|---|
| aclnn调用 | test_aclnn_grouped_quant_max | 通过aclnnGroupedQuantMax接口方式调用GroupedQuantMax算子。 |
| 图模式调用 | - | 通过算子IR构图方式调用GroupedQuantMax算子。 |