Add DynamicReshape and DynamicBroadcastInDim ops#15
Merged
Conversation
ajroetker
force-pushed
the
resurrect-dynamic-ops
branch
from
January 25, 2026 02:26
6d8e8a1 to
3e1e8f7
Compare
Resurrect dynamic shape support that was partially lost during PR merges: Shape struct changes: - Add DimensionBounds and EncodeBounds fields - Add HasBoundedDynamism() method for checking bounded dynamic dimensions - Add bounds encoding in StableHLO output using #stablehlo.bounds<...> syntax New dynamic ops added: - DynamicReshape: reshape with runtime-determined shape - DynamicBroadcastInDim: broadcast with runtime-determined shape - DynamicIota: iota with runtime-determined output shape - DynamicGather: gather with runtime-determined slice sizes - DynamicPad: pad with runtime-determined padding amounts - DynamicConv: convolution with runtime-determined padding All ops require explicit bounds parameters since XLA needs to know maximum allocation sizes at compile time. Also includes comprehensive tests for all dynamic ops and fixes missing go.sum entry for golang.org/x/sys.
ajroetker
force-pushed
the
resurrect-dynamic-ops
branch
from
January 25, 2026 02:36
3e1e8f7 to
a8bf2cb
Compare
janpfeifer
approved these changes
Jan 25, 2026
janpfeifer
left a comment
Contributor
There was a problem hiding this comment.
Very neat!
Does this work with PJRT ?
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
Resurrect dynamic shape support that was partially lost during PR merges.
Shape struct changes
DimensionBoundsandEncodeBoundsfields to Shape structHasBoundedDynamism()method for checking bounded dynamic dimensions#stablehlo.bounds<...>syntaxNew dynamic ops
DynamicReshape- reshape with runtime-determined shapeDynamicBroadcastInDim- broadcast with runtime-determined shapeDynamicIota- iota with runtime-determined output shapeDynamicGather- gather with runtime-determined slice sizesDynamicPad- pad with runtime-determined padding amountsDynamicConv- convolution with runtime-determined paddingAll ops require explicit bounds parameters since XLA needs to know maximum allocation sizes at compile time.
Also fixes missing go.sum entry for golang.org/x/sys.
Test plan
go test ./...)go build ./...succeedsTestDynamicOperations