Skip to content

Commit e9b257d

Browse files
committed
Do not support multiple SVE sizes
1 parent 3e8c742 commit e9b257d

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

cpp/src/arrow/util/cpu_info.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,12 @@ void OsRetrieveCpuInfo(int64_t* hardware_flags, CpuInfo::Vendor* vendor,
431431
assert(vl >= 0);
432432
// prctl returns vector length in bytes; mask off status flags
433433
const int vl_bytes = vl & PR_SVE_VL_LEN_MASK;
434-
if (vl_bytes >= 16) *hardware_flags |= CpuInfo::SVE128; // 128 bits
435-
if (vl_bytes >= 32) *hardware_flags |= CpuInfo::SVE256; // 256 bits
436-
if (vl_bytes >= 64) *hardware_flags |= CpuInfo::SVE512; // 512 bits
434+
// Running SVE128 on a SVE256 machine is more tricky than the x86 equivalent of
435+
// running SSE code on an AVX machine and requires to explicitly change the
436+
// vector length using `prctl` (per thread setting).
437+
if (vl_bytes == 16) *hardware_flags |= CpuInfo::SVE128; // 128 bits
438+
if (vl_bytes == 32) *hardware_flags |= CpuInfo::SVE256; // 256 bits
439+
if (vl_bytes == 64) *hardware_flags |= CpuInfo::SVE512; // 512 bits
437440
# endif // PR_SVE_GET_VL
438441
}
439442
# endif // HWCAP_SVE

0 commit comments

Comments
 (0)