| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[CANNBot]add FresnelSin operator Co-authored-by: handsomeRobot_SK<suke13@huawei.com> Co-authored-by: handsomeRobot_SK<2034073486@qq.com> # message auto-generated for no-merge-commit merge: !3644 merge master into master [CANNBot]add FresnelSin operator Created-by: handsomeRobot_SK Commit-by: handsomeRobot_SK Merged-by: cann-robot Description: # feat: add FresnelSin operator ## 概述 新增 FresnelSin 算子,计算 **Fresnel 正弦积分** \[ S(x) = \int_0^x \sin\left(\frac{\pi t^2}{2}\right) dt \] 对标 TensorFlow 的 tf.math.special.fresnel_sin 实现。 --- ## 支持规格 | 项目 | 说明 | |------------|-------------------------------| | 数据类型 | float16, float32, bfloat16 | | 目标芯片 | Ascend 950 (arch35) | | 接口类型 | GE IR(无 ACLNN) | --- ## 算法实现 基于 Cephes 库 fresnl.c 的分段逼近策略: - **小值分支**(\(x^2 < 2.5625\)): 有理逼近 \[ S(|x|) = |x|^3 \cdot \frac{P_S(x^*)}{Q_S(x^*)} \] 其中 \(x^* = x^2\),\(P_S\)、\(Q_S\) 为特定多项式系数。 - **渐近分支**(\(x^2 \ge 2.5625\)): \[ S(|x|) = 0.5 - \frac{f \cdot \cos(z) + g \cdot \sin(z)}{\pi |x|} \] 其中 \(z = \frac{\pi x^2}{2}\),\(f\)、\(g\) 由辅助函数计算。 - **特殊值处理**: - NaN → NaN - ±Inf → ±0.5 - **符号恢复**:利用奇函数性质 \(S(-x) = -S(x)\) 保证数值正确。 --- ## 新增文件 | 文件路径 | 说明 | |----------|------| | math/fresnel_sin/CMakeLists.txt | 构建配置 | | math/fresnel_sin/op_graph/fresnel_sin_proto.h | GE IR 算子注册 | | math/fresnel_sin/op_host/fresnel_sin_def.cpp | 算子定义(dtype/format/config) | | math/fresnel_sin/op_host/fresnel_sin_infershape.cpp | 形状推导(输出 = 输入) | | math/fresnel_sin/op_host/arch35/fresnel_sin_tiling_arch35.cpp | Tiling 策略(多核分块 + UB 规划) | | math/fresnel_sin/op_kernel/arch35/fresnel_sin.h | Kernel 核心实现(Cephes 系数 + Horner 求值) | | math/fresnel_sin/op_kernel/arch35/fresnel_sin_tiling_data.h | Tiling 数据结构 | | math/fresnel_sin/op_kernel/arch35/fresnel_sin_tiling_key.h | 模板参数声明 | | math/fresnel_sin/op_kernel/fresnel_sin_apt.cpp | Kernel 入口 | | math/fresnel_sin/examples/test_geir_fresnel_sin.cpp | GE IR 精度验证(10 个 L1 用例) | | math/fresnel_sin/examples/arch35/test_geir_fresnel_sin.cpp | arch35 精度验证 | --- ## 精度标准 | dtype | rtol | |------------|--------| | float32 | 1e-4 | | float16 | 1e-3 | | bfloat16 | 4e-3 | --- ## UB Buffer 规划 - 输入队列 qIn :1 × sizeof(T) - 输出队列 qOut :1 × sizeof(T) - 计算队列 calcQ :8 × sizeof(float) - 掩码队列 maskQ :3 × sizeof(uint8_t) See merge request: cann/ops-math!3644 | 3 个月前 | |
[CANNBot]add FresnelSin operator Co-authored-by: handsomeRobot_SK<suke13@huawei.com> Co-authored-by: handsomeRobot_SK<2034073486@qq.com> # message auto-generated for no-merge-commit merge: !3644 merge master into master [CANNBot]add FresnelSin operator Created-by: handsomeRobot_SK Commit-by: handsomeRobot_SK Merged-by: cann-robot Description: # feat: add FresnelSin operator ## 概述 新增 FresnelSin 算子,计算 **Fresnel 正弦积分** \[ S(x) = \int_0^x \sin\left(\frac{\pi t^2}{2}\right) dt \] 对标 TensorFlow 的 tf.math.special.fresnel_sin 实现。 --- ## 支持规格 | 项目 | 说明 | |------------|-------------------------------| | 数据类型 | float16, float32, bfloat16 | | 目标芯片 | Ascend 950 (arch35) | | 接口类型 | GE IR(无 ACLNN) | --- ## 算法实现 基于 Cephes 库 fresnl.c 的分段逼近策略: - **小值分支**(\(x^2 < 2.5625\)): 有理逼近 \[ S(|x|) = |x|^3 \cdot \frac{P_S(x^*)}{Q_S(x^*)} \] 其中 \(x^* = x^2\),\(P_S\)、\(Q_S\) 为特定多项式系数。 - **渐近分支**(\(x^2 \ge 2.5625\)): \[ S(|x|) = 0.5 - \frac{f \cdot \cos(z) + g \cdot \sin(z)}{\pi |x|} \] 其中 \(z = \frac{\pi x^2}{2}\),\(f\)、\(g\) 由辅助函数计算。 - **特殊值处理**: - NaN → NaN - ±Inf → ±0.5 - **符号恢复**:利用奇函数性质 \(S(-x) = -S(x)\) 保证数值正确。 --- ## 新增文件 | 文件路径 | 说明 | |----------|------| | math/fresnel_sin/CMakeLists.txt | 构建配置 | | math/fresnel_sin/op_graph/fresnel_sin_proto.h | GE IR 算子注册 | | math/fresnel_sin/op_host/fresnel_sin_def.cpp | 算子定义(dtype/format/config) | | math/fresnel_sin/op_host/fresnel_sin_infershape.cpp | 形状推导(输出 = 输入) | | math/fresnel_sin/op_host/arch35/fresnel_sin_tiling_arch35.cpp | Tiling 策略(多核分块 + UB 规划) | | math/fresnel_sin/op_kernel/arch35/fresnel_sin.h | Kernel 核心实现(Cephes 系数 + Horner 求值) | | math/fresnel_sin/op_kernel/arch35/fresnel_sin_tiling_data.h | Tiling 数据结构 | | math/fresnel_sin/op_kernel/arch35/fresnel_sin_tiling_key.h | 模板参数声明 | | math/fresnel_sin/op_kernel/fresnel_sin_apt.cpp | Kernel 入口 | | math/fresnel_sin/examples/test_geir_fresnel_sin.cpp | GE IR 精度验证(10 个 L1 用例) | | math/fresnel_sin/examples/arch35/test_geir_fresnel_sin.cpp | arch35 精度验证 | --- ## 精度标准 | dtype | rtol | |------------|--------| | float32 | 1e-4 | | float16 | 1e-3 | | bfloat16 | 4e-3 | --- ## UB Buffer 规划 - 输入队列 qIn :1 × sizeof(T) - 输出队列 qOut :1 × sizeof(T) - 计算队列 calcQ :8 × sizeof(float) - 掩码队列 maskQ :3 × sizeof(uint8_t) See merge request: cann/ops-math!3644 | 3 个月前 | |
feat(math): fresnel_cos/fresnel_sin 补充 tiling 校验并迁移 def 驱动 dtype 模式 Co-authored-by: handsomeRobot_SK<suke13@huawei.com> # message auto-generated for no-merge-commit merge: !4447 merge feature/fresnel_cos_v2 into master feat(math): fresnel_cos/fresnel_sin 补充 tiling 校验并迁移 def 驱动 dtype 模式 Created-by: handsomeRobot_SK Commit-by: handsomeRobot_SK Merged-by: cann-robot Description: 标题: feat(math): fresnel_cos/fresnel_sin 补充 tiling 校验并迁移 def 驱动 dtype 模式 描述: ## 变更内容 ### 1. Tiling 校验补充 参考 ops-nn PR#8161 / PR#8095 的校验规范,为 FresnelCos 和 FresnelSin 算子补充以下 tiling 阶段校验: | 校验项 | 宏 | 说明 | |--------|----|------| | 维度数 | OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON | 输入维度数不超过 8 | | dtype | OP_LOGE_WITH_INVALID_INPUT_DTYPE | 替换原有简单 OP_LOGE,使用标准错误日志宏 | | format | OP_LOGE | 校验输入 format 必须为 ND | ### 2. Def 驱动 dtype 模式迁移 - 移除 tiling_key.h 中的 ASCENDC_TPL_ARGS_DECL / ASCENDC_TPL_SEL 模板参数声明 - apt.cpp 中 kernel 函数移除 template <typename T>,改用 DTYPE_X 宏(由 def.cpp DataTypeList 自动注入) ### 3. UT 用例补充 每个算子新增 2 个 tiling UT 用例: - invalid_dim_num_exceeds_max:9 维输入,期望 GRAPH_FAILED - invalid_format_nchw:NCHW 格式输入,期望 GRAPH_FAILED ## 涉及文件 - math/fresnel_cos/op_host/arch35/fresnel_cos_tiling_arch35.cpp - math/fresnel_cos/op_kernel/arch35/fresnel_cos_tiling_key.h - math/fresnel_cos/op_kernel/fresnel_cos_apt.cpp - math/fresnel_cos/tests/ut/op_host/arch35/test_fresnel_cos_tiling_arch35.cpp - math/fresnel_sin/op_host/arch35/fresnel_sin_tiling_arch35.cpp - math/fresnel_sin/op_kernel/arch35/fresnel_sin_tiling_key.h - math/fresnel_sin/op_kernel/fresnel_sin_apt.cpp - math/fresnel_sin/tests/ut/op_host/arch35/test_fresnel_sin_tiling_arch35.cpp See merge request: cann/ops-math!4447 | 2 个月前 | |
feat(math): fresnel_cos/fresnel_sin 补充 tiling 校验并迁移 def 驱动 dtype 模式 Co-authored-by: handsomeRobot_SK<suke13@huawei.com> # message auto-generated for no-merge-commit merge: !4447 merge feature/fresnel_cos_v2 into master feat(math): fresnel_cos/fresnel_sin 补充 tiling 校验并迁移 def 驱动 dtype 模式 Created-by: handsomeRobot_SK Commit-by: handsomeRobot_SK Merged-by: cann-robot Description: 标题: feat(math): fresnel_cos/fresnel_sin 补充 tiling 校验并迁移 def 驱动 dtype 模式 描述: ## 变更内容 ### 1. Tiling 校验补充 参考 ops-nn PR#8161 / PR#8095 的校验规范,为 FresnelCos 和 FresnelSin 算子补充以下 tiling 阶段校验: | 校验项 | 宏 | 说明 | |--------|----|------| | 维度数 | OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON | 输入维度数不超过 8 | | dtype | OP_LOGE_WITH_INVALID_INPUT_DTYPE | 替换原有简单 OP_LOGE,使用标准错误日志宏 | | format | OP_LOGE | 校验输入 format 必须为 ND | ### 2. Def 驱动 dtype 模式迁移 - 移除 tiling_key.h 中的 ASCENDC_TPL_ARGS_DECL / ASCENDC_TPL_SEL 模板参数声明 - apt.cpp 中 kernel 函数移除 template <typename T>,改用 DTYPE_X 宏(由 def.cpp DataTypeList 自动注入) ### 3. UT 用例补充 每个算子新增 2 个 tiling UT 用例: - invalid_dim_num_exceeds_max:9 维输入,期望 GRAPH_FAILED - invalid_format_nchw:NCHW 格式输入,期望 GRAPH_FAILED ## 涉及文件 - math/fresnel_cos/op_host/arch35/fresnel_cos_tiling_arch35.cpp - math/fresnel_cos/op_kernel/arch35/fresnel_cos_tiling_key.h - math/fresnel_cos/op_kernel/fresnel_cos_apt.cpp - math/fresnel_cos/tests/ut/op_host/arch35/test_fresnel_cos_tiling_arch35.cpp - math/fresnel_sin/op_host/arch35/fresnel_sin_tiling_arch35.cpp - math/fresnel_sin/op_kernel/arch35/fresnel_sin_tiling_key.h - math/fresnel_sin/op_kernel/fresnel_sin_apt.cpp - math/fresnel_sin/tests/ut/op_host/arch35/test_fresnel_sin_tiling_arch35.cpp See merge request: cann/ops-math!4447 | 2 个月前 | |
feat(math): fresnel_cos/fresnel_sin 补充 tiling 校验并迁移 def 驱动 dtype 模式 Co-authored-by: handsomeRobot_SK<suke13@huawei.com> # message auto-generated for no-merge-commit merge: !4447 merge feature/fresnel_cos_v2 into master feat(math): fresnel_cos/fresnel_sin 补充 tiling 校验并迁移 def 驱动 dtype 模式 Created-by: handsomeRobot_SK Commit-by: handsomeRobot_SK Merged-by: cann-robot Description: 标题: feat(math): fresnel_cos/fresnel_sin 补充 tiling 校验并迁移 def 驱动 dtype 模式 描述: ## 变更内容 ### 1. Tiling 校验补充 参考 ops-nn PR#8161 / PR#8095 的校验规范,为 FresnelCos 和 FresnelSin 算子补充以下 tiling 阶段校验: | 校验项 | 宏 | 说明 | |--------|----|------| | 维度数 | OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON | 输入维度数不超过 8 | | dtype | OP_LOGE_WITH_INVALID_INPUT_DTYPE | 替换原有简单 OP_LOGE,使用标准错误日志宏 | | format | OP_LOGE | 校验输入 format 必须为 ND | ### 2. Def 驱动 dtype 模式迁移 - 移除 tiling_key.h 中的 ASCENDC_TPL_ARGS_DECL / ASCENDC_TPL_SEL 模板参数声明 - apt.cpp 中 kernel 函数移除 template <typename T>,改用 DTYPE_X 宏(由 def.cpp DataTypeList 自动注入) ### 3. UT 用例补充 每个算子新增 2 个 tiling UT 用例: - invalid_dim_num_exceeds_max:9 维输入,期望 GRAPH_FAILED - invalid_format_nchw:NCHW 格式输入,期望 GRAPH_FAILED ## 涉及文件 - math/fresnel_cos/op_host/arch35/fresnel_cos_tiling_arch35.cpp - math/fresnel_cos/op_kernel/arch35/fresnel_cos_tiling_key.h - math/fresnel_cos/op_kernel/fresnel_cos_apt.cpp - math/fresnel_cos/tests/ut/op_host/arch35/test_fresnel_cos_tiling_arch35.cpp - math/fresnel_sin/op_host/arch35/fresnel_sin_tiling_arch35.cpp - math/fresnel_sin/op_kernel/arch35/fresnel_sin_tiling_key.h - math/fresnel_sin/op_kernel/fresnel_sin_apt.cpp - math/fresnel_sin/tests/ut/op_host/arch35/test_fresnel_sin_tiling_arch35.cpp See merge request: cann/ops-math!4447 | 2 个月前 | |
[CANNBot]add FresnelSin operator Co-authored-by: handsomeRobot_SK<suke13@huawei.com> Co-authored-by: handsomeRobot_SK<2034073486@qq.com> # message auto-generated for no-merge-commit merge: !3644 merge master into master [CANNBot]add FresnelSin operator Created-by: handsomeRobot_SK Commit-by: handsomeRobot_SK Merged-by: cann-robot Description: # feat: add FresnelSin operator ## 概述 新增 FresnelSin 算子,计算 **Fresnel 正弦积分** \[ S(x) = \int_0^x \sin\left(\frac{\pi t^2}{2}\right) dt \] 对标 TensorFlow 的 tf.math.special.fresnel_sin 实现。 --- ## 支持规格 | 项目 | 说明 | |------------|-------------------------------| | 数据类型 | float16, float32, bfloat16 | | 目标芯片 | Ascend 950 (arch35) | | 接口类型 | GE IR(无 ACLNN) | --- ## 算法实现 基于 Cephes 库 fresnl.c 的分段逼近策略: - **小值分支**(\(x^2 < 2.5625\)): 有理逼近 \[ S(|x|) = |x|^3 \cdot \frac{P_S(x^*)}{Q_S(x^*)} \] 其中 \(x^* = x^2\),\(P_S\)、\(Q_S\) 为特定多项式系数。 - **渐近分支**(\(x^2 \ge 2.5625\)): \[ S(|x|) = 0.5 - \frac{f \cdot \cos(z) + g \cdot \sin(z)}{\pi |x|} \] 其中 \(z = \frac{\pi x^2}{2}\),\(f\)、\(g\) 由辅助函数计算。 - **特殊值处理**: - NaN → NaN - ±Inf → ±0.5 - **符号恢复**:利用奇函数性质 \(S(-x) = -S(x)\) 保证数值正确。 --- ## 新增文件 | 文件路径 | 说明 | |----------|------| | math/fresnel_sin/CMakeLists.txt | 构建配置 | | math/fresnel_sin/op_graph/fresnel_sin_proto.h | GE IR 算子注册 | | math/fresnel_sin/op_host/fresnel_sin_def.cpp | 算子定义(dtype/format/config) | | math/fresnel_sin/op_host/fresnel_sin_infershape.cpp | 形状推导(输出 = 输入) | | math/fresnel_sin/op_host/arch35/fresnel_sin_tiling_arch35.cpp | Tiling 策略(多核分块 + UB 规划) | | math/fresnel_sin/op_kernel/arch35/fresnel_sin.h | Kernel 核心实现(Cephes 系数 + Horner 求值) | | math/fresnel_sin/op_kernel/arch35/fresnel_sin_tiling_data.h | Tiling 数据结构 | | math/fresnel_sin/op_kernel/arch35/fresnel_sin_tiling_key.h | 模板参数声明 | | math/fresnel_sin/op_kernel/fresnel_sin_apt.cpp | Kernel 入口 | | math/fresnel_sin/examples/test_geir_fresnel_sin.cpp | GE IR 精度验证(10 个 L1 用例) | | math/fresnel_sin/examples/arch35/test_geir_fresnel_sin.cpp | arch35 精度验证 | --- ## 精度标准 | dtype | rtol | |------------|--------| | float32 | 1e-4 | | float16 | 1e-3 | | bfloat16 | 4e-3 | --- ## UB Buffer 规划 - 输入队列 qIn :1 × sizeof(T) - 输出队列 qOut :1 × sizeof(T) - 计算队列 calcQ :8 × sizeof(float) - 掩码队列 maskQ :3 × sizeof(uint8_t) See merge request: cann/ops-math!3644 | 3 个月前 | |
docs: 添加 fresnel_sin 算子 README 文档 Co-authored-by: handsomeRobot_SK<suke13@huawei.com> # message auto-generated for no-merge-commit merge: !4474 merge feature/fresnel_cos_v2 into master docs: 添加 fresnel_sin 算子 README 文档 Created-by: handsomeRobot_SK Commit-by: handsomeRobot_SK Merged-by: cann-robot Description: ## 描述 参照 fresnel_cos/README.md,为 fresnel_sin 算子补充 README 文档,包括: - 产品支持情况 - 功能说明及计算公式 - 参数说明 - 约束说明 - 图模式调用说明及样例 See merge request: cann/ops-math!4474 | 2 个月前 |
FresnelSin
产品支持情况
| 产品 | 是否支持 |
|---|---|
| Ascend 950PR/Ascend 950DT | √ |
| Atlas A3 训练系列产品/Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品/Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | × |
| Atlas 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |
功能说明
-
算子功能:计算Fresnel正弦积分 S(x) = integral_0^x sin(pi*t^2/2) dt。
-
计算公式:
S(x)=∫0xsin(π2t2)dtS(x) = \int_{0}^{x} \sin\left(\frac{\pi}{2} t^{2}\right) \mathrm{d}t S(x)=∫0xsin(2πt2)dt
参数说明
| 参数名 | 输入/输出/属性 | 描述 | 数据类型 | 数据格式 |
|---|---|---|---|---|
| x | 输入 | 待进行Fresnel正弦积分计算的入参,公式中的x。 | BFLOAT16、FLOAT16、FLOAT | ND |
| y | 输出 | Fresnel正弦积分计算的出参,公式中的S(x)。 | BFLOAT16、FLOAT16、FLOAT | ND |
约束说明
- 不支持DOUBLE(FP64)数据类型。
调用说明
| 调用方式 | 调用样例 | 说明 |
|---|---|---|
| 图模式调用 | test_geir_fresnel_sin | 通过图模式调用FresnelSin算子。 |