mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-04-19 14:29:05 +00:00
Only link with hiprtc when necessary.
This commit is contained in:
@@ -15,38 +15,6 @@ configure_file(${CK_ROOT}/include/ck/config.h.in ${CK_ROOT}/include/ck/config.h)
|
||||
find_package(ROCM)
|
||||
include(ROCMInstallTargets)
|
||||
include(ROCMTest)
|
||||
list(APPEND CMAKE_PREFIX_PATH /opt/rocm $ENV{ROCM_PATH})
|
||||
|
||||
# Debug output for hiprtc find_package issues
|
||||
message(STATUS "=== hiprtc find_package debug ===")
|
||||
message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}")
|
||||
message(STATUS "ROCM_PATH env: $ENV{ROCM_PATH}")
|
||||
message(STATUS "CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}")
|
||||
foreach(_prefix IN LISTS CMAKE_PREFIX_PATH)
|
||||
message(STATUS "Checking prefix: ${_prefix}")
|
||||
if(EXISTS "${_prefix}/lib/cmake")
|
||||
file(GLOB _cmake_pkgs "${_prefix}/lib/cmake/*")
|
||||
message(STATUS " lib/cmake packages: ${_cmake_pkgs}")
|
||||
endif()
|
||||
if(EXISTS "${_prefix}/share")
|
||||
file(GLOB _share_dirs "${_prefix}/share/*")
|
||||
message(STATUS " share dirs: ${_share_dirs}")
|
||||
endif()
|
||||
if(EXISTS "${_prefix}/include")
|
||||
file(GLOB _inc_dirs "${_prefix}/include/*")
|
||||
message(STATUS " include dirs: ${_inc_dirs}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Direct search for hiprtc files
|
||||
find_path(HIPRTC_INCLUDE_TEST hiprtc/hiprtc.h PATHS ${CMAKE_PREFIX_PATH} PATH_SUFFIXES include NO_DEFAULT_PATH)
|
||||
message(STATUS "hiprtc.h search result: ${HIPRTC_INCLUDE_TEST}")
|
||||
find_library(HIPRTC_LIB_TEST hiprtc PATHS ${CMAKE_PREFIX_PATH} PATH_SUFFIXES lib lib64 NO_DEFAULT_PATH)
|
||||
message(STATUS "libhiprtc search result: ${HIPRTC_LIB_TEST}")
|
||||
|
||||
message(STATUS "=== end hiprtc debug ===")
|
||||
|
||||
find_package(hiprtc REQUIRED)
|
||||
|
||||
rocm_setup_version(VERSION 1.0)
|
||||
|
||||
@@ -62,7 +30,7 @@ add_compile_options(-std=c++20)
|
||||
file(GLOB SOURCES CONFIGURE_DEPENDS src/*.cpp)
|
||||
# TODO: Use object library
|
||||
add_library(ck_host STATIC ${SOURCES})
|
||||
target_link_libraries(ck_host PRIVATE ck_headers hiprtc::hiprtc)
|
||||
target_link_libraries(ck_host PRIVATE ck_headers)
|
||||
|
||||
set_target_properties(ck_host PROPERTIES
|
||||
LINKER_LANGUAGE CXX
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
# Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
find_package(hip)
|
||||
option(USE_HIPRTC_FOR_CODEGEN_TESTS "Whether to enable hipRTC for codegen tests." ON)
|
||||
|
||||
find_package(hip REQUIRED)
|
||||
if(USE_HIPRTC_FOR_CODEGEN_TESTS)
|
||||
find_package(hiprtc REQUIRED)
|
||||
endif()
|
||||
|
||||
file(GLOB RTC_SOURCES CONFIGURE_DEPENDS src/*.cpp)
|
||||
add_library(ck_rtc ${RTC_SOURCES})
|
||||
target_include_directories(ck_rtc PUBLIC include)
|
||||
target_link_libraries(ck_rtc PUBLIC hip::host)
|
||||
target_link_libraries(ck_rtc PUBLIC -lstdc++fs)
|
||||
target_link_libraries(ck_rtc PUBLIC hip::host -lstdc++fs)
|
||||
|
||||
option(USE_HIPRTC_FOR_CODEGEN_TESTS "Whether to enable hipRTC for codegen tests." ON)
|
||||
if(USE_HIPRTC_FOR_CODEGEN_TESTS)
|
||||
target_link_libraries(ck_rtc PUBLIC hiprtc::hiprtc)
|
||||
target_compile_definitions(ck_rtc PUBLIC HIPRTC_FOR_CODEGEN_TESTS)
|
||||
message(STATUS "CK compiled with USE_HIPRTC_FOR_CODEGEN_TESTS set to ${USE_HIPRTC_FOR_CODEGEN_TESTS}")
|
||||
message(STATUS "CK codegen tests: hipRTC enabled")
|
||||
else()
|
||||
message(STATUS "CK codegen tests: hipRTC disabled")
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user