| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[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 | 1 个月前 | |
[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 | 1 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 1 个月前 | ||
| 1 个月前 |