Skip to content

Preserve parent alias checks for StridedViews - #57

Merged
lkdvos merged 2 commits into
QuantumKitHub:mainfrom
lkdvos:ld-parent-alias-detection
Oct 6, 2026
Merged

lkdvos merged 2 commits into
QuantumKitHub:mainfrom
lkdvos:ld-parent-alias-detection

Conversation

@lkdvos

@lkdvos lkdvos commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

StridedView currently relies on the default Base.mightalias check over its parents' dataids. When two dense parents share an allocation but occupy disjoint ranges, that loses any more precise alias check supplied by the parent array type. This blocks buffer-backed JLArray contractions in QuantumKitHub/TensorOperations.jl#310 even after the dense JLArray check is fixed in JuliaGPU/GPUArrays.jl#803.

Specialize Base.mightalias(::StridedView, ::StridedView) to delegate to the dense parents, with an explicit empty-view guard. Disjoint parents prove their views are disjoint; overlapping parents remain conservatively classified as potentially aliasing. Keep dataids unchanged for other wrapper combinations.

Validation on Julia 1.13.1: five assertions in the existing JLArrays testset check that self-aliasing, disjoint parents, and overlapping parents preserve JLArrays' alias result, plus empty views in both argument orders. They pass with released JLArrays 0.3.3 / GPUArrays 11.5.16 and with GPUArrays #803 applied. Comparing against the parent result keeps the tests compatible with the current release while detecting lost byte-range precision once the JLArrays specialization is available. With this change and GPUArrays #803 applied in the TensorOperations test process, all 219 original allocator assertions pass, including the four failing tensor-network cases. Files pass Runic formatting.

@codecov

codecov Bot commented Oct 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/stridedview.jl 95.59% <100.00%> (+67.39%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lkdvos
lkdvos merged commit d69e71f into QuantumKitHub:main Oct 6, 2026
11 of 14 checks passed
@lkdvos
lkdvos deleted the ld-parent-alias-detection branch October 6, 2026 14:22
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