Skip to content

[SKEEP-008]: Precision and encoding conversion #1433

Closed

Description

@michalharakal

Proposal document: docs/modules/skeep/pages/008-precision-and-encoding-conversion.adoc (#1434)
Status: Implemented
Branch: feature/skeep-008-precision-and-encoding-conversion

Trigger

Public Kotlin API (NeuralNetworkDsl members, TensorStorage) · DSL syntax/semantics (what a layer's dtype means, where a cast happens) · compatibility/migration policy (removing members that always threw, rules for precision loss).

Summary

Two public entry points promise to change a tensor's numeric form and do not work:

  • Mixed precision in the DSL. dense<TLayer>(…) ×2 and stage<TStage>(…) are TODO() in both NeuralNetworkDslImpl and StageImpl. That's the six stubs allowlisted in config/stub-allowlist.txt. They can't be implemented as declared, because a type parameter on an interface method can't be reified, so the implementation never gets the layer's KClass.
  • Encoding change after load. TensorStorage.repackTo throws for every encoding change.

The proposal:

  • takes the dtype as a value (dense(64, dtype = FP16), stage("head", dtype = BF16)) behind one PrecisionBoundary module, using the existing TensorOps.convert, which is traced and lowers to stablehlo.convert;
  • keeps repackTo lossless and adds an explicit, lossy requantizeTo on top of the existing Requantizers registry, so it accepts the same encodings as loader quantize-at-load;
  • retires the unused MixedPrecisionModule / InternalMixedPrecisionModule / MixedPrecisionTensorOps scaffold.

Related DARC features

Sub-issues

No sub-issues were filed; the phases shipped in three PRs:

Status upkeep

Activity

  1. added
    trackingParent/tracking issue with sub-issues
    skeepSKEEP proposal tracking issue (durable design record)
    on Oct 21, 2026
  2. michalharakal commented on Nov 10, 2026

    @michalharakal
    ContributorAuthor

    All five phases are merged: B1 in #1470 and A1 in #1469 (released in 0.63.0), A2, A3 and A4 in #1492. The proposal is at Status: Implemented.

    Left open on purpose, as recorded in the proposal's Open Questions: folding the cast pair between two adjacent boundaries in a compile pass, and per-boundary DTypePolicy metadata. Neither is tracked by an issue yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    skeepSKEEP proposal tracking issue (durable design record)trackingParent/tracking issue with sub-issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions