Skip to content

feat(storage): two-way LogicalDType ↔ DType bridge (SKEEP-003 P0, M0) - #1045

Merged
michalharakal merged 1 commit into
developfrom
feature/1006-dtype-bridge
Aug 22, 2026
Merged

michalharakal merged 1 commit into
developfrom
feature/1006-dtype-bridge

Conversation

@michalharakal

@michalharakal michalharakal commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

First code slice of the SKEEP-003 memory architecture (Phase P0, milestone M0 #1001): the two-way LogicalDType ↔ DType bridge that decision #13 requires before LogicalDType can be merged into one sealed DType.

  • LogicalDType.toDType() — inverse of the existing LogicalDType.fromDType; exhaustive when, no else.
  • DType.toLogicalDType() — extension in sk.ainet.lang.tensor.storage (file LogicalDTypeBridge.kt, JVM facade DTypeBridge), so sk.ainet.lang.types stays a leaf package.
  • Computed dtype: DType on StorageSpec, TensorStorage, StorageMemoryReport (additive; toString() unchanged); StorageSpec factories no longer call fromDType twice.
  • LogicalDTypeBridgeTest (commonTest): 14 ↔ 14 membership, explicit pair table, round trips both ways, bijectivity, sizeInBits/float-ness agreement across the bridge, descriptors expose the dtype.
  • scripts/pr-gate.sh — local equivalent of the CI legs (jvmTest, apiCheck, JS/Wasm tests, linuxX64Test, assemble, Java API tests; --bench adds StorageBenchmarks + JMH; auto-detects CHROME_BIN for Karma) used before every memory-architecture PR.
  • BCV: skainet-lang-core jvm dump regenerated — additions only (LogicalDType.toDType, DTypeBridge.toLogicalDType, three getDtype()); the api/android dump is not produced by the current BCV setup (stale since feat(optim): mutable learning rate and warmup+cosine LR schedule #866) and is left untouched.
  • Rebased onto develop after docs(skeep): SKEEP-003 accepted — decisions, memory-architecture design record, M0–M2 roadmap #1043 and chore(bcv): refresh stale skainet-compile-hlo API dump (pre-existing apiCheck failure on develop) #1047 merged (single commit, no CHANGELOG edit — release notes are written at release time).

Purely additive; no consumer changed; develop behaviour identical.

Test plan

scripts/pr-gate.sh output is in the first comment (full: jvmTest, apiCheck, verifyNpmPins jsTest wasmJsTest wasmWasiTest, linuxX64Test, assemble, :skainet-test:skainet-test-java:test).

Closes #1006

🤖 Generated with Claude Code

@michalharakal

Copy link
Copy Markdown
Contributor Author

Local gate scripts/pr-gate.sh (JDK 25, CHROME_BIN=/snap/bin/chromium) on d875ea4:

=== pr-gate: JVM tests ===                         BUILD SUCCESSFUL in 6m 15s   (first run; re-runs up-to-date)
=== pr-gate: apiCheck ===                          BUILD SUCCESSFUL
=== pr-gate: verifyNpmPins jsTest wasmJsTest wasmWasiTest === BUILD SUCCESSFUL in 2m 13s
=== pr-gate: linuxX64Test ===                      BUILD SUCCESSFUL in 1m 23s
=== pr-gate: assemble ===                          BUILD SUCCESSFUL in 2m 9s
=== pr-gate: :skainet-test:skainet-test-java:test === BUILD SUCCESSFUL in 21s
pr-gate: all legs passed.

Targeted: LogicalDTypeBridgeTest 7/7, TensorStorageContractTest 18/18, DTypeTest 31/31, DTypeLatticeConsistencyTest 9/9 on jvmTest; commonTest also ran on linuxX64/js/wasm in the legs above.

@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-1045 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 22, 2026 15:27
@michalharakal
michalharakal force-pushed the feature/1006-dtype-bridge branch from d875ea4 to 3e4d6f6 Compare August 22, 2026 15:56
@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-1045 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 22, 2026
@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-1045 artifact to view the complete documentation locally.

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

First code slice of the SKEEP-003 memory architecture (milestone M0,
#1001). Decision #13 merges LogicalDType into one sealed DType; the
prerequisite is a total, bijective bridge in both directions:

- LogicalDType.toDType() — inverse of LogicalDType.fromDType; exhaustive
  when over the 14 constants, no else branch.
- DType.toLogicalDType() — extension in sk.ainet.lang.tensor.storage
  (file LogicalDTypeBridge.kt, JVM facade DTypeBridge), keeping
  sk.ainet.lang.types a leaf package.
- Computed dtype: DType on StorageSpec, TensorStorage and
  StorageMemoryReport; StorageSpec factories no longer call fromDType
  twice. toString() texts unchanged.
- LogicalDTypeBridgeTest (commonTest): 14 ↔ 14 membership, explicit pair
  table, round trips both ways, bijectivity, sizeInBits/float-ness
  agreement, descriptors expose the dtype.
- scripts/pr-gate.sh: local equivalent of the CI test legs (jvmTest,
  apiCheck, JS/Wasm tests, linuxX64Test, assemble, Java API tests;
  --bench adds StorageBenchmarks + JMH; auto-detects CHROME_BIN).
- BCV: jvm dump regenerated (additions only).

Purely additive; no consumer changed.

Closes #1006

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@michalharakal
michalharakal force-pushed the feature/1006-dtype-bridge branch from 5db6bf5 to b62256e Compare August 22, 2026 17:15
@michalharakal
michalharakal requested a review from aharakal August 22, 2026 17:16
@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-1045 artifact to view the complete documentation locally.

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

1 similar comment
@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-1045 artifact to view the complete documentation locally.

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

@michalharakal

Copy link
Copy Markdown
Contributor Author

Rebased onto develop @ c7d0c4f (after #1043, #1047); CHANGELOG edit dropped. Gate re-run on b62256e — all legs green (jvmTest, apiCheck, verifyNpmPins jsTest wasmJsTest wasmWasiTest, linuxX64Test, assemble, :skainet-test:skainet-test-java:test; tasks up-to-date/from cache vs the previous run since only the base changed).

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.

[S0.1] P0: two-way LogicalDType ↔ DType bridge (LogicalDType.toDType(), DType.toLogicalDType(), StorageSpec.dtype)

2 participants