Skip to content
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

[ONNX] Skip assertion nodes #126889

Closed

Conversation

titaiwangms
Copy link
Collaborator

@titaiwangms titaiwangms commented May 22, 2024

Continue from #125930

The PR addresses the common existence of unused assertion nodes in models. (workaround #112443)

Assertion ops does not return anything in the graph, so it's not even an no-op in ONNX:

- func: _assert_async.msg(Tensor self, str assert_msg) -> ()

- func: sym_constrain_range_for_size(Scalar size, *, int? min=None, int? max=None) -> ()

This pass can be extended when we see more and more none-return ops in FX.

@titaiwangms titaiwangms added module: onnx Related to torch.onnx onnx-triaged triaged by ONNX team labels May 22, 2024
Copy link

pytorch-bot bot commented May 22, 2024

🔗 Helpful Links

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

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

❌ 1 New Failure, 12 Unrelated Failures

As of commit 62c56bf with merge base bdc39ee (image):

NEW FAILURE - The following job has failed:

UNSTABLE - The following jobs failed but were likely due to flakiness present on trunk and has been marked as unstable:

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

@pytorch-bot pytorch-bot bot added the release notes: onnx torch.onnx related changes that should show up in the release notes label May 22, 2024
@titaiwangms titaiwangms added the topic: new features topic category label May 22, 2024
@titaiwangms
Copy link
Collaborator Author

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label May 22, 2024
@titaiwangms titaiwangms self-assigned this May 22, 2024
@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

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: Not merging any PRs at the moment because there is a merge blocking https://github.com/pytorch/pytorch/labels/ci:%20sev issue open at:
#126896

Details for Dev Infra team Raised by workflow job

@titaiwangms
Copy link
Collaborator Author

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: Approvers from one of the following sets are needed:

  • superuser (pytorch/metamates)
  • Core Reviewers (mruberry, lezcano, Skylion007, ngimel, peterbell10)
  • Core Maintainers (soumith, gchanan, ezyang, dzhulgakov, malfet)
Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

@titaiwangms
Copy link
Collaborator Author

titaiwangms commented May 22, 2024

@albanD @kit1980 @malfet PTAL test_public_bindings.py is touched.

@titaiwangms titaiwangms added the onnx-needs-import This PR is related to ONNX, but touches files outside of merge rule patterns, and hence needs import label May 22, 2024
@titaiwangms
Copy link
Collaborator Author

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Successfully rebased titaiwang/skip_assertion_onnx onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout titaiwang/skip_assertion_onnx && git pull --rebase)

@@ -309,6 +309,7 @@ def test_modules_can_be_imported(self):
"torch.onnx._internal.fx.op_validation",
"torch.onnx._internal.fx.passes",
"torch.onnx._internal.fx.passes._utils",
"torch.onnx._internal.fx.passes.assertion_removal",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Adding new entries here is highly discouraged as it means that trying to "import" this module leads to a hard crash.
You should consider making the module importable from generic configs (in this case the based cpu image in CI).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks! I just found that the very same problem happened before: #117314, and what is happened is #117314 (comment). I wonder if there is a better way to do this. @xadupre @malfet

Copy link
Contributor

Choose a reason for hiding this comment

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

The goal of this test is to make sure that every module is importable, i.e. it does not rely on any implicit imports.
Is there a good reason why this should not be the case for this module. If it depends on some non-PyTorch package, it's totally fine to add it as dependency to requirements-ci.txt

@titaiwangms
Copy link
Collaborator Author

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Successfully rebased titaiwang/skip_assertion_onnx onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout titaiwang/skip_assertion_onnx && git pull --rebase)

@titaiwangms
Copy link
Collaborator Author

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Successfully rebased titaiwang/skip_assertion_onnx onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout titaiwang/skip_assertion_onnx && git pull --rebase)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk Trigger trunk jobs on your pull request module: onnx Related to torch.onnx onnx-needs-import This PR is related to ONNX, but touches files outside of merge rule patterns, and hence needs import onnx-triaged triaged by ONNX team open source release notes: onnx torch.onnx related changes that should show up in the release notes topic: new features topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants