Skip to content

[S0.3] P0: AllocationSpec replaces zero-consumer StorageSpec (deprecated with ReplaceWith) #1009

Description

@michalharakal

Sub-issue of #1001 · Phase P0 · Milestone M0 · PRD: — · Proposal: §0 StorageSpec note, §9 P0, SKEEP-003 prerequisite 'StorageSpec fate'
Branch: feature/1009-allocation-spec

Design docs: docs/design/memory/memory-architecture-proposal.md (proposal rev. 2, §-numbers below refer to it) and docs/design/memory/memory-architecture-milestones-prd.md (PRD, requirement IDs Mx-Fy/Mx-Ay) — both land with the SKEEP-003 docs PR; until merged they are attached to #932.

Task

  • sk.ainet.lang.memory.AllocationSpec(format: Format, elementCount: Long, domain: MemoryDomain = HOST_HEAP, scope: ScopeKind = AMBIENT, mutable: Boolean = true, alignment: Int = 64) + bytes; enum ScopeKind { MODEL, FORWARD, AMBIENT } (M1 Scope will expose kind: ScopeKind, so no rename later).
  • StorageSpec.toAllocationSpec(elementCount); @Deprecated(ReplaceWith) on StorageSpec and its companion factories (zero consumers: evidence = grep in PR).
  • First consumer: the MemoryPlan slice's line items (TensorId, AllocationSpec, bytes).

Acceptance

  • Unit tests for bytes per encoding (dense, Q4_K, TurboQuant); deprecation compiles warning-only; apiCheck clean after dump.

Depends on

#1008 (S0.4) (needs Format).

Keeps develop green by

New type + deprecation only.

Working rules (every slice)

  • One slice = one branch feature/1009-<slug> from develop = one PR (Closes #1009), merged independently.
  • develop stays usable after merge: additive API or behind façade / opt-in; no default behaviour switch without golden-parity + benchmark evidence in the PR; deprecate with ReplaceWith, never delete before a major (zero-consumer dead code may be removed with evidence in the PR). No new abstract members on TensorData/KernelProvider (defaults only); no data-class primary-constructor changes (secondary ctors only); BCV: apiDump both api/jvm and api/android, apiCheck clean.
  • Test gate before the PR (JDK 25, scripts/pr-gate.sh once it exists): ./gradlew jvmTest linuxX64Test assemble, ./gradlew verifyNpmPins jsTest wasmJsTest wasmWasiTest, ./gradlew apiCheck, ./gradlew :skainet-test:skainet-test-java:test; storage/backend slices add :skainet-lang:skainet-lang-core:jvmBenchmark and :skainet-backends:benchmarks:jvm-cpu-jmh:jmh before/after when a hot path changes.
  • Commits: conventional commit subject, Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> trailer. Do not edit CHANGELOG.md in slice PRs (parallel branches conflict on it; release notes are written at release time from the merged PRs).

Metadata

Metadata

Assignees

No one assigned

    Labels

    codingImplementation task (DARC: C)sub-issueSub-issue of a tracking issuetensorsTensor operations and data structures

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions