Carriage 2: structural layout attrs at the StableHLO and .irpa boundary - #1183
Merged
Merged
Conversation
Carriage slice 2 (#1147): the export boundary carries structure, not display names. The module attribute 'skainet.tensor_layouts' is machine-readable — block element counts, block bytes, bit widths, and block order — straight off the encoding objects' own constants, so a downstream consumer can size and address packed weights without a lookup table. TurboQuantPolar(4b, 128) used to degrade to a name whose block size was unrecoverable; now it is two integers in the header. The former 'skainet.tensor_encodings' names dictionary is REMOVED, not duplicated: an org-wide code search shows nothing outside this repo ever read it (its only consumers were the emitter and its own test), and 'kind' in the structural dictionary carries the name. The no-encodings case still emits a bare 'module {' header (test kept). Block order rides the whole way as a stable string (never the storage-model enum — the no-import rule): TensorRef.blockOrder is captured from PackedBlockStorage at the tape, flows through every spec site slice 1 opened, and lands both in the module attribute and on ExternalParameterRef, so a kernel-feed-ordered weight can be blitted into the .irpa verbatim and say so. StructuralLayoutsModuleAttributeTest pins the header facts for a feed-ordered Q4_K (256/144 + order) and a TurboQuant weight (bits + block), the absence of the removed dictionary, and the bare header. Closes #1179. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…one decision Carriage slice 3 (#1147): the optimizer pipeline joins the production tape→HLO path, and the first real layout decision runs on it. - HloGenerator.generate gains target: String? = null. Null — the default — runs no pipeline and emits byte-identically to before; a named target runs dagPipelineFor(target) with LayoutAssignmentPass as a core pass, plus whatever the target registered through TargetOptimizers. compile-hlo gains the compile-opt dependency this wiring always implied (opt depends on dag; no cycle). - LayoutAssignmentPass, deliberately narrow: rank-2 block-quantized weights (the GGML block formats) get kernel-feed order (INPUT_BLOCK_MAJOR) for the target — mirroring the decision the eager form resolver makes at load (#1120) — and never overrides an order the tape already carried: the loader's fact outranks the pass's preference. Touched nodes are stamped with the backend assignment. - The pre-built ResolvedComputeGraph seams stop returning hardcoded null: resolvedLayout derives BlockOrderLayout from the spec the passes (or the tape) stamped; backendAssignment reads the node metadata key, which lives on ResolvedComputeGraph so the pass imports it along the legal opt→dag direction. - Tests: pass semantics (decides / never-overrides / leaves dense and rank-1 alone; seams surface exactly the decisions made) and the pipeline→emission composition (a decided order reaches the module header as block_order; with no pipeline, no order is invented). Closes #1180. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…pass Carriage 3: LayoutAssignmentPass on the production path — one target, one decision
|
📖 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 #1179 (parent #1147, carriage slice 2 of 3). Stacked on #1182 — merge that first (tick "delete branch" and this retargets to
develop).The export boundary carries structure, not display names.
skainet.tensor_layoutsmodule attribute — machine-readable per-tensor facts straight off the encoding objects' own constants:{kind = "Q4_K", block_elems = 256, block_bytes = 144, block_order = "INPUT_BLOCK_MAJOR"}. The headline repair:TurboQuantPolar(4b, 128)used to degrade to a name whose block size was unrecoverable; it is now two integers in the header.skainet.tensor_encodingsnames dictionary is removed, not duplicated — an org-wide code search shows nothing outside this repo ever read it (its only consumers were the emitter and its own test), andkindcarries the name. The no-encodings case still emits a baremodule {header (test preserved).PackedBlockStorageintoTensorRef.blockOrder, through every spec site slice 1 opened, into both the module attribute andExternalParameterRef— so a kernel-feed-ordered weight can be blitted into the.irpaverbatim and declare its order to the consumer (the compiled-side half of the Packed storage that knows its own block order, so KERNEL_FEED can reach a kernel #1120 gap).StructuralLayoutsModuleAttributeTestpins: Q4_K facts + order, TurboQuant bits + block, the absence of the removed dictionary, and the bare header for dense graphs.This is the contract the conformity pipeline (SKaiNET-transformers side, post-release) will read. Slice 3 (#1180) puts the first decision pass on the production path.
Full pr-gate green.
🤖 Generated with Claude Code