Skip to content

Commit c2a78b3

Browse files
committed
move CMake variable sanitation to main CMakeLists
1 parent 488ce75 commit c2a78b3

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

flang-rt/CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,23 @@ elseif (FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT STREQUAL "OpenMP")
147147
set(FLANG_RT_DEVICE_ARCHITECTURES "all" CACHE STRING
148148
"List of OpenMP device architectures to be used to compile the Fortran runtime (e.g. 'gfx1103;sm_90')"
149149
)
150+
151+
if (FLANG_RT_DEVICE_ARCHITECTURES STREQUAL "all")
152+
# TODO: support auto detection on the build system.
153+
set(all_amdgpu_architectures
154+
"gfx700;gfx701;gfx801;gfx803;gfx900;gfx902;gfx906"
155+
"gfx908;gfx90a;gfx90c;gfx940;gfx1010;gfx1030"
156+
"gfx1031;gfx1032;gfx1033;gfx1034;gfx1035;gfx1036"
157+
"gfx1100;gfx1101;gfx1102;gfx1103;gfx1150;gfx1151"
158+
"gfx1152;gfx1153")
159+
set(all_nvptx_architectures
160+
"sm_35;sm_37;sm_50;sm_52;sm_53;sm_60;sm_61;sm_62"
161+
"sm_70;sm_72;sm_75;sm_80;sm_86;sm_89;sm_90")
162+
set(all_gpu_architectures
163+
"${all_amdgpu_architectures};${all_nvptx_architectures}")
164+
set(FLANG_RT_DEVICE_ARCHITECTURES ${all_gpu_architectures})
165+
endif()
166+
list(REMOVE_DUPLICATES FLANG_RT_DEVICE_ARCHITECTURES)
150167
else ()
151168
message(FATAL_ERROR "Invalid value '${FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT}' for FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT; must be empty, 'CUDA', or 'OpenMP'")
152169
endif ()

flang-rt/cmake/modules/AddFlangRTOffload.cmake

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,26 +69,6 @@ macro(enable_omp_offload_compilation name files)
6969
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND
7070
"${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
7171

72-
set(all_amdgpu_architectures
73-
"gfx700;gfx701;gfx801;gfx803;gfx900;gfx902;gfx906"
74-
"gfx908;gfx90a;gfx90c;gfx940;gfx1010;gfx1030"
75-
"gfx1031;gfx1032;gfx1033;gfx1034;gfx1035;gfx1036"
76-
"gfx1100;gfx1101;gfx1102;gfx1103;gfx1150;gfx1151"
77-
"gfx1152;gfx1153"
78-
)
79-
set(all_nvptx_architectures
80-
"sm_35;sm_37;sm_50;sm_52;sm_53;sm_60;sm_61;sm_62"
81-
"sm_70;sm_72;sm_75;sm_80;sm_86;sm_89;sm_90"
82-
)
83-
set(all_gpu_architectures
84-
"${all_amdgpu_architectures};${all_nvptx_architectures}"
85-
)
86-
# TODO: support auto detection on the build system.
87-
if (FLANG_RT_DEVICE_ARCHITECTURES STREQUAL "all")
88-
set(FLANG_RT_DEVICE_ARCHITECTURES ${all_gpu_architectures})
89-
endif()
90-
list(REMOVE_DUPLICATES FLANG_RT_DEVICE_ARCHITECTURES)
91-
9272
string(REPLACE ";" "," compile_for_architectures
9373
"${FLANG_RT_DEVICE_ARCHITECTURES}"
9474
)

0 commit comments

Comments
 (0)