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

Fix get_elf_hwcap always return 0 on HarmonyOS NEXT. #5951

Merged
merged 1 commit into from
Mar 28, 2025

Conversation

peerless2012
Copy link
Contributor

This is a fix for get_elf_hwcap on HarmonyOS NEXT device, see #5950 .

By default, get_elf_hwcap will use get_elf_hwcap_from_proc_self_auxv, and it need to read /proc/self/auxv to get the hwcap.

And on HarmonyOS NEXT, when build hap with debug type, /proc/self/auxv is readable. But when build hap with release, /proc/self/auxv can't read. That will make g_hwcaps and g_hwcaps2 to 0 when use release build type.

HarmonyOS NEXT has <sys/auxv.h>, so use getauxval() in <sys/auxv.h>, just like android do.

This issue will Influence the methods below:

auto asimdhp = ncnn::cpu_support_arm_asimdhp();
auto cpuid = ncnn::cpu_support_arm_cpuid();
auto asimddp = ncnn::cpu_support_arm_asimddp();
auto asimdfhm = ncnn::cpu_support_arm_asimdfhm();
auto bf16 = ncnn::cpu_support_arm_bf16();
auto i8mm = ncnn::cpu_support_arm_i8mm();
auto sve = ncnn::cpu_support_arm_sve();
auto sve2 = ncnn::cpu_support_arm_sve2();
auto svebf16 = ncnn::cpu_support_arm_svebf16();
...

Due my test, after the change, cpuid and sve2 art still 0, others works fine.

@github-actions github-actions bot added the core label Mar 27, 2025
@tencent-adm
Copy link
Member

tencent-adm commented Mar 27, 2025

CLA assistant check
All committers have signed the CLA.

@codecov-commenter
Copy link

codecov-commenter commented Mar 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.42%. Comparing base (8211930) to head (b49696c).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5951      +/-   ##
==========================================
+ Coverage   95.37%   95.42%   +0.05%     
==========================================
  Files         816      819       +3     
  Lines      267270   268184     +914     
==========================================
+ Hits       254907   255922    +1015     
+ Misses      12363    12262     -101     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nihui nihui merged commit 1d1ad06 into Tencent:master Mar 28, 2025
77 of 81 checks passed
@nihui
Copy link
Member

nihui commented Mar 28, 2025

Thanks for your contribution !

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

Successfully merging this pull request may close these issues.

4 participants