HLO: collapse uniform-value constants to dense<v> splat (relates to #519)#522
Merged
michalharakal merged 1 commit intodevelopfrom Apr 18, 2026
Merged
Conversation
formatTensorValues now detects a uniform value list covering the declared shape and emits the scalar splat form (`dense<0.0>`) instead of spelling out every element. A 10x10 zero-initialized weight drops from 100 floats in text to a single scalar; larger VoidTensorOps-backed tensors scale the same way. Non-uniform values continue to render as nested array literals, so real learned weights are unaffected. This is polish on the inline path — it does not solve #519's 151 MB blowup for non-uniform weights on its own. The architectural fix for that case is to stop inlining weights at all and reference them via IREE's util.parameter.load, with a `.irpa` sidecar written by a new `skainet-io-iree-params` module; a design issue tracking that work will follow and supersede #519. Relates to #519 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced Apr 18, 2026
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.
Summary
formatTensorValuesdetects uniform value lists covering the declared shape and emitsdense<v>splat form instead of spelling out every element.util.parameter.load+ a newskainet-io-iree-params.irpawriter) will follow and supersede HLO: inline dense constants for large tensors — scale / compile-time blocker #519.Background
Zero-initialized
VoidTensorOpstensors are uniform by construction. Previously a 10x10 zero weight rendered as 100 floats of text; now it's one scalar. For Whisper-tiny.en, this is mostly cosmetic — the heavy cost is the real (non-uniform) learned weights, which still blow up inline text MLIR. The architectural fix is PR B–E in the forthcoming design issue.Test plan
testTensorConstantWithUniformValuesEmitsSplat— uniform zeros on a 10x10 tensor assertsdense<0.0>and no spelled-out array.testTensorConstantWithNonUniformValuesKeepsNestedLiteral— non-uniform values must still render as[[1.0, 2.0], [3.0, 4.0]].:skainet-compile:skainet-compile-hlo:jvmTestpasses, no regressions in existing tests.Relates to #519
🤖 Generated with Claude Code