Skip to content

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

Open
lkdvos wants to merge 3 commits into
JuliaGPU:mainfrom
lkdvos:ld-jlarray-byte-range-aliasing
Open

lkdvos wants to merge 3 commits into
JuliaGPU:mainfrom
lkdvos:ld-jlarray-byte-range-aliasing

Conversation

@lkdvos

@lkdvos lkdvos commented Oct 5, 2026 •

Copy link
Copy Markdown

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.

This branch has not been deployed

No deployments
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