Skip to content

Fix cluster barriers silently trapping on Julia <= 1.11#3188

Merged
maleadt merged 1 commit into
JuliaGPU:mainfrom
AntonOresten:cluster-barrier
Jul 8, 2026
Merged

Fix cluster barriers silently trapping on Julia <= 1.11#3188
maleadt merged 1 commit into
JuliaGPU:mainfrom
AntonOresten:cluster-barrier

Conversation

@AntonOresten

@AntonOresten AntonOresten commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

The cluster barriers use ccall("llvm.nvvm.barrier.cluster.*", llvmcall, ...), which resolves the name against the loaded LLVM. These intrinsics only exist in LLVM 17+, so on Julia 1.10/1.11 the call lowers to a deferred runtime error: the kernel compiles cleanly and traps at launch, with no diagnostic. CI never sees it because the cluster tests require sm_90 hardware, which never runs with Julia 1.11.

Fix: emit them via the full-module llvmcall form (as version.jl does), so the name passes through to the NVPTX back end, with convergent nomerge spelled out since the loaded LLVM can't infer attributes for unknown names (nomerge because SimplifyCFG only learned to not merge convergent calls in LLVM 17).

Also adds a codegen test outside the capability gate — device IR must contain both calls and no gpu_report_exception — so it runs on all CI, including CPU-only. Verified on 1.10/1.11/1.12: IR and sm_90 PTX contain the barriers, and the new test fails on 1.11 without the fix.

Diagnosed by Fable 5

@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.

CUDA.jl Benchmarks

Details
Benchmark suite Current: 4bf42e6 Previous: fbb9098 Ratio
array/accumulate/Float32/1d 98921 ns 98020 ns 1.01
array/accumulate/Float32/dims=1 74370 ns 73968 ns 1.01
array/accumulate/Float32/dims=1L 1599319 ns 1598577 ns 1.00
array/accumulate/Float32/dims=2 139520 ns 139829 ns 1.00
array/accumulate/Float32/dims=2L 660428 ns 660479 ns 1.00
array/accumulate/Int64/1d 118533 ns 118236 ns 1.00
array/accumulate/Int64/dims=1 78480 ns 78818 ns 1.00
array/accumulate/Int64/dims=1L 1716419 ns 1717142 ns 1.00
array/accumulate/Int64/dims=2 152697 ns 151913 ns 1.01
array/accumulate/Int64/dims=2L 987558 ns 987639 ns 1.00
array/broadcast 18279 ns 18185 ns 1.01
array/construct 1137.1 ns 900.1904761904761 ns 1.26
array/copy 16863 ns 16081 ns 1.05
array/copyto!/cpu_to_gpu 206736 ns 210623 ns 0.98
array/copyto!/gpu_to_cpu 239429 ns 242406 ns 0.99
array/copyto!/gpu_to_gpu 9118.333333333334 ns 8883.666666666666 ns 1.03
array/iteration/findall/bool 132728 ns 132352 ns 1.00
array/iteration/findall/int 146734 ns 146447 ns 1.00
array/iteration/findfirst/bool 68093 ns 67784 ns 1.00
array/iteration/findfirst/int 70171 ns 69220 ns 1.01
array/iteration/findmin/1d 64586 ns 62612 ns 1.03
array/iteration/findmin/2d 99992 ns 99990 ns 1.00
array/iteration/logical 187044 ns 186900 ns 1.00
array/iteration/scalar 62615 ns 62246 ns 1.01
array/permutedims/2d 49363 ns 49143 ns 1.00
array/permutedims/3d 50721 ns 49912 ns 1.02
array/permutedims/4d 50259 ns 50252 ns 1.00
array/random/rand/Float32 12499 ns 10722 ns 1.17
array/random/rand/Int64 23583 ns 20792 ns 1.13
array/random/rand!/Float32 7750.75 ns 7728 ns 1.00
array/random/rand!/Int64 19684 ns 20553 ns 0.96
array/random/randn/Float32 34303 ns 33301 ns 1.03
array/random/randn!/Float32 24761 ns 24939 ns 0.99
array/reductions/mapreduce/Float32/1d 32270 ns 31290 ns 1.03
array/reductions/mapreduce/Float32/dims=1 37691 ns 37312 ns 1.01
array/reductions/mapreduce/Float32/dims=1L 50888 ns 50036 ns 1.02
array/reductions/mapreduce/Float32/dims=2 55141 ns 54292 ns 1.02
array/reductions/mapreduce/Float32/dims=2L 66738 ns 65880 ns 1.01
array/reductions/mapreduce/Int64/1d 39715 ns 39323 ns 1.01
array/reductions/mapreduce/Int64/dims=1 40558 ns 40145 ns 1.01
array/reductions/mapreduce/Int64/dims=1L 88833 ns 87779 ns 1.01
array/reductions/mapreduce/Int64/dims=2 57672 ns 57093 ns 1.01
array/reductions/mapreduce/Int64/dims=2L 83191 ns 82500 ns 1.01
array/reductions/reduce/Float32/1d 32204 ns 31207 ns 1.03
array/reductions/reduce/Float32/dims=1 37749 ns 37284 ns 1.01
array/reductions/reduce/Float32/dims=1L 50828 ns 50034 ns 1.02
array/reductions/reduce/Float32/dims=2 55181 ns 54677 ns 1.01
array/reductions/reduce/Float32/dims=2L 68391 ns 67287 ns 1.02
array/reductions/reduce/Int64/1d 38790 ns 38695 ns 1.00
array/reductions/reduce/Int64/dims=1 40598 ns 39938 ns 1.02
array/reductions/reduce/Int64/dims=1L 88764 ns 87933 ns 1.01
array/reductions/reduce/Int64/dims=2 57598 ns 56801 ns 1.01
array/reductions/reduce/Int64/dims=2L 83253 ns 82417 ns 1.01
array/reverse/1d 17112 ns 16212 ns 1.06
array/reverse/1dL 69807 ns 69012 ns 1.01
array/reverse/1dL_inplace 67036 ns 66891 ns 1.00
array/reverse/1d_inplace 8625.333333333334 ns 9703.666666666666 ns 0.89
array/reverse/2d 20109 ns 19393 ns 1.04
array/reverse/2dL 73428 ns 72842 ns 1.01
array/reverse/2dL_inplace 66857 ns 66766 ns 1.00
array/reverse/2d_inplace 10046 ns 10134 ns 0.99
array/sorting/1d 2650555 ns 2658542 ns 1.00
array/sorting/2d 1038856 ns 1039211 ns 1.00
array/sorting/by 3193540 ns 3193897 ns 1.00
cuda/synchronization/context/auto 1047.7 ns 1040 ns 1.01
cuda/synchronization/context/blocking 801.0652173913044 ns 795.5444444444445 ns 1.01
cuda/synchronization/context/nonblocking 5664.166666666667 ns 5738.666666666667 ns 0.99
cuda/synchronization/stream/auto 897.4090909090909 ns 889.2083333333334 ns 1.01
cuda/synchronization/stream/blocking 684.8053691275168 ns 676.8387096774194 ns 1.01
cuda/synchronization/stream/nonblocking 5522.666666666667 ns 5562.285714285715 ns 0.99
integration/byval/reference 147352 ns 147385 ns 1.00
integration/byval/slices=1 149499 ns 149634 ns 1.00
integration/byval/slices=2 292373 ns 292176 ns 1.00
integration/byval/slices=3 435124 ns 435096 ns 1.00
integration/cudadevrt 104438 ns 104391 ns 1.00
integration/volumerhs 9305196 ns 9304645 ns 1.00
kernel/indexing 12571 ns 12267 ns 1.02
kernel/indexing_checked 13334 ns 13063 ns 1.02
kernel/launch 2004.2 ns 1980.4 ns 1.01
kernel/occupancy 648.2024539877301 ns 638.797619047619 ns 1.01
kernel/rand 15147 ns 14927 ns 1.01
latency/import 3886238524 ns 3890391684 ns 1.00
latency/precompile 4655942183 ns 4668709973 ns 1.00
latency/ttfp 4859468459 ns 4883527794 ns 1.00

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

@maleadt

maleadt commented Jul 6, 2026

Copy link
Copy Markdown
Member

1.11 CI failure needs a JLD2 version bump, I think...

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 17.42%. Comparing base (bc81d40) to head (4bf42e6).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3188      +/-   ##
==========================================
- Coverage   17.44%   17.42%   -0.03%     
==========================================
  Files         124      124              
  Lines        9883     9883              
==========================================
- Hits         1724     1722       -2     
- Misses       8159     8161       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maleadt maleadt merged commit 1b62bc2 into JuliaGPU:main Jul 8, 2026
2 checks passed
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