文件最后提交记录最后更新时间
math仓的doc tools 工具检测的低错问题 Co-authored-by: caiwenwen<caiwenwen6@h-partners.com> # message auto-generated for no-merge-commit merge: !2461 merge master into master math仓的doc tools 工具检测的低错问题 Created-by: caiwenwen Commit-by: caiwenwen Merged-by: cann-robot Description: ## 描述 处理math仓的doc tools 工具检测的低错问题,包括markdown低错、htlm标签合入、链接是否可以正常跳转 ## 关联的Issue #关联issue#1262 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 更新全部文档 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!24611 个月前
Support Acos op with AscendC Co-authored-by: zyf0712<zhangyufei63@huawei.com> # message auto-generated for no-merge-commit merge: !1033 merge master into master Support Acos op with AscendC Created-by: luomin2005 Commit-by: luomin2005;zyf0712 Merged-by: cann-robot Description: ## 描述 使用AscendC实现acos算子 1.按照泰勒公式计算arcsin(x) = Cx + Cx^3 + Cx^5 + Cx^7 + Cx^9 + Cx^11 + Cx^13 + Cx^15 ..... 其中C为泰勒系数,参考常量taylorCoefficients,参考精度要求泰勒系数计算到第8项 T taylorCoefficients[] = {1.0, 1.0 / 6, 3.0 / 40, 5.0 / 112, 35.0 / 1152, 63.0 / 2816, 231.0 / 13312, 143.0 / 10240}; 2.将x取绝对值,并将正负号保存到xSignMask掩码中; 3.当x < Boudry = 0.70710678118654752440084436210485 时计算 arcsin(x), 当x >Boudry计算arcsin(x) = halfPi - 1/2 sqrt(1-x^2) 4.利用arcsin(-x) = -arcsin(x), 根据符号标记合并还原计算负值情况 3.arccos(x) = halfPi - arcsin(x) ## 关联的Issue https://gitcode.com/cann/ops-math/issues/581 ## 测试 [2026-01-30 15:09:13] Start to run examples,name:acos mode:eager [2026-01-30 15:09:13] Start compile and run examples file: ../math/acos/examples/test_aclnn_acos.cpp [2026-01-30 15:09:13] pkg_mode:cust vendor_name:custom [2026-01-30 15:09:19] [Warning]: tiling struct [ReduceOpTilingDataV2] is conflict with one in file kl_div_v2.cc, line 41 [2026-01-30 15:09:19] [Warning]: tiling struct [RepeatInterleaveGradTilingData] is conflict with one in file repeat_interleave_grad_tiling.h, line 21 [2026-01-30 15:09:19] [Warning]: tiling struct [IndexFillTilingData] is conflict with one in file index_fill_tiling.h, line 21 [2026-01-30 15:09:19] [Warning]: tiling struct [MaskedSelectV3TilingData] is conflict with one in file masked_select_v3_tiling.h, line 27 [2026-01-30 15:09:19] [Warning]: tiling struct [MaskedSelectV3TilingData] is conflict with one in file masked_select_v3_tiling.h, line 27 [2026-01-30 15:09:19] [Warning]: tiling struct [ScatterPaKvCacheTilingData] is conflict with one in file scatter_pa_kv_cache_tiling.h, line 35 [2026-01-30 15:09:19] [Warning]: tiling struct [ScatterPaKvCacheTilingData] is conflict with one in file scatter_pa_kv_cache_tiling.h, line 35 [2026-01-30 15:09:19] [Warning]: tiling struct [TopKTopPSampleTilingData] is conflict with one in file top_k_top_p_sample_tiling.h, line 26 [2026-01-30 15:09:19] [Warning]: tiling struct [AvgPool3dGradTilingBlockParam] is conflict with one in file avg_pool_3d_grad_tiling.h, line 99 [2026-01-30 15:09:19] [Warning]: tiling struct [AvgPool3dGradTilingParam] is conflict with one in file avg_pool_3d_grad_tiling.h, line 125 [2026-01-30 15:09:19] [Warning]: tiling struct [FusedCrossEntropyLossWithMaxSumTilingData] is conflict with one in file fused_cross_entropy_loss_with_max_sum_tiling.h, line 27 [2026-01-30 15:09:19] [Warning]: tiling struct [TilingDataBackgroundReplace] is conflict with one in file background_replace_tiling.h, line 22 [2026-01-30 15:09:19] [Warning]: tiling struct [TilingDataBlendImages] is conflict with one in file blend_images_custom_tiling.h, line 24 [2026-01-30 15:09:19] 0 acos(-inf) = nan [2026-01-30 15:09:19] 1 acos(-12.000000) = nan [2026-01-30 15:09:19] 2 acos(-1.000001) = nan [2026-01-30 15:09:19] 3 acos(-1.000010) = nan [2026-01-30 15:09:19] 4 acos(-1.000100) = nan [2026-01-30 15:09:19] 5 acos(-1.001000) = nan [2026-01-30 15:09:19] 6 acos(-1.010000) = nan [2026-01-30 15:09:19] 7 acos(-1.000000) = 3.141593 [2026-01-30 15:09:19] 8 acos(-0.999990) = 3.137117 [2026-01-30 15:09:19] 9 acos(-0.999900) = 3.127449 [2026-01-30 15:09:19] 10 acos(-0.999000) = 3.096868 [2026-01-30 15:09:19] 11 acos(-0.990000) = 3.000053 [2026-01-30 15:09:19] 12 acos(-0.900000) = 2.690566 [2026-01-30 15:09:19] 13 acos(-0.800000) = 2.498095 [2026-01-30 15:09:19] 14 acos(-0.710000) = 2.360346 [2026-01-30 15:09:19] 15 acos(-0.705000) = 2.353167 [2026-01-30 15:09:19] 16 acos(-0.700000) = 2.346148 [2026-01-30 15:09:19] 17 acos(-0.650000) = 2.278369 [2026-01-30 15:09:19] 18 acos(-0.600000) = 2.214295 [2026-01-30 15:09:19] 19 acos(-0.500000) = 2.094395 [2026-01-30 15:09:19] 20 acos(-0.400000) = 1.982313 [2026-01-30 15:09:19] 21 acos(-0.300000) = 1.875489 [2026-01-30 15:09:19] 22 acos(-0.200000) = 1.772154 [2026-01-30 15:09:19] 23 acos(-0.100000) = 1.670964 [2026-01-30 15:09:19] 24 acos(-0.010000) = 1.580796 [2026-01-30 15:09:19] 25 acos(-0.001000) = 1.571796 [2026-01-30 15:09:19] 26 acos(-0.000100) = 1.570896 [2026-01-30 15:09:19] 27 acos(-0.000010) = 1.570806 [2026-01-30 15:09:19] 28 acos(-0.000001) = 1.570797 [2026-01-30 15:09:19] 29 acos(-0.000000) = 1.570796 [2026-01-30 15:09:19] 30 acos(0.000000) = 1.570796 [2026-01-30 15:09:19] 31 acos(nan) = nan [2026-01-30 15:09:19] 32 acos(0.000000) = 1.570796 [2026-01-30 15:09:19] 33 acos(0.000000) = 1.570796 [2026-01-30 15:09:19] 34 acos(0.000001) = 1.570795 [2026-01-30 15:09:19] 35 acos(0.000010) = 1.570786 [2026-01-30 15:09:19] 36 acos(0.000100) = 1.570696 [2026-01-30 15:09:19] 37 acos(0.010000) = 1.560796 [2026-01-30 15:09:19] 38 acos(0.100000) = 1.470629 [2026-01-30 15:09:19] 39 acos(0.200000) = 1.369438 [2026-01-30 15:09:19] 40 acos(0.200000) = 1.369438 [2026-01-30 15:09:19] 41 acos(0.300000) = 1.266104 [2026-01-30 15:09:19] 42 acos(0.400000) = 1.159280 [2026-01-30 15:09:19] 43 acos(0.500000) = 1.047198 [2026-01-30 15:09:19] 44 acos(0.500000) = 1.047198 [2026-01-30 15:09:19] 45 acos(0.600000) = 0.927298 [2026-01-30 15:09:19] 46 acos(0.650000) = 0.863224 [2026-01-30 15:09:19] 47 acos(0.700000) = 0.795445 [2026-01-30 15:09:19] 48 acos(0.705000) = 0.788426 [2026-01-30 15:09:19] 49 acos(0.710000) = 0.781247 [2026-01-30 15:09:19] 50 acos(0.800000) = 0.643498 [2026-01-30 15:09:19] 51 acos(0.900000) = 0.451027 [2026-01-30 15:09:19] 52 acos(0.990000) = 0.141539 [2026-01-30 15:09:19] 53 acos(0.999000) = 0.044725 [2026-01-30 15:09:19] 54 acos(0.999900) = 0.014144 [2026-01-30 15:09:19] 55 acos(0.999990) = 0.004475 [2026-01-30 15:09:19] 56 acos(1.000000) = 0.000000 [2026-01-30 15:09:19] 57 acos(1.010000) = nan [2026-01-30 15:09:19] 58 acos(1.001000) = nan [2026-01-30 15:09:19] 59 acos(1.000100) = nan [2026-01-30 15:09:19] 60 acos(1.000010) = nan [2026-01-30 15:09:19] 61 acos(1.000001) = nan [2026-01-30 15:09:19] 62 acos(12.000000) = nan [2026-01-30 15:09:19] 63 acos(inf) = nan [2026-01-30 15:09:19] run test_aclnn_acos, execute samples success Kernel UT测试结果如下:测试数据形状(32, 8, 7, 7) tmp_input = np.random.choice([1.0, 0.8, 0.7, 0.5, -1, 0.1, 0.0, np.nan, np.inf], size=size)随机选择,精度误差绝对误差和相对误差10的负4次方 diff_res = np.isclose(tmp_out, tmp_gold, rtol=1e-4, atol=1e-4, equal_nan=True) [2026-01-30 15:13:38] Run fast op utest [2026-01-30 15:13:38] [==========] Running 1 test from 1 test suite. [2026-01-30 15:13:38] [----------] Global test environment set-up. [2026-01-30 15:13:38] Global Environment SetpUp. [2026-01-30 15:13:38] [----------] 1 test from AcosTest [2026-01-30 15:13:38] AcosTest SetUp [2026-01-30 15:13:38] [2026-01-30 15:13:38] [ RUN ] AcosTest.test_case_0 [2026-01-30 15:13:38] /home/l00614971/op-math/build/tests/ut/op_kernel/acos_data/gen_data.py:36: RuntimeWarning: invalid value encountered in arccos [2026-01-30 15:13:38] tmp_golden = np.arccos(tmp_input) [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/math/acos/CMakeFiles/ophost_math_tiling_obj.dir/op_host/acos_tiling.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/tests/ut/op_kernel/CMakeFiles/math_op_kernel_ut_ascend910B1.dir/test_op_kernel_main.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/math/acos/tests/ut/op_kernel/CMakeFiles/acos_Ascend910B1_cases_obj.dir/test_acos.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/tests/ut/op_kernel/CMakeFiles/math_op_kernel_ut_common_obj.dir/__/common/tiling_context_faker.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/tests/ut/op_kernel/CMakeFiles/math_op_kernel_ut_common_obj.dir/__/common/tiling_case_executor.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [SUCCESS][CORE_0][pid 1618408] exit success! [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [SUCCESS][CORE_1][pid 1618409] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_2][pid 1618410] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_3][pid 1618411] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_4][pid 1618412] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_5][pid 1618413] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_6][pid 1618414] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_7][pid 1618415] exit success! [2026-01-30 15:13:46] PASSED! [2026-01-30 15:13:46] compare result: True [2026-01-30 15:13:46] [ OK ] AcosTest.test_case_0 (7926 ms) [2026-01-30 15:13:46] AcosTest TearDown [2026-01-30 15:13:46] [2026-01-30 15:13:46] [----------] 1 test from AcosTest (7926 ms total) [2026-01-30 15:13:46] [2026-01-30 15:13:46] [----------] Global test environment tear-down [2026-01-30 15:13:46] Global Environment TearDown [2026-01-30 15:13:46] [==========] 1 test from 1 test suite ran. (7960 ms total) [2026-01-30 15:13:46] [ PASSED ] 1 test. [2026-01-30 15:13:46] [100%] Built target math_op_kernel_ut_ascend910B1 [2026-01-30 15:13:46] [100%] Built target math_op_kernel_ut (ws) [root@shlqh-cann-cluster8-141-61-33-172 op-math]# ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!10333 个月前
Support Acos op with AscendC Co-authored-by: zyf0712<zhangyufei63@huawei.com> # message auto-generated for no-merge-commit merge: !1033 merge master into master Support Acos op with AscendC Created-by: luomin2005 Commit-by: luomin2005;zyf0712 Merged-by: cann-robot Description: ## 描述 使用AscendC实现acos算子 1.按照泰勒公式计算arcsin(x) = Cx + Cx^3 + Cx^5 + Cx^7 + Cx^9 + Cx^11 + Cx^13 + Cx^15 ..... 其中C为泰勒系数,参考常量taylorCoefficients,参考精度要求泰勒系数计算到第8项 T taylorCoefficients[] = {1.0, 1.0 / 6, 3.0 / 40, 5.0 / 112, 35.0 / 1152, 63.0 / 2816, 231.0 / 13312, 143.0 / 10240}; 2.将x取绝对值,并将正负号保存到xSignMask掩码中; 3.当x < Boudry = 0.70710678118654752440084436210485 时计算 arcsin(x), 当x >Boudry计算arcsin(x) = halfPi - 1/2 sqrt(1-x^2) 4.利用arcsin(-x) = -arcsin(x), 根据符号标记合并还原计算负值情况 3.arccos(x) = halfPi - arcsin(x) ## 关联的Issue https://gitcode.com/cann/ops-math/issues/581 ## 测试 [2026-01-30 15:09:13] Start to run examples,name:acos mode:eager [2026-01-30 15:09:13] Start compile and run examples file: ../math/acos/examples/test_aclnn_acos.cpp [2026-01-30 15:09:13] pkg_mode:cust vendor_name:custom [2026-01-30 15:09:19] [Warning]: tiling struct [ReduceOpTilingDataV2] is conflict with one in file kl_div_v2.cc, line 41 [2026-01-30 15:09:19] [Warning]: tiling struct [RepeatInterleaveGradTilingData] is conflict with one in file repeat_interleave_grad_tiling.h, line 21 [2026-01-30 15:09:19] [Warning]: tiling struct [IndexFillTilingData] is conflict with one in file index_fill_tiling.h, line 21 [2026-01-30 15:09:19] [Warning]: tiling struct [MaskedSelectV3TilingData] is conflict with one in file masked_select_v3_tiling.h, line 27 [2026-01-30 15:09:19] [Warning]: tiling struct [MaskedSelectV3TilingData] is conflict with one in file masked_select_v3_tiling.h, line 27 [2026-01-30 15:09:19] [Warning]: tiling struct [ScatterPaKvCacheTilingData] is conflict with one in file scatter_pa_kv_cache_tiling.h, line 35 [2026-01-30 15:09:19] [Warning]: tiling struct [ScatterPaKvCacheTilingData] is conflict with one in file scatter_pa_kv_cache_tiling.h, line 35 [2026-01-30 15:09:19] [Warning]: tiling struct [TopKTopPSampleTilingData] is conflict with one in file top_k_top_p_sample_tiling.h, line 26 [2026-01-30 15:09:19] [Warning]: tiling struct [AvgPool3dGradTilingBlockParam] is conflict with one in file avg_pool_3d_grad_tiling.h, line 99 [2026-01-30 15:09:19] [Warning]: tiling struct [AvgPool3dGradTilingParam] is conflict with one in file avg_pool_3d_grad_tiling.h, line 125 [2026-01-30 15:09:19] [Warning]: tiling struct [FusedCrossEntropyLossWithMaxSumTilingData] is conflict with one in file fused_cross_entropy_loss_with_max_sum_tiling.h, line 27 [2026-01-30 15:09:19] [Warning]: tiling struct [TilingDataBackgroundReplace] is conflict with one in file background_replace_tiling.h, line 22 [2026-01-30 15:09:19] [Warning]: tiling struct [TilingDataBlendImages] is conflict with one in file blend_images_custom_tiling.h, line 24 [2026-01-30 15:09:19] 0 acos(-inf) = nan [2026-01-30 15:09:19] 1 acos(-12.000000) = nan [2026-01-30 15:09:19] 2 acos(-1.000001) = nan [2026-01-30 15:09:19] 3 acos(-1.000010) = nan [2026-01-30 15:09:19] 4 acos(-1.000100) = nan [2026-01-30 15:09:19] 5 acos(-1.001000) = nan [2026-01-30 15:09:19] 6 acos(-1.010000) = nan [2026-01-30 15:09:19] 7 acos(-1.000000) = 3.141593 [2026-01-30 15:09:19] 8 acos(-0.999990) = 3.137117 [2026-01-30 15:09:19] 9 acos(-0.999900) = 3.127449 [2026-01-30 15:09:19] 10 acos(-0.999000) = 3.096868 [2026-01-30 15:09:19] 11 acos(-0.990000) = 3.000053 [2026-01-30 15:09:19] 12 acos(-0.900000) = 2.690566 [2026-01-30 15:09:19] 13 acos(-0.800000) = 2.498095 [2026-01-30 15:09:19] 14 acos(-0.710000) = 2.360346 [2026-01-30 15:09:19] 15 acos(-0.705000) = 2.353167 [2026-01-30 15:09:19] 16 acos(-0.700000) = 2.346148 [2026-01-30 15:09:19] 17 acos(-0.650000) = 2.278369 [2026-01-30 15:09:19] 18 acos(-0.600000) = 2.214295 [2026-01-30 15:09:19] 19 acos(-0.500000) = 2.094395 [2026-01-30 15:09:19] 20 acos(-0.400000) = 1.982313 [2026-01-30 15:09:19] 21 acos(-0.300000) = 1.875489 [2026-01-30 15:09:19] 22 acos(-0.200000) = 1.772154 [2026-01-30 15:09:19] 23 acos(-0.100000) = 1.670964 [2026-01-30 15:09:19] 24 acos(-0.010000) = 1.580796 [2026-01-30 15:09:19] 25 acos(-0.001000) = 1.571796 [2026-01-30 15:09:19] 26 acos(-0.000100) = 1.570896 [2026-01-30 15:09:19] 27 acos(-0.000010) = 1.570806 [2026-01-30 15:09:19] 28 acos(-0.000001) = 1.570797 [2026-01-30 15:09:19] 29 acos(-0.000000) = 1.570796 [2026-01-30 15:09:19] 30 acos(0.000000) = 1.570796 [2026-01-30 15:09:19] 31 acos(nan) = nan [2026-01-30 15:09:19] 32 acos(0.000000) = 1.570796 [2026-01-30 15:09:19] 33 acos(0.000000) = 1.570796 [2026-01-30 15:09:19] 34 acos(0.000001) = 1.570795 [2026-01-30 15:09:19] 35 acos(0.000010) = 1.570786 [2026-01-30 15:09:19] 36 acos(0.000100) = 1.570696 [2026-01-30 15:09:19] 37 acos(0.010000) = 1.560796 [2026-01-30 15:09:19] 38 acos(0.100000) = 1.470629 [2026-01-30 15:09:19] 39 acos(0.200000) = 1.369438 [2026-01-30 15:09:19] 40 acos(0.200000) = 1.369438 [2026-01-30 15:09:19] 41 acos(0.300000) = 1.266104 [2026-01-30 15:09:19] 42 acos(0.400000) = 1.159280 [2026-01-30 15:09:19] 43 acos(0.500000) = 1.047198 [2026-01-30 15:09:19] 44 acos(0.500000) = 1.047198 [2026-01-30 15:09:19] 45 acos(0.600000) = 0.927298 [2026-01-30 15:09:19] 46 acos(0.650000) = 0.863224 [2026-01-30 15:09:19] 47 acos(0.700000) = 0.795445 [2026-01-30 15:09:19] 48 acos(0.705000) = 0.788426 [2026-01-30 15:09:19] 49 acos(0.710000) = 0.781247 [2026-01-30 15:09:19] 50 acos(0.800000) = 0.643498 [2026-01-30 15:09:19] 51 acos(0.900000) = 0.451027 [2026-01-30 15:09:19] 52 acos(0.990000) = 0.141539 [2026-01-30 15:09:19] 53 acos(0.999000) = 0.044725 [2026-01-30 15:09:19] 54 acos(0.999900) = 0.014144 [2026-01-30 15:09:19] 55 acos(0.999990) = 0.004475 [2026-01-30 15:09:19] 56 acos(1.000000) = 0.000000 [2026-01-30 15:09:19] 57 acos(1.010000) = nan [2026-01-30 15:09:19] 58 acos(1.001000) = nan [2026-01-30 15:09:19] 59 acos(1.000100) = nan [2026-01-30 15:09:19] 60 acos(1.000010) = nan [2026-01-30 15:09:19] 61 acos(1.000001) = nan [2026-01-30 15:09:19] 62 acos(12.000000) = nan [2026-01-30 15:09:19] 63 acos(inf) = nan [2026-01-30 15:09:19] run test_aclnn_acos, execute samples success Kernel UT测试结果如下:测试数据形状(32, 8, 7, 7) tmp_input = np.random.choice([1.0, 0.8, 0.7, 0.5, -1, 0.1, 0.0, np.nan, np.inf], size=size)随机选择,精度误差绝对误差和相对误差10的负4次方 diff_res = np.isclose(tmp_out, tmp_gold, rtol=1e-4, atol=1e-4, equal_nan=True) [2026-01-30 15:13:38] Run fast op utest [2026-01-30 15:13:38] [==========] Running 1 test from 1 test suite. [2026-01-30 15:13:38] [----------] Global test environment set-up. [2026-01-30 15:13:38] Global Environment SetpUp. [2026-01-30 15:13:38] [----------] 1 test from AcosTest [2026-01-30 15:13:38] AcosTest SetUp [2026-01-30 15:13:38] [2026-01-30 15:13:38] [ RUN ] AcosTest.test_case_0 [2026-01-30 15:13:38] /home/l00614971/op-math/build/tests/ut/op_kernel/acos_data/gen_data.py:36: RuntimeWarning: invalid value encountered in arccos [2026-01-30 15:13:38] tmp_golden = np.arccos(tmp_input) [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/math/acos/CMakeFiles/ophost_math_tiling_obj.dir/op_host/acos_tiling.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/tests/ut/op_kernel/CMakeFiles/math_op_kernel_ut_ascend910B1.dir/test_op_kernel_main.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/math/acos/tests/ut/op_kernel/CMakeFiles/acos_Ascend910B1_cases_obj.dir/test_acos.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/tests/ut/op_kernel/CMakeFiles/math_op_kernel_ut_common_obj.dir/__/common/tiling_context_faker.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/tests/ut/op_kernel/CMakeFiles/math_op_kernel_ut_common_obj.dir/__/common/tiling_case_executor.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [SUCCESS][CORE_0][pid 1618408] exit success! [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [SUCCESS][CORE_1][pid 1618409] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_2][pid 1618410] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_3][pid 1618411] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_4][pid 1618412] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_5][pid 1618413] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_6][pid 1618414] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_7][pid 1618415] exit success! [2026-01-30 15:13:46] PASSED! [2026-01-30 15:13:46] compare result: True [2026-01-30 15:13:46] [ OK ] AcosTest.test_case_0 (7926 ms) [2026-01-30 15:13:46] AcosTest TearDown [2026-01-30 15:13:46] [2026-01-30 15:13:46] [----------] 1 test from AcosTest (7926 ms total) [2026-01-30 15:13:46] [2026-01-30 15:13:46] [----------] Global test environment tear-down [2026-01-30 15:13:46] Global Environment TearDown [2026-01-30 15:13:46] [==========] 1 test from 1 test suite ran. (7960 ms total) [2026-01-30 15:13:46] [ PASSED ] 1 test. [2026-01-30 15:13:46] [100%] Built target math_op_kernel_ut_ascend910B1 [2026-01-30 15:13:46] [100%] Built target math_op_kernel_ut (ws) [root@shlqh-cann-cluster8-141-61-33-172 op-math]# ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!10333 个月前
Support Acos op with AscendC Co-authored-by: zyf0712<zhangyufei63@huawei.com> # message auto-generated for no-merge-commit merge: !1033 merge master into master Support Acos op with AscendC Created-by: luomin2005 Commit-by: luomin2005;zyf0712 Merged-by: cann-robot Description: ## 描述 使用AscendC实现acos算子 1.按照泰勒公式计算arcsin(x) = Cx + Cx^3 + Cx^5 + Cx^7 + Cx^9 + Cx^11 + Cx^13 + Cx^15 ..... 其中C为泰勒系数,参考常量taylorCoefficients,参考精度要求泰勒系数计算到第8项 T taylorCoefficients[] = {1.0, 1.0 / 6, 3.0 / 40, 5.0 / 112, 35.0 / 1152, 63.0 / 2816, 231.0 / 13312, 143.0 / 10240}; 2.将x取绝对值,并将正负号保存到xSignMask掩码中; 3.当x < Boudry = 0.70710678118654752440084436210485 时计算 arcsin(x), 当x >Boudry计算arcsin(x) = halfPi - 1/2 sqrt(1-x^2) 4.利用arcsin(-x) = -arcsin(x), 根据符号标记合并还原计算负值情况 3.arccos(x) = halfPi - arcsin(x) ## 关联的Issue https://gitcode.com/cann/ops-math/issues/581 ## 测试 [2026-01-30 15:09:13] Start to run examples,name:acos mode:eager [2026-01-30 15:09:13] Start compile and run examples file: ../math/acos/examples/test_aclnn_acos.cpp [2026-01-30 15:09:13] pkg_mode:cust vendor_name:custom [2026-01-30 15:09:19] [Warning]: tiling struct [ReduceOpTilingDataV2] is conflict with one in file kl_div_v2.cc, line 41 [2026-01-30 15:09:19] [Warning]: tiling struct [RepeatInterleaveGradTilingData] is conflict with one in file repeat_interleave_grad_tiling.h, line 21 [2026-01-30 15:09:19] [Warning]: tiling struct [IndexFillTilingData] is conflict with one in file index_fill_tiling.h, line 21 [2026-01-30 15:09:19] [Warning]: tiling struct [MaskedSelectV3TilingData] is conflict with one in file masked_select_v3_tiling.h, line 27 [2026-01-30 15:09:19] [Warning]: tiling struct [MaskedSelectV3TilingData] is conflict with one in file masked_select_v3_tiling.h, line 27 [2026-01-30 15:09:19] [Warning]: tiling struct [ScatterPaKvCacheTilingData] is conflict with one in file scatter_pa_kv_cache_tiling.h, line 35 [2026-01-30 15:09:19] [Warning]: tiling struct [ScatterPaKvCacheTilingData] is conflict with one in file scatter_pa_kv_cache_tiling.h, line 35 [2026-01-30 15:09:19] [Warning]: tiling struct [TopKTopPSampleTilingData] is conflict with one in file top_k_top_p_sample_tiling.h, line 26 [2026-01-30 15:09:19] [Warning]: tiling struct [AvgPool3dGradTilingBlockParam] is conflict with one in file avg_pool_3d_grad_tiling.h, line 99 [2026-01-30 15:09:19] [Warning]: tiling struct [AvgPool3dGradTilingParam] is conflict with one in file avg_pool_3d_grad_tiling.h, line 125 [2026-01-30 15:09:19] [Warning]: tiling struct [FusedCrossEntropyLossWithMaxSumTilingData] is conflict with one in file fused_cross_entropy_loss_with_max_sum_tiling.h, line 27 [2026-01-30 15:09:19] [Warning]: tiling struct [TilingDataBackgroundReplace] is conflict with one in file background_replace_tiling.h, line 22 [2026-01-30 15:09:19] [Warning]: tiling struct [TilingDataBlendImages] is conflict with one in file blend_images_custom_tiling.h, line 24 [2026-01-30 15:09:19] 0 acos(-inf) = nan [2026-01-30 15:09:19] 1 acos(-12.000000) = nan [2026-01-30 15:09:19] 2 acos(-1.000001) = nan [2026-01-30 15:09:19] 3 acos(-1.000010) = nan [2026-01-30 15:09:19] 4 acos(-1.000100) = nan [2026-01-30 15:09:19] 5 acos(-1.001000) = nan [2026-01-30 15:09:19] 6 acos(-1.010000) = nan [2026-01-30 15:09:19] 7 acos(-1.000000) = 3.141593 [2026-01-30 15:09:19] 8 acos(-0.999990) = 3.137117 [2026-01-30 15:09:19] 9 acos(-0.999900) = 3.127449 [2026-01-30 15:09:19] 10 acos(-0.999000) = 3.096868 [2026-01-30 15:09:19] 11 acos(-0.990000) = 3.000053 [2026-01-30 15:09:19] 12 acos(-0.900000) = 2.690566 [2026-01-30 15:09:19] 13 acos(-0.800000) = 2.498095 [2026-01-30 15:09:19] 14 acos(-0.710000) = 2.360346 [2026-01-30 15:09:19] 15 acos(-0.705000) = 2.353167 [2026-01-30 15:09:19] 16 acos(-0.700000) = 2.346148 [2026-01-30 15:09:19] 17 acos(-0.650000) = 2.278369 [2026-01-30 15:09:19] 18 acos(-0.600000) = 2.214295 [2026-01-30 15:09:19] 19 acos(-0.500000) = 2.094395 [2026-01-30 15:09:19] 20 acos(-0.400000) = 1.982313 [2026-01-30 15:09:19] 21 acos(-0.300000) = 1.875489 [2026-01-30 15:09:19] 22 acos(-0.200000) = 1.772154 [2026-01-30 15:09:19] 23 acos(-0.100000) = 1.670964 [2026-01-30 15:09:19] 24 acos(-0.010000) = 1.580796 [2026-01-30 15:09:19] 25 acos(-0.001000) = 1.571796 [2026-01-30 15:09:19] 26 acos(-0.000100) = 1.570896 [2026-01-30 15:09:19] 27 acos(-0.000010) = 1.570806 [2026-01-30 15:09:19] 28 acos(-0.000001) = 1.570797 [2026-01-30 15:09:19] 29 acos(-0.000000) = 1.570796 [2026-01-30 15:09:19] 30 acos(0.000000) = 1.570796 [2026-01-30 15:09:19] 31 acos(nan) = nan [2026-01-30 15:09:19] 32 acos(0.000000) = 1.570796 [2026-01-30 15:09:19] 33 acos(0.000000) = 1.570796 [2026-01-30 15:09:19] 34 acos(0.000001) = 1.570795 [2026-01-30 15:09:19] 35 acos(0.000010) = 1.570786 [2026-01-30 15:09:19] 36 acos(0.000100) = 1.570696 [2026-01-30 15:09:19] 37 acos(0.010000) = 1.560796 [2026-01-30 15:09:19] 38 acos(0.100000) = 1.470629 [2026-01-30 15:09:19] 39 acos(0.200000) = 1.369438 [2026-01-30 15:09:19] 40 acos(0.200000) = 1.369438 [2026-01-30 15:09:19] 41 acos(0.300000) = 1.266104 [2026-01-30 15:09:19] 42 acos(0.400000) = 1.159280 [2026-01-30 15:09:19] 43 acos(0.500000) = 1.047198 [2026-01-30 15:09:19] 44 acos(0.500000) = 1.047198 [2026-01-30 15:09:19] 45 acos(0.600000) = 0.927298 [2026-01-30 15:09:19] 46 acos(0.650000) = 0.863224 [2026-01-30 15:09:19] 47 acos(0.700000) = 0.795445 [2026-01-30 15:09:19] 48 acos(0.705000) = 0.788426 [2026-01-30 15:09:19] 49 acos(0.710000) = 0.781247 [2026-01-30 15:09:19] 50 acos(0.800000) = 0.643498 [2026-01-30 15:09:19] 51 acos(0.900000) = 0.451027 [2026-01-30 15:09:19] 52 acos(0.990000) = 0.141539 [2026-01-30 15:09:19] 53 acos(0.999000) = 0.044725 [2026-01-30 15:09:19] 54 acos(0.999900) = 0.014144 [2026-01-30 15:09:19] 55 acos(0.999990) = 0.004475 [2026-01-30 15:09:19] 56 acos(1.000000) = 0.000000 [2026-01-30 15:09:19] 57 acos(1.010000) = nan [2026-01-30 15:09:19] 58 acos(1.001000) = nan [2026-01-30 15:09:19] 59 acos(1.000100) = nan [2026-01-30 15:09:19] 60 acos(1.000010) = nan [2026-01-30 15:09:19] 61 acos(1.000001) = nan [2026-01-30 15:09:19] 62 acos(12.000000) = nan [2026-01-30 15:09:19] 63 acos(inf) = nan [2026-01-30 15:09:19] run test_aclnn_acos, execute samples success Kernel UT测试结果如下:测试数据形状(32, 8, 7, 7) tmp_input = np.random.choice([1.0, 0.8, 0.7, 0.5, -1, 0.1, 0.0, np.nan, np.inf], size=size)随机选择,精度误差绝对误差和相对误差10的负4次方 diff_res = np.isclose(tmp_out, tmp_gold, rtol=1e-4, atol=1e-4, equal_nan=True) [2026-01-30 15:13:38] Run fast op utest [2026-01-30 15:13:38] [==========] Running 1 test from 1 test suite. [2026-01-30 15:13:38] [----------] Global test environment set-up. [2026-01-30 15:13:38] Global Environment SetpUp. [2026-01-30 15:13:38] [----------] 1 test from AcosTest [2026-01-30 15:13:38] AcosTest SetUp [2026-01-30 15:13:38] [2026-01-30 15:13:38] [ RUN ] AcosTest.test_case_0 [2026-01-30 15:13:38] /home/l00614971/op-math/build/tests/ut/op_kernel/acos_data/gen_data.py:36: RuntimeWarning: invalid value encountered in arccos [2026-01-30 15:13:38] tmp_golden = np.arccos(tmp_input) [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/math/acos/CMakeFiles/ophost_math_tiling_obj.dir/op_host/acos_tiling.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/tests/ut/op_kernel/CMakeFiles/math_op_kernel_ut_ascend910B1.dir/test_op_kernel_main.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/math/acos/tests/ut/op_kernel/CMakeFiles/acos_Ascend910B1_cases_obj.dir/test_acos.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/tests/ut/op_kernel/CMakeFiles/math_op_kernel_ut_common_obj.dir/__/common/tiling_context_faker.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/tests/ut/op_kernel/CMakeFiles/math_op_kernel_ut_common_obj.dir/__/common/tiling_case_executor.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [SUCCESS][CORE_0][pid 1618408] exit success! [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [SUCCESS][CORE_1][pid 1618409] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_2][pid 1618410] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_3][pid 1618411] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_4][pid 1618412] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_5][pid 1618413] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_6][pid 1618414] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_7][pid 1618415] exit success! [2026-01-30 15:13:46] PASSED! [2026-01-30 15:13:46] compare result: True [2026-01-30 15:13:46] [ OK ] AcosTest.test_case_0 (7926 ms) [2026-01-30 15:13:46] AcosTest TearDown [2026-01-30 15:13:46] [2026-01-30 15:13:46] [----------] 1 test from AcosTest (7926 ms total) [2026-01-30 15:13:46] [2026-01-30 15:13:46] [----------] Global test environment tear-down [2026-01-30 15:13:46] Global Environment TearDown [2026-01-30 15:13:46] [==========] 1 test from 1 test suite ran. (7960 ms total) [2026-01-30 15:13:46] [ PASSED ] 1 test. [2026-01-30 15:13:46] [100%] Built target math_op_kernel_ut_ascend910B1 [2026-01-30 15:13:46] [100%] Built target math_op_kernel_ut (ws) [root@shlqh-cann-cluster8-141-61-33-172 op-math]# ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!10333 个月前
refactor: 清理 experimental 目录 tiling 文件中多余的头文件引用 Co-authored-by: songkai111<songkai16@huawei.com> # message auto-generated for no-merge-commit merge: !2956 merge master into master refactor: 清理 experimental 目录 tiling 文件中多余的头文件引用 Created-by: songkai111 Commit-by: songkai111 Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!29567 天前
Support Acos op with AscendC,new data type float16 and bfloat16 Co-authored-by: zyf0712<zhangyufei63@huawei.com> # message auto-generated for no-merge-commit merge: !1095 merge master into master Support Acos op with AscendC,new data type float16 and bfloat16 Created-by: luomin2005 Commit-by: luomin2005;zyf0712 Merged-by: cann-robot Description: 描述 使用AscendC实现acos算子,本次新增数据类型float16和bfloat16,修复kernel计算Compute未进行256字节对齐问题,并且完善UT用例 出问题的log日志如下 [2026-02-03 14:28:27] tileLength =1638 [2026-02-03 14:28:29] [ERROR][Block_1][AIV_0][/home/l00614971/cann/cann-9.0.0/aarch64-linux/asc/include/basic_api/../../impl/basic_api/kernel_operator_vec_cmpsel_intf_impl.h:314][CompareScalar][182417] Failed to check count elements size in CompareScalar, current size is 6556, should be an integer multiple of 256. [2026-02-03 14:28:29] [ERROR][CORE_1][pid 182417] error happened! ========= 关联的Issue [Requirement|需求建议]: 支持AscendC类型Acos算子 测试 [2026-02-09 16:40:25] [INFO] RUNTIME(264152,test_aclnn_acos):2026-02-09-16:40:25.044.668 [task_fail_callback_data_manager.cc:93] 264152 ~TaskFailCallBackManager: Destructor. [2026-02-09 16:40:25] [INFO] ATRACE(264152,test_aclnn_acos):2026-02-09-16:40:25.044.913 [stacktrace_signal.c:194](tid:264152) unregister all signal handlers, can not capture signal. [2026-02-09 16:40:25] [INFO] ATRACE(264152,test_aclnn_acos):2026-02-09-16:40:25.101.762 [awatchdog_monitor.c:233](tid:264152) AwdMonitorExit [2026-02-09 16:40:25] 0 acos(-inf) = nan [2026-02-09 16:40:25] 1 acos(-12.000000) = nan [2026-02-09 16:40:25] 2 acos(-1.000001) = nan [2026-02-09 16:40:25] 3 acos(-1.000010) = nan [2026-02-09 16:40:25] 4 acos(-1.000100) = nan [2026-02-09 16:40:25] 5 acos(-1.001000) = nan [2026-02-09 16:40:25] 6 acos(-1.010000) = nan [2026-02-09 16:40:25] 7 acos(-1.000000) = 3.141593 [2026-02-09 16:40:25] 8 acos(-0.999990) = 3.137117 [2026-02-09 16:40:25] 9 acos(-0.999900) = 3.127449 [2026-02-09 16:40:25] 10 acos(-0.999000) = 3.096868 [2026-02-09 16:40:25] 11 acos(-0.990000) = 3.000053 [2026-02-09 16:40:25] 12 acos(-0.900000) = 2.690566 [2026-02-09 16:40:25] 13 acos(-0.800000) = 2.498095 [2026-02-09 16:40:25] 14 acos(-0.710000) = 2.360346 [2026-02-09 16:40:25] 15 acos(-0.705000) = 2.353167 [2026-02-09 16:40:25] 16 acos(-0.700000) = 2.346148 [2026-02-09 16:40:25] 17 acos(-0.650000) = 2.278369 [2026-02-09 16:40:25] 18 acos(-0.600000) = 2.214295 [2026-02-09 16:40:25] 19 acos(-0.500000) = 2.094395 [2026-02-09 16:40:25] 20 acos(-0.400000) = 1.982313 [2026-02-09 16:40:25] 21 acos(-0.300000) = 1.875489 [2026-02-09 16:40:25] 22 acos(-0.200000) = 1.772154 [2026-02-09 16:40:25] 23 acos(-0.100000) = 1.670964 [2026-02-09 16:40:25] 24 acos(-0.010000) = 1.580796 [2026-02-09 16:40:25] 25 acos(-0.001000) = 1.571796 [2026-02-09 16:40:25] 26 acos(-0.000100) = 1.570896 [2026-02-09 16:40:25] 27 acos(-0.000010) = 1.570806 [2026-02-09 16:40:25] 28 acos(-0.000001) = 1.570797 [2026-02-09 16:40:25] 29 acos(-0.000000) = 1.570796 [2026-02-09 16:40:25] 30 acos(0.000000) = 1.570796 [2026-02-09 16:40:25] 31 acos(nan) = nan [2026-02-09 16:40:25] 32 acos(0.000000) = 1.570796 [2026-02-09 16:40:25] 33 acos(0.000000) = 1.570796 [2026-02-09 16:40:25] 34 acos(0.000001) = 1.570795 [2026-02-09 16:40:25] 35 acos(0.000010) = 1.570786 [2026-02-09 16:40:25] 36 acos(0.000100) = 1.570696 [2026-02-09 16:40:25] 37 acos(0.010000) = 1.560796 [2026-02-09 16:40:25] 38 acos(0.100000) = 1.470629 [2026-02-09 16:40:25] 39 acos(0.200000) = 1.369438 [2026-02-09 16:40:25] 40 acos(0.200000) = 1.369438 [2026-02-09 16:40:25] 41 acos(0.300000) = 1.266104 [2026-02-09 16:40:25] 42 acos(0.400000) = 1.159280 [2026-02-09 16:40:25] 43 acos(0.500000) = 1.047198 [2026-02-09 16:40:25] 44 acos(0.500000) = 1.047198 [2026-02-09 16:40:25] 45 acos(0.600000) = 0.927298 [2026-02-09 16:40:25] 46 acos(0.650000) = 0.863224 [2026-02-09 16:40:25] 47 acos(0.700000) = 0.795445 [2026-02-09 16:40:25] 48 acos(0.705000) = 0.788426 [2026-02-09 16:40:25] 49 acos(0.710000) = 0.781247 [2026-02-09 16:40:25] 50 acos(0.800000) = 0.643498 [2026-02-09 16:40:25] 51 acos(0.900000) = 0.451027 [2026-02-09 16:40:25] 52 acos(0.990000) = 0.141539 [2026-02-09 16:40:25] 53 acos(0.999000) = 0.044725 [2026-02-09 16:40:25] 54 acos(0.999900) = 0.014144 [2026-02-09 16:40:25] 55 acos(0.999990) = 0.004475 [2026-02-09 16:40:25] 56 acos(1.000000) = 0.000000 [2026-02-09 16:40:25] 57 acos(1.010000) = nan [2026-02-09 16:40:25] 58 acos(1.001000) = nan [2026-02-09 16:40:25] 59 acos(1.000100) = nan [2026-02-09 16:40:25] 60 acos(1.000010) = nan [2026-02-09 16:40:25] 61 acos(1.000001) = nan [2026-02-09 16:40:25] 62 acos(12.000000) = nan [2026-02-09 16:40:25] 63 acos(inf) = nan [2026-02-09 16:40:25] run test_aclnn_acos, execute samples success ST用例测试通过,测试数据随机,形状10281*10241 (base) [root@shlqh-cann-cluster8-141-61-33-172 st]# python test_acos.py fp32 result: True fp16 result: True bf16 result: True (base) [root@shlqh-cann-cluster8-141-61-33-172 st]# Kernel UT测试结果如下:测试数据形状(32, 8, 7, 7) 精度误差绝对误差和相对误差float32类型控制10的负4次方,float16控制10的负3次方,bfloat16控制4*10的负三次方 [2026-02-09 16:43:08] [SUCCESS][CORE_39][pid 266919] exit success! [2026-02-09 16:43:12] PASSED! [2026-02-09 16:43:12] compare result: True [2026-02-09 16:43:12] [ OK ] AcosTest.test_case_2 (12822 ms) [2026-02-09 16:43:12] AcosTest TearDown [2026-02-09 16:43:12] [2026-02-09 16:43:12] [----------] 3 tests from AcosTest (40890 ms total) [2026-02-09 16:43:12] [2026-02-09 16:43:12] [----------] Global test environment tear-down [2026-02-09 16:43:12] Global Environment TearDown [2026-02-09 16:43:12] [==========] 3 tests from 1 test suite ran. (40922 ms total) [2026-02-09 16:43:12] [ PASSED ] 3 tests. host侧tiling UT测试通过 [2026-02-09 16:45:17] [----------] 5 tests from AcosTiling [2026-02-09 16:45:17] AcosTiling SetUp [2026-02-09 16:45:17] [ RUN ] AcosTiling.acos_tiling_001 [2026-02-09 16:45:17] [INFO] GE(268526,math_op_host_ut):2026-02-09-16:45:17.592.907 [op_context_builder_impl.cc:103]268526 CreateComputeNodeInfoImpl:Node Acos, compute_node_info attr_size 48, outputs_ins_info_size:48, offset:416, total_size:520. [2026-02-09 16:45:17] [ OK ] AcosTiling.acos_tiling_001 (0 ms) [2026-02-09 16:45:17] [ RUN ] AcosTiling.acos_tiling_002 [2026-02-09 16:45:17] [INFO] GE(268526,math_op_host_ut):2026-02-09-16:45:17.593.743 [op_context_builder_impl.cc:103]268526 CreateComputeNodeInfoImpl:Node Acos, compute_node_info attr_size 48, outputs_ins_info_size:48, offset:416, total_size:520. [2026-02-09 16:45:17] [ OK ] AcosTiling.acos_tiling_002 (0 ms) [2026-02-09 16:45:17] [ RUN ] AcosTiling.acos_tiling_003 [2026-02-09 16:45:17] [INFO] GE(268526,math_op_host_ut):2026-02-09-16:45:17.594.411 [op_context_builder_impl.cc:103]268526 CreateComputeNodeInfoImpl:Node Acos, compute_node_info attr_size 48, outputs_ins_info_size:48, offset:416, total_size:520. [2026-02-09 16:45:17] [ OK ] AcosTiling.acos_tiling_003 (0 ms) [2026-02-09 16:45:17] [ RUN ] AcosTiling.acos_tiling_004 [2026-02-09 16:45:17] [INFO] GE(268526,math_op_host_ut):2026-02-09-16:45:17.595.066 [op_context_builder_impl.cc:103]268526 CreateComputeNodeInfoImpl:Node Acos, compute_node_info attr_size 48, outputs_ins_info_size:48, offset:416, total_size:520. [2026-02-09 16:45:17] [ OK ] AcosTiling.acos_tiling_004 (0 ms) [2026-02-09 16:45:17] [ RUN ] AcosTiling.acos_tiling_005 [2026-02-09 16:45:17] [INFO] GE(268526,math_op_host_ut):2026-02-09-16:45:17.595.730 [op_context_builder_impl.cc:103]268526 CreateComputeNodeInfoImpl:Node Acos, compute_node_info attr_size 48, outputs_ins_info_size:48, offset:416, total_size:520. [2026-02-09 16:45:17] [ OK ] AcosTiling.acos_tiling_005 (0 ms) [2026-02-09 16:45:17] AcosTiling TearDown [2026-02-09 16:45:17] [----------] 5 tests from AcosTiling (3 ms total) [2026-02-09 16:45:17] [2026-02-09 16:45:17] [----------] Global test environment tear-down [2026-02-09 16:45:17] Global Environment TearDown [2026-02-09 16:45:17] [==========] 5 tests from 1 test suite ran. (15 ms total) [2026-02-09 16:45:17] [ PASSED ] 5 tests. (ws) [root@shlqh-cann-cluster8-141-61-33-172 op-math]# <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!10953 个月前
修复experimental默认acos用例错误 Co-authored-by: liulinxiang<liulinxiang1@huawei.com> # message auto-generated for no-merge-commit merge: !1948 merge test/readme-update-test into master 修复experimental默认acos用例错误 Created-by: liulinxiang Commit-by: liulinxiang Merged-by: cann-robot Description: ## 描述 acos只支持910b,跑到ascend950会失败 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/1089 ## 测试 自测OK ## 文档更新 无需更新文档 ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他 See merge request: cann/ops-math!19482 个月前
Support Acos op with AscendC Co-authored-by: zyf0712<zhangyufei63@huawei.com> # message auto-generated for no-merge-commit merge: !1033 merge master into master Support Acos op with AscendC Created-by: luomin2005 Commit-by: luomin2005;zyf0712 Merged-by: cann-robot Description: ## 描述 使用AscendC实现acos算子 1.按照泰勒公式计算arcsin(x) = Cx + Cx^3 + Cx^5 + Cx^7 + Cx^9 + Cx^11 + Cx^13 + Cx^15 ..... 其中C为泰勒系数,参考常量taylorCoefficients,参考精度要求泰勒系数计算到第8项 T taylorCoefficients[] = {1.0, 1.0 / 6, 3.0 / 40, 5.0 / 112, 35.0 / 1152, 63.0 / 2816, 231.0 / 13312, 143.0 / 10240}; 2.将x取绝对值,并将正负号保存到xSignMask掩码中; 3.当x < Boudry = 0.70710678118654752440084436210485 时计算 arcsin(x), 当x >Boudry计算arcsin(x) = halfPi - 1/2 sqrt(1-x^2) 4.利用arcsin(-x) = -arcsin(x), 根据符号标记合并还原计算负值情况 3.arccos(x) = halfPi - arcsin(x) ## 关联的Issue https://gitcode.com/cann/ops-math/issues/581 ## 测试 [2026-01-30 15:09:13] Start to run examples,name:acos mode:eager [2026-01-30 15:09:13] Start compile and run examples file: ../math/acos/examples/test_aclnn_acos.cpp [2026-01-30 15:09:13] pkg_mode:cust vendor_name:custom [2026-01-30 15:09:19] [Warning]: tiling struct [ReduceOpTilingDataV2] is conflict with one in file kl_div_v2.cc, line 41 [2026-01-30 15:09:19] [Warning]: tiling struct [RepeatInterleaveGradTilingData] is conflict with one in file repeat_interleave_grad_tiling.h, line 21 [2026-01-30 15:09:19] [Warning]: tiling struct [IndexFillTilingData] is conflict with one in file index_fill_tiling.h, line 21 [2026-01-30 15:09:19] [Warning]: tiling struct [MaskedSelectV3TilingData] is conflict with one in file masked_select_v3_tiling.h, line 27 [2026-01-30 15:09:19] [Warning]: tiling struct [MaskedSelectV3TilingData] is conflict with one in file masked_select_v3_tiling.h, line 27 [2026-01-30 15:09:19] [Warning]: tiling struct [ScatterPaKvCacheTilingData] is conflict with one in file scatter_pa_kv_cache_tiling.h, line 35 [2026-01-30 15:09:19] [Warning]: tiling struct [ScatterPaKvCacheTilingData] is conflict with one in file scatter_pa_kv_cache_tiling.h, line 35 [2026-01-30 15:09:19] [Warning]: tiling struct [TopKTopPSampleTilingData] is conflict with one in file top_k_top_p_sample_tiling.h, line 26 [2026-01-30 15:09:19] [Warning]: tiling struct [AvgPool3dGradTilingBlockParam] is conflict with one in file avg_pool_3d_grad_tiling.h, line 99 [2026-01-30 15:09:19] [Warning]: tiling struct [AvgPool3dGradTilingParam] is conflict with one in file avg_pool_3d_grad_tiling.h, line 125 [2026-01-30 15:09:19] [Warning]: tiling struct [FusedCrossEntropyLossWithMaxSumTilingData] is conflict with one in file fused_cross_entropy_loss_with_max_sum_tiling.h, line 27 [2026-01-30 15:09:19] [Warning]: tiling struct [TilingDataBackgroundReplace] is conflict with one in file background_replace_tiling.h, line 22 [2026-01-30 15:09:19] [Warning]: tiling struct [TilingDataBlendImages] is conflict with one in file blend_images_custom_tiling.h, line 24 [2026-01-30 15:09:19] 0 acos(-inf) = nan [2026-01-30 15:09:19] 1 acos(-12.000000) = nan [2026-01-30 15:09:19] 2 acos(-1.000001) = nan [2026-01-30 15:09:19] 3 acos(-1.000010) = nan [2026-01-30 15:09:19] 4 acos(-1.000100) = nan [2026-01-30 15:09:19] 5 acos(-1.001000) = nan [2026-01-30 15:09:19] 6 acos(-1.010000) = nan [2026-01-30 15:09:19] 7 acos(-1.000000) = 3.141593 [2026-01-30 15:09:19] 8 acos(-0.999990) = 3.137117 [2026-01-30 15:09:19] 9 acos(-0.999900) = 3.127449 [2026-01-30 15:09:19] 10 acos(-0.999000) = 3.096868 [2026-01-30 15:09:19] 11 acos(-0.990000) = 3.000053 [2026-01-30 15:09:19] 12 acos(-0.900000) = 2.690566 [2026-01-30 15:09:19] 13 acos(-0.800000) = 2.498095 [2026-01-30 15:09:19] 14 acos(-0.710000) = 2.360346 [2026-01-30 15:09:19] 15 acos(-0.705000) = 2.353167 [2026-01-30 15:09:19] 16 acos(-0.700000) = 2.346148 [2026-01-30 15:09:19] 17 acos(-0.650000) = 2.278369 [2026-01-30 15:09:19] 18 acos(-0.600000) = 2.214295 [2026-01-30 15:09:19] 19 acos(-0.500000) = 2.094395 [2026-01-30 15:09:19] 20 acos(-0.400000) = 1.982313 [2026-01-30 15:09:19] 21 acos(-0.300000) = 1.875489 [2026-01-30 15:09:19] 22 acos(-0.200000) = 1.772154 [2026-01-30 15:09:19] 23 acos(-0.100000) = 1.670964 [2026-01-30 15:09:19] 24 acos(-0.010000) = 1.580796 [2026-01-30 15:09:19] 25 acos(-0.001000) = 1.571796 [2026-01-30 15:09:19] 26 acos(-0.000100) = 1.570896 [2026-01-30 15:09:19] 27 acos(-0.000010) = 1.570806 [2026-01-30 15:09:19] 28 acos(-0.000001) = 1.570797 [2026-01-30 15:09:19] 29 acos(-0.000000) = 1.570796 [2026-01-30 15:09:19] 30 acos(0.000000) = 1.570796 [2026-01-30 15:09:19] 31 acos(nan) = nan [2026-01-30 15:09:19] 32 acos(0.000000) = 1.570796 [2026-01-30 15:09:19] 33 acos(0.000000) = 1.570796 [2026-01-30 15:09:19] 34 acos(0.000001) = 1.570795 [2026-01-30 15:09:19] 35 acos(0.000010) = 1.570786 [2026-01-30 15:09:19] 36 acos(0.000100) = 1.570696 [2026-01-30 15:09:19] 37 acos(0.010000) = 1.560796 [2026-01-30 15:09:19] 38 acos(0.100000) = 1.470629 [2026-01-30 15:09:19] 39 acos(0.200000) = 1.369438 [2026-01-30 15:09:19] 40 acos(0.200000) = 1.369438 [2026-01-30 15:09:19] 41 acos(0.300000) = 1.266104 [2026-01-30 15:09:19] 42 acos(0.400000) = 1.159280 [2026-01-30 15:09:19] 43 acos(0.500000) = 1.047198 [2026-01-30 15:09:19] 44 acos(0.500000) = 1.047198 [2026-01-30 15:09:19] 45 acos(0.600000) = 0.927298 [2026-01-30 15:09:19] 46 acos(0.650000) = 0.863224 [2026-01-30 15:09:19] 47 acos(0.700000) = 0.795445 [2026-01-30 15:09:19] 48 acos(0.705000) = 0.788426 [2026-01-30 15:09:19] 49 acos(0.710000) = 0.781247 [2026-01-30 15:09:19] 50 acos(0.800000) = 0.643498 [2026-01-30 15:09:19] 51 acos(0.900000) = 0.451027 [2026-01-30 15:09:19] 52 acos(0.990000) = 0.141539 [2026-01-30 15:09:19] 53 acos(0.999000) = 0.044725 [2026-01-30 15:09:19] 54 acos(0.999900) = 0.014144 [2026-01-30 15:09:19] 55 acos(0.999990) = 0.004475 [2026-01-30 15:09:19] 56 acos(1.000000) = 0.000000 [2026-01-30 15:09:19] 57 acos(1.010000) = nan [2026-01-30 15:09:19] 58 acos(1.001000) = nan [2026-01-30 15:09:19] 59 acos(1.000100) = nan [2026-01-30 15:09:19] 60 acos(1.000010) = nan [2026-01-30 15:09:19] 61 acos(1.000001) = nan [2026-01-30 15:09:19] 62 acos(12.000000) = nan [2026-01-30 15:09:19] 63 acos(inf) = nan [2026-01-30 15:09:19] run test_aclnn_acos, execute samples success Kernel UT测试结果如下:测试数据形状(32, 8, 7, 7) tmp_input = np.random.choice([1.0, 0.8, 0.7, 0.5, -1, 0.1, 0.0, np.nan, np.inf], size=size)随机选择,精度误差绝对误差和相对误差10的负4次方 diff_res = np.isclose(tmp_out, tmp_gold, rtol=1e-4, atol=1e-4, equal_nan=True) [2026-01-30 15:13:38] Run fast op utest [2026-01-30 15:13:38] [==========] Running 1 test from 1 test suite. [2026-01-30 15:13:38] [----------] Global test environment set-up. [2026-01-30 15:13:38] Global Environment SetpUp. [2026-01-30 15:13:38] [----------] 1 test from AcosTest [2026-01-30 15:13:38] AcosTest SetUp [2026-01-30 15:13:38] [2026-01-30 15:13:38] [ RUN ] AcosTest.test_case_0 [2026-01-30 15:13:38] /home/l00614971/op-math/build/tests/ut/op_kernel/acos_data/gen_data.py:36: RuntimeWarning: invalid value encountered in arccos [2026-01-30 15:13:38] tmp_golden = np.arccos(tmp_input) [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/math/acos/CMakeFiles/ophost_math_tiling_obj.dir/op_host/acos_tiling.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/tests/ut/op_kernel/CMakeFiles/math_op_kernel_ut_ascend910B1.dir/test_op_kernel_main.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/math/acos/tests/ut/op_kernel/CMakeFiles/acos_Ascend910B1_cases_obj.dir/test_acos.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/tests/ut/op_kernel/CMakeFiles/math_op_kernel_ut_common_obj.dir/__/common/tiling_context_faker.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:39] libgcov profiling error:/home/l00614971/op-math/build/tests/ut/op_kernel/CMakeFiles/math_op_kernel_ut_common_obj.dir/__/common/tiling_case_executor.cpp.gcda:overwriting an existing profile data with a different timestamp [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [SUCCESS][CORE_0][pid 1618408] exit success! [2026-01-30 15:13:46] [TmSim]: Run in serial mode. [2026-01-30 15:13:46] [SUCCESS][CORE_1][pid 1618409] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_2][pid 1618410] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_3][pid 1618411] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_4][pid 1618412] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_5][pid 1618413] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_6][pid 1618414] exit success! [2026-01-30 15:13:46] [SUCCESS][CORE_7][pid 1618415] exit success! [2026-01-30 15:13:46] PASSED! [2026-01-30 15:13:46] compare result: True [2026-01-30 15:13:46] [ OK ] AcosTest.test_case_0 (7926 ms) [2026-01-30 15:13:46] AcosTest TearDown [2026-01-30 15:13:46] [2026-01-30 15:13:46] [----------] 1 test from AcosTest (7926 ms total) [2026-01-30 15:13:46] [2026-01-30 15:13:46] [----------] Global test environment tear-down [2026-01-30 15:13:46] Global Environment TearDown [2026-01-30 15:13:46] [==========] 1 test from 1 test suite ran. (7960 ms total) [2026-01-30 15:13:46] [ PASSED ] 1 test. [2026-01-30 15:13:46] [100%] Built target math_op_kernel_ut_ascend910B1 [2026-01-30 15:13:46] [100%] Built target math_op_kernel_ut (ws) [root@shlqh-cann-cluster8-141-61-33-172 op-math]# ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [x] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!10333 个月前
修改math仓失效链接 Co-authored-by: sakuraqqz<furao15@h-partners.com> # message auto-generated for no-merge-commit merge: !1227 merge md_link into master 修改math仓失效链接 Created-by: sakuraqqz Commit-by: sakuraqqz Merged-by: cann-robot Description: ## 描述 <!--在这里详细描述你的改动,包括改动的原因和所采取的方法。--> 修改math仓失效链接 ## 关联的Issue <!-- 如果这个PR是为了解决特定的Issue,请在这里提供Issue链接。--> <!-- 如果这个PR是为了解决特定的问题单,请在这里描述问题单单号。--> https://gitcode.com/cann/ops-math/issues/718 ## 测试 <!--描述进行了哪些测试来验证你的改动。包括但不限于二级冒烟、算子泛化等。--> ## 文档更新 <!--如果这个PR包含文档的更新,请在这里指出。例如:更新了README.md文件。--> ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!12273 个月前
README.md

Acos

产品支持情况

产品 是否支持
Atlas A3 训练系列产品/Atlas A3 推理系列产品
Atlas A2 训练系列产品/Atlas A2 推理系列产品

功能说明

  • 算子功能:对输入的每个元素进行反余弦操作后输出。

  • 计算公式:

    yi=cos−1(xi)y_{i}=cos^{-1}(x_{i})

参数说明

参数名 输入/输出/属性 描述 数据类型 数据格式
x 输入 公式中的输入张量x。 INT8、INT16、INT32、INT64、UINT8、BOOL、FLOAT、BFLOAT16、FLOAT16、DOUBLE ND
y 输出 公式中的输出张量y。 FLOAT、BFLOAT16、FLOAT16、DOUBLE ND

约束说明

  • 输入类型为INT8、INT16、INT32、INT64、UINT8、BOOL时,转化为FLOAT32进行运算,输出FLOAT32类型。支持非连续的Tensor数据格式支持ND,非连续的Tensor维度不大于8,且输入与输出的shape需要一致。

调用说明

调用方式 调用样例 说明
aclnn调用 test_aclnn_acos 通过aclnnAcos接口方式调用Acos算子。
图模式调用 test_geir_acos 通过算子IR构图方式调用Acos算子。