Skip to content

feat: Constant duplication#4257

Open
narendasan wants to merge 1 commit into
mainfrom
push-zupxwwusykto
Open

feat: Constant duplication#4257
narendasan wants to merge 1 commit into
mainfrom
push-zupxwwusykto

Conversation

@narendasan
Copy link
Copy Markdown
Collaborator

Description

Duplicate weights in order to split subgraphs with common constants in to separate trees to provide more opportunities for constant folding

Fixes #4234

Type of change

Please delete options that are not relevant and/or add your own.

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the style guidelines of this project (You can use the linters)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas and hacks
  • I have made corresponding changes to the documentation
  • I have added tests to verify my fix or my feature
  • New and existing unit tests pass locally with my changes
  • I have added the relevant labels to my PR in so that relevant reviewers are notified

@meta-cla meta-cla Bot added the cla signed label May 12, 2026
@github-actions github-actions Bot added component: tests Issues re: Tests component: lowering Issues re: The lowering / preprocessing passes component: core Issues re: The core compiler component: api [Python] Issues re: Python API component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels May 12, 2026
@github-actions github-actions Bot requested a review from cehongwang May 12, 2026 23:04
@narendasan narendasan force-pushed the push-zupxwwusykto branch from e7b4139 to 304fc36 Compare May 12, 2026 23:14
DYNAMICALLY_ALLOCATE_RESOURCES = False
DECOMPOSE_ATTENTION = False
ATTN_BIAS_IS_CAUSAL = True
CONSTANT_DUPLICATION = False
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can flip this if TRT is able to catch the identical weights

…aphs with common constants in to seperate trees to provide more opportunities for constant folding
@narendasan narendasan force-pushed the push-zupxwwusykto branch from 304fc36 to 23a8b46 Compare May 12, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed component: api [Python] Issues re: Python API component: core Issues re: The core compiler component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths component: lowering Issues re: The lowering / preprocessing passes component: tests Issues re: Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨[Feature] Extend constant folding to handle multiple users of a constant by copying

1 participant