m-j-w / CpuId.jl

Ask the CPU for cache sizes, SIMD feature support, a running hypervisor, and more.
Other
54 stars 10 forks source link

`cachesize()` and `cachelinesize()` do not work on ARM architectures #61

Open amrueda opened 8 months ago

amrueda commented 8 months ago

I need to read the cache line size in my application. However, for some reason, CpuId returns the following on an Apple M2 Pro chip:

julia> using CpuId

julia> cachesize()
ERROR: This CPU does not provide information on cpuid leaf 0x00000004.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] _throw_unsupported_leaf(leaf::UInt32)
   @ CpuId ~/.julia/packages/CpuId/n7zKC/src/CpuId.jl:38
 [3] cachesize()
   @ CpuId ~/.julia/packages/CpuId/n7zKC/src/CpuId.jl:737
 [4] top-level scope
   @ REPL[8]:1

julia> cachelinesize()
0
giordano commented 6 months ago

for some reason

I think you missed this at the very beginning of the README of this package

Works on Julia 1.0 and later, on Linux, Mac and Windows with Intel CPUs and AMD CPUs. Other processor types like ARM are not supported.

CPUID is a set of instructions for x86 CPUs.