PythonArgs::toBool: order cheap mutually exclusive checks first#161455
Closed
swolchok wants to merge 4 commits intogh/swolchok/807/basefrom
Closed
PythonArgs::toBool: order cheap mutually exclusive checks first#161455swolchok wants to merge 4 commits intogh/swolchok/807/basefrom
swolchok wants to merge 4 commits intogh/swolchok/807/basefrom
Conversation
symbools are not identical with Py_True or PyFalse, so we can do those cheap checks first and at least get plain old bools to go fast [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/161455
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ⏳ No Failures, 1 PendingAs of commit 71172fa with merge base 05eeb29 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Aug 26, 2025
This was referenced Aug 26, 2025
…first" symbools are not identical with Py_True or PyFalse, so we can do those cheap checks first and at least get plain old bools to go fast. [ghstack-poisoned]
This was referenced Aug 28, 2025
…first" symbools are not identical with Py_True or PyFalse, so we can do those cheap checks first and at least get plain old bools to go fast. [ghstack-poisoned]
…first" symbools are not identical with Py_True or PyFalse, so we can do those cheap checks first and at least get plain old bools to go fast. [ghstack-poisoned]
Skylion007
approved these changes
Aug 30, 2025
swolchok
commented
Aug 31, 2025
| if (args[i] == Py_True) { | ||
| return true; | ||
| } | ||
| if (args[i] == Py_False) { |
Contributor
Author
There was a problem hiding this comment.
I wonder if we should also check for Py_None here
Contributor
Author
|
@pytorchbot merge |
Collaborator
Merge startedYour 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 |
markc-614
pushed a commit
to markc-614/pytorch
that referenced
this pull request
Sep 17, 2025
…rch#161455) symbools are not identical with Py_True or PyFalse, so we can do those cheap checks first and at least get plain old bools to go fast. Pull Request resolved: pytorch#161455 Approved by: https://github.com/Skylion007 ghstack dependencies: pytorch#161301, pytorch#161292, pytorch#161304, pytorch#161308, pytorch#161315, pytorch#161317, pytorch#161328, pytorch#161329, pytorch#161432
mansiag05
pushed a commit
to mansiag05/pytorch
that referenced
this pull request
Sep 22, 2025
…rch#161455) symbools are not identical with Py_True or PyFalse, so we can do those cheap checks first and at least get plain old bools to go fast. Pull Request resolved: pytorch#161455 Approved by: https://github.com/Skylion007 ghstack dependencies: pytorch#161301, pytorch#161292, pytorch#161304, pytorch#161308, pytorch#161315, pytorch#161317, pytorch#161328, pytorch#161329, pytorch#161432
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack (oldest at bottom):
is, not ==, to check exact type matches in _python_dispatch #161304symbools are not identical with Py_True or PyFalse, so we can do those cheap checks first and at least get plain old bools to go fast.