feat(memory): Format(dtype, encoding), TensorData.encoding, Tensor/TensorStorage.format (SKEEP-003 P1, S0.4) - #1051
Merged
Conversation
…mber; Tensor/TensorStorage.format (SKEEP-003 P1) Milestone M0 (#1001), acceptance M0-A3: every tensor reports a coherent Format — a packed weight is logically FP32 with its block encoding, never a Byte-typed tensor. - New package sk.ainet.lang.memory (opt-in @ExperimentalMemoryApi while M0–M1 shape the API): data class Format(dtype: DType, encoding: TensorEncoding) with isDense, physicalBytes(count), Format.dense(dtype), toString "Float32/Q4_K". - TensorData.encoding: TensorEncoding? as a *default* member (null = plain dense representation of the dtype) — TensorData is implemented outside lang-core, so no abstract member. The packed implementations already expose `encoding` through PackedBlockStorage; NarrowFloat data now reports Dense(2) (physical width whatever the dtype witness), the JVM Q4/Q8 MemorySegment data report Q4_0/Q8_0. - Tensor<*, *>.format / formatOrNull: Format(DType.fromWitness(dtype), data.encoding ?: Dense(dtype.sizeInBytes)); TensorStorage.format. - FormatTest (commonTest): dense/narrow/packed data for all seven GGML encodings + ternary, storage format, non-concrete witness. - BCV: lang-core jvm dump regenerated (additions only). Closes #1008 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
|
Local gate Targeted: lang-core |
michalharakal
changed the base branch from
feature/1007-dtype-witness
to
develop
August 22, 2026 19:18
…torageSpec (SKEEP-003 P0) Milestone M0 (#1001), SKEEP-003 prerequisite "StorageSpec becomes the allocation spec". - sk.ainet.lang.memory.AllocationSpec(format, elementCount, domain = HOST_HEAP, scope = AMBIENT, mutable = true, alignment = 64): bytes / bytesOrNull from the encoding, AllocationSpec.of(format, shape, ...), validation (count >= 0, power-of-two alignment). The input of the M0 MemoryPlan line items and, from M1, of Storage.allocate(spec, scope). - enum ScopeKind { MODEL, FORWARD, AMBIENT } — the lifetime classes of SKEEP-003 §4.5, declared now; M1's Scope exposes kind: ScopeKind. - StorageSpec and its companion factories @deprecated(ReplaceWith AllocationSpec); zero consumers outside its own file and the S0.1 bridge test (kept on purpose, suppressed). StorageSpec.toAllocationSpec(count) is the migration path. Removed at the next major. - AllocationSpecTest; BCV lang-core jvm dump regenerated (additions + deprecation annotations). Closes #1009 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ion-spec feat(memory): AllocationSpec + ScopeKind replace the never-consumed StorageSpec (SKEEP-003 P0, S0.3)
aharakal
approved these changes
Aug 22, 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 was referenced Aug 22, 2026
This was referenced Aug 23, 2026
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.
Summary
SKEEP-003 slice S0.4 (milestone M0 #1001, acceptance M0-A3): every tensor reports a coherent
Format(dtype, encoding)— a packed weight is logicallyFP32with its block encoding, never aByte-typed tensor.sk.ainet.lang.memory(opt-in@ExperimentalMemoryApiwhile M0–M1 shape the API; this is whereAllocationSpec,Storage,Scope,TensorView… will live):data class Format(dtype: DType, encoding: TensorEncoding)withisDense,physicalBytes(count),Format.dense(dtype),toString()=Float32/Q4_K.TensorData.encoding: TensorEncoding?as a default member (null= plain dense representation of the dtype).TensorDatais implemented outside lang-core, so no abstract member is added. The packed implementations already exposeencodingviaPackedBlockStorage; narrow-float data now reportsDense(2)(physical width regardless of the dtype witness); the JVMQ4/Q8MemorySegmentTensorDatareportQ4_0/Q8_0.Tensor<*, *>.format/formatOrNull=Format(DType.fromWitness(dtype), data.encoding ?: Dense(dtype.sizeInBytes))(uses [S0.2a] P0: DType carries its witness (DType.witness,fromWitness,entries); descriptors/readers reportDTypeadditively #1007'sfromWitness);TensorStorage.format.FormatTest(commonTest): dense and narrow data, all seven GGML packed encodings + ternary (Format(FP32, <enc>), string form), storage format, non-concrete witness.Stacked on #1050 (S0.2a —
DType.fromWitness); base is that branch and GitHub retargets todevelopwhen it merges.Test plan
Full local gate (
scripts/pr-gate.sh, JDK 25) on the stacked tree; results in the first comment. Targeted: lang-coresk.ainet.lang.memory.*+sk.ainet.lang.tensor.data.*110/110.Closes #1008
🤖 Generated with Claude Code