Repository navigation
[S0.2a] P0: DType carries its witness (DType.witness, fromWitness, entries); descriptors/readers report DType additively #1007
Copy link
Copy link
Closed
Labels
codingImplementation task (DARC: C)Implementation task (DARC: C)file-format:ggufGGUF file formatGGUF file formatfile-format:safetensorsSafeTensors file formatSafeTensors file formatsub-issueSub-issue of a tracking issueSub-issue of a tracking issuetensorsTensor operations and data structuresTensor operations and data structures
Milestone
Description
Sub-issue of #1001 · Phase P0 · Milestone M0 · PRD: M0-A3 (enabler) · Proposal: §0 DType, §10 decision #13
Branch: feature/1007-dtype-witness
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.types.DType:val witness: KClass<out DType>(each of the 14 objects narrows, e.g.FP32.witness: KClass<FP32>),val isSigned(default true, false on UInt*),val sizeInBytes; companion@JvmStatic fromWitness(kclass)(identity-keyed map — no name-based reflection, JS/wasm safe),entries(LogicalDType order). Do not reuseDType.kotlinClass()(value KClass).- Additive
dtype: DTypesecondary constructors / overloads:TensorStorage,TensorStorageFactory(fromRawBytes,fromRawBytesOwned,fileBacked;toTensorDatadispatches onDTypewith identical semantics),PackedBlockStorage(dtype = FP32overload),DefaultKvCacheStore/TurboQuantKvCacheStoreconstruct via the dtype ctor. - Readers:
StreamingGGUFReader.ggmlTypeToDType()(quantized → FP32,Opaquefallback kept),StreamingSafeTensorsReader(BOOL→UInt8, UNKNOWN→Int8 kept). - Tests:
DTypeWitnessTest; dtype twins inTensorStorageContractTest; ioStorageIntegrationTestassertsassertSame(FP32, storage.dtype)for Q4_K.
Acceptance
- All existing storage/io tests unchanged and green; new tests green on JVM + linuxX64 + js/wasm;
apiCheckon lang-core, lang-dag, lang-models, backend-cpu, compile-* clean after dump.
Depends on
#1006 (S0.1).
Keeps develop green by
Secondary ctors/overloads only; primary ctors and toString() texts untouched; no deprecations yet (that is #1014 (S0.2b)).
Working rules (every slice)
- One slice = one branch
feature/1007-<slug>fromdevelop= one PR (Closes #1007), merged independently. developstays usable after merge: additive API or behind façade / opt-in; no default behaviour switch without golden-parity + benchmark evidence in the PR; deprecate withReplaceWith, never delete before a major (zero-consumer dead code may be removed with evidence in the PR). No new abstract members onTensorData/KernelProvider(defaults only); no data-class primary-constructor changes (secondary ctors only); BCV:apiDumpbothapi/jvmandapi/android,apiCheckclean.- Test gate before the PR (JDK 25,
scripts/pr-gate.shonce 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:jvmBenchmarkand:skainet-backends:benchmarks:jvm-cpu-jmh:jmhbefore/after when a hot path changes. - Commits: conventional commit subject,
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>trailer. Do not editCHANGELOG.mdin slice PRs (parallel branches conflict on it; release notes are written at release time from the merged PRs).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
codingImplementation task (DARC: C)Implementation task (DARC: C)file-format:ggufGGUF file formatGGUF file formatfile-format:safetensorsSafeTensors file formatSafeTensors file formatsub-issueSub-issue of a tracking issueSub-issue of a tracking issuetensorsTensor operations and data structuresTensor operations and data structures
Activity