-
Notifications
You must be signed in to change notification settings - Fork 486
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
Added support for compiling the CUDA stubs on Windows. #15518
Added support for compiling the CUDA stubs on Windows. #15518
Conversation
Imported from GitHub PR openxla/xla#15518 I'm not 100% that I'm doing the right thing but I'll just say that after this, I got rid of some compilation errors on Windows and the linker seems to be happy so I think it may be ok. But let me describe my reasoning: 1. This [commit](openxla/xla@b021ae8) added support for lazily loading symbols from the CUDA shared libraries. 2. As discussed in [this issue](openxla/xla#6993), the current approach is not supported on Windows due to the use of GNU assembly (it results in compilation errors with MSVC). 3. After reading a little into this, I believe that Windows libraries built with MSVC already load the linked dynamic libraries lazily and so it appears that this trampoline mechanism is not needed on Windows. 4. For this reason, I made the trampoline bits conditional on not being on Windows hoping that the symbols will not directly be resolved to the CUDA dependencies that are coming in via the CUDA header files. @metab0t is this what you were suggesting in the end of that discussion? cc @ddunl (this should be the last PR that touches the TSL code for Windows CUDA support) Copybara import of the project: -- ccd500cea1fa08f65c680d67b02d444c29422981 by eaplatanios <[email protected]>: Added support for compiling the CUDA stubs on Windows. Merging this change closes #15518 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#15518 from eaplatanios:u/eaplatanios/cuda-stubs-windows ccd500cea1fa08f65c680d67b02d444c29422981 PiperOrigin-RevId: 659724373
Imported from GitHub PR openxla/xla#15518 I'm not 100% that I'm doing the right thing but I'll just say that after this, I got rid of some compilation errors on Windows and the linker seems to be happy so I think it may be ok. But let me describe my reasoning: 1. This [commit](openxla/xla@b021ae8) added support for lazily loading symbols from the CUDA shared libraries. 2. As discussed in [this issue](openxla/xla#6993), the current approach is not supported on Windows due to the use of GNU assembly (it results in compilation errors with MSVC). 3. After reading a little into this, I believe that Windows libraries built with MSVC already load the linked dynamic libraries lazily and so it appears that this trampoline mechanism is not needed on Windows. 4. For this reason, I made the trampoline bits conditional on not being on Windows hoping that the symbols will not directly be resolved to the CUDA dependencies that are coming in via the CUDA header files. @metab0t is this what you were suggesting in the end of that discussion? cc @ddunl (this should be the last PR that touches the TSL code for Windows CUDA support) Copybara import of the project: -- ccd500cea1fa08f65c680d67b02d444c29422981 by eaplatanios <[email protected]>: Added support for compiling the CUDA stubs on Windows. Merging this change closes #15518 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#15518 from eaplatanios:u/eaplatanios/cuda-stubs-windows ccd500cea1fa08f65c680d67b02d444c29422981 PiperOrigin-RevId: 659724373
Imported from GitHub PR openxla/xla#15518 I'm not 100% that I'm doing the right thing but I'll just say that after this, I got rid of some compilation errors on Windows and the linker seems to be happy so I think it may be ok. But let me describe my reasoning: 1. This [commit](openxla/xla@b021ae8) added support for lazily loading symbols from the CUDA shared libraries. 2. As discussed in [this issue](openxla/xla#6993), the current approach is not supported on Windows due to the use of GNU assembly (it results in compilation errors with MSVC). 3. After reading a little into this, I believe that Windows libraries built with MSVC already load the linked dynamic libraries lazily and so it appears that this trampoline mechanism is not needed on Windows. 4. For this reason, I made the trampoline bits conditional on not being on Windows hoping that the symbols will not directly be resolved to the CUDA dependencies that are coming in via the CUDA header files. @metab0t is this what you were suggesting in the end of that discussion? cc @ddunl (this should be the last PR that touches the TSL code for Windows CUDA support) Copybara import of the project: -- ccd500cea1fa08f65c680d67b02d444c29422981 by eaplatanios <[email protected]>: Added support for compiling the CUDA stubs on Windows. Merging this change closes #15518 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#15518 from eaplatanios:u/eaplatanios/cuda-stubs-windows ccd500cea1fa08f65c680d67b02d444c29422981 PiperOrigin-RevId: 659724373
Imported from GitHub PR openxla/xla#15518 I'm not 100% that I'm doing the right thing but I'll just say that after this, I got rid of some compilation errors on Windows and the linker seems to be happy so I think it may be ok. But let me describe my reasoning: 1. This [commit](openxla/xla@b021ae8) added support for lazily loading symbols from the CUDA shared libraries. 2. As discussed in [this issue](openxla/xla#6993), the current approach is not supported on Windows due to the use of GNU assembly (it results in compilation errors with MSVC). 3. After reading a little into this, I believe that Windows libraries built with MSVC already load the linked dynamic libraries lazily and so it appears that this trampoline mechanism is not needed on Windows. 4. For this reason, I made the trampoline bits conditional on not being on Windows hoping that the symbols will not directly be resolved to the CUDA dependencies that are coming in via the CUDA header files. @metab0t is this what you were suggesting in the end of that discussion? cc @ddunl (this should be the last PR that touches the TSL code for Windows CUDA support) Copybara import of the project: -- ccd500cea1fa08f65c680d67b02d444c29422981 by eaplatanios <[email protected]>: Added support for compiling the CUDA stubs on Windows. Merging this change closes #15518 FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#15518 from eaplatanios:u/eaplatanios/cuda-stubs-windows ccd500cea1fa08f65c680d67b02d444c29422981 PiperOrigin-RevId: 659724373
This fails our Ubuntu CI tests, because the linker can't find a ton of CUDA symbols. Likely what's happening is that the new config causes the necessary @eaplatanios Can you have a look, do you know what might be going wrong? |
I suspect that what's going wrong is that |
@chsigg I see that a long time ago, you made some changes to the |
Hey,
Henning |
@eaplatanios @ddunl Please check this comment in a parallel thread #6993 (comment). tl;dr; unless there is a plan to give proper cuda support on windows for XLA, which would be a huge task, I don't think we shoudl be trying to compile cuda-specific code on Windows. |
@vam-google that sounds fine to me. Sorry for the late response; I was traveling over the past month. I also decided to give up on CUDA support on Windows for XLA basically for the reason you mentioned. It does seem to be a huge task and I can just sort out something to work with WSL on Windows rather than take this on right now. Thanks for reviewing this! |
I'm not 100% that I'm doing the right thing but I'll just say that after this, I got rid of some compilation errors on Windows and the linker seems to be happy so I think it may be ok. But let me describe my reasoning:
@metab0t is this what you were suggesting in the end of that discussion?
cc @ddunl (this should be the last PR that touches the TSL code for Windows CUDA support)