Skip to content

Make versioninfo() robust to version-probe crashes - #1001

Merged
luraess merged 2 commits into
mainfrom
lr/versioninfo
Jul 29, 2026
Merged

Make versioninfo() robust to version-probe crashes#1001
luraess merged 2 commits into
mainfrom
lr/versioninfo

Conversation

@luraess

@luraess luraess commented Jul 23, 2026

Copy link
Copy Markdown
Member

Summary

AMDGPU.versioninfo() could take down the entire Julia session with an uncatchable SIGSEGV on broken or mismatched ROCm installs. This isolates the one crash-prone probe in a subprocess, and fixes rocRAND to report the actually loaded version. Relates to #920.

Motivation

Of all the library version() calls in versioninfo(), only rocSPARSE requires creating a handle (rocsparse_get_version(handle, …)), which initializes a HIP context. On a broken/mismatched ROCm stack that can segfault (see #920), and a SIGSEGV cannot be caught with try/catch, so the crash propagated out and killed the caller. This is worse now that KA 0.10 forwards KA.versioninfo(io, ::ROCBackend) here (#868), exposing the crash through the backend-agnostic API.

Separately, rocRAND.version() reported the compile-time ROCRAND_VERSION constant (the version AMDGPU was built against) rather than the loaded library, the other libraries already probe at runtime.

Changes

  • rocSPARSE: probe its version in a short-lived subprocess with a timeout. A crash, hang, or nonzero exit degrades to "err" in the table plus a single warning, instead of crashing the session. The other libraries expose handle-free version queries and stay in-process.
  • rocRAND: query rocrand_get_version() at runtime (handle-free, safe) instead of the compile-time constant.

"err" is distinct from "-": "-" means the library was not found, "err" means it is present but its version query failed — itself a useful diagnostic signal.

Testing

New versioninfo probe isolation testset asserts that a clean child returns its output while SIGABRT / SIGSEGV / nonzero-exit / no-output / hang all degrade to nothing without crashing the caller (the first cases are GPU-independent). Verified locally on gfx1100 (RX 7900 XTX): full versioninfo() output unchanged, rocSPARSE version now probed out-of-process, failure path shows err + warning.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AMDGPU.jl Benchmarks

Details
Benchmark suite Current: 2d9ed4d Previous: c3e9e19 Ratio
amdgpu/synchronization/context/device 570 ns 562.5 ns 1.01
amdgpu/synchronization/stream/blocking 240 ns 235 ns 1.02
amdgpu/synchronization/stream/nonblocking 327.5 ns 320 ns 1.02
array/accumulate/Float32/1d 77481 ns 74431.25 ns 1.04
array/accumulate/Float32/dims=1 263748.75 ns 279051.75 ns 0.95
array/accumulate/Float32/dims=1L 89566.25 ns 80943.75 ns 1.11
array/accumulate/Float32/dims=2 83301 ns 72506 ns 1.15
array/accumulate/Float32/dims=2L 2769649.5 ns 2617537.5 ns 1.06
array/accumulate/Int64/1d 80831 ns 78246 ns 1.03
array/accumulate/Int64/dims=1 242393.5 ns 243966 ns 0.99
array/accumulate/Int64/dims=1L 83743.75 ns 83891.25 ns 1.00
array/accumulate/Int64/dims=2 88883.75 ns 81418.75 ns 1.09
array/accumulate/Int64/dims=2L 2866545.75 ns 2867614.25 ns 1.00
array/broadcast 73851 ns 52263.25 ns 1.41
array/construct 2292.5 ns 2372.5 ns 0.97
array/copy 36850.5 ns 36485.5 ns 1.01
array/copyto!/cpu_to_gpu 112021.5 ns 86611 ns 1.29
array/copyto!/gpu_to_cpu 110771.5 ns 112164.25 ns 0.99
array/copyto!/gpu_to_gpu 58870.75 ns 35980.5 ns 1.64
array/iteration/findall/bool 141642 ns 141492 ns 1.00
array/iteration/findall/int 151397 ns 158094.75 ns 0.96
array/iteration/findfirst/bool 119881.75 ns 127356.75 ns 0.94
array/iteration/findfirst/int 123009.25 ns 127839.25 ns 0.96
array/iteration/findmin/1d 124126.75 ns 113976.75 ns 1.09
array/iteration/findmin/2d 113961.5 ns 107709 ns 1.06
array/iteration/logical 252981 ns 260086.25 ns 0.97
array/iteration/scalar 296701.75 ns 295631.5 ns 1.00
array/permutedims/2d 72038.5 ns 71536 ns 1.01
array/permutedims/3d 71783.5 ns 71118.5 ns 1.01
array/permutedims/4d 74058.5 ns 74313.5 ns 1.00
array/random/rand/Float32 43330.5 ns 45328 ns 0.96
array/random/rand/Int64 55025.75 ns 55040.75 ns 1.00
array/random/rand!/Float32 65228.5 ns 65493.5 ns 1.00
array/random/rand!/Int64 66540.75 ns 53880.75 ns 1.23
array/random/randn/Float32 80446 ns 76038.5 ns 1.06
array/random/randn!/Float32 80706 ns 60518.5 ns 1.33
array/reductions/mapreduce/Float32/1d 103841.25 ns 96758.75 ns 1.07
array/reductions/mapreduce/Float32/dims=1 95346.25 ns 85553.75 ns 1.11
array/reductions/mapreduce/Float32/dims=1L 780553.5 ns 781805.75 ns 1.00
array/reductions/mapreduce/Float32/dims=2 94276.25 ns 84621.25 ns 1.11
array/reductions/mapreduce/Float32/dims=2L 143419.5 ns 144722 ns 0.99
array/reductions/mapreduce/Int64/1d 100499 ns 94921.25 ns 1.06
array/reductions/mapreduce/Int64/dims=1 94746.5 ns 84463.75 ns 1.12
array/reductions/mapreduce/Int64/dims=1L 784633.75 ns 791916 ns 0.99
array/reductions/mapreduce/Int64/dims=2 94451.25 ns 83748.75 ns 1.13
array/reductions/mapreduce/Int64/dims=2L 141677 ns 141764.5 ns 1.00
array/reductions/reduce/Float32/1d 104479 ns 96491.5 ns 1.08
array/reductions/reduce/Float32/dims=1 94498.75 ns 85201.25 ns 1.11
array/reductions/reduce/Float32/dims=1L 780106.25 ns 782083.25 ns 1.00
array/reductions/reduce/Float32/dims=2 93883.75 ns 84891 ns 1.11
array/reductions/reduce/Float32/dims=2L 143179.75 ns 142992 ns 1.00
array/reductions/reduce/Int64/1d 92141.5 ns 88566.25 ns 1.04
array/reductions/reduce/Int64/dims=1 93456.5 ns 84548.5 ns 1.11
array/reductions/reduce/Int64/dims=1L 787721.25 ns 788023.5 ns 1.00
array/reductions/reduce/Int64/dims=2 94168.75 ns 83401.25 ns 1.13
array/reductions/reduce/Int64/dims=2L 143089.5 ns 143302 ns 1.00
array/reverse/1d 43258.25 ns 43483.25 ns 0.99
array/reverse/1dL 72776 ns 73061 ns 1.00
array/reverse/1dL_inplace 79201.25 ns 78998.5 ns 1.00
array/reverse/1d_inplace 59733.25 ns 59848.25 ns 1.00
array/reverse/2d 49335.75 ns 49138.25 ns 1.00
array/reverse/2dL 85381.25 ns 79461.25 ns 1.07
array/reverse/2dL_inplace 90711.25 ns 91798.75 ns 0.99
array/reverse/2d_inplace 62633.5 ns 62230.75 ns 1.01
array/sorting/1d 342852 ns 340847.5 ns 1.01
integration/byval/reference 39570 ns 39480 ns 1.00
integration/byval/slices=1 40511 ns 40561 ns 1.00
integration/byval/slices=2 154052 ns 121111 ns 1.27
integration/byval/slices=3 233633 ns 234933 ns 0.99
integration/volumerhs 5045009 ns 5042886 ns 1.00
kernel/indexing 57708.5 ns 57603.25 ns 1.00
kernel/indexing_checked 53245.75 ns 59520.75 ns 0.89
kernel/launch 1572.5 ns 1570 ns 1.00
kernel/rand 106384.25 ns 80076.25 ns 1.33
latency/import 1765363002 ns 1763912896 ns 1.00
latency/precompile 37705375366 ns 37604981379 ns 1.00
latency/ttfp 5781907160 ns 5783496043 ns 1.00

This comment was automatically generated by workflow using github-action-benchmark.

@luraess
luraess merged commit e3e5b25 into main Jul 29, 2026
5 checks passed
@luraess
luraess deleted the lr/versioninfo branch July 29, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant