Repository navigation
Conversation
With `--check-bounds=no`, Julia no longer folds `Base.aligned_sizeof(T)`: it reads the element type's layout from the `DataType` at run time. A `ROCDeviceArray` built in device code, as local memory is (`@localmem`, `@ROCStaticLocalArray`), computes its `maxsize` with it, so the kernel loaded the type object from host memory and faulted (HSA_STATUS_ERROR_MEMORY_FAULT). Every reduction uses local memory, so `sum`, `any` and the precompile workload of AcceleratedKernels' AMDGPU extension all faulted. Use the generated `aligned_sizeof` on every Julia version, not only before 1.11. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Keep aligned_sizeof a compile-time constant under
--check-bounds=noWith
--check-bounds=no, Julia (seen on 1.13.4) stops constant-folding Base.aligned_sizeof(T). It compiles to a run-time load of the type's layout from the DataType object:Since Julia 1.11, AMDGPU uses Base.aligned_sizeof directly. A ROCDeviceArray built in device code computes its maxsize with it, and local memory (@LocalMem, @ROCStaticLocalArray) builds one there. So under --check-bounds=no, any kernel using local memory loads the DataType from host memory and faults with HSA_STATUS_ERROR_MEMORY_FAULT. In GCN the fault shows as an s_getpc_b64/@rel32 load of …_Core_Float32… followed by a flat_load … offset:40.
Every reduction uses local memory, so sum, any and mapreduce all fault. So does the precompile workload of AcceleratedKernels' AMDGPU extension, which then never caches. Seen with AMDGPU 2.13.1, KernelAbstractions 0.10.9 and AcceleratedKernels 0.5.14, on MI250X (Frontier) and MI210, both gfx90a.
Minimal repro:
The fix uses the @generated aligned_sizeof, which was already there for Julia < 1.11, on every version. The added test runs that kernel in a --check-bounds=no subprocess. Note that the subprocess may have to precompile under that flag on a cold depot; with warm caches it takes about 5 s.
🤖 Generated with Claude Code