-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Update pybind to 2.6.0 #46415
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
Update pybind to 2.6.0 #46415
Conversation
💊 CI failures summary and remediationsAs of commit 6f23698cbb (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group. This comment has been revised 2 times. |
💊 CI failures summary and remediationsAs of commit 8e3ea24 (more details on the Dr. CI page):
Extra GitHub checks: 1 failed
codecov.io: 1 failed
This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group. This comment has been revised 79 times. |
|
So there are only two errors (same in two jobs, other jobs passed), and Looks pybind11 related. The second one seems to be losing the "TypeError" to a more generic "RuntimeError", and the first one might be a result of some of the code correctness work? Reaching out to other devs and looking into it. The odd thing is that this only shows up on Clang? |
b278ebb to
d2c7eea
Compare
|
Interesting, the change causes macOS to fail similarly. That means the flags you are adding are being added when PyTorch is compiled, but not the JIT extension, I expect. Ideally, I think the "correct" solution would be to store the values of those two defines as added by pybind11 (which will be something like A test solution would be to also define them when defining the JITing. Though it's odd, it seems like all tests should fail if my JIT theory were correct; all mainline compilers get something defined here, so it should always mismatch, I'd think. |
|
Ah, I missed one. Can you also add |
0eccd32 to
2942621
Compare
|
I have the fix that addresses all the failures locally, will see if CI agrees with me. |
|
@malfet you need to add The old pybind11 used to build an ABI string like this: f"__pybind11_internals_v{PYBIND11_INTERNALS_VERSION}{PYBIND11_INTERNALS_KIND}{PYBIND11_BUILD_TYPE}__"Since 2.4, it now builds one like this: f"__pybind11_internals_v{PYBIND11_INTERNALS_VERSION}{PYBIND11_INTERNALS_KIND}{PYBIND11_COMPILER_TYPE}{PYBIND11_STDLIB}{PYBIND11_BUILD_ABI}{PYBIND11_BUILD_TYPE}__"This was because mixing extensions built with different compilers sometimes segfaulted, so this was the "sledgehammer" solution. Ideally, compilers that are ABI compatible (at least for the parts that pybind11 uses in it's ABI) should have the same ABI string so they can interact, but for now, this was done to avoid hard-to-debug issues until someone can carefully investigate what is compatible. If you know it works (such as is it was working before), then you can control the values of these new components. I think in the failing test, The correct fix, I believe, will be to store these three values into the pytorch extension, say as "torch._detail.pybind11_compiler_type", etc, then to define the values to match when running the JIT compile step. |
|
Would have been nice to have the diff without the f-string refactor |
|
#46415 (comment) is a really good discussion and I'd expect some reference to it in the code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a horrible hack but I understand the mechanism by which it works and agree that it is appropriate to restore old behavior.
I would like it to be hella more documented.
a6b635e to
abd2827
Compare
abd2827 to
8fb0deb
Compare
Moved the refactors to #47025 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@malfet has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
559f97c to
cb17c2f
Compare
cb17c2f to
f8b7375
Compare
|
Rebased PR on top of code refactors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@malfet has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
Passing arguments with quotes via command line is non uniform on different platforms. On the other hand, I don't think there is much compiler variability on Windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@malfet has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Yes, I've done it before here: https://github.com/pybind/python_example/blob/fc12654bf8915c3237ff4265e7e6889d228b5da7/src/main.cpp#L39 & https://github.com/pybind/python_example/blob/fc12654bf8915c3237ff4265e7e6889d228b5da7/setup.py#L24 but I agree, I don't think it's needed on Windows. |
|
@henryiii Do you think it would make developers live easier if they are to be stringified on pybind11 side? (Can work on a PR if you want) |
|
|
||
| for pname in ["COMPILER_TYPE", "STDLIB", "BUILD_ABI"]: | ||
| pval = getattr(torch._C, f"_PYBIND11_{pname}") | ||
| if pval is not None and not IS_WINDOWS: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you please tell me why we add IS_WINDOWS check here?
| # See note [Pybind11 ABI constants] | ||
| for name in ["COMPILER_TYPE", "STDLIB", "BUILD_ABI"]: | ||
| val = getattr(torch._C, f"_PYBIND11_{name}") | ||
| if val is not None and not IS_WINDOWS: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here?
Well, then why don't we just don't quote all the args later on different platforms? |
Summary: Recent update of pybind version from PyTorch (pytorch/pytorch#46415) created compatibility issue, resulting in mysterious errors like ``` __________________ TestRemoveException.test_remove_exceptions __________________ self = <tests.functionality.remove_exceptions_test.TestRemoveException testMethod=test_remove_exceptions> def test_remove_exceptions(self): """Test Glow's removeExceptions JIT pass""" foo_jit = torch.jit.script(foo) graph = foo_jit.graph assert graph_contains_str(graph, "prim::RaiseException") > torch_glow.removeExceptions_(graph) E TypeError: removeExceptions_(): incompatible function arguments. The following argument types are supported: E 1. (arg0: torch::jit::Graph) -> None ``` This PR aligns the pybind11 versions in glow and pytorch, hence fixing the issue. Documentation: [Optional Fixes #issue] Pull Request resolved: #5067 Test Plan: CI Reviewed By: hl475 Differential Revision: D24912990 Pulled By: yinghai fbshipit-source-id: ed22a8c70b51638fa11a5a172b93339563152869
Summary: Preserve PYBIND11 (pytorch@63ce3fb) configuration options in `torch._C._PYBIND11 (https://github.com/pytorch/pytorch/commit/63ce3fbde85672e112411ad731839e6db3c15c08)_COMPILER_TYPE` and use them when building extensions Also, use f-strings in `torch.utils.cpp_extension` "Fixes" pytorch#46367 Pull Request resolved: pytorch#46415 Reviewed By: VitalyFedyunin Differential Revision: D24605949 Pulled By: malfet fbshipit-source-id: 87340f2ed5308266a46ef8f0317316227dab9d4d (cherry picked from commit 2b6a720) Signed-off-by: Eli Uriegas <eliuriegas@fb.com>
Preserve PYBIND11 configuration options in
torch._C._PYBIND11_COMPILER_TYPEand use them when building extensionsAlso, use f-strings in
torch.utils.cpp_extension"Fixes" #46367