fix(lang): copyMaterialize handles Aliased and FileBacked; resolver overloads for transfer ops (#929) - #937
Merged
Conversation
…verloads for transfer ops TensorStorage.copyMaterialize() threw UnsupportedOperationException for everything except Owned/Borrowed. That left two gaps: - Aliased: the descriptor level supports views (bounds-checked, mutability delegated to parent) and DefaultBufferResolver can already read them — but materializing one threw. It now resolves through the buffer-accessor path and produces an independent owned copy of the slice. - FileBacked: Placement.MMAP_WEIGHTS is one of the layer's three presets, yet copyToHost() -> copyMaterialize() could not read it — the one transfer the storage layer was designed around. copyMaterialize and copyToHost gain BufferResolver overloads; with a file-backed resolver configured (e.g. skainet-io-core's JVM resolver) mmap weights materialize to the heap. The no-arg forms keep their signatures and delegate to a DefaultBufferResolver, so Aliased now also works without any resolver. DeviceResident stays unsupported with an error that names the reason (no device backend exists yet) instead of a generic ownership message. Tests: aliased materialization (slice content + independence from parent), file-backed materialization and copyToHost through a fake resolver, helpful failure without a resolver, device-resident unchanged. Closes #929
|
📖 Documentation Preview The documentation has been built successfully for this PR. Generated Files:
Artifacts:
This comment will be updated automatically when the PR is updated. |
aharakal
previously approved these changes
Aug 10, 2026
|
📖 Documentation Preview The documentation has been built successfully for this PR. Generated Files:
Artifacts:
This comment will be updated automatically when the PR is updated. |
aharakal
approved these changes
Aug 10, 2026
|
📖 Documentation Preview The documentation has been built successfully for this PR. Generated Files:
Artifacts:
This comment will be updated automatically when the PR is updated. |
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.
Full analysis in #929.
copyMaterialize()threw for everything exceptOwned/Borrowed, which produced two gaps:Aliased— the descriptor level supports views andDefaultBufferResolvercan already read them, but materializing threw. Now resolves through the buffer-accessor path; works with the existing no-arg call.FileBacked—Placement.MMAP_WEIGHTSis one of the layer's own presets, yetcopyToHost()couldn't bring it to the heap.copyMaterialize/copyToHostgainBufferResolveroverloads; with a file-backed resolver configured (e.g.skainet-io-core's JVM resolver) mmap weights materialize. The lang-core→io-core dependency direction is why the resolver is injected rather than defaulted-in.No-arg signatures unchanged (delegate to
DefaultBufferResolver());DeviceResidentstays unsupported with an error naming the reason.Tests: aliased slice materialization (content + independence), file-backed materialization +
copyToHostvia fake resolver, helpful no-resolver failure, device-resident unchanged.Verified:
:skainet-lang:skainet-lang-core:jvmTestgreen (full module).Note: CHANGELOG entry included — trivial
[Unreleased]conflicts expected with the sibling #927–#931 PRs.Closes #929