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

Fix op_builder against PyTorch nightly #3596

Merged
merged 3 commits into from
May 24, 2023
Merged

Conversation

malfet
Copy link
Contributor

@malfet malfet commented May 23, 2023

After pytorch/pytorch#100557 PyTorch is free to use C++17 feature in it's headers, such as std::optional, if constexpr etc.

This update language standard for DS extensions to use C++17 standard by default

After pytorch/pytorch#100557 PyTorch is free to use C++17 feature in it's headers, such as `std::optional`, `if constexpr` etc.

This update language standard for DS extensions to use C++17 standard by default
@stas00
Copy link
Collaborator

stas00 commented May 23, 2023

@tjruwase, For context please see the breakage reported when trying to build deepspeed with pt-nightly as of last week:
pytorch/pytorch#102082

@stas00
Copy link
Collaborator

stas00 commented May 23, 2023

@malfet, would your proposed changes work with older pytorch versions? if I'm not mistaken deepspeed needs to work with pt-1.9 or higher.

@malfet
Copy link
Contributor Author

malfet commented May 23, 2023

@malfet, would your proposed changes work with older pytorch versions? if I'm not mistaken deepspeed needs to work with pt-1.9 or higher.

@stas00 I have not checked with pt-1.9, but I don't see why not (it should clearly work with 1.13/2.0), as C++17 is backward compatible with C++14. It might print a few warnings (for example because older PyTorch builds use std::iterator

@stas00
Copy link
Collaborator

stas00 commented May 23, 2023

Perfect, thank you for validating that, @malfet!

@stas00
Copy link
Collaborator

stas00 commented May 24, 2023

fyi @jeffra

@malfet
Copy link
Contributor Author

malfet commented May 24, 2023

Looking into formatting failure, but will not push following diff until all checks are finished:

diff --git a/op_builder/builder.py b/op_builder/builder.py
index b8e9f13b..e2902918 100644
--- a/op_builder/builder.py
+++ b/op_builder/builder.py
@@ -673,8 +673,8 @@ class CUDAOpBuilder(OpBuilder):
             cuda_major, _ = installed_cuda_version()
             args += [
                 '-allow-unsupported-compiler' if sys.platform == "win32" else '', '--use_fast_math',
-                '-std=c++17' if cuda_major > 10 else '-std=c++14',
-                '-U__CUDA_NO_HALF_OPERATORS__', '-U__CUDA_NO_HALF_CONVERSIONS__', '-U__CUDA_NO_HALF2_OPERATORS__'
+                '-std=c++17' if cuda_major > 10 else '-std=c++14', '-U__CUDA_NO_HALF_OPERATORS__',
+                '-U__CUDA_NO_HALF_CONVERSIONS__', '-U__CUDA_NO_HALF2_OPERATORS__'
             ]
             if os.environ.get('DS_DEBUG_CUDA_BUILD', '0') == '1':
                 args.append('--ptxas-options=-v')

Copy link
Collaborator

@jeffra jeffra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @malfet! 🚀

@jeffra jeffra merged commit 6622776 into microsoft:master May 24, 2023
@malfet malfet deleted the patch-1 branch May 25, 2023 14:31
@fecet
Copy link
Contributor

fecet commented Jul 2, 2023

Still cannot build, could you please provide the command and environment while building?

@dainey94
Copy link

dainey94 commented Jul 2, 2023 via email

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.

6 participants