Skip to content

Commit 2cb025a

Browse files
match targets to tensile targets (#90) (#92)
* clarify targets and force them to match tensile * tensile hipclang also needs the target compile flags Co-authored-by: Eiden Yoshida <[email protected]>
1 parent 696932f commit 2cb025a

File tree

2 files changed

+35
-8
lines changed

2 files changed

+35
-8
lines changed

CMakeLists.txt

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,23 @@ if( CMAKE_CXX_COMPILER MATCHES ".*/hcc$" )
203203
find_package( hcc REQUIRED CONFIG PATHS ${ROCM_PATH} /opt/rocm )
204204
find_package( hip REQUIRED CONFIG PATHS ${ROCM_PATH} /opt/rocm )
205205
endif( )
206+
if( CMAKE_CXX_COMPILER MATCHES ".*/hipcc$" )
207+
find_package( hip REQUIRED CONFIG PATHS ${ROCM_PATH} /opt/rocm )
208+
endif( )
206209

207210
# CMake list of machine targets
208-
if( Tensile_ARCHITECTURE STREQUAL "all" )
209-
set( gpus "gfx803;gfx900;gfx906;gfx908")
211+
if( Tensile_ARCHITECTURE )
212+
if( Tensile_ARCHITECTURE STREQUAL "all" )
213+
set( gpus "gfx803;gfx900;gfx906;gfx908")
214+
else()
215+
set( gpus ${Tensile_ARCHITECTURE})
216+
endif()
217+
# We must match tensile if architecture is set
218+
set( ROCBLAS_GPUS ${gpus} )
210219
else()
211-
set( gpus ${Tensile_ARCHITECTURE})
212-
endif()
213-
set( AMDGPU_TARGETS ${gpus} CACHE STRING "List of specific machine types for library to target" )
220+
set( ROCBLAS_GPUS ${AMDGPU_TARGETS} )
221+
endif( )
222+
message(STATUS "Specific GPU TARGET(s): " ${ROCBLAS_GPUS})
214223

215224
add_subdirectory( library )
216225

library/src/CMakeLists.txt

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ if( BUILD_WITH_TENSILE )
4242
endif( )
4343

4444
set( Tensile_RUNTIME_LANGUAGE "HIP" )
45-
message( STATUS "AMDGPU_TARGETS=${AMDGPU_TARGETS}" )
45+
message( STATUS "ROCBLAS_GPUS=${ROCBLAS_GPUS}" )
4646
if( BUILD_WITH_TENSILE_HOST )
4747
#TODO update when this feature has been validated
4848
#set( PACKAGE_TENSILE_LIBRARY ON )
@@ -84,7 +84,7 @@ if( BUILD_WITH_TENSILE )
8484
# Remove following when hcc is fixed; hcc emits following spurious warning ROCm v1.6.1
8585
# "clang-5.0: warning: argument unused during compilation: '-isystem /opt/rocm/include'"
8686
# target_compile_options( Tensile PRIVATE -Wno-unused-command-line-argument -fno-gpu-rdc -Wno-deprecated-declarations)
87-
foreach( target ${AMDGPU_TARGETS} )
87+
foreach( target ${ROCBLAS_GPUS} )
8888
if( BUILD_WITH_TENSILE_HOST )
8989
# Remove following when hcc is fixed; hcc emits following spurious warning ROCm v1.6.1
9090
# "clang-5.0: warning: argument unused during compilation: '-isystem /opt/rocm/include'"
@@ -99,6 +99,16 @@ if( BUILD_WITH_TENSILE )
9999
endforeach( )
100100
endif( )
101101

102+
if( CMAKE_CXX_COMPILER MATCHES ".*/hipcc$" )
103+
foreach( target ${ROCBLAS_GPUS} )
104+
if( BUILD_WITH_TENSILE_HOST )
105+
target_compile_options( TensileHost PRIVATE --amdgpu-target=${target} )
106+
else()
107+
target_compile_options( Tensile PRIVATE --amdgpu-target=${target} )
108+
endif()
109+
endforeach( )
110+
endif( )
111+
102112
if( ROCBLAS_SHARED_LIBS )
103113
set( BUILD_SHARED_LIBS ON )
104114
if( BUILD_WITH_TENSILE_HOST )
@@ -326,8 +336,16 @@ if( CMAKE_CXX_COMPILER MATCHES ".*/hcc$" )
326336
# Remove following when hcc is fixed; hcc emits following spurious warning ROCm v1.6.1
327337
# "clang-5.0: warning: argument unused during compilation: '-isystem /opt/rocm/include'"
328338
target_compile_options( rocblas PRIVATE -Wno-unused-command-line-argument -fno-gpu-rdc )
329-
foreach( target ${AMDGPU_TARGETS} )
339+
foreach( target ${ROCBLAS_GPUS} )
340+
target_compile_options( rocblas PRIVATE --amdgpu-target=${target} )
341+
endforeach( )
342+
endif( )
343+
344+
if( CMAKE_CXX_COMPILER MATCHES ".*/hipcc$" )
345+
foreach( target ${ROCBLAS_GPUS} )
346+
message( STATUS "TARGET: " ${target} )
330347
target_compile_options( rocblas PRIVATE --amdgpu-target=${target} )
348+
target_link_libraries( rocblas PRIVATE --amdgpu-target=${target} )
331349
endforeach( )
332350
endif( )
333351

0 commit comments

Comments
 (0)