Skip to content

[XLA] Reorganize dynamic-size support into feature-based commits - #53

Open
stevenvar wants to merge 21 commits into
steven.for-serving-2.20-clean-history-basefrom
steven.for-serving-2.20-clean-history
Open

[XLA] Reorganize dynamic-size support into feature-based commits#53
stevenvar wants to merge 21 commits into
steven.for-serving-2.20-clean-history-basefrom
steven.for-serving-2.20-clean-history

Conversation

@stevenvar

@stevenvar stevenvar commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Summary

This PR reconstructs the current for-serving-2.20 source tree from commit 92148e0b108c3547ca73c2b08b2149b6bf349e75 using a dependency-ordered, feature-based history.

The new history separates:

  • shared dynamic expression representation
  • TensorFlow and HLO shape inference
  • tf2xla propagation and broadcasting
  • symbolic constant folding
  • clustering and cluster runtime boundaries
  • MLIR guards
  • CPU runtime plumbing, LLVM loop bounds, and operation emitters
  • integration tests

The final source tree is byte-for-byte identical to the current for-serving-2.20 branch. This PR is intended for reviewing the proposed history rather than introducing new source changes.

Verification

  • Confirmed that the reconstructed branch and for-serving-2.20 have the same Git tree hash: e92c08b099aa105e9e75fb7b26b862a071856983.
  • Confirmed that the worktree is clean.

@stevenvar
stevenvar force-pushed the steven.for-serving-2.20-clean-history branch 4 times, most recently from d53f0c2 to d2858fa Compare August 17, 2026 09:25
@stevenvar stevenvar changed the title Reorganize dynamic-size support into feature-based commits [XLA] Reorganize dynamic-size support into feature-based commits Aug 17, 2026
@stevenvar stevenvar added the enhancement New feature or request label Aug 17, 2026
@stevenvar
stevenvar force-pushed the steven.for-serving-2.20-clean-history branch 17 times, most recently from edd2ef7 to e8b6182 Compare August 20, 2026 09:26
Guillermo-Callaghan and others added 2 commits August 24, 2026 11:47
Rewrite eligible scalar broadcast divisions to multiply by one shared reciprocal when fast math permits it. Preserve the original divide shape and cover both the simplifier and CPU compiler pipeline.
Use the same owned expression representation for TensorFlow TensorShape dimensions and XLA Shape dimensions. Add serialization, simplification, substitution, solving, and focused expression tests.
@stevenvar
stevenvar force-pushed the steven.for-serving-2.20-clean-history branch from 199fc4f to a2f4dc3 Compare August 24, 2026 10:48
stevenvar and others added 4 commits August 25, 2026 12:56
Extend TensorFlow shape inference to preserve symbolic dimension identities and shape-derived tensor values. Keep unknown physical sizes separate from their symbolic expressions.
Assign one configurable symbolic variable to dynamic dimensions of top-level graph inputs while keeping inferred internal dimensions distinct. Add GraphProperties coverage for shared input symbols and non-input dimensions.
Carry dynamic expressions through XLA shape construction, HLO instructions, and shape inference. This keeps symbolic dimensions available while HLO graphs are built and transformed.
Add the flags, shape conversion helpers, argument metadata, and XlaExpression APIs needed to carry symbolic dimensions and shape-derived contents through tf2xla. Keep concrete kernel propagation separate so this commit defines the common contract first.
@stevenvar
stevenvar force-pushed the steven.for-serving-2.20-clean-history branch from a2f4dc3 to 894136d Compare August 25, 2026 11:56
Update individual tf2xla kernel lowerings to derive and preserve symbolic shape and value expressions. Cover shape-producing, reshaping, slicing, sequence, partitioning, and related kernels using the shared expression plumbing.
Derive binary-op output expressions from the operand XLA shapes during broadcasting. Preserve the non-singleton expression when an operand expands from a singleton dimension.
Retain symbolic contents when shape-derived operations are rewritten or folded to constants. Add a dedicated rewrite path so optimization does not erase runtime shape dependencies.
Normalize compatible dynamic expressions around their smallest shared variable-covering subexpression before clustering. Reject cluster merges whose dynamic inputs and outputs cannot use one consistent symbolic core.
@stevenvar
stevenvar force-pushed the steven.for-serving-2.20-clean-history branch from 894136d to 55b5c4d Compare August 25, 2026 12:37
stevenvar and others added 11 commits August 25, 2026 15:17
Map compiled XLA parameters back to their runtime TensorFlow inputs and solve the shared dynamic value from concrete dimensions. Filter broadcast-singleton evidence, pass the solved value through execution, and substitute it into dynamic output shapes after execution.
Normalize symbolic input metadata, pad solved dynamic values to configured compilation buckets, and include the resulting constants in executable cache signatures. Retry inconsistent dynamic requests with concrete static arguments instead of reusing an incompatible executable.
Prevent MLIR XLA kernels from silently consuming dynamic expressions they cannot preserve. Keep the existing MLIR path for operations without dynamic expression metadata.
Store the solved dynamic batch value in executable run options and expose it to CPU execution paths. Keep thunk and non-thunk execution consistent at the cluster boundary.
Generate LLVM loop bounds from the runtime batch dimension when an HLO dimension carries a dynamic expression. Add focused coverage for runtime-dependent bounds.
Teach CPU emitters to use runtime dynamic dimensions for affected operations instead of fixed padded extents. Preserve the padded allocation while limiting computation to the real shape.
Make CPU HLO profiling tolerate dynamic execution metadata and missing profile counters. Avoid invalid accesses while retaining profiling for supported instructions.
Add end-to-end coverage for symbolic shape propagation, clustering, compilation, and CPU execution. Exercise representative dynamic models across the complete TensorFlow-to-XLA path.
Replace power-of-two padding with configurable factor-preserving batch buckets. Use separate environment-controlled multipliers for small and large batches while retaining discovered bounds per cluster.
Avoid representing ceil-aligned reshape padding with ordinary integer division, which can simplify to an incorrect symbolic bound.
Solve the dynamic branch when the observed result is strictly greater than the constant bound, while keeping equality ambiguous.
@stevenvar
stevenvar force-pushed the steven.for-serving-2.20-clean-history branch from 55b5c4d to 28f7813 Compare August 25, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants