platform: Add AArch64 CPU feature detection#622
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
CpuInfo only supported x86. Add GetAArch64CpuInfo() backed by cpu_features::GetAarch64Info(), with vendor and microarchitecture strings resolved from implementer/part codes (Linux kernel arch/arm64/include/asm/cputype.h). Adds CpuInfo::AArch64Features with 31 feature flags. Update sample_00_ppx_info to print the AArch64 feature set on AArch64 and the x86 feature set otherwise. Fix !PPX_ANDROID to NOT PPX_ANDROID in projects/CMakeLists.txt. Tested on Snapdragon X Elite (Qualcomm Oryon X1), Linux AArch64.
|
@jorgeag-google I've signed the CLA, who would be an appropriate reviewer for this change? Thanks. |
hysw
left a comment
There was a problem hiding this comment.
Thanks.
Two nits, don't need to be fixed in this PR.
|
@hysw @jorgeag-google thanks for the review. I think I've addressed all the feedback. PTAL. |
|
@hysw all the tests finished successfully. If the PR is ok, would you be able to submit it for me? I don't have write access to the repo. Thanks. |
This all started because I got myself an ARM laptop and tried to build BigWheels on it under Windows and WSL2.
CpuInfoonly supported x86. On AArch64 the platform-detection code did not compile,Platform::GetCpuInfo()returned an empty struct, andsample_00_ppx_infodid not build.This PR adds AArch64 support to the CPU detection layer.
CpuInfo::AArch64Featurestoplatform.h. It exposes 31 feature flags populated fromcpu_features::GetAarch64Info().GetAArch64CpuInfo()toplatform.cpp, gated on__aarch64__ || _M_ARM64. Vendor and microarchitecture strings areresolved from the
implementer/partfields using codes from the Linux kernel (arch/arm64/include/asm/cputype.h).sample_00_ppx_infoto print the AArch64 feature set on AArch64 and the x86 feature set otherwise.!PPX_ANDROIDtoNOT PPX_ANDROIDinprojects/CMakeLists.txt. The original expression always evaluated to true, sosample_00_ppx_infowas always added regardless of the Android target.Tested on a Snapdragon X Elite (Qualcomm Oryon X1) running Linux AArch64 and Windows 11.
NOTE: On Linux I still cannot get samples to work (they all fail with
VK_ERROR_INCOMPATIBLE_DRIVER). I think Mesa drivers don't yet support my hardware (Qualcomm(R) Adreno(TM) X1-85 GPU). Or maybe I've not configured it properly.All the samples work fine on Windows, though. Both in Vulkan and DX12 mode.