| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
FFT算子新增 Co-authored-by: Tian_1122<tianjunhan@h-partners.com> # message auto-generated for no-merge-commit merge: !27 merge master into master FFT算子新增 Created-by: Tian_1122 Commit-by: Tian_1122 Merged-by: cann-robot Description: ## 变更描述 / Description <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> 新增 4 个 FFT 算子实现,并重构公共 kernel 层。 **新增算子** - fft1_d arch32 mix:C2C 混合基数(910B) - fft1_d arch35 mix:C2C Stockham 混合基数(950) - irfft1_d arch32 c2r_fft:C2R FFT(910B) - rfft1_d arch32 r2c_fft:R2C FFT(910B) **其他改动** - 公共 kernel 重构:base 头文件移入 kernel/base/,新增共享层 fft_all_common / fft_c2c_common / fft_c2r_common / fft_r2c_common - 命名空间、宏命名修正,移除冗余注释 - 修复 irfft1_d.h 缺失的 aclfftIrfft1DDft 声明 - rfft1_d arch35 R2C 选核:FFT 优先、FastDFT 兜底 - aclfftMakePlan1d 头文件参数名 stride → dimType,补全 @param 注释 - 文档更新:FFT_1D.md 约束说明、目录结构、开发指南、测试指南 - 许可证名称修正 ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [x] 新功能 / New Feature - [ ] 性能优化 / Performance - [x] 代码重构 / Refactoring - [x] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> [#2](https://gitcode.com/cann/ops-fft/issues/2) [#13](https://gitcode.com/cann/ops-fft/issues/13) ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [ ] 单元测试通过 / UT passed - [ ] 集成测试通过 / ST passed - [ ] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [ ] 代码符合规范 / Code follows style guide - [ ] 测试添加并通过 / Tests added and passed - [x] 文档已更新 / Docs updated if needed - [ ] 无硬编码敏感信息 / No secrets hardcoded - [ ] 提交信息符合规范 / Commit message follows convention See merge request: cann/ops-fft!27 | 27 天前 | |
fix: 修复 FFT 算子 host 侧缓冲区尺寸计算的整数溢出 Co-authored-by: Tian_1122<tianjunhan@h-partners.com> # message auto-generated for no-merge-commit merge: !33 merge fix/fft-integer-overflow into master fix: 修复 FFT 算子 host 侧缓冲区尺寸计算的整数溢出 Created-by: Tian_1122 Commit-by: Tian_1122 Merged-by: cann-robot Description: <!-- 感谢您的合入申请! --> ### 当前PR是否有AI参与: [x] 否 [ ] 是 __1. AI Agent 平台: __2. AI 模型: __3. Prompt上下文 : ### PR功能描述 / 为什么需要这个合入**: <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> 本 PR 修复 FFT 算子 host 侧缓冲区尺寸计算的整数溢出缺陷(9 处,8 文件,19±19 行)。 - 问题:aclfftFft1DN / Fft1DStride / Fft1DB / Fft1DMix / Fft2DDd / Irfft1DC2RFft / Rfft1DR2CFft / Irfft1DFft 等函数将 inputSize / outputSize / workspaceSize 声明为 uint32_t。表达式 n * batches * sizeof(float) * 2 等左结合求值时,n*batches 先在 uint32_t 算术下溢出(>2^32 回绕),赋给 uint32_t 再截断一次。导致 aclrtMalloc 按截断后的小值分配设备内存,而 kernel 按 tiling 中真实 n/batches 写完整数据 → 设备内存越界(静默堆溢出 / 结果错乱)。 - 修正原因:用库自身配置表支持的参数、经公开 API 即可触发。以 910B3(HBM 64GB)为例,tier3 n=16384 × batch=65536 真实输入缓冲 8GB(可存进 64GB),当前实现截断为 0 字节分配后 kernel 写 8GB → 必失败;多个支持档位(tier3 fftB/fftN、stride 路径 n=262144、R2C/C2R 大 batch、2D DD)均落入"4GB < 真实尺寸 ≤ 31GB"的"可行且必失败"范围。 - 根因旁证:lib/fft_plan_init_api.cpp:43-50 已用 size_t 正确计算 plan->input_size,fft_handle_impl.h:35 亦存 size_t input_size —— 库本就按支持大尺寸设计,arch 函数用 uint32_t 重算是实现问题,应"进行size_t 改造让大尺寸能跑"而非"在 plan 加上界拒绝"。 - 改法:变量 uint32_t → size_t(消赋值截断)+ 首操作数 static_cast<size_t>(n/batches)(强制乘法从第一步走 64 位)。只动随 n×batch 放大的 size 量,不碰 wMatrix/tMatrix/index/scratch 等固定量;常规尺寸(<4GB)行为不变。 ### 该PR关联的issue *(格式为fixes #<issue号>, 或者resolves #<issue号>)*: fixes # fixes [#22](https://gitcode.com/cann/ops-fft/issues/22) fixes [#23](https://gitcode.com/cann/ops-fft/issues/23) fixes [#24](https://gitcode.com/cann/ops-fft/issues/24) fixes [#25](https://gitcode.com/cann/ops-fft/issues/25) fixes [#26](https://gitcode.com/cann/ops-fft/issues/26) fixes [#31](https://gitcode.com/cann/ops-fft/issues/31) fixes [#32](https://gitcode.com/cann/ops-fft/issues/32) fixes [#33](https://gitcode.com/cann/ops-fft/issues/33) fixes [#34](https://gitcode.com/cann/ops-fft/issues/34) ### 希望检视人员了解: ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [x] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [x] 单元测试通过 / UT passed - [x] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [x] 代码符合规范 / Code follows style guide - [x] 测试添加并通过 / Tests added and passed - [ ] 文档已更新 / Docs updated if needed - [ ] 无硬编码敏感信息 / No secrets hardcoded - [ ] 提交信息符合规范 / Commit message follows convention See merge request: cann/ops-fft!33 | 9 天前 | |
fix: 修复 FFT 算子 host 侧缓冲区尺寸计算的整数溢出 Co-authored-by: Tian_1122<tianjunhan@h-partners.com> # message auto-generated for no-merge-commit merge: !33 merge fix/fft-integer-overflow into master fix: 修复 FFT 算子 host 侧缓冲区尺寸计算的整数溢出 Created-by: Tian_1122 Commit-by: Tian_1122 Merged-by: cann-robot Description: <!-- 感谢您的合入申请! --> ### 当前PR是否有AI参与: [x] 否 [ ] 是 __1. AI Agent 平台: __2. AI 模型: __3. Prompt上下文 : ### PR功能描述 / 为什么需要这个合入**: <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> 本 PR 修复 FFT 算子 host 侧缓冲区尺寸计算的整数溢出缺陷(9 处,8 文件,19±19 行)。 - 问题:aclfftFft1DN / Fft1DStride / Fft1DB / Fft1DMix / Fft2DDd / Irfft1DC2RFft / Rfft1DR2CFft / Irfft1DFft 等函数将 inputSize / outputSize / workspaceSize 声明为 uint32_t。表达式 n * batches * sizeof(float) * 2 等左结合求值时,n*batches 先在 uint32_t 算术下溢出(>2^32 回绕),赋给 uint32_t 再截断一次。导致 aclrtMalloc 按截断后的小值分配设备内存,而 kernel 按 tiling 中真实 n/batches 写完整数据 → 设备内存越界(静默堆溢出 / 结果错乱)。 - 修正原因:用库自身配置表支持的参数、经公开 API 即可触发。以 910B3(HBM 64GB)为例,tier3 n=16384 × batch=65536 真实输入缓冲 8GB(可存进 64GB),当前实现截断为 0 字节分配后 kernel 写 8GB → 必失败;多个支持档位(tier3 fftB/fftN、stride 路径 n=262144、R2C/C2R 大 batch、2D DD)均落入"4GB < 真实尺寸 ≤ 31GB"的"可行且必失败"范围。 - 根因旁证:lib/fft_plan_init_api.cpp:43-50 已用 size_t 正确计算 plan->input_size,fft_handle_impl.h:35 亦存 size_t input_size —— 库本就按支持大尺寸设计,arch 函数用 uint32_t 重算是实现问题,应"进行size_t 改造让大尺寸能跑"而非"在 plan 加上界拒绝"。 - 改法:变量 uint32_t → size_t(消赋值截断)+ 首操作数 static_cast<size_t>(n/batches)(强制乘法从第一步走 64 位)。只动随 n×batch 放大的 size 量,不碰 wMatrix/tMatrix/index/scratch 等固定量;常规尺寸(<4GB)行为不变。 ### 该PR关联的issue *(格式为fixes #<issue号>, 或者resolves #<issue号>)*: fixes # fixes [#22](https://gitcode.com/cann/ops-fft/issues/22) fixes [#23](https://gitcode.com/cann/ops-fft/issues/23) fixes [#24](https://gitcode.com/cann/ops-fft/issues/24) fixes [#25](https://gitcode.com/cann/ops-fft/issues/25) fixes [#26](https://gitcode.com/cann/ops-fft/issues/26) fixes [#31](https://gitcode.com/cann/ops-fft/issues/31) fixes [#32](https://gitcode.com/cann/ops-fft/issues/32) fixes [#33](https://gitcode.com/cann/ops-fft/issues/33) fixes [#34](https://gitcode.com/cann/ops-fft/issues/34) ### 希望检视人员了解: ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [x] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [x] 单元测试通过 / UT passed - [x] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [x] 代码符合规范 / Code follows style guide - [x] 测试添加并通过 / Tests added and passed - [ ] 文档已更新 / Docs updated if needed - [ ] 无硬编码敏感信息 / No secrets hardcoded - [ ] 提交信息符合规范 / Commit message follows convention See merge request: cann/ops-fft!33 | 9 天前 | |
fix: 修复 FFT 算子 host 侧缓冲区尺寸计算的整数溢出 Co-authored-by: Tian_1122<tianjunhan@h-partners.com> # message auto-generated for no-merge-commit merge: !33 merge fix/fft-integer-overflow into master fix: 修复 FFT 算子 host 侧缓冲区尺寸计算的整数溢出 Created-by: Tian_1122 Commit-by: Tian_1122 Merged-by: cann-robot Description: <!-- 感谢您的合入申请! --> ### 当前PR是否有AI参与: [x] 否 [ ] 是 __1. AI Agent 平台: __2. AI 模型: __3. Prompt上下文 : ### PR功能描述 / 为什么需要这个合入**: <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> 本 PR 修复 FFT 算子 host 侧缓冲区尺寸计算的整数溢出缺陷(9 处,8 文件,19±19 行)。 - 问题:aclfftFft1DN / Fft1DStride / Fft1DB / Fft1DMix / Fft2DDd / Irfft1DC2RFft / Rfft1DR2CFft / Irfft1DFft 等函数将 inputSize / outputSize / workspaceSize 声明为 uint32_t。表达式 n * batches * sizeof(float) * 2 等左结合求值时,n*batches 先在 uint32_t 算术下溢出(>2^32 回绕),赋给 uint32_t 再截断一次。导致 aclrtMalloc 按截断后的小值分配设备内存,而 kernel 按 tiling 中真实 n/batches 写完整数据 → 设备内存越界(静默堆溢出 / 结果错乱)。 - 修正原因:用库自身配置表支持的参数、经公开 API 即可触发。以 910B3(HBM 64GB)为例,tier3 n=16384 × batch=65536 真实输入缓冲 8GB(可存进 64GB),当前实现截断为 0 字节分配后 kernel 写 8GB → 必失败;多个支持档位(tier3 fftB/fftN、stride 路径 n=262144、R2C/C2R 大 batch、2D DD)均落入"4GB < 真实尺寸 ≤ 31GB"的"可行且必失败"范围。 - 根因旁证:lib/fft_plan_init_api.cpp:43-50 已用 size_t 正确计算 plan->input_size,fft_handle_impl.h:35 亦存 size_t input_size —— 库本就按支持大尺寸设计,arch 函数用 uint32_t 重算是实现问题,应"进行size_t 改造让大尺寸能跑"而非"在 plan 加上界拒绝"。 - 改法:变量 uint32_t → size_t(消赋值截断)+ 首操作数 static_cast<size_t>(n/batches)(强制乘法从第一步走 64 位)。只动随 n×batch 放大的 size 量,不碰 wMatrix/tMatrix/index/scratch 等固定量;常规尺寸(<4GB)行为不变。 ### 该PR关联的issue *(格式为fixes #<issue号>, 或者resolves #<issue号>)*: fixes # fixes [#22](https://gitcode.com/cann/ops-fft/issues/22) fixes [#23](https://gitcode.com/cann/ops-fft/issues/23) fixes [#24](https://gitcode.com/cann/ops-fft/issues/24) fixes [#25](https://gitcode.com/cann/ops-fft/issues/25) fixes [#26](https://gitcode.com/cann/ops-fft/issues/26) fixes [#31](https://gitcode.com/cann/ops-fft/issues/31) fixes [#32](https://gitcode.com/cann/ops-fft/issues/32) fixes [#33](https://gitcode.com/cann/ops-fft/issues/33) fixes [#34](https://gitcode.com/cann/ops-fft/issues/34) ### 希望检视人员了解: ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [x] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [x] 单元测试通过 / UT passed - [x] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [x] 代码符合规范 / Code follows style guide - [x] 测试添加并通过 / Tests added and passed - [ ] 文档已更新 / Docs updated if needed - [ ] 无硬编码敏感信息 / No secrets hardcoded - [ ] 提交信息符合规范 / Commit message follows convention See merge request: cann/ops-fft!33 | 9 天前 | |
fix: 修复 FFT 算子 host 侧缓冲区尺寸计算的整数溢出 Co-authored-by: Tian_1122<tianjunhan@h-partners.com> # message auto-generated for no-merge-commit merge: !33 merge fix/fft-integer-overflow into master fix: 修复 FFT 算子 host 侧缓冲区尺寸计算的整数溢出 Created-by: Tian_1122 Commit-by: Tian_1122 Merged-by: cann-robot Description: <!-- 感谢您的合入申请! --> ### 当前PR是否有AI参与: [x] 否 [ ] 是 __1. AI Agent 平台: __2. AI 模型: __3. Prompt上下文 : ### PR功能描述 / 为什么需要这个合入**: <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> 本 PR 修复 FFT 算子 host 侧缓冲区尺寸计算的整数溢出缺陷(9 处,8 文件,19±19 行)。 - 问题:aclfftFft1DN / Fft1DStride / Fft1DB / Fft1DMix / Fft2DDd / Irfft1DC2RFft / Rfft1DR2CFft / Irfft1DFft 等函数将 inputSize / outputSize / workspaceSize 声明为 uint32_t。表达式 n * batches * sizeof(float) * 2 等左结合求值时,n*batches 先在 uint32_t 算术下溢出(>2^32 回绕),赋给 uint32_t 再截断一次。导致 aclrtMalloc 按截断后的小值分配设备内存,而 kernel 按 tiling 中真实 n/batches 写完整数据 → 设备内存越界(静默堆溢出 / 结果错乱)。 - 修正原因:用库自身配置表支持的参数、经公开 API 即可触发。以 910B3(HBM 64GB)为例,tier3 n=16384 × batch=65536 真实输入缓冲 8GB(可存进 64GB),当前实现截断为 0 字节分配后 kernel 写 8GB → 必失败;多个支持档位(tier3 fftB/fftN、stride 路径 n=262144、R2C/C2R 大 batch、2D DD)均落入"4GB < 真实尺寸 ≤ 31GB"的"可行且必失败"范围。 - 根因旁证:lib/fft_plan_init_api.cpp:43-50 已用 size_t 正确计算 plan->input_size,fft_handle_impl.h:35 亦存 size_t input_size —— 库本就按支持大尺寸设计,arch 函数用 uint32_t 重算是实现问题,应"进行size_t 改造让大尺寸能跑"而非"在 plan 加上界拒绝"。 - 改法:变量 uint32_t → size_t(消赋值截断)+ 首操作数 static_cast<size_t>(n/batches)(强制乘法从第一步走 64 位)。只动随 n×batch 放大的 size 量,不碰 wMatrix/tMatrix/index/scratch 等固定量;常规尺寸(<4GB)行为不变。 ### 该PR关联的issue *(格式为fixes #<issue号>, 或者resolves #<issue号>)*: fixes # fixes [#22](https://gitcode.com/cann/ops-fft/issues/22) fixes [#23](https://gitcode.com/cann/ops-fft/issues/23) fixes [#24](https://gitcode.com/cann/ops-fft/issues/24) fixes [#25](https://gitcode.com/cann/ops-fft/issues/25) fixes [#26](https://gitcode.com/cann/ops-fft/issues/26) fixes [#31](https://gitcode.com/cann/ops-fft/issues/31) fixes [#32](https://gitcode.com/cann/ops-fft/issues/32) fixes [#33](https://gitcode.com/cann/ops-fft/issues/33) fixes [#34](https://gitcode.com/cann/ops-fft/issues/34) ### 希望检视人员了解: ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [x] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [x] 单元测试通过 / UT passed - [x] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [x] 代码符合规范 / Code follows style guide - [x] 测试添加并通过 / Tests added and passed - [ ] 文档已更新 / Docs updated if needed - [ ] 无硬编码敏感信息 / No secrets hardcoded - [ ] 提交信息符合规范 / Commit message follows convention See merge request: cann/ops-fft!33 | 9 天前 | |
Fix: 修复8个issue(#41/#42/#50/#52/#53/#56/#59/#60) 构建脚本清理/空指针防护/尺寸截断/UAF Co-authored-by: yang_3597<mr_yangdong@163.com> # message auto-generated for no-merge-commit merge: !38 merge fix/issues-41-42-50-60 into master Fix: 修复8个issue(#41/#42/#50/#52/#53/#56/#59/#60) 构建脚本清理/空指针防护/尺寸截断/UAF Created-by: yang_3597 Commit-by: yang_3597 Merged-by: cann-robot Description: ## 修复内容 本 PR 修复 8 个 issue:#41 #42 #50 #52 #53 #56 #59 #60 ### #41 build.sh 死代码与 sed 错误 删除无任何调用点的 normalize_soc_name() 函数。其 sed 表达式 s/.$/\U&/ 会把末字符转为大写(ascend910 → Ascend91O),与注释意图不符,且属于死代码,直接清理。 ### #42 build.sh 帮助文档与实现不一致 头注释与 show_help() 的 Supported SoC models 原声称仅支持 Ascend950/Ascend910B,与 get_soc_version() 实际支持的六种型号矛盾。同步更新为真实列表(Ascend950/910B/910_93/910/310P),并注明 Ascend310B 可识别但当前版本不支持构建。 ### #50 aclfftExecC2C_1D(arch32) 空指针解引用 入口处未校验即解引用 impl->rank。本函数为 weak 符号可被外部直接调用,plan 为 NULL 时崩溃。补 ACLFFT_CHECK_PARAM(impl != nullptr && idata != nullptr && odata != nullptr) 防御。 ### #52 aclfftFft1DC2CMix 空指针解引用 输出指针 y 未校验即作为 aclrtMemcpy 目的地址。函数入口补 x/y 判空,返回 ACL_ERROR_INVALID_PARAM。 ### #53 aclfftFft2DDd 空指针解引用 输入指针 x 未校验即作为 aclrtMemcpy 源地址。函数入口补 x/y 判空,返回 ACL_ERROR_INVALID_PARAM。 ### #56 aclfftRfft1DDft 数据类型截断 uint32_t inputSize = batches * fftN * sizeof(float) 以 64 位运算后截断为 uint32_t,batches 无上界校验,超过阈值时高位截断导致 aclrtMalloc 分配不足。inputSize/outputSize 等全部改为 size_t 并对操作数显式提升。 ### #59 aclfftRfft1D 数据类型截断 ((n/2)+1) * COMPLEX_PART * batches * sizeof(float) 中 uint32_t 域中间结果可回绕。改为 size_t 计算,正常范围内结果不变。 ### #60 aclfftDestroy use-after-free is_destroyed 防重复销毁检查本身构成 UAF:对象首次调用即被 delete,标志随对象一同释放,第二次调用读取已释放内存来判断标志。移除该无效检查与置位(内部调用方在销毁后均已执行 *plan=nullptr 防重复销毁),NULL 校验后直接 delete。 ## 验证 - 环境:Atlas 910B3 / CANN 9.1.0 - bash build.sh --soc=ascend910b 编译通过 - bash build.sh --soc=ascend910b --run 42/42 测试全部 PASS(覆盖 fft1_d/fft2_d/rfft1_d 修改路径) Fixes #41, fixes #42, fixes #50, fixes #52, fixes #53, fixes #56, fixes #59, fixes #60 See merge request: cann/ops-fft!38 | 1 天前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 27 天前 | ||
| 9 天前 | ||
| 9 天前 | ||
| 9 天前 | ||
| 9 天前 | ||
| 1 天前 |