Skip to content

Use byte-range overlap for dense JLArray alias detection - #803

Merged
maleadt merged 3 commits into
JuliaGPU:mainfrom
lkdvos:ld-jlarray-byte-range-aliasing
Oct 8, 2026
Merged

maleadt merged 3 commits into
JuliaGPU:mainfrom
lkdvos:ld-jlarray-byte-range-aliasing

Conversation

@lkdvos

@lkdvos lkdvos commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Since #784, disjoint dense JLArrays sharing one allocation are reported as aliases, rejecting valid buffer-backed contractions in QuantumKitHub/TensorOperations.jl#310.

Specialize Base.mightalias(::JLArray, ::JLArray) using half-open byte ranges, following CUDA's dense-array implementation (linked in the source comment). Zero-byte arrays return false. Keep shared-allocation dataids for conservative wrapper checks and the #716 broadcast fix.

Validation on Julia 1.13.1: The shared GPUArrays aliasing testsuite uses the supplied array type, with nine assertions covering self-aliasing, adjacent and overlapping slices in both orders, independent allocations, mixed element sizes, and empty views. All 18 assertions pass for Array and JLArray through the standard test runner. With this fix and the companion StridedViews #57, all 219 original TensorOperations allocator assertions pass. The JLArrays fix can also be backported to the 0.3 release line.

@maleadt
maleadt merged commit 70cf21c into JuliaGPU:main Oct 8, 2026
16 of 18 checks passed
@lkdvos
lkdvos deleted the ld-jlarray-byte-range-aliasing branch October 8, 2026 19:40
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