Julia 1.9 on Intel Sapphire Rapid CPU doesn't work

We recently bought a new server with the latest Intel CPU (Sapphire Rapids), yet we just realized that it doesn’t work for Julia 1.9.x versions. Here’s a brief report:

julia> versioninfo()
Julia Version 1.9.3
Commit bed2cd540a1 (2023-08-24 14:43 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 96 × Intel(R) Xeon(R) Gold 6442Y
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, sapphirerapids)
  Threads: 1 on 96 virtual cores

julia> -Float16(5.0)
Float16(0.0)

julia> Float16(Inf)
Float16(0.0)

Compiling CSV also crashes:

(@v1.9) pkg> st
Status `~/.julia/environments/v1.9/Project.toml`
  [336ed68f] CSV v0.10.14

julia> using CSV
[ Info: Precompiling CSV [336ed68f-0bac-5ca0-87d4-7b16caf5d00b]

[715965] signal (11.1): Segmentation fault
in expression starting at /home/chenjiuning/.julia/packages/CSV/cwX2w/src/precompile.jl:3
_ZN4llvm19MachineRegisterInfo22addRegOperandToUseListEPNS_14MachineOperandE at /home/chenjiuning/packages/julias/julia-1.9/bin/../lib/julia/libLLVM-14jl.so (unknown line)
_ZN4llvm12MachineInstr10addOperandERNS_15MachineFunctionERKNS_14MachineOperandE at /home/chenjiuning/packages/julias/julia-1.9/bin/../lib/julia/libLLVM-14jl.so (unknown line)
_ZN4llvm7BuildMIERNS_17MachineBasicBlockERNS_12MachineInstrERKNS_8DebugLocERKNS_11MCInstrDescENS_8RegisterE at /home/chenjiuning/packages/julias/julia-1.9/bin/../lib/julia/libLLVM-14jl.so (unknown line)
_ZNK4llvm17X86TargetLowering27EmitInstrWithCustomInserterERNS_12MachineInstrEPNS_17MachineBasicBlockE at /home/chenjiuning/packages/julias/julia-1.9/bin/../lib/julia/libLLVM-14jl.so (unknown line)

This is likely a LLVM 14 issue. It’s verified that Julia 1.6, 1.7, 1.8, 1.10, 1.11 all work for the above cases.

Suggestion? Stick to the latest Julia :slight_smile:


It’s verified that if we create a virtual machine on this server with CPU virtualization, then we work around the issue. We’ve tested libvirt by changing host-passthrough to host-model:

  <cpu mode='custom' match='exact' check='partial'>
    <model fallback='allow'>Skylake-Server</model>
    <feature policy='disable' name='hle'/>
    <feature policy='disable' name='rtm'/>
    <feature policy='disable' name='mpx'/>
  </cpu>

then Julia 1.9.3 works normally inside the VM (linux or windows).

1 Like

Yes, stick to latest 1.10, and soon 1.11 Julia. But it’s strange, I couldn’t confirm in 1.9.x versions either (while it should work on all platforms, it’s a bug that will not get fixed since 1.9 is no longer supported):

julia> -Float16(5.0)
Float16(-5.0)

julia> versioninfo()
Julia Version 1.9.3
Commit bed2cd540a1 (2023-08-24 14:43 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 × Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, broadwell)
  Threads: 1 on 16 virtual cores
Environment:
  JULIA_PKG_PRESERVE_TIERED_INSTALLED = true

Also worked in 1.9.3 for me:

julia> using CSV
 │ Package CSV not found, but a package named CSV is available from a registry. 
 │ Install package?
 │   (@v1.9) pkg> add CSV 
 └ (y/n/o) [y]: y
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
    Updating `~/.julia/environments/v1.9/Project.toml`
⌃ [336ed68f] + CSV v0.10.11
    Updating `~/.julia/environments/v1.9/Manifest.toml`
⌃ [336ed68f] + CSV v0.10.11
  [2dfb63ee] + PooledArrays v1.4.3
⌃ [91c51154] + SentinelArrays v1.4.3
  [ea10d353] + WeakRefStrings v1.4.2
  [76eceee3] + WorkerUtilities v1.6.1
  [b27032c2] ↓ LibCURL v0.6.4 ⇒ v0.6.3
  [deac9b47] ↓ LibCURL_jll v8.4.0+0 ⇒ v7.84.0+0
  [29816b5a] ↓ LibSSH2_jll v1.11.0+1 ⇒ v1.10.2+0
  [8e850ede] ↓ nghttp2_jll v1.52.0+1 ⇒ v1.48.0+0

I’m not a fan of getting those (avoidable) downgrades, and not latest version, but can also confirm worked for me when I ask explicitly for same version you got:

(@v1.9) pkg> add CSV@0.10.14

CSV has its own dependencies, and I’m not sure we have the same versions of those… i.e. latest, nor do I know an (easy) way to check (but would like to know of an easy way).

You can also use -C to target a different microarchitecture or disable CPU features.

4 Likes

To elaborate: Segmentation fault in LLVM frames on Julia 1.9.3 when precompiling CSV.jl on Intel Sapphire Rapids CPU · Issue #51482 · JuliaLang/julia · GitHub

5 Likes

Followed the comment on Segmentation fault in LLVM frames on Julia 1.9.3 when precompiling CSV.jl on Intel Sapphire Rapids CPU · Issue #51482 · JuliaLang/julia · GitHub

julia -C sapphirerapids,-avx512fp16 also works around the issue.

1 Like

Hi @Palli, the issue I reported is closely related to specific CPU architecture. Thus, you’d only reproduce it on Intel’s Xeon server CPU with the code name Sapphire Rapids, which was released in 2023 Q1.

For familiar CPU arches, Julia 1.9 is good.

1 Like