[英]How do I Detect Availability of NEON and Helium Instruction Sets at Runtime
I'm working on a cross-platform parallel math library and I've made great progress implementing SSE, AVX, AVX2 and AVX-512 for x86/amd64 including runtime detection of ISA availability.我正在开发一个跨平台的并行数学库,并且在为 x86/amd64 实现 SSE、AVX、AVX2 和 AVX-512 方面取得了很大进展,包括 ISA 可用性的运行时检测。
However, I've run into a major problem.但是,我遇到了一个大问题。 There is no documentation for detecting NEON or Helium support at runtime on MSVC.
MSVC 上没有在运行时检测 NEON 或 Helium 支持的文档。 It appears that there is no
cpuid
instruction on ARM or ARM64. ARM 或 ARM64 上似乎没有
cpuid
指令。 It isn't clear whether there is a cross-platform way to accomplish this for Linux either.目前还不清楚是否有跨平台的方式来为 Linux 实现这一点。
Do you even need to detect it manually or can you just use preprocessor definitions (such as _M_ARM64
) to check for runtime support?您甚至需要手动检测它还是可以只使用预处理器定义(例如
_M_ARM64
)来检查运行时支持? It is my understanding that preprocessor macros are ONLY evaluated at compile-time.我的理解是预处理器宏仅在编译时进行评估。
Are we just supposed to assume that every ARM CPU has NEON?我们是否应该假设每个 ARM CPU 都有 NEON? What about Helium?
氦气呢?
I'm hoping that someone here knows how to do it.我希望这里有人知道怎么做。 Thank You in advance.
先感谢您。
NEON
as well as VFP
is mandatory on armv8-a
. NEON
和VFP
在armv8-a
上是强制性armv8-a
。
Hence there is no need to check the availability at runtime on aarch64
.因此,无需在运行时检查
aarch64
上的aarch64
。
And I'd ditch aarch32
support altogether.我会完全
aarch32
对aarch32
支持。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.