10000 [hop_schema] support gen_schema for invoke_subgraph by ydwu4 · Pull Request #152984 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

[hop_schema] support gen_schema for invoke_subgraph #152984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: gh/ydwu4/245/base
Choose a base branch
from

Conversation

ydwu4
Copy link
Contributor
@ydwu4 ydwu4 commented May 6, 2025

Copy link
pytorch-bot bot commented May 6, 2025

🔗 Helpful Links

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

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

❌ 2 New Failures

As of commit bb83b5c with merge base 7a0781e (image):

NEW FAILURES - The following jobs have failed:

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

ydwu4 added a commit that referenced this pull request May 6, 2025
ghstack-source-id: 19f385c
Pull Request resolved: #152984
@ydwu4 ydwu4 added the topic: not user facing topic category label May 6, 2025
Comment on lines +80 to +101
def gen_schema(self, subgraph, identifier, *operands):
from torch._higher_order_ops.schema import HopSchemaGenerator
from torch._higher_order_ops.utils import (
check_input_alias_and_mutation_return_ouputs,
)

schema_gen = HopSchemaGenerator(self)
schema_gen.add_arg("subgraph", subgraph)
schema_gen.add_arg("identifier", identifier)
example_inputs = [
n.meta["val"] if "val" in n.meta else n.meta["example_value"]
for n in subgraph.graph.find_nodes(op="placeholder")
]
mutated_inputs, _, _, _, outputs = check_input_alias_and_mutation_return_ouputs(
subgraph, example_inputs
)
for idx, arg in enumerate(operands):
schema_gen.add_arg(f"arg{idx}", arg, is_mutated=idx in mutated_inputs)
for out in outputs:
schema_gen.add_output(out)

return schema_gen.gen_schema()
Copy link
Contributor

Choose a reason for hiding this comment

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

not bad

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ofc, this is your design lol

Copy link
Contributor

Choose a reason for hiding this comment

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

Honestly I don't remember this at all so it is now your design :P

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.

2 participants
0