-
Notifications
You must be signed in to change notification settings - Fork 24.2k
Uniformly apply Windows logic in cpp_extensions everywhere #31161
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
Conversation
Signed-off-by: Edward Z. Yang <[email protected]> [ghstack-poisoned]
💊 CircleCI build failures summary and remediationsAs of commit 8a6d169:
Detailed failure analysisOne may explore the probable reasons each build failed interactively on the Dr. CI website. ❄️ 2 failures recognized as flakyThe following build failures have been detected as flaky and may not be your fault:
|
Job | Step | Status |
---|---|---|
Test | New in PR |
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.
This comment has been revised 26 times.
Signed-off-by: Edward Z. Yang <[email protected]> [ghstack-poisoned]
Signed-off-by: Edward Z. Yang <[email protected]> [ghstack-poisoned]
Signed-off-by: Edward Z. Yang <[email protected]> [ghstack-poisoned]
Signed-off-by: Edward Z. Yang <[email protected]> [ghstack-poisoned]
Signed-off-by: Edward Z. Yang <[email protected]> [ghstack-poisoned]
Previously, it wasn't necessary to specify `DT_NEEDED` in C++ extensions on Linux (aka pass `-l` flags) because all of the symbols would have already been loaded with `RTLD_GLOBAL`, so there wouldn't be any undefined symbols. But when we switch to loading `_C` with `RTLD_LOCAL`, it's now necessary for all the C++ extensions to know what libraries to link with. The resulting code is clearer and more uniform, so it's wins all around. Signed-off-by: Edward Z. Yang <[email protected]> [ghstack-poisoned]
Previously, it wasn't necessary to specify `DT_NEEDED` in C++ extensions on Linux (aka pass `-l` flags) because all of the symbols would have already been loaded with `RTLD_GLOBAL`, so there wouldn't be any undefined symbols. But when we switch to loading `_C` with `RTLD_LOCAL`, it's now necessary for all the C++ extensions to know what libraries to link with. The resulting code is clearer and more uniform, so it's wins all around. Signed-off-by: Edward Z. Yang <[email protected]> Differential Revision: [D19262578](https://our.internmc.facebook.com/intern/diff/D19262578) [ghstack-poisoned]
Previously, it wasn't necessary to specify `DT_NEEDED` in C++ extensions on Linux (aka pass `-l` flags) because all of the symbols would have already been loaded with `RTLD_GLOBAL`, so there wouldn't be any undefined symbols. But when we switch to loading `_C` with `RTLD_LOCAL`, it's now necessary for all the C++ extensions to know what libraries to link with. The resulting code is clearer and more uniform, so it's wins all around. Signed-off-by: Edward Z. Yang <[email protected]> Differential Revision: [D19262578](https://our.internmc.facebook.com/intern/diff/D19262578) [ghstack-poisoned]
Previously, it wasn't necessary to specify `DT_NEEDED` in C++ extensions on Linux (aka pass `-l` flags) because all of the symbols would have already been loaded with `RTLD_GLOBAL`, so there wouldn't be any undefined symbols. But when we switch to loading `_C` with `RTLD_LOCAL`, it's now necessary for all the C++ extensions to know what libraries to link with. The resulting code is clearer and more uniform, so it's wins all around. Signed-off-by: Edward Z. Yang <[email protected]> Differential Revision: [D19262578](https://our.internmc.facebook.com/intern/diff/D19262578) [ghstack-poisoned]
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.
lgtm
Previously, it wasn't necessary to specify `DT_NEEDED` in C++ extensions on Linux (aka pass `-l` flags) because all of the symbols would have already been loaded with `RTLD_GLOBAL`, so there wouldn't be any undefined symbols. But when we switch to loading `_C` with `RTLD_LOCAL`, it's now necessary for all the C++ extensions to know what libraries to link with. The resulting code is clearer and more uniform, so it's wins all around. Signed-off-by: Edward Z. Yang <[email protected]> Differential Revision: [D19262578](https://our.internmc.facebook.com/intern/diff/D19262578) [ghstack-poisoned]
Previously, it wasn't necessary to specify `DT_NEEDED` in C++ extensions on Linux (aka pass `-l` flags) because all of the symbols would have already been loaded with `RTLD_GLOBAL`, so there wouldn't be any undefined symbols. But when we switch to loading `_C` with `RTLD_LOCAL`, it's now necessary for all the C++ extensions to know what libraries to link with. The resulting code is clearer and more uniform, so it's wins all around. Signed-off-by: Edward Z. Yang <[email protected]> Differential Revision: [D19262578](https://our.internmc.facebook.com/intern/diff/D19262578) [ghstack-poisoned]
@peterjc123 Would you like to take a look? |
libraries.append('_C') | ||
libraries.append('c10') | ||
libraries.append('c10_cuda') | ||
libraries.append('torch') |
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.
What is torch
here used for? The functions should be in torch_cpu
and torch_cuda
, right?
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.
Yeah, it's supposed to be an empty library. I put torch
in here for "good luck", in case someone ever accidentally puts some symbols in it.
|
||
libraries = kwargs.get('libraries', []) | ||
libraries.append('c10') | ||
libraries.append('torch') |
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?
extra_ldflags.append('-ltorch_cpu') | ||
if with_cuda: | ||
extra_ldflags.append('-ltorch_cuda') | ||
extra_ldflags.append('-ltorch') |
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?
Previously, it wasn't necessary to specify `DT_NEEDED` in C++ extensions on Linux (aka pass `-l` flags) because all of the symbols would have already been loaded with `RTLD_GLOBAL`, so there wouldn't be any undefined symbols. But when we switch to loading `_C` with `RTLD_LOCAL`, it's now necessary for all the C++ extensions to know what libraries to link with. The resulting code is clearer and more uniform, so it's wins all around. Signed-off-by: Edward Z. Yang <[email protected]> Differential Revision: [D19262578](https://our.internmc.facebook.com/intern/diff/D19262578) [ghstack-poisoned]
Signed-off-by: Edward Z. Yang <[email protected]> ghstack-source-id: 77b5ed9 Pull Request resolved: pytorch/pytorch#31161
Signed-off-by: Edward Z. Yang <[email protected]> ghstack-source-id: 98f3dbe Pull Request resolved: pytorch/pytorch#31161
…1161) Summary: Pull Request resolved: pytorch#31161 Previously, it wasn't necessary to specify `DT_NEEDED` in C++ extensions on Linux (aka pass `-l` flags) because all of the symbols would have already been loaded with `RTLD_GLOBAL`, so there wouldn't be any undefined symbols. But when we switch to loading `_C` with `RTLD_LOCAL`, it's now necessary for all the C++ extensions to know what libraries to link with. The resulting code is clearer and more uniform, so it's wins all around. Signed-off-by: Edward Z. Yang <[email protected]> Test Plan: Imported from OSS Differential Revision: D19262578 Pulled By: ezyang fbshipit-source-id: a893cc96f2e9aad1c064a6de4f7ccf79257dec3f
Stack from ghstack:
Previously, it wasn't necessary to specify
DT_NEEDED
in C++ extensions on Linux (aka pass-l
flags) because all of the symbols would have already been loaded withRTLD_GLOBAL
, so there wouldn't be any undefined symbols. But when we switch to loading_C
withRTLD_LOCAL
, it's now necessary for all the C++ extensions to know what libraries to link with. The resulting code is clearer and more uniform, so it's wins all around.Signed-off-by: Edward Z. Yang [email protected]
Differential Revision: D19262578