Skip to content

[invoke_subgraph] Support symint/int as inputs #140058

Closed
anijain2305 wants to merge 5 commits intogh/anijain2305/582/basefrom
gh/anijain2305/582/head
Closed

[invoke_subgraph] Support symint/int as inputs #140058
anijain2305 wants to merge 5 commits intogh/anijain2305/582/basefrom
gh/anijain2305/582/head

Conversation

@anijain2305 anijain2305 requested a review from zou3519 as a code owner November 7, 2024 22:27
@pytorch-bot
Copy link

pytorch-bot bot commented Nov 7, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/140058

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 4b0787a with merge base bf1b8ad (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

operands: Union[
List[Union[torch.Tensor, torch.SymInt]],
Tuple[Union[torch.Tensor, torch.SymInt]],
List[Union[torch.Tensor, int]],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is __call__ - not while tracing. So, symints would not be present here, they would be converted to ints.

Copy link
Contributor

Choose a reason for hiding this comment

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

There could be cases where we're make_fx(symbolic=True) a function and if the subgraph takes a a shape from parent graph's input size (that would be a symbolic integer) i think.

something like:

def f(x: [s0, s1]):
  def g(x, s: s0):
    return x + s
  return invoke_subgraph(g, x, (x, x.shape[0]))

make_fx(f, symbolic=True)(torch.randn(3, 3))

Dynamo tracing produce a hop call like:

invoke_subgraph(subgraph, (x, x.size(0)))

make_fx(symbolic=True) then start to tracing the subgraph and going through the __call__ , that have a symbolic input.

Is it worth verifying? Probably not that useful since users might in general might not be make_fx the compiled artifacts any way. So stamp it any way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I just got that. Adding symints here as well.

@anijain2305 anijain2305 requested a review from ydwu4 November 7, 2024 22:29
@anijain2305 anijain2305 added ciflow/trunk Trigger trunk jobs on your pull request topic: not user facing topic category labels Nov 7, 2024
@anijain2305 anijain2305 changed the title [invoke_subgraph] Fix error checking - replace SymInt with integer [invoke_subgraph] Fix error checking - accept integer Nov 7, 2024
@anijain2305 anijain2305 requested a review from eellison November 8, 2024 00:07
@anijain2305 anijain2305 changed the title [invoke_subgraph] Fix error checking - accept integer [invoke_subgraph] Support symint as inputs Nov 8, 2024
@anijain2305 anijain2305 changed the title [invoke_subgraph] Support symint as inputs [invoke_subgraph] Support symint/int as inputs Nov 8, 2024
@anijain2305 anijain2305 requested a review from ydwu4 November 8, 2024 00:07
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy yf225 chenyang78 kadeng muchulee8 ColinPeppler amjames desertfire chauhang aakhundov

[ghstack-poisoned]
@anijain2305
Copy link
Contributor Author

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

pobin6 pushed a commit to pobin6/pytorch that referenced this pull request Dec 5, 2024
@github-actions github-actions bot deleted the gh/anijain2305/582/head branch December 12, 2024 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants