Skip to content

docs(skeep): SKEEP-003 draft — unifying the tensor storage model (#932) - #933

Merged
michalharakal merged 2 commits into
developfrom
feature/skeep-003-unified-tensor-storage
Aug 10, 2026
Merged

michalharakal merged 2 commits into
developfrom
feature/skeep-003-unified-tensor-storage

Conversation

@michalharakal

Copy link
Copy Markdown
Contributor

Design proposal (Status: Draft) anchoring the discussion in #932. Docs-only: the SKEEP + registration in nav.adoc and the index table.

What it addresses

TensorData (live: every Tensor holds one, backends dispatch by downcasting to concrete classes, all common-code storage is heap arrays) and TensorStorage (designed: BufferHandle.{Owned,Borrowed,Aliased,FileBacked,DeviceResident}, Placement, TensorEncoding, MemoryPlanner) are parallel layers — the second directs new code to target it, but no Tensor ever holds one and most of it has no production consumer. The draft documents the recurring costs: ownership recorded but never enforced (with the arena-OOM history rediagnosed as a missing weights-vs-activations lifetime split), two disconnected view systems, three type representations with packed tensors erasing their logical dtype (Q4_KTensorData : TensorData<DType, Byte>), and placement machinery never consulted at allocation.

What it proposes

  • Two candidate end-states, no recommendation — storage-first (one byte-owner, TensorData as typed views, dispatch on dtype+encoding) vs data-first (absorb the useful vocabulary, retire the parallel layer). The trade-off is explicitly a maintainer decision; both share two small prerequisites (two-way LogicalDType bridge; settle StorageSpec's fate).
  • Five cross-cutting improvements valid under either outcome: scoped lifetimes (model vs forward scope, keyed off the existing Residency), one view mechanism, logical-dtype + encoding coherence, IO/staging as one pipeline — including a Kotlin Multiplatform feasibility assessment of a userland file-system layer (verdict: read path feasible over the existing RandomAccessSource seam; direct-IO is platform-gated with no Apple equivalent; DMA-pinned staging has no portable form and is deferred; JS/Wasm force a suspend source variant) — and placement consulted at creation.
  • A hard constraint: the packed-encoding system (7 GGML formats, ternary, TurboQuant, kernel dispatch, StableHLO skainet.tensor_encodings export) is ahead of comparable frameworks and must survive bit-identically.

Mechanical bugs found in the same audit are filed independently (#927–#931) and are fixable under either end-state.

Sibling: SKEEP-002 (PR #926) is the mobile/mmap slice of the IO pipeline improvement; the two proposals compose but neither depends on the other.

Refs #932

TensorData (live, marker-downcast dispatch, heap arrays) and TensorStorage
(designed descriptor layer: BufferHandle ownership variants, Placement,
TensorEncoding, MemoryPlanner) are parallel abstractions; the second has
almost no production consumers. The draft lays out the costs of the split
(unenforced ownership after the documented arena-OOM retreat, two
disconnected view systems, three type representations with packed tensors
erasing their logical dtype, placement machinery never consulted) and two
candidate end-states — storage-first vs data-first — deliberately without
a recommendation; the trade-off is left to maintainer discussion.

Cross-cutting improvements proposed under either outcome: scoped lifetimes
keyed off the existing Residency vocabulary, one view mechanism, explicit
logical-dtype + encoding pairs, IO/staging as one pipeline (including a
Kotlin Multiplatform feasibility assessment of a ZML-style userland
file-system layer over the existing RandomAccessSource seam), and placement
consulted at creation. Hard constraint: the packed-encoding system and its
StableHLO metadata export must survive bit-identically.

Registered in nav.adoc and the index proposal table as Draft.

Refs #932
@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-933 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 08:57
Resolve nav.adoc and index.adoc conflicts with the merged SKEEP-002
(PR #926): keep both proposal entries in numeric order.
@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-933 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.

2 participants