Skip to content

Commit ae95ea8

Browse files
r-barnesfacebook-github-bot
authored andcommitted
Upgrade torchao build configs to C++20 (pytorch#4025)
Summary: Update CMAKE_CXX_STANDARD and compiler flags from c++17 to c++20 in torchao's setup.py, CMakeLists.txt, and Makefile files. Reviewed By: andrewor14 Differential Revision: D95103084
1 parent 5065738 commit ae95ea8

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,12 +523,12 @@ def get_extensions():
523523
"-DNDEBUG" if not debug_mode else "-DDEBUG",
524524
"-O3" if not debug_mode else "-O0",
525525
"-t=0",
526-
"-std=c++17",
526+
"-std=c++20",
527527
]
528528
rocm_args = [
529529
"-DNDEBUG" if not debug_mode else "-DDEBUG",
530530
"-O3" if not debug_mode else "-O0",
531-
"-std=c++17",
531+
"-std=c++20",
532532
]
533533
maybe_hipify_v2_flag = []
534534
if use_rocm and detect_hipify_v2():
@@ -773,7 +773,7 @@ def get_extensions():
773773
extra_compile_args={
774774
"cxx": [
775775
f"-DPy_LIMITED_API={min_supported_cpython_hexcode}",
776-
"-std=c++17",
776+
"-std=c++20",
777777
"-O3",
778778
],
779779
"nvcc": nvcc_args

torchao/csrc/cpu/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ include(CMakeDependentOption)
99

1010
project(torchao)
1111

12-
set(CMAKE_CXX_STANDARD 17)
12+
set(CMAKE_CXX_STANDARD 20)
1313

1414
if (NOT CMAKE_BUILD_TYPE)
1515
set(CMAKE_BUILD_TYPE Release)

torchao/experimental/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ include(CMakeDependentOption)
99

1010
project(torchao)
1111

12-
set(CMAKE_CXX_STANDARD 17)
12+
set(CMAKE_CXX_STANDARD 20)
1313

1414
if (NOT CMAKE_BUILD_TYPE)
1515
set(CMAKE_BUILD_TYPE Release)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
all: test_lowbit
22

33
test_lowbit: test_lowbit.mm ../src/OperationUtils.mm
4-
clang++ -I${TORCHAO_ROOT} -O3 -std=c++17 -Wall -Wextra -o $@ $^ -framework Metal -framework Foundation
4+
clang++ -I${TORCHAO_ROOT} -O3 -std=c++20 -Wall -Wextra -o $@ $^ -framework Metal -framework Foundation
55

66
run: test_lowbit
77
./test_lowbit

torchao/experimental/ops/mps/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 3.19)
88

99
project(torchao_ops_mps_linear_fp_act_xbit_weight)
1010

11-
set(CMAKE_CXX_STANDARD 17)
11+
set(CMAKE_CXX_STANDARD 20)
1212
set(CMAKE_CXX_STANDARD_REQUIRED YES)
1313

1414
if (NOT CMAKE_BUILD_TYPE)

0 commit comments

Comments
 (0)