Skip to content
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

CPU/XPU: disable torch.compile if g++ is not available #1251

Conversation

Xia-Weiwen
Copy link

@Xia-Weiwen Xia-Weiwen commented Jun 17, 2024

torch.compile requires g++. On platforms like Windows, g++ is not available. In that case, torch.compile is disabled to avoid runtime errors. With this patch, the CPU/XPU backend works on Windows.

I have validated CPU backend with the patch by running UTs for CPU backend in test_functional.py and a real model (OPT-1.3B) on my local machine (Windows 11 Enterprise, 12th Gen Intel(R) Core(TM) i7-1270P 2.20 GHz, 16.0 GB RAM).

@jiqing-feng jiqing-feng mentioned this pull request Jun 18, 2024
@Xia-Weiwen Xia-Weiwen marked this pull request as ready for review June 18, 2024 05:50
@Xia-Weiwen
Copy link
Author

Hi @Titus-von-Koeller Could you please review? Thanks. Looks like the CI failure is about ROCM. I am not sure if the failure is caused by this PR.

@matthewdouglas
Copy link
Member

Related: pytorch/pytorch#124245

I'm not sure what PyTorch release that's going to land in, but good news is that it looks like it'll eventually support MSVC on Windows and we can update this as appropriate. Until then, I think this will be OK.

@xuhancn
Copy link

xuhancn commented Jun 19, 2024

https://github.com/pytorch/pytorch/blob/main/torch/_inductor/cpp_builder.py#L123-L134 @Xia-Weiwen FYI.

@Xia-Weiwen
Copy link
Author

Hi @matthewdouglas Yes, it will still take some time to enable torch.compile on Windows, and the clang compiler is required. The contributor is @xuhancn . So, I would agree that it's better to disable it on Windows now and enable it later when everything is ready.

@xuhancn
Copy link

xuhancn commented Jun 20, 2024

Hi @matthewdouglas Yes, it will still take some time to enable torch.compile on Windows, and the clang compiler is required. The contributor is @xuhancn . So, I would agree that it's better to disable it on Windows now and enable it later when everything is ready.

Windows default compiler is msvc(cl.exe), please correct it. :)

@Xia-Weiwen
Copy link
Author

Hi @matthewdouglas Yes, it will still take some time to enable torch.compile on Windows, and the clang compiler is required. The contributor is @xuhancn . So, I would agree that it's better to disable it on Windows now and enable it later when everything is ready.

Windows default compiler is msvc(cl.exe), please correct it. :)

Thanks for the correction.

@Titus-von-Koeller
Copy link
Collaborator

Hi @matthewdouglas Yes, it will still take some time to enable torch.compile on Windows, and the clang compiler is required. The contributor is @xuhancn . So, I would agree that it's better to disable it on Windows now and enable it later when everything is ready.

Windows default compiler is msvc(cl.exe), please correct it. :)

Thanks for the correction.

@Xia-Weiwen does this still need correction or is this ready to merge? In the diff it still shows gcc for the compiler...

@matthewdouglas
Copy link
Member

@Titus-von-Koeller That's just a correction on comment about the compiler requirement for Windows (when we get there). It will use MSVC by default and not clang. I think it's OK to merge now as it is and my commentary here is just a note for future refinement.

@Xia-Weiwen
Copy link
Author

Hi @Titus-von-Koeller . This PR does not need correction. torch.compile is not ready on Windows yet. G++ is required for torch.compile now. So, this PR just disable it on Windows by checking if G++ is available. @matthewdouglas is correct. Thanks.

@Xia-Weiwen
Copy link
Author

Hi @Titus-von-Koeller Do you have more comments? Thanks

@Xia-Weiwen
Copy link
Author

Hallo @Titus-von-Koeller It's been a while since last update. Do you think there are any blocking issues preventing this PR merging? Thanks.

@Titus-von-Koeller Titus-von-Koeller merged commit 1bfecc8 into bitsandbytes-foundation:multi-backend-refactor Jul 10, 2024
1 of 2 checks passed
@Titus-von-Koeller
Copy link
Collaborator

@Xia-Weiwen Yes, everything is right the way it is then, thanks for the clarification!

@Xia-Weiwen
Copy link
Author

@Xia-Weiwen Yes, everything is right the way it is then, thanks for the clarification!

Thanks!

@Xia-Weiwen Xia-Weiwen deleted the multi-backend-refactor-win-cpu branch July 21, 2024 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants