Repository navigation
Define device-only functions as overlays, so sysimages load - #3502
Conversation
97a3e60 to
748058c
Compare
Benchmark resultsCompared with 4eb6468cd, the merge base. Times are the minimum time of every benchmark. A change is unusual when it exceeds both three times the benchmark's typical change between consecutive runs on the default branch and a minimum per category (performance 3%, latency 5%, applications 3%, other 3%). A benchmark that starts or stops allocating is listed however few the allocations. A single run can still be a fluke, so rerun before drawing conclusions.
All benchmarks
History: https://juliagpu.org/perf/?pkg=cuda |
f477371 to
4ed1edd
Compare
`@device_override`, `@device_function` and `@device_functions` now forward to `GPUToolbox.Overlays`, which implements the same rewrite (including the docstring and block handling) for all back ends, so ExprTools is no longer needed. `initialize_rng_state` becomes a device function, and `finish_module!` looks it up in the job's method tables and calls it as a void function instead of inferring its return type on the host. CUDACore already has no device code that sysimage builds would compile for the host; a test with `GPUToolbox.Overlays.host_leaks` keeps it that way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4ed1edd to
8a12729
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3502 +/- ##
==========================================
- Coverage 88.51% 85.71% -2.80%
==========================================
Files 198 197 -1
Lines 22021 21734 -287
==========================================
- Hits 19491 18629 -862
- Misses 2530 3105 +575 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Device-only code in the global method table gets compiled for the host by sysimage builds: Julia 1.12+ compiles every method with a compileable signature, and 1.11 keeps native code instances (e.g. those left by
Core.Compiler.return_type(initialize_rng_state)infinish_module!). The image then refers to device symbols likejulia.gpu.state_getter, and since sysimages are loaded withRTLD_NOW, it fails to load. Same fix as JuliaGPU/KernelAbstractions.jl#930 and JuliaGPU/OpenCL.jl#598, using the shared definitions from GPUToolbox 3.5.CUDA already marked its runtime in #3249 and
host_leaks(CUDACore)was empty, so this is mostly for coherence with the other back ends:@device_override,@device_functionand@device_functionsare one-liners aroundGPUToolbox.Overlays.device_override/device_function(which accepts blocks); ExprTools is no longer needed.finish_module!looks upinitialize_rng_statethrough the job's method tables and calls it as a void function, instead of inferring its return type with the native interpreter, which on 1.11 left native code instances of it behind.initialize_rng_stateis now a device function.host leakstest next to the method table tests checks thatGPUToolbox.Overlays.host_leaks(CUDACore)stays empty.Tested locally on an RTX 5080 with Julia 1.13 (device, exceptions, codegen, execution, KernelAbstractions and KernelInterface tests) and 1.10.