m-j-w/CpuId.jl

ERROR: LoadError: This CPU does not provide information on cpuid leaf 0x00000004.

chriselrod opened this issue · 4 comments

https://github.com/JuliaSIMD/VectorizationBase.jl/runs/6198591014?check_suite_focus=true#step:6:168

Could it return some sort of error code that I can check to use a generic fallback instead?

m-j-w commented

What would be your preferred behaviour ?

cachesize()     --> () | missing | nothing         # empty tuple, or 'missing', or 'nothing'
cachesize(lvl)  --> -1 | 0 | missing | nothing      # illegal value, zero or 'missing', or 'nothing'

Personally, I'd lean towards empty tuple and -1, or missing/nothing.

Missing/nothing could also easily be applied to all other functions instead of throwing exceptions.
An illegal value would be difficult for functions that return booleans

I'd prefer nothing, as it's the standard of methods like findfirst, and will generally force you to handle it immediately or throw (as not many people define methods for nothing), so it's easier to find where it originated vs missing which will tend to propagate.

We also see this error over at JuliaParallel/Hwloc.jl#61 in our x86 CI. Note, however, that in only effects the Julia >= 1.7 runners (with CpuId.jl version 3.1). So I wonder what has changed in CpuId.jl since version 3.0, on first sight, this looks like a regression.

m-j-w commented

@carstenbauer this issue is about the failure behavior of the function if the hardware is not providing the expected information. The request is to report nothing rather than to throw an exception.