Carriage 1: TensorRef carries identity and encoding to the graph - #1182
Merged
Merged
Conversation
Carriage slice 1 (#1147): capture, don't decide. The tape is the only stage that can see the live tensor, and everything it saw used to die at the trace→graph handoff — a packed weight reached downstream stages as a display name, a parameter as 't7'. - TensorRef gains tensorId/encoding (nullable, default null — every existing construction compiles unchanged). TraceSession.refOf captures the encoding *object* (block size intact) from the data; identity comes from the new TraceSession.identify(tensor, id) hook — a tensor does not know which parameter it is, so whoever does (the HLO generator walking trainableParameters() before recording) registers it. Refs are immutable and cached: identify before first refOf, no retrofit (pinned by test). - Every spec-construction site that starts from a ref carries both through TensorSpec.metadata: TraceToGraphBuilder's input/output specs and synthetic weight nodes, and DefaultExecutionTape's recordOperation + legacy addTrace bridge. TensorSpecIdentity.kt adds the typed accessors following the TensorSpecEncoding precedent — untyped map entries, no storage-model import into skainet-compile. - Tests: TraceSessionIdentityTest (capture semantics incl. the no-retrofit rule) and TraceIdentityToGraphTest (a Q8_0 weight's TensorId and encoding object survive tape → ComputeGraph). Closes #1178. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
📖 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 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.
Closes #1178 (parent #1147, carriage slice 1 of 3). Capture, don't decide.
The tape is the only stage that can see the live tensor — its module-path identity and its storage encoding — and everything it saw used to die at the trace→graph handoff: a packed weight reached downstream stages as a display name, a parameter as
t7.TensorRefgainstensorId/encoding(nullable, defaultnull— every existing construction compiles unchanged).TraceSession.refOfcaptures the encoding object (block size intact, unlike the name strings downstream stages were left with); identity comes from the newTraceSession.identify(tensor, id)hook — a tensor does not know which parameter it is, so whoever does registers it:HloGeneratorwalkstrainableParameters()before recording. Refs are immutable and cached — identify before firstrefOf, no retrofit (pinned by test).TensorSpec.metadata(two more than expected — the graph-level test caughtDefaultExecutionTape's own paths):TraceToGraphBuilder's input/output specs and synthetic weight nodes, and the tape'srecordOperation+ legacyaddTracebridge.TensorSpecIdentity.ktadds the typed accessors following theTensorSpecEncodingprecedent — untyped map entries, no storage-model import intoskainet-compile(the standing rule).TraceSessionIdentityTest(capture semantics incl. the no-retrofit rule) andTraceIdentityToGraphTest(a Q8_0 weight'sTensorIdand encoding object survive tape →ComputeGraph).Per the #1148 reframing, the conformity pipeline (via SKaiNET-transformers, post-release) is the eventual consumer; until then these tests are the metadata's reader. Slice 2 (#1179) serializes it structurally at the StableHLO/
.irpaboundary.Full pr-gate green.
🤖 Generated with Claude Code