Skip to content

Preserve folded dynamic-shape metadata through constant folding - #95

Draft
stevenvar wants to merge 3 commits into
joeyye-work:for-serving-2.20from
stevenvar:steven.dynamic_ancestor_metadata
Draft

Preserve folded dynamic-shape metadata through constant folding#95
stevenvar wants to merge 3 commits into
joeyye-work:for-serving-2.20from
stevenvar:steven.dynamic_ancestor_metadata

Conversation

@stevenvar

@stevenvar stevenvar commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

This is an experimental follow-up to symbolic content propagation that teaches TensorFlow constant folding to preserve dynamic-shape provenance on folded constants by walking backward through their ancestor graph.

Today, when a value is constant-folded into a Const, we can lose the information that it originally came from a dynamic shape computation. This branch adds a recursive ancestor walk in constant folding so that if a folded value ultimately descends from a Shape / _xla_shape_derived path tied to an _Arg with dynamic dim expressions, we keep that inferred shape metadata on the replacement Const.

In short:

  • before: only directly shape-derived folded constants kept dynamic metadata
  • after: folded constants can also inherit that metadata from dynamic shape ancestors further upstream

This branch was split out as a separate experiment because it broadens provenance recovery beyond the direct-source behavior used in the main contents-propagation work.

@stevenvar
stevenvar marked this pull request as draft April 16, 2026 17:25
@stevenvar
stevenvar force-pushed the steven.dynamic_ancestor_metadata branch from f2f528a to e7d8f13 Compare April 18, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant