Fix conv1d/conv3d static shape loss in HLO trace (#530)#531
Merged
michalharakal merged 1 commit intodevelopfrom Apr 19, 2026
Merged
Fix conv1d/conv3d static shape loss in HLO trace (#530)#531michalharakal merged 1 commit intodevelopfrom
michalharakal merged 1 commit intodevelopfrom
Conversation
The KSP-generated tracer wrapper only populates outputShapes/inputShapes attributes for a hard-coded allowlist (conv2d, unary/binary/scalar ops, shape ops). conv1d and conv3d fall through AttributeStrategy.DefaultMapping, which records only stride/padding/dilation/groups. Without the shape attributes, DefaultExecutionTape.recordTrace built TensorSpecs with shape=null, and the StableHLO converter emitted tensor<?xf32> for conv1d output (12 occurrences in the Whisper encoder), which iree-compile rejects as a type mismatch against the static bias. The TensorRef in the trace already carries the correct static Shape captured from the runtime tensor, so use it as the fallback. Same treatment for dtype. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Fixes #530.
Summary
DefaultExecutionTape.recordTracenow falls back toTensorRef.shape.dimensions.toList()andTensorRef.dtype.namewhen the trace'sinputShapes/outputShapes/inputDTypes/outputDTypesattributes are absent.conv1dandconv3dfell throughAttributeStrategy.DefaultMappingand recorded only scalar params — producingTensorSpec(shape = null)andtensor<?xf32>in the emitted MLIR (12 occurrences in the Whisper encoder, which blocksiree-compile).TensorRefalready carries the correct staticShapecaptured from the runtime tensor, so this is a free, always-correct fallback.Test plan
DefaultExecutionTapeTest.recordTrace_without_shape_attributes_falls_back_to_tensor_ref_shapesynthesizes aconv1dOpTracewith only stride/padding/dilation/groups and asserts the recordedTensorSpec.shapeis the static[1, 384, 3000](output) /[1, 80, 3000](input) /[384, 80, 3](weight) from theTensorRef../gradlew :skainet-compile:skainet-compile-dag:jvmTest --tests 'sk.ainet.compile.grad.DefaultExecutionTapeTest.*'passes locally.WhisperHloExportTest+iree-compile(depends on bumping the skainet version in that repo).Out of scope
RecordingTensorOpsDecorator.conv1d/.conv3dinskainet-compile-corestill skiprecord(...)entirely (unlikeconv2d). Filed as a separate follow-up — the Whisper path doesn't exercise that decorator today, so it isn't load-bearing for the reported bug.🤖 Generated with Claude Code