Skip to content

Commit bb47571

Browse files
committed
Fix hardcoded amd clang version and update target flags
1 parent b6b87cd commit bb47571

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

CMakeLists.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ option (ASGARD_PROFILE_PERF "enable profiling support for using linux perf" "")
7878
option (ASGARD_PROFILE_VALGRIND "enable profiling support for using valgrind" "")
7979
option (ASGARD_GRAPHVIZ_PATH "optional location of bin/ containing dot executable" "")
8080
option (ASGARD_IO_HIGHFIVE "Use the HighFive HDF5 header library for I/O" OFF)
81-
option (ASGARD_USE_HIP "Optional HIP support for asgard" ON)
81+
option (ASGARD_USE_HIP "Optional HIP support for asgard" OFF)
8282
option (ASGARD_USE_OPENMP "Optional openMP support for asgard" ON)
8383
option (ASGARD_USE_MPI "Optional distributed computing support for asgard" OFF)
8484
option (ASGARD_USE_SLATE "Use optional slate linear algebra library" OFF)
@@ -158,7 +158,8 @@ if(ASGARD_USE_HIP)
158158
# note: could probably grab this path directly using hipconfig?
159159
if (NOT DEFINED HIP_CLANG_INCLUDE_PATH)
160160
if(NOT DEFINED ENV{HIP_CLANG_INCLUDE_PATH})
161-
set(HIP_CLANG_INCLUDE_PATH "${HIP_CLANG_PATH}/../lib/clang/12.0.0/include" CACHE PATH "Path to HIP clang include directory")
161+
# probably need a better way to get the compiler version.. this will cause non-existent paths for non-clang compilers
162+
set(HIP_CLANG_INCLUDE_PATH "${HIP_CLANG_PATH}/../lib/clang/${CMAKE_CXX_COMPILER_VERSION}/include" CACHE PATH "Path to HIP clang include directory")
162163
else()
163164
set(HIP_CLANG_INCLUDE_PATH $ENV{HIP_CLANG_INCLUDE_PATH} CACHE PATH "Path to HIP clang include directory")
164165
endif()
@@ -207,6 +208,11 @@ if(ASGARD_USE_HIP)
207208
if(ASGARD_PLATFORM_HCC)
208209
# note: causes issues on nvidia, but might be needed on amd platforms?
209210
list(APPEND CMAKE_PREFIX_PATH "${HIP_PATH}/lib/cmake" "${ROCM_PATH}")
211+
212+
# output a warning if compiling for AMD without using amd-clang
213+
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
214+
message(WARNING "Compiling HIP for AMD without using AMD clang might not work. Use -DCMAKE_CXX_COMPILER=clang++")
215+
endif()
210216
endif()
211217
list(APPEND CMAKE_PREFIX_PATH "${HIPBLAS_PATH}/lib/cmake")
212218

@@ -222,8 +228,8 @@ if(ASGARD_USE_HIP)
222228
set(HIP_CLANG_FLAGS "${HIP_CLANG_FLAGS} ${ASGARD_AMD_FLAGS}" CACHE STRING "")
223229
set(HIP_NVCC_FLAGS "${HIP_NVCC_FLAGS} ${ASGARD_NVCC_FLAGS}" CACHE STRING "")
224230

225-
set(AMDGPU_TARGETS "gfx${ASGARD_AMD_ARCH}")
226-
set(GPU_TARGETS "gfx${ASGARD_AMD_ARCH}")
231+
set(AMDGPU_TARGETS "gfx${ASGARD_AMD_ARCH}" CACHE STRING "GPU target architectures to compile for")
232+
set(GPU_TARGETS "gfx${ASGARD_AMD_ARCH}" CACHE STRING "GPU target architectures to compile for")
227233

228234
find_package(HIP 4.0 REQUIRED)
229235
find_package(hipblas REQUIRED)
@@ -246,8 +252,6 @@ if(ASGARD_USE_HIP)
246252
# these compile definitions should be added automatically if using amd's clang, but
247253
# may not necessarily be added if compiling with gcc or others
248254
add_compile_definitions(__HIP_PLATFORM_HCC__ __HIP_PLATFORM_AMD__)
249-
# temporarily disable warnings generated when using clang
250-
add_compile_options("-Wno-dtor-name" "-Wno-gnu-anonymous-struct" "-Wno-nested-anon-types")
251255
endif()
252256

253257
if (hipBLAS_FOUND)

0 commit comments

Comments
 (0)