Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement simplemath #4905

Merged
merged 60 commits into from
Oct 23, 2023
Merged

implement simplemath #4905

merged 60 commits into from
Oct 23, 2023

Conversation

HonestDeng
Copy link
Contributor

No description provided.

@tencent-adm
Copy link
Member

tencent-adm commented Aug 3, 2023

CLA assistant check
All committers have signed the CLA.

@nihui
Copy link
Member

nihui commented Aug 3, 2023

simplemath 只需要实现 float 版本就足够吧,ncnn 里头应该没用到 double :D

@nihui
Copy link
Member

nihui commented Aug 10, 2023

  • 目标:新增cmake选项NCNN_SIMPLEMATH,用于开启
  • 目标:新增 simplemath CI,通过全部测试,免去libm依赖

@codecov-commenter
Copy link

codecov-commenter commented Aug 20, 2023

Codecov Report

Merging #4905 (c1b4364) into master (3f437d3) will decrease coverage by 0.39%.
The diff coverage is 85.81%.

@@            Coverage Diff             @@
##           master    #4905      +/-   ##
==========================================
- Coverage   94.89%   94.51%   -0.39%     
==========================================
  Files         776      784       +8     
  Lines      238724   239612     +888     
==========================================
- Hits       226547   226479      -68     
- Misses      12177    13133     +956     
Files Coverage Δ
src/gpu.cpp 78.19% <ø> (-3.41%) ⬇️
src/layer.cpp 45.28% <ø> (-0.72%) ⬇️
src/layer/arm/binaryop_arm.cpp 99.66% <ø> (ø)
src/layer/arm/binaryop_arm_asimdhp.cpp 99.71% <ø> (ø)
src/layer/arm/gelu_arm.cpp 100.00% <ø> (ø)
src/layer/arm/gelu_arm_asimdhp.cpp 100.00% <ø> (ø)
src/layer/arm/gru_arm.cpp 96.58% <ø> (ø)
src/layer/arm/gru_arm_asimdhp.cpp 95.03% <ø> (ø)
src/layer/arm/interp_arm.cpp 98.34% <ø> (ø)
src/layer/arm/interp_arm_asimdhp.cpp 98.05% <ø> (ø)
... and 118 more

... and 158 files with indirect coverage changes

@HonestDeng
Copy link
Contributor Author

@nihui nihui大大,我在.ci/test-coverage.yml末尾添加了一个“linux-gcc-x64-simplemath"测试任务之后,test-coverage.yml文件就运行失败了,我想问为什么我的test-coveragte.yml测试会失败?是因为我在test-coverage.yml文件后面添加的“linux-gcc-x64-simplemath”写错了么?
我之前没有接触过软件测试和CI,所以有很多地方不同的,希望nihui大大见谅。

@HonestDeng
Copy link
Contributor Author

@nihui 想问一下,为什么test-coverage.yml运行失败吗?

@HonestDeng
Copy link
Contributor Author

HonestDeng commented Sep 22, 2023

当我尝试在苹果M1芯片上的ubuntu虚拟机里编译ncnn时,cmake命令是
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/aarch64-linux-gnu-c.toolchain.cmake -DNCNN_STDIO=ON -DNCNN_STRING=ON -DNCNN_SIMPLESTL=ON -DNCNN_SIMPLEMATH=ON -DNCNN_BUILD_TESTS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF ..
但是出现了这个报错下面的报错:
undefined reference to '__aarch64_ldadd4_acq_rel'
经过一番搜索,发现原因好像是因为编译器没有找到上面的这个函数。我的解决方法是删除aarch64-linux-gnu-c.toolchain.cmake中的-nodefaultlibs编译命令。在删除-nodefaultlibs 之后,就可以在运行ubuntu虚拟机的M1芯片上成功编译了。另外,我还在工作流linux-aarch64-cpu-gcc.yml中加入了build-simplestl-simplemath任务,自动测试simplemath是否能在aarch64上成功编译。我的工作已经完成了。
我不清楚直接删除-nodefaultlibs是否合适,所以需要 @nihui 来审查代码。

@nihui
Copy link
Member

nihui commented Sep 22, 2023

当我尝试在苹果M1芯片上的ubuntu虚拟机里编译ncnn时,cmake命令是 cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/aarch64-linux-gnu-c.toolchain.cmake -DNCNN_STDIO=ON -DNCNN_STRING=ON -DNCNN_SIMPLESTL=ON -DNCNN_SIMPLEMATH=ON -DNCNN_BUILD_TESTS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF .. 但是出现了这个报错下面的报错: undefined reference to '__aarch64_ldadd4_acq_rel' 经过一番搜索,发现原因好像是因为编译器没有找到上面的这个函数。我的解决方法是删除aarch64-linux-gnu-c.toolchain.cmake中的-nodefaultlibs编译命令。在删除-nodefaultlibs 之后,就可以在运行ubuntu虚拟机的M1芯片上成功编译了。另外,我还在工作流linux-aarch64-cpu-gcc.yml中加入了build-simplestl-simplemath任务,自动测试simplemath是否能在aarch64上成功编译。我的工作已经完成了。 我不清楚直接删除-nodefaultlibs是否合适,所以需要 @nihui 来审查代码。

这是新版本 clang / gcc 的行为,可以添加 -mno-outline-atomics 参数恢复

@HonestDeng
Copy link
Contributor Author

当我尝试在苹果M1芯片上的ubuntu虚拟机里编译ncnn时,cmake命令是 cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/aarch64-linux-gnu-c.toolchain.cmake -DNCNN_STDIO=ON -DNCNN_STRING=ON -DNCNN_SIMPLESTL=ON -DNCNN_SIMPLEMATH=ON -DNCNN_BUILD_TESTS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF .. 但是出现了这个报错下面的报错: undefined reference to '__aarch64_ldadd4_acq_rel' 经过一番搜索,发现原因好像是因为编译器没有找到上面的这个函数。我的解决方法是删除aarch64-linux-gnu-c.toolchain.cmake中的-nodefaultlibs编译命令。在删除-nodefaultlibs 之后,就可以在运行ubuntu虚拟机的M1芯片上成功编译了。另外,我还在工作流linux-aarch64-cpu-gcc.yml中加入了build-simplestl-simplemath任务,自动测试simplemath是否能在aarch64上成功编译。我的工作已经完成了。 我不清楚直接删除-nodefaultlibs是否合适,所以需要 @nihui 来审查代码。

这是新版本 clang / gcc 的行为,可以添加 -mno-outline-atomics 参数恢复

是的。昨晚我也尝试过加入-mno-outline-atomics参数进行编译,确实可以成功编译。但是我搜索一番,担心-mno-outline-atomics会影响编译器的其它行为,所以没有采用。Anyway,我现在把-mno-outline-atomics 参数加上去。

@HonestDeng
Copy link
Contributor Author

我已经完成了代码的编写了, @nihui 可以打开测试然后检查我的代码了。

@HonestDeng HonestDeng changed the title [WIP] implement simplemath implement simplemath Sep 25, 2023
@HonestDeng
Copy link
Contributor Author

@nihui nihui忘记simplemath了吗?😂

src/layer/x86/deformableconv2d_x86.cpp Outdated Show resolved Hide resolved
src/simplestl.cpp Outdated Show resolved Hide resolved
@nihui nihui mentioned this pull request Oct 20, 2023
@nihui nihui merged commit a1e3ebf into Tencent:master Oct 23, 2023
94 checks passed
@nihui
Copy link
Member

nihui commented Oct 23, 2023

Thanks for your contribution !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants