Skip to content

[C++] Add support to GetRuntimeInfo for reporting ASIMD/NEON #40806

@amoeba

Description

@amoeba

Describe the enhancement requested

PyArrow and R arrow have user-facing functions that call into Arrow C++'s arrow::GetRuntimeInfo() to report on build and runtime SIMD support:

RuntimeInfo GetRuntimeInfo() {
RuntimeInfo info;
auto cpu_info = CpuInfo::GetInstance();
info.simd_level =
MakeSimdLevelString([&](int64_t flags) { return cpu_info->IsSupported(flags); });
info.detected_simd_level =
MakeSimdLevelString([&](int64_t flags) { return cpu_info->IsDetected(flags); });

GetRuntimeInfo calls into MakeSimdLevelString to populate a RuntimeInfo object.
On ARM-based systems, "none" is reported for both SIMD levels which I think is caused by a there being no branch for CpuInfo::ASIMD:

std::string MakeSimdLevelString(QueryFlagFunction&& query_flag) {
if (query_flag(CpuInfo::AVX512)) {
return "avx512";
} else if (query_flag(CpuInfo::AVX2)) {
return "avx2";
} else if (query_flag(CpuInfo::AVX)) {
return "avx";
} else if (query_flag(CpuInfo::SSE4_2)) {
return "sse4_2";
} else {
return "none";
}
}

  1. Should we add a branch for CpuInfo::ASIMD?
  2. If so, would it make more sense to call it ASIMD or NEON? They're related but slightly different concepts and I'm not sure what language users will be most familiar with and which makes more sense alongside other values.

Component(s)

C++

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions