Skip to content

Probe rocSPARSE with Libdl only - #1051

Merged
luraess merged 2 commits into
mainfrom
lr/verinf
Aug 31, 2026
Merged

Probe rocSPARSE with Libdl only#1051
luraess merged 2 commits into
mainfrom
lr/verinf

Conversation

@luraess

@luraess luraess commented Aug 25, 2026

Copy link
Copy Markdown
Member

Relates to #1040. Follow-up to #1001.

#1001 moved the rocSPARSE version query into a subprocess so a segfault on a broken ROCm install (#920) degrades to err instead of killing the session. But the child ran using AMDGPU under the active project which is expensive.

The child now uses Base.Libc.Libdl only: it dlopens librocsparse by the absolute path the parent already knows and calls rocsparse_create_handle / rocsparse_get_version directly. The result is memoized for the session.

cc @simeonschaub

@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: 7d78c4e Previous: 021540a Ratio
amdgpu/synchronization/context/device 542.5 ns 547.5 ns 0.99
amdgpu/synchronization/stream/blocking 227.5 ns 235 ns 0.97
amdgpu/synchronization/stream/nonblocking 307.5 ns 312.5 ns 0.98
array/accumulate/Float32/1d 72718.5 ns 73158.5 ns 0.99
array/accumulate/Float32/dims=1 276651.5 ns 275026.25 ns 1.01
array/accumulate/Float32/dims=1L 78858.75 ns 78546 ns 1.00
array/accumulate/Float32/dims=2 73126 ns 72268.75 ns 1.01
array/accumulate/Float32/dims=2L 2751166.5 ns 2753974 ns 1.00
array/accumulate/Int64/1d 77896.25 ns 77868.75 ns 1.00
array/accumulate/Int64/dims=1 245016 ns 242633.5 ns 1.01
array/accumulate/Int64/dims=1L 83876.25 ns 84091 ns 1.00
array/accumulate/Int64/dims=2 83463.75 ns 71476.25 ns 1.17
array/accumulate/Int64/dims=2L 2893341.25 ns 2894525.75 ns 1.00
array/broadcast 73333.5 ns 73271 ns 1.00
array/construct 2262.5 ns 2295 ns 0.99
array/copy 36825.5 ns 36888 ns 1.00
array/copyto!/cpu_to_gpu 110471.75 ns 110634 ns 1.00
array/copyto!/gpu_to_cpu 120766.75 ns 110424 ns 1.09
array/copyto!/gpu_to_gpu 58846 ns 46220.75 ns 1.27
array/iteration/findall/bool 138384.5 ns 137422 ns 1.01
array/iteration/findall/int 147324.75 ns 147062 ns 1.00
array/iteration/findfirst/bool 146894.5 ns 147042 ns 1.00
array/iteration/findfirst/int 145784.75 ns 146377.25 ns 1.00
array/iteration/findmin/1d 113379.25 ns 111171.75 ns 1.02
array/iteration/findmin/2d 109674 ns 107931.5 ns 1.02
array/iteration/logical 251106 ns 248031.25 ns 1.01
array/iteration/scalar 295749.25 ns 295989.25 ns 1.00
array/permutedims/2d 71878.5 ns 71926 ns 1.00
array/permutedims/3d 71426 ns 71156 ns 1.00
array/permutedims/4d 74483.5 ns 73986 ns 1.01
array/random/rand/Float32 45185.75 ns 44998.25 ns 1.00
array/random/rand/Int64 54473.25 ns 54190.75 ns 1.01
array/random/rand!/Float32 65216 ns 65228.25 ns 1.00
array/random/rand!/Int64 52290.75 ns 73168.5 ns 0.71
array/random/randn/Float32 77221 ns 78318.75 ns 0.99
array/random/randn!/Float32 80846.25 ns 76536.25 ns 1.06
array/reductions/mapreduce/Float32/1d 95996.25 ns 95341.5 ns 1.01
array/reductions/mapreduce/Float32/dims=1 84291.25 ns 88586.25 ns 0.95
array/reductions/mapreduce/Float32/dims=1L 833392 ns 832311.75 ns 1.00
array/reductions/mapreduce/Float32/dims=2 85361.25 ns 85021.25 ns 1.00
array/reductions/mapreduce/Float32/dims=2L 144572 ns 144267 ns 1.00
array/reductions/mapreduce/Int64/1d 96606.25 ns 97431.25 ns 0.99
array/reductions/mapreduce/Int64/dims=1 84488.5 ns 84368.5 ns 1.00
array/reductions/mapreduce/Int64/dims=1L 831479.25 ns 832297 ns 1.00
array/reductions/mapreduce/Int64/dims=2 84721.25 ns 84728.75 ns 1.00
array/reductions/mapreduce/Int64/dims=2L 145389.5 ns 144659.5 ns 1.01
array/reductions/reduce/Float32/1d 98248.75 ns 95276.25 ns 1.03
array/reductions/reduce/Float32/dims=1 84633.75 ns 84243.75 ns 1.00
array/reductions/reduce/Float32/dims=1L 832226.75 ns 833756.75 ns 1.00
array/reductions/reduce/Float32/dims=2 84661.25 ns 91626.5 ns 0.92
array/reductions/reduce/Float32/dims=2L 144654.75 ns 144562 ns 1.00
array/reductions/reduce/Int64/1d 97661.25 ns 97216.25 ns 1.00
array/reductions/reduce/Int64/dims=1 84461.25 ns 84073.75 ns 1.00
array/reductions/reduce/Int64/dims=1L 835541.75 ns 831101.75 ns 1.01
array/reductions/reduce/Int64/dims=2 84598.75 ns 84513.75 ns 1.00
array/reductions/reduce/Int64/dims=2L 144357 ns 144894.5 ns 1.00
array/reverse/1d 45765.5 ns 45428.25 ns 1.01
array/reverse/1dL 73478.5 ns 72771 ns 1.01
array/reverse/1dL_inplace 80428.75 ns 79873.75 ns 1.01
array/reverse/1d_inplace 40028 ns 60975.75 ns 0.66
array/reverse/2d 50268.25 ns 50025.75 ns 1.00
array/reverse/2dL 82666.25 ns 82088.75 ns 1.01
array/reverse/2dL_inplace 91928.75 ns 91983.75 ns 1.00
array/reverse/2d_inplace 63415.75 ns 63378.5 ns 1.00
array/sorting/1d 336734.5 ns 334864.75 ns 1.01
integration/byval/reference 39601 ns 39681 ns 1.00
integration/byval/slices=1 40040 ns 40541 ns 0.99
integration/byval/slices=2 152272 ns 153712 ns 0.99
integration/byval/slices=3 239263 ns 237193 ns 1.01
integration/volumerhs 5008007 ns 5005451 ns 1.00
kernel/indexing 57185.75 ns 47583.25 ns 1.20
kernel/indexing_checked 34028 ns 33818 ns 1.01
kernel/launch 1395 ns 1412.5 ns 0.99
kernel/rand 97571.25 ns 97204 ns 1.00
latency/import 1713310429 ns 1709687565 ns 1.00
latency/precompile 39614017578 ns 39720673731 ns 1.00
latency/ttfp 2316216409 ns 2310174550 ns 1.00

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

@simeonschaub simeonschaub left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, seems pretty much what I had in mind, thanks! Left some comments below

Comment thread src/utils.jl Outdated
Comment thread src/utils.jl Outdated
Comment thread src/utils.jl Outdated
@luraess
luraess requested a review from simeonschaub August 28, 2026 07:29
@luraess

luraess commented Aug 28, 2026

Copy link
Copy Markdown
Member Author

cscs-ci run

@luraess
luraess merged commit 4be1354 into main Aug 31, 2026
5 checks passed
@luraess
luraess deleted the lr/verinf branch August 31, 2026 08:16
simeonschaub added a commit to simeonschaub/AMDGPU.jl that referenced this pull request Sep 3, 2026
Upstream (JuliaGPU#1051) moved the rocSPARSE version probe into a bare child
process that dlopens librocsparse directly. That child no longer runs
ROCm_Runtime.__init__, so it misses the comgr preload that keeps a system
ROCm on the library path from displacing the bundle's libamd_comgr, and
the probe would report "err" on exactly the hosts the workaround targets.
Preload the provider's comgr in the child as well. The bundle's libraries
carry an $ORIGIN RUNPATH, so nothing else is needed for them to resolve.

Assisted-by: Claude Code (claude-fable-5-1)
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.

2 participants