From bb4ebe1946ab3f0f8cea609d73a14b7d2cfd6e58 Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Mon, 19 Feb 2024 11:59:39 +0100 Subject: [PATCH] fix compilation after merging 'develop' branch --- CMakeLists.txt | 29 +++++++++++++------------- client_example/CMakeLists.txt | 2 +- include/ck/utility/type_convert.hpp | 4 ++-- library/src/jit_library/CMakeLists.txt | 6 +++--- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eefae4ae15..6ec4093090 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,8 +144,8 @@ else() message("Building CK for the following targets: ${AMDGPU_TARGETS}") endif() -option(USE_BITINT_EXTENSION_INT4, "Whether to enable clang's BitInt extension to provide int4 data type." OFF) -option(USE_OPT_NAVI3X, "Whether to enable LDS cumode and Wavefront32 mode for NAVI3X silicons." OFF) +option(USE_BITINT_EXTENSION_INT4 "Whether to enable clang's BitInt extension to provide int4 data type." OFF) +option(USE_OPT_NAVI3X "Whether to enable LDS cumode and Wavefront32 mode for NAVI3X silicons." OFF) if(USE_BITINT_EXTENSION_INT4) add_compile_definitions(CK_EXPERIMENTAL_BIT_INT_EXTENSION_INT4) @@ -165,23 +165,22 @@ find_package(Threads REQUIRED) link_libraries(Threads::Threads) ## C++ -enable_language(CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) message("CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}") -option(CK_BUILD_JIT_LIB, "Only build the CK JIT Helper Library" OFF) +option(CK_BUILD_JIT_LIB "Only build the CK JIT Helper Library" OFF) if (NOT CK_BUILD_JIT_LIB) - find_package(hip) - # No assumption that HIP kernels are launched with uniform block size for backward compatibility - # SWDEV-413293 and https://reviews.llvm.org/D155213 - math(EXPR hip_VERSION_FLAT "(${hip_VERSION_MAJOR} * 1000 + ${hip_VERSION_MINOR}) * 100000 + ${hip_VERSION_PATCH}") - message("hip_version_flat=${hip_VERSION_FLAT}") + find_package(hip) + # No assumption that HIP kernels are launched with uniform block size for backward compatibility + # SWDEV-413293 and https://reviews.llvm.org/D155213 + math(EXPR hip_VERSION_FLAT "(${hip_VERSION_MAJOR} * 1000 + ${hip_VERSION_MINOR}) * 100000 + ${hip_VERSION_PATCH}") + message("hip_version_flat=${hip_VERSION_FLAT}") if(NOT WIN32 AND ${hip_VERSION_FLAT} GREATER 500723302) - message("Adding the fno-offload-uniform-block compiler flag") - add_compile_options(-fno-offload-uniform-block) - endif() + message("Adding the fno-offload-uniform-block compiler flag") + add_compile_options(-fno-offload-uniform-block) + endif() # # Seperate linking jobs from compiling @@ -199,7 +198,7 @@ if (NOT CK_BUILD_JIT_LIB) endif() # Similar for compiling set(CK_PARALLEL_COMPILE_JOBS "" CACHE STRING - "Define the maximum number of concurrent compile jobs (Ninja only).") + "Define the maximum number of concurrent compile jobs (Ninja only).") if(CMAKE_GENERATOR MATCHES "Ninja") if(CK_PARALLEL_COMPILE_JOBS) set_property(GLOBAL APPEND PROPERTY JOB_POOLS compile_job_pool=${CK_PARALLEL_COMPILE_JOBS}) @@ -208,6 +207,7 @@ if (NOT CK_BUILD_JIT_LIB) elseif(CK_PARALLEL_COMPILE_JOBS) message(WARNING "Job pooling is only available with Ninja generators.") endif() + ## OpenMP if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # workaround issue hipcc in rocm3.5 cannot find openmp @@ -255,7 +255,7 @@ if (NOT CK_BUILD_JIT_LIB) add_compile_definitions(__HIP_PLATFORM_AMD__=1) else() add_compile_definitions(__HIP_PLATFORM_HCC__=1) - endif() + endif() endif() ## tidy @@ -368,7 +368,6 @@ enable_clang_tidy( -DCK_USE_CLANG_TIDY ) - include(CppCheck) enable_cppcheck( CHECKS diff --git a/client_example/CMakeLists.txt b/client_example/CMakeLists.txt index 753f5e5ae5..99b5cfa53a 100644 --- a/client_example/CMakeLists.txt +++ b/client_example/CMakeLists.txt @@ -49,7 +49,7 @@ else() endif() find_package(composable_kernel COMPONENTS device_other_operations device_gemm_operations device_conv_operations device_contraction_operations device_reduction_operations) -find_package(hip REQUIRED PATHS /opt/rocm) +find_package(hip REQUIRED PATHS /opt/rocm $ENV{HIP_PATH} PATH_SUFFIXES llvm) message(STATUS "Build with HIP ${hip_VERSION}") # add all example subdir diff --git a/include/ck/utility/type_convert.hpp b/include/ck/utility/type_convert.hpp index 9f95e114f8..3bc1b94248 100644 --- a/include/ck/utility/type_convert.hpp +++ b/include/ck/utility/type_convert.hpp @@ -157,7 +157,7 @@ template <> inline __host__ __device__ bf8_t f8_convert_sr(float x) { constexpr int seed = 42; - uint32_t rng = prand_generator(reinterpret_cast(&x), x); + uint32_t rng = prand_generator(reinterpret_cast(&x), x); #if defined(__gfx94__) union { @@ -192,7 +192,7 @@ inline __host__ __device__ bf8_t f8_convert_sr(half_t x) constexpr bool clip = true; constexpr f8_rounding_mode rm = f8_rounding_mode::stochastic; constexpr int seed = 42; - uint32_t rng = prand_generator(reinterpret_cast(&x), x); + uint32_t rng = prand_generator(reinterpret_cast(&x), x); return utils:: cast_to_f8( x, rng); diff --git a/library/src/jit_library/CMakeLists.txt b/library/src/jit_library/CMakeLists.txt index cecd2d50e2..e9b456d799 100644 --- a/library/src/jit_library/CMakeLists.txt +++ b/library/src/jit_library/CMakeLists.txt @@ -5,8 +5,10 @@ message(STATUS "KERNEL_FILES: ${KERNEL_FILES}") message(STATUS "RELATIVE: ${PROJECT_SOURCE_DIR}/include") add_embed_library(ck_headers ${KERNEL_FILES} RELATIVE ${PROJECT_SOURCE_DIR}/include) +find_package(Python 3.8 REQUIRED COMPONENTS Interpreter) + execute_process( - COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/util/make_instance_strings.py + COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/util/make_instance_strings.py ${PROJECT_SOURCE_DIR}/library/src/tensor_operation_instance/gpu ${CMAKE_CURRENT_BINARY_DIR}/solution_instances WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../tensor_operation_instance/gpu/ @@ -44,5 +46,3 @@ rocm_install( NAMESPACE composable_kernel:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/composable_kernel ) - -