-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'amd-develop' into amd-master
- Loading branch information
Showing
17 changed files
with
646 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,58 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
project(composable_kernel_host) | ||
|
||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
set(CK_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/..) | ||
|
||
add_compile_options(-std=c++17) | ||
find_package(hip) | ||
add_custom_target(codegen) | ||
find_package(ROCM) | ||
include(ROCMInstallTargets) | ||
include(ROCMTest) | ||
|
||
# add include directories | ||
include_directories(BEFORE | ||
${PROJECT_BINARY_DIR}/include | ||
${PROJECT_SOURCE_DIR}/include | ||
${PROJECT_SOURCE_DIR}/library/include | ||
${HIP_INCLUDE_DIRS} | ||
) | ||
rocm_setup_version(VERSION 1.0) | ||
|
||
list(APPEND CMAKE_MODULE_PATH ${CK_ROOT}/cmake) | ||
include(Embed) | ||
file(GLOB_RECURSE KERNEL_FILES CONFIGURE_DEPENDS | ||
${CK_ROOT}/include/ck/*.hpp) | ||
#printouts fot debug purposes | ||
#message(STATUS "KERNEL_FILES: ${KERNEL_FILES}") | ||
#message(STATUS "RELATIVE: ${CK_ROOT}/include") | ||
${CK_ROOT}/include/ck/*.hpp) | ||
# printouts fot debug purposes | ||
# message(STATUS "KERNEL_FILES: ${KERNEL_FILES}") | ||
# message(STATUS "RELATIVE: ${CK_ROOT}/include") | ||
add_embed_library(ck_headers ${KERNEL_FILES} RELATIVE ${CK_ROOT}/include) | ||
|
||
file(GLOB SOURCES CONFIGURE_DEPENDS src/*.cpp) | ||
add_compile_options(-std=c++17) | ||
|
||
##message(STATUS "SOURCE_FILES: ${SOURCES}") | ||
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) | ||
|
||
set_target_properties(ck_host PROPERTIES | ||
LINKER_LANGUAGE CXX | ||
POSITION_INDEPENDENT_CODE ON) | ||
set_target_properties(ck_host PROPERTIES | ||
LINKER_LANGUAGE CXX | ||
POSITION_INDEPENDENT_CODE ON) | ||
|
||
target_include_directories(ck_host PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:include> | ||
) | ||
# target_include_directories(ck_host PUBLIC | ||
# $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
# ) | ||
|
||
add_executable(ck-template-driver driver/main.cpp) | ||
target_link_libraries(ck-template-driver ck_host) | ||
|
||
rocm_install( | ||
rocm_install_targets( | ||
TARGETS ck_host ck_headers | ||
EXPORT ck_hostTargets | ||
EXPORT ck_host_targets | ||
INCLUDE include | ||
PRIVATE | ||
) | ||
rocm_export_targets( | ||
EXPORT ck_host_targets | ||
NAMESPACE composable_kernel:: | ||
) | ||
rocm_install(EXPORT ck_hostTargets | ||
FILE composable_kernelck_hostTargets.cmake | ||
NAMESPACE composable_kernel:: | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/composable_kernel) | ||
rocm_install(DIRECTORY include/ck DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
|
||
if(BUILD_TESTING) | ||
add_subdirectory(test) | ||
add_subdirectory(test) | ||
endif() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
list(APPEND CMAKE_PREFIX_PATH /opt/rocm) | ||
add_subdirectory(rtc) | ||
file(GLOB TEST_SRCS CONFIGURE_DEPENDS *.cpp) | ||
# do not build the tests when we build the library for various targets | ||
if(NOT GPU_ARCHS) | ||
foreach(TEST_SRC ${TEST_SRCS}) | ||
set_source_files_properties(${TEST_SRC} PROPERTIES LANGUAGE HIP) | ||
get_filename_component(BASE_NAME ${TEST_SRC} NAME_WE) | ||
add_executable(codegen_test_${BASE_NAME} ${TEST_SRC}) | ||
if(CK_USE_ALTERNATIVE_PYTHON) | ||
target_link_options(codegen_test_${BASE_NAME} PRIVATE -lstdc++fs) | ||
endif() | ||
add_dependencies(codegen codegen_test_${BASE_NAME}) | ||
add_dependencies(tests codegen_test_${BASE_NAME}) | ||
add_dependencies(check codegen_test_${BASE_NAME}) | ||
add_test(NAME codegen_test_${BASE_NAME} COMMAND codegen_test_${BASE_NAME}) | ||
message("adding test codegen_test_${BASE_NAME}") | ||
target_link_libraries(codegen_test_${BASE_NAME} ck_rtc ck_host) | ||
target_include_directories(codegen_test_${BASE_NAME} PUBLIC ${CK_ROOT}/codegen/test/include) | ||
|
||
# TODO: These tests need to be refactored to remove dependency on main ck | ||
# headers and device compilation. | ||
set(TESTS_REQUIRE_DEVICE_COMPILE | ||
grouped_conv_fwd_multiple_d_v1 | ||
grouped_conv_fwd_multiple_d_v2 | ||
grouped_conv_fwd_multiple_d_v3 | ||
grouped_conv_fwd_multiple_d_v4 | ||
) | ||
find_package(hip) | ||
|
||
foreach(TEST_SRC ${TEST_SRCS}) | ||
get_filename_component(BASE_NAME ${TEST_SRC} NAME_WE) | ||
rocm_add_test_executable(codegen_test_${BASE_NAME} ${TEST_SRC}) | ||
target_link_libraries(codegen_test_${BASE_NAME} ck_rtc ck_host) | ||
target_include_directories(codegen_test_${BASE_NAME} PUBLIC include) | ||
if(BASE_NAME IN_LIST TESTS_REQUIRE_DEVICE_COMPILE) | ||
target_link_libraries(codegen_test_${BASE_NAME} hip::device) | ||
target_include_directories(codegen_test_${BASE_NAME} PUBLIC ${CK_ROOT}/include) | ||
target_include_directories(codegen_test_${BASE_NAME} PUBLIC ${CK_ROOT}/library/include) | ||
endforeach() | ||
endif() | ||
endif() | ||
endforeach() |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
find_package(hip) | ||
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Copyright (c) 2018-2024, Advanced Micro Devices, Inc. All rights reserved. | ||
|
||
#ifndef GUARD_TEST_HOST_RTC_FILESYSTEM_HPP | ||
#define GUARD_TEST_HOST_RTC_FILESYSTEM_HPP | ||
|
||
#include <string> | ||
#include <string_view> | ||
|
||
// clang-format off | ||
#if defined(CPPCHECK) | ||
#define RTC_HAS_FILESYSTEM 1 | ||
#define RTC_HAS_FILESYSTEM_TS 1 | ||
#elif defined(_WIN32) | ||
#if _MSC_VER >= 1920 | ||
#define RTC_HAS_FILESYSTEM 1 | ||
#define RTC_HAS_FILESYSTEM_TS 0 | ||
#elif _MSC_VER >= 1900 | ||
#define RTC_HAS_FILESYSTEM 0 | ||
#define RTC_HAS_FILESYSTEM_TS 1 | ||
#else | ||
#define RTC_HAS_FILESYSTEM 0 | ||
#define RTC_HAS_FILESYSTEM_TS 0 | ||
#endif | ||
#elif defined(__has_include) | ||
#if __has_include(<filesystem>) && __cplusplus >= 201703L | ||
#define RTC_HAS_FILESYSTEM 1 | ||
#else | ||
#define RTC_HAS_FILESYSTEM 0 | ||
#endif | ||
#if __has_include(<experimental/filesystem>) && __cplusplus >= 201103L | ||
#define RTC_HAS_FILESYSTEM_TS 1 | ||
#else | ||
#define RTC_HAS_FILESYSTEM_TS 0 | ||
#endif | ||
#else | ||
#define RTC_HAS_FILESYSTEM 0 | ||
#define RTC_HAS_FILESYSTEM_TS 0 | ||
#endif | ||
// clang-format on | ||
|
||
#if RTC_HAS_FILESYSTEM | ||
#include <filesystem> | ||
#elif RTC_HAS_FILESYSTEM_TS | ||
#include <experimental/filesystem> | ||
#else | ||
#error "No filesystem include available" | ||
#endif | ||
|
||
namespace rtc { | ||
|
||
#if RTC_HAS_FILESYSTEM | ||
namespace fs = ::std::filesystem; | ||
#elif RTC_HAS_FILESYSTEM_TS | ||
namespace fs = ::std::experimental::filesystem; | ||
#endif | ||
|
||
} // namespace rtc | ||
|
||
#endif // GUARD_RTC_FILESYSTEM_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.