Skip to content

Let empty arrays alias nothing on Julia 1.10 - #152

Closed
maleadt wants to merge 2 commits into
mainfrom
tb/empty-mightalias
Closed

maleadt wants to merge 2 commits into
mainfrom
tb/empty-mightalias

Conversation

@maleadt

@maleadt maleadt commented Oct 8, 2026

Copy link
Copy Markdown
Member

Julia 1.10's Base.mightalias doesn't check for empty arrays; 1.11 and later do. GPU back-ends like AMDGPU give every empty array the same null data pointer, so on Julia 1.10 reductions, scans and workspace checks rejected empty destinations and sources as aliasing. This caused 221 errors in AMDGPU's GPUArrays testsuite on 1.10, e.g. cumsum(ROCArray(Int[])) and sum(A; dims=2) for a 0×3 A.

Uses an isempty-guarded _mightalias at the three call sites. The tests use reshaped empty views, which reproduce the false positive on CPU arrays on Julia 1.10.

Bumps the version to 0.5.3.

Julia 1.10's Base.mightalias does not check for empty arrays, which later
versions do. GPU back-ends like AMDGPU give every empty array the same null
data pointer, so reductions, scans and workspaces rejected empty destinations
and sources as aliasing (GPUArrays' testsuite on AMDGPU with Julia 1.10).
@maleadt

maleadt commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

Superseded: the problem is AMDGPU's pointer-based Base.dataids, which made every empty ROCArray alias every other (and missed overlaps between offset views). AMDGPU's GPUArrays 12 port now drops it in favour of GPUArrays' allocation-based dataids (JuliaGPU/AMDGPU.jl#1145, 1f34fe1a), so AK can keep using Base.mightalias.

@maleadt maleadt closed this Oct 8, 2026
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.

1 participant