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

Change CMake to respect GPU_TARGETS variable #257

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ else()
)
endif()
set(AMDGPU_TARGETS "${DEFAULT_AMDGPU_TARGETS}" CACHE STRING "List of specific machine types for library to target")
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we can also remove AMDGPU_TARGETS?

Copy link
Contributor

@jsandham jsandham Oct 31, 2024

Choose a reason for hiding this comment

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

I think we are supposed to continue supporting AMDGPU_TARGETS but just issue a deprecation warning saying to use GPU_TARGETS. I think we want to add something like what rocblas did, i.e. delete the above line and add this instead:

if( AMDGPU_TARGETS AND NOT GPU_TARGETS )
message( DEPRECATION "AMDGPU_TARGETS use is deprecated. Use GPU_TARGETS." )
set( GFX_LIST ${AMDGPU_TARGETS} )
elseif( GPU_TARGETS )
set( GFX_LIST ${GPU_TARGETS} )
else ()
set( GFX_LIST ${DEFAULT_AMDGPU_TARGETS} ) # default if not set
endif()

set(GPU_TARGETS "${GFX_LIST}" CACHE STRING "GPU architectures to build for")

# Don't force, as users should be able to override GPU_TARGETS at the command line if desired
set(GPU_TARGETS "${AMDGPU_TARGETS}" CACHE STRING "GPU architectures to build for")

include(CheckLanguage)
include(CMakeDependentOption)
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ if(SUPPORT_HIP)
if((${CMAKE_BUILD_TYPE} MATCHES "Release") OR (${CMAKE_BUILD_TYPE} MATCHES "RelWithDebInfo"))
list(APPEND HIP_HIPCC_FLAGS "-DNDEBUG")
endif()
foreach(target ${AMDGPU_TARGETS})
foreach(target ${GPU_TARGETS})
list(APPEND HIP_HIPCC_FLAGS "--offload-arch=${target}")
endforeach()

Expand Down
Loading