Conversation
maleadt
added this pull request to stack #3303
September 27, 2026 12:29
maleadt
force-pushed
the
tb/ka-ndlaunch
branch
4 times, most recently
from
September 27, 2026 15:08
81967db to
637db6f
Compare
Contributor
CUDA.jl BenchmarksDetails
This comment was automatically generated by workflow using github-action-benchmark. |
maleadt
force-pushed
the
tb/ka-ndlaunch
branch
from
September 27, 2026 17:35
637db6f to
910dca0
Compare
maleadt
added a commit
to JuliaGPU/KernelAbstractions.jl
that referenced
this pull request
Sep 28, 2026
JuliaGPU/CUDA.jl#3304 (branch tb/ka-ndlaunch) builds on the KernelAbstractions 0.10 port (#3302, branch intrinsics) that CI tests otherwise.
Use KernelAbstractions' launch configurations: kernels over iteration spaces of up to 3 dimensions are launched on a grid of that shape, which avoids the divisions `@index` needs to decompose a linear hardware index, and indices are computed in Int32 whenever the padded iteration space fits. Also stop querying the device for the maximum workgroup size on every launch (it's 1024 on every supported device), and compute the typed KernelInterface queries in the requested type (`get_global_id` and `get_global_size` computed in Int32 before, wrapping for 2^31 or more threads).
maleadt
force-pushed
the
tb/ka-ndlaunch
branch
from
September 28, 2026 05:16
910dca0 to
3926ab5
Compare
maleadt
added a commit
to JuliaGPU/KernelAbstractions.jl
that referenced
this pull request
Sep 28, 2026
JuliaGPU/CUDA.jl#3304 (branch tb/ka-ndlaunch) builds on the KernelAbstractions 0.10 port (#3302, branch intrinsics) that CI tests otherwise.
maleadt
added a commit
to JuliaGPU/KernelAbstractions.jl
that referenced
this pull request
Sep 28, 2026
JuliaGPU/CUDA.jl#3304 (branch tb/ka-ndlaunch) builds on the KernelAbstractions 0.10 port (#3302, branch intrinsics) that CI tests otherwise.
maleadt
added a commit
to JuliaGPU/KernelAbstractions.jl
that referenced
this pull request
Sep 28, 2026
JuliaGPU/CUDA.jl#3304 (branch tb/ka-ndlaunch) builds on the KernelAbstractions 0.10 port (#3302, branch intrinsics) that CI tests otherwise.
maleadt
added a commit
to JuliaGPU/KernelAbstractions.jl
that referenced
this pull request
Sep 28, 2026
JuliaGPU/CUDA.jl#3304 (branch tb/ka-ndlaunch) builds on the KernelAbstractions 0.10 port (#3302, branch intrinsics) that CI tests otherwise.
maleadt
added a commit
to JuliaGPU/KernelAbstractions.jl
that referenced
this pull request
Sep 28, 2026
JuliaGPU/CUDA.jl#3304 (branch tb/ka-ndlaunch) builds on the KernelAbstractions 0.10 port (#3302, branch intrinsics) that CI tests otherwise.
maleadt
added a commit
to JuliaGPU/KernelAbstractions.jl
that referenced
this pull request
Sep 28, 2026
JuliaGPU/CUDA.jl#3304 (branch tb/ka-ndlaunch) builds on the KernelAbstractions 0.10 port (#3302, branch intrinsics) that CI tests otherwise.
maleadt
added a commit
to JuliaGPU/KernelAbstractions.jl
that referenced
this pull request
Sep 28, 2026
JuliaGPU/CUDA.jl#3304 (branch tb/ka-ndlaunch) builds on the KernelAbstractions 0.10 port (#3302, branch intrinsics) that CI tests otherwise.
maleadt
added a commit
to JuliaGPU/KernelAbstractions.jl
that referenced
this pull request
Sep 28, 2026
JuliaGPU/CUDA.jl#3304 (branch tb/ka-ndlaunch) builds on the KernelAbstractions 0.10 port (#3302, branch intrinsics) that CI tests otherwise.
maleadt
added a commit
to JuliaGPU/KernelAbstractions.jl
that referenced
this pull request
Sep 29, 2026
JuliaGPU/CUDA.jl#3304 (branch tb/ka-ndlaunch) builds on the KernelAbstractions 0.10 port (#3302, branch intrinsics) that CI tests otherwise.
Member
Author
|
Superseded by #3314: KernelAbstractions now launches |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
KernelAbstractions kernels (including GPUArrays' broadcast,
permutedims!etc.) currently launch on a 1-D grid, and every thread recovers its Cartesian index fromblockIdx/threadIdxwith 64-bit divisions. With JuliaGPU/KernelAbstractions.jl#797, back ends can launch on a grid shaped like the iteration space instead. This PR does that for CUDA, on top of the KA 0.10 port (#3302):@indexneeds no divisions. 4-D and larger ranges, or ranges needing more than 65535 blocks along y or z, keep the 1-D grid.Int32whenever the padded iteration space fits (inIntotherwise), which also helps the 1-D fallback.@indexstill returnsInts.Also included: the typed KernelInterface index queries now compute in the requested type (
get_global_id(Int)used to wrap around at 2^31 threads), the KernelInterface per-dimension launch limits, and two fixes for #3302 (empty ndranges divided by zero when tuning; ranges with offsets couldn't be tuned).Benchmarks
Kernel times on an RTX 5080 (median of 21×10 launches, best of two interleaved rounds), comparing #3302 with this PR. Both use KernelAbstractions with the first commit of JuliaGPU/KernelAbstractions.jl#797, which fixes a regression in KA 0.10
main(the untyped KernelInterface queries weren't inlined, making #3302 as-is up to 2.4× slower than CUDA.jlmain):bcast 1D F32 a+bbcast 2D F32 A+rowbcast 3D F32 A*vbcast 3D F32 A+Bbcast 3D F32 smallbcast 3D Int8 A+vbcast 3D F16 A+B+1bcast 4D F32 A*vbcast 2D viewpermutedims 3DKA 2D CartesianKA 3D CartesianKA 3D LinearKA 3D Cartesian wgs=(32,8)KA 3D stencil NTupleKA 4D CartesianN-d broadcasts and dynamically-sized N-d kernels get considerably faster; 1-D and memory-bound 2-D kernels don't change. Neither does the kernel with a static
(32, 8)workgroup, where decomposing the linear index only divides by constants.Host overhead went down too: launching a tiny 3-D kernel takes 2.15 µs and allocates 688 B, vs. 2.35 µs and 1648 B with #3302.
Oceananigans.jl and Breeze.jl (on their KA 0.10 ports, CliMA/Oceananigans.jl#5799 and NumericalEarth/Breeze.jl#848), median ms/step over 200 steps, 3 interleaved rounds:
The largest per-kernel wins are Oceananigans'
Gv(98 → 80 registers, −23%),update_hydrostatic_pressure(−33%) and broadcasts (−20%). A few of Breeze's momentum tendencies cross a register threshold instead (up to +20% for one kernel), hence the +0.4%. Oceananigans' results are bitwise identical; Breeze's anelastic ones differ at rounding level (FMA contraction).Tests
KernelAbstractions' testsuite, which runs here too, now checks every
@indexflavour against the expected layout for 1–4-D, ragged, offset, static and empty ranges. The CUDA tests add launch selection, the absence of divisions in the PTX for a dynamic 3-D range, and ranges of more than 2^31 threads on both kinds of grid.Temporary:
[sources]and the Julia 1.10 CI step point KernelAbstractions and KernelInterface at the #797 branch (KernelInterface is repeated in every workspace project to work around JuliaLang/Pkg.jl#4831). To be reverted once KA 0.10 is registered.