Skip to content

Avoid boxing compiler jobs during kernel resolution - #1073

Open
maleadt wants to merge 1 commit into
mainfrom
tb/compiler-job-allocations
Open

maleadt wants to merge 1 commit into
mainfrom
tb/compiler-job-allocations

Conversation

@maleadt

@maleadt maleadt commented Sep 14, 2026

Copy link
Copy Markdown
Member

Kernel resolution constructs a CompilerJob immediately before passing it through an unspecialized compile_or_lookup boundary, which can force the job onto the heap. Allow specialization on the job's target and compiler-parameter types, and keep the method @noinline so its body is not duplicated into callers specialized per kernel. Kernel identity remains a field of the job, so this does not introduce per-kernel specialization or another cache.

Applies the approach from KernelAbstractions.jl#769.

Syntax and whitespace checks passed, and the package loaded on Julia 1.13. Device execution and allocation measurements were unavailable because the local HIP runtime was not functional.

Specialize compile_or_lookup on the backend target and parameter types. Keep it out of line to avoid duplicating the body in callers specialized per kernel, while preserving the existing GPUCompiler cache path.

@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: 52023c9 Previous: 63c6c40 Ratio
amdgpu/synchronization/context/device 552.5 ns 582.5 ns 0.95
amdgpu/synchronization/stream/blocking 230.25 ns 235 ns 0.98
amdgpu/synchronization/stream/nonblocking 315 ns 342.5 ns 0.92
applications/bitonic_sort 1129812.25 ns 1135780.75 ns 0.99
applications/convolution 104334 ns 105389 ns 0.99
applications/floyd_warshall 8864840.25 ns 8837117.5 ns 1.00
applications/histogram 810207.5 ns 803238.75 ns 1.01
applications/prefix_sum 231968.5 ns 231228.25 ns 1.00
array/accumulate/Float32/1d 75573.75 ns 79176 ns 0.95
array/accumulate/Float32/dims=1 266539 ns 270856.25 ns 0.98
array/accumulate/Float32/dims=1L 67636 ns 82303.75 ns 0.82
array/accumulate/Float32/dims=2 70118.75 ns 70921 ns 0.99
array/accumulate/Float32/dims=2L 2609173.5 ns 2753465.25 ns 0.95
array/accumulate/Int64/1d 78238.75 ns 77441 ns 1.01
array/accumulate/Int64/dims=1 242869 ns 242275.75 ns 1.00
array/accumulate/Int64/dims=1L 81491.25 ns 83723.5 ns 0.97
array/accumulate/Int64/dims=2 85266.25 ns 85516.25 ns 1.00
array/accumulate/Int64/dims=2L 2889973.25 ns 2887214.75 ns 1.00
array/broadcast 71943.75 ns 72326 ns 0.99
array/construct 2212.5 ns 2327.5 ns 0.95
array/copy 37200.5 ns 33308 ns 1.12
array/copyto!/cpu_to_gpu 111219.25 ns 111544 ns 1.00
array/copyto!/gpu_to_cpu 118657 ns 112239 ns 1.06
array/copyto!/gpu_to_gpu 58703.5 ns 53915.75 ns 1.09
array/iteration/findall/bool 131467.25 ns 134521.75 ns 0.98
array/iteration/findall/int 147562.5 ns 148569.5 ns 0.99
array/iteration/findfirst/bool 181535.5 ns 182537.5 ns 0.99
array/iteration/findfirst/int 141354.75 ns 140624.25 ns 1.01
array/iteration/findmin/1d 105612 ns 118906.5 ns 0.89
array/iteration/findmin/2d 106744.5 ns 109151.5 ns 0.98
array/iteration/logical 234893.75 ns 238428.25 ns 0.99
array/iteration/scalar 288022.25 ns 292276.25 ns 0.99
array/permutedims/2d 58606 ns 70986 ns 0.83
array/permutedims/3d 69891.25 ns 70406 ns 0.99
array/permutedims/4d 72351 ns 60245.75 ns 1.20
array/random/rand/Float32 45158 ns 45383 ns 1.00
array/random/rand/Int64 53278.25 ns 53550.75 ns 0.99
array/random/rand!/Float32 64536 ns 64251 ns 1.00
array/random/rand!/Int64 71883.75 ns 71186 ns 1.01
array/random/randn/Float32 78326.25 ns 79301 ns 0.99
array/random/randn!/Float32 80408.75 ns 80246.25 ns 1.00
array/reductions/mapreduce/Float32/1d 92771.5 ns 94648.75 ns 0.98
array/reductions/mapreduce/Float32/dims=1 85004 ns 86616.25 ns 0.98
array/reductions/mapreduce/Float32/dims=1L 840941 ns 835469 ns 1.01
array/reductions/mapreduce/Float32/dims=2 81206.25 ns 82718.75 ns 0.98
array/reductions/mapreduce/Float32/dims=2L 137979.75 ns 138384.5 ns 1.00
array/reductions/mapreduce/Int64/1d 93644 ns 94203.75 ns 0.99
array/reductions/mapreduce/Int64/dims=1 70518.5 ns 86458.75 ns 0.82
array/reductions/mapreduce/Int64/dims=1L 843898.75 ns 841119 ns 1.00
array/reductions/mapreduce/Int64/dims=2 82213.75 ns 83068.5 ns 0.99
array/reductions/mapreduce/Int64/dims=2L 139117.25 ns 138761.75 ns 1.00
array/reductions/reduce/Float32/1d 92884 ns 94551.5 ns 0.98
array/reductions/reduce/Float32/dims=1 79568.75 ns 86223.75 ns 0.92
array/reductions/reduce/Float32/dims=1L 838031 ns 841294 ns 1.00
array/reductions/reduce/Float32/dims=2 81986.5 ns 82688.5 ns 0.99
array/reductions/reduce/Float32/dims=2L 137454.75 ns 137874.25 ns 1.00
array/reductions/reduce/Int64/1d 92369 ns 94288.75 ns 0.98
array/reductions/reduce/Int64/dims=1 70558.75 ns 85981.25 ns 0.82
array/reductions/reduce/Int64/dims=1L 850099 ns 840701.25 ns 1.01
array/reductions/reduce/Int64/dims=2 80853.75 ns 83251.25 ns 0.97
array/reductions/reduce/Int64/dims=2L 138654.75 ns 138074.5 ns 1.00
array/reverse/1d 43295.75 ns 43553 ns 0.99
array/reverse/1dL 73666.25 ns 73793.5 ns 1.00
array/reverse/1dL_inplace 77761.25 ns 78213.5 ns 0.99
array/reverse/1d_inplace 59073.5 ns 41343 ns 1.43
array/reverse/2d 48696 ns 49133 ns 0.99
array/reverse/2dL 81496.25 ns 84381 ns 0.97
array/reverse/2dL_inplace 88741.5 ns 89121 ns 1.00
array/reverse/2d_inplace 60903.5 ns 61473.25 ns 0.99
array/sorting/1d 333430.25 ns 335059.75 ns 1.00
gemm/tiled 1892401.5 ns 1903771.5 ns 0.99
gemm/tiled_unbounded 1895439 ns 1922259 ns 0.99
integration/byval/reference 36781 ns 39361 ns 0.93
integration/byval/slices=1 41660 ns 41280 ns 1.01
integration/byval/slices=2 158513 ns 158962 ns 1.00
integration/byval/slices=3 237694 ns 237943 ns 1.00
integration/volumerhs 4913295 ns 4900479 ns 1.00
kernel/indexing 34908 ns 55808.25 ns 0.63
kernel/indexing_checked 56728.25 ns 38333 ns 1.48
kernel/launch 1152.5 ns 1337.5 ns 0.86
kernel/rand 85994 ns 99514 ns 0.86
latency/import 1714206163 ns 1748092483 ns 0.98
latency/precompile 39858876511 ns 39846434991 ns 1.00
latency/ttfp 2325183817 ns 2322353398 ns 1.00
stencil/diffusion3d 1618706.25 ns 1620301.5 ns 1.00
stencil/diffusion3d_checked 1664557 ns 1658012.25 ns 1.00

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

@luraess

luraess commented Sep 14, 2026

Copy link
Copy Markdown
Member

Again Int128 failing test, on 1.12 only

@test Array(test_kernel.(ROCArray(M), Int128(10))) == test_kernel.(M, Int128(10))

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