-
Notifications
You must be signed in to change notification settings - Fork 203
Use static constexpr for VS compilation
#342
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
…ation fails in VS
Codecov Report
@@ Coverage Diff @@
## master #342 +/- ##
=======================================
Coverage 96.85% 96.85%
=======================================
Files 9 9
Lines 191 191
=======================================
Hits 185 185
Misses 6 6 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
rusty1s
left a comment
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.
thanks!
|
It looks like this breaks our current Windows build in the CI. Do you know why? |
static constexpr for VS compilation
|
It seems a bug in pytorch release version. There is a conflict between include/ATen/Parallel.h inline implementation of void lazy_init_num_threads and libs in pytorch release, a simple solution is to remove the inline TORCH_API void lazy_init_num_threads() implementation and only keeps TORCH_API void lazy_init_num_threads();. A similar answer can be found in https://stackoverflow.com/questions/74366357/updating-to-visual-studio-17-4-0-yields-linker-errors-related-to-tls |
|
Another way is to rebuild libtorch by ourselves and not use the official release version |
|
Thanks! I did something similar here: https://github.com/pyg-team/pyg-lib/blob/master/.github/actions/setup/action.yml#L42. Can we add the patching of |
|
I think it's ok. The only thing need to do is to replace to |
|
Okay, do you wanna take care of this? |
|
We would just need to add this here: https://github.com/rusty1s/pytorch_scatter/blob/master/.github/workflows/testing.yml#L30 |
|
Can I use python code in testing.yml to replace the context? If so, maybe I can try, since I'm not quite familiar with the bash language. |
|
I think you can, but with where |
|
This can work if Parallel.h in all versions of pytorch remains the same. If the source code change the position of lazy_init_num_threads, such method may fail. |
|
Yes, that is correct. We would need to adjust line numbers both for PyTorch 1.12 and 1.13 |
|
Fortunately, for pytorch 1.12 and 1.13, the positions are the same, both of them are 32-38 |
|
I just add the text replacement |
|
Sorry for that, I made a mistake, for pytorch 1.12, the lines should be 31-37. |
|
Yeah, I think I have fixed this. |
|
OK, thanks! |
static constexpr should be used in macro in cuda/reducer.cuh, otherwise VS compilation will fail with error C2975: 'REDUCE': invalid template argument for 'Reducer', expected compile-time constant expression