Skip to content

fix(lang): copyMaterialize handles Aliased and FileBacked; resolver overloads for transfer ops (#929) - #937

Merged
michalharakal merged 4 commits into
developfrom
fix/storage-transfer-materialize-929
Aug 10, 2026
Merged

michalharakal merged 4 commits into
developfrom
fix/storage-transfer-materialize-929

Conversation

@michalharakal

Copy link
Copy Markdown
Contributor

Full analysis in #929.

copyMaterialize() threw for everything except Owned/Borrowed, which produced two gaps:

  1. Aliased — the descriptor level supports views and DefaultBufferResolver can already read them, but materializing threw. Now resolves through the buffer-accessor path; works with the existing no-arg call.
  2. FileBacked — Placement.MMAP_WEIGHTS is one of the layer's own presets, yet copyToHost() couldn't bring it to the heap. copyMaterialize/copyToHost gain BufferResolver overloads; 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()); DeviceResident stays unsupported with an error naming the reason.

Tests: aliased slice materialization (content + independence), file-backed materialization + copyToHost via fake resolver, helpful no-resolver failure, device-resident unchanged.

Verified: :skainet-lang:skainet-lang-core:jvmTest green (full module).

Note: CHANGELOG entry included — trivial [Unreleased] conflicts expected with the sibling #927–#931 PRs.

Closes #929

…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
@michalharakal
michalharakal requested a review from aharakal August 10, 2026 08:55
@github-actions

Copy link
Copy Markdown

📖 Documentation Preview

The documentation has been built successfully for this PR.

Generated Files:

  • Operator documentation: docs/modules/operators/_generated_/
  • JSON schema output: operators.json

Artifacts:

  • Download the documentation-preview-937 artifact to view the complete documentation locally.

This comment will be updated automatically when the PR is updated.

aharakal
aharakal previously approved these changes Aug 10, 2026
Resolve the [Unreleased] CHANGELOG conflict with the merged #930 entry
(the earlier remote merge predated PRs #934/#926): keep all bullets.
@github-actions

Copy link
Copy Markdown

📖 Documentation Preview

The documentation has been built successfully for this PR.

Generated Files:

  • Operator documentation: docs/modules/operators/_generated_/
  • JSON schema output: operators.json

Artifacts:

  • Download the documentation-preview-937 artifact to view the complete documentation locally.

This comment will be updated automatically when the PR is updated.

@michalharakal
michalharakal requested a review from aharakal August 10, 2026 13:06
@michalharakal
michalharakal merged commit e5ebd44 into develop Aug 10, 2026
13 checks passed
@michalharakal
michalharakal deleted the fix/storage-transfer-materialize-929 branch August 10, 2026 13:07
@github-actions

Copy link
Copy Markdown

📖 Documentation Preview

The documentation has been built successfully for this PR.

Generated Files:

  • Operator documentation: docs/modules/operators/_generated_/
  • JSON schema output: operators.json

Artifacts:

  • Download the documentation-preview-937 artifact to view the complete documentation locally.

This comment will be updated automatically when the PR is updated.

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.

TensorStorage transfer API cannot perform its core transfer: copyToHost() throws for FileBacked (MMAP_WEIGHTS), copyMaterialize() misses Aliased

2 participants