Support launch bounds (@roc maxthreads) and set them for static KernelAbstractions workgroups - #1060
Draft
gbaraldi wants to merge 1 commit into
Draft
Support launch bounds (@roc maxthreads) and set them for static KernelAbstractions workgroups#1060gbaraldi wants to merge 1 commit into
gbaraldi wants to merge 1 commit into
Conversation
@roc minthreads/maxthreads map to GCNCompilerTarget's new launch bounds; KernelAbstractions kernels with static workgroup sizes set maxthreads automatically, matching CUDAKernels. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Depends on JuliaGPU/GPUCompiler.jl#918 (draft until a GPUCompiler release carries it).
Every kernel currently compiles against the backend default
amdgpu-flat-work-group-sizeof1,1024, so the register allocator budgets for 1024-item workgroups — a hard 128-VGPR cap on gfx942 — and register-heavy kernels spill even when they only ever launch with smaller workgroups. HIP C++ tunes this with__launch_bounds__; CUDA.jl exposes it as@cuda maxthreads=.This adds the same knobs:
@roc maxthreads=N/minthreads=N(also onhipfunction), mapped toGCNCompilerTarget's new launch bounds.maxthreadsautomatically for KernelAbstractions kernels with static workgroup sizes, mirroring CUDAKernels — statically-sized KA kernels get the right register budget with no user action.Measured on MI300A (ROCm 7.2.4, Julia 1.12), register-tiled FP32 GEMM (16×16 workgroup, 8×8 microtile per thread, 4096³):
maxthreads=256The bound also lands in the code object's
.max_flat_workgroup_size, so HIP rejects oversize launches at the API level (previously silent UB); the new test covers the attribute, an in-bounds launch, and the oversize rejection.test/core/codegen.jlpasses in full on MI300A.🤖 Generated with Claude Code