-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[inductor] fix UndefinedTensorImpl singleton can't export on Windows. #132326
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
[inductor] fix UndefinedTensorImpl singleton can't export on Windows. #132326
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/132326
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 460143f with merge base 39a3c98 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
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.
Can we do getInstance()
regardless of whether it is MSVC build or not?
460143f |
The doc you linked suggests using dllexport (C10_EXPORT in PyTorch) would solve the problem. Have you tried that? |
@desertfire |
@pytorchbot merge |
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 |
This PR fix the

UndefinedTensorImpl::_singleton
can't export on Windows issue.Snapshot:
The reason is MSVC can't export class static data to external linkage, ref: https://learn.microsoft.com/en-us/cpp/cpp/using-dllimport-and-dllexport-in-cpp-classes?view=msvc-170#_pluslang_using_dllimport_and_dllexport_in_c2b2bselectivememberimportexport
I use another singleton implenmentation to avoid the issue, for Windows.
Since this PR, cpp_wrapper on Windows would start to work.

Next step, I will enable the cpp_wrapper UTs.
cc @peterjc123 @mszhanyi @skyline75489 @nbcsm @iremyux @Blackhex @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @voznesenskym @penguinwu @EikanWang @Guobing-Chen @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @ColinPeppler @amjames @desertfire @chauhang