diff --git a/CMakeLists.txt b/CMakeLists.txt index cc157f50e1ba..0e74015dd061 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,7 @@ set(ROCMLIR_DRIVER_RANDOM_DATA_SEED "none" CACHE STRING "Enable E2E tests using set(ROCMLIR_GEN_FLAGS "" CACHE BOOL "Set feature flag for rocmlir-gen") set(ROCMLIR_DRIVER_TEST_GPU_VALIDATION 1 CACHE BOOL "Enable E2E tests with GPU validation") set(ROCK_E2E_TEST_ENABLED 0 CACHE BOOL "Enable build rock E2E tests") +option(ROCMLIR_BUILD_TUNING_DRIVER "Build rocmlir-tuning-driver (default ON when BUILD_FAT_LIBROCKCOMPILER)" OFF) set(ROCMLIR_ENABLE_BENCHMARKS "" CACHE STRING "List of enabled benchmarks") set(ROCMLIR_BIN_DIR "${CMAKE_CURRENT_BINARY_DIR}/bin" CACHE PATH "") @@ -81,6 +82,8 @@ if( BUILD_FAT_LIBROCKCOMPILER ) set(LLVM_BUILD_LLVM_DYLIB OFF CACHE BOOL "") # rocm-runner is not supported with static libraries set(MLIR_ENABLE_ROCM_RUNNER 0 CACHE BOOL "") + # Enable tuning driver by default for fat-lib builds (it can link against static dialect libs + shared HIP) + set(ROCMLIR_BUILD_TUNING_DRIVER ON CACHE BOOL "" FORCE) set(MLIR_INCLUDE_INTEGRATION_TESTS OFF CACHE BOOL "") set(ROCMLIR_DRIVER_PR_E2E_TEST_ENABLED 0 CACHE BOOL "Enable build PR-triggered E2E tests for Rock driver") set(MHAL_ENABLE_HOST_RUNNER OFF CACHE BOOL "Enable MHAL host runner") diff --git a/mlir/test/CMakeLists.txt b/mlir/test/CMakeLists.txt index 37d4e393e7af..86d17971e281 100644 --- a/mlir/test/CMakeLists.txt +++ b/mlir/test/CMakeLists.txt @@ -124,6 +124,10 @@ if(MLIR_ENABLE_ROCM_RUNNER) rocmlir-tuning-driver ) endif() +# When building tuning driver without rocm-runner (e.g. fat-lib), ensure it is built before tests +if(ROCMLIR_BUILD_TUNING_DRIVER) + list(APPEND ROCMLIR_TEST_DEPENDS rocmlir-tuning-driver) +endif() if(MLIR_BINDINGS_PYTHON_ENABLED) list(APPEND ROCMLIR_TEST_DEPENDS diff --git a/mlir/tools/rocmlir-tuning-driver/CMakeLists.txt b/mlir/tools/rocmlir-tuning-driver/CMakeLists.txt index d79b496b96c4..ca392984bae6 100644 --- a/mlir/tools/rocmlir-tuning-driver/CMakeLists.txt +++ b/mlir/tools/rocmlir-tuning-driver/CMakeLists.txt @@ -2,7 +2,7 @@ set(LLVM_OPTIONAL_SOURCES rocmlir-tuning-driver.cpp ) -if(MLIR_ENABLE_ROCM_RUNNER) +if(MLIR_ENABLE_ROCM_RUNNER OR ROCMLIR_BUILD_TUNING_DRIVER) get_property(rocmlir_dialect_libs GLOBAL PROPERTY ROCMLIR_DIALECT_LIBS) get_property(rocmlir_conversion_libs GLOBAL PROPERTY ROCMLIR_CONVERSION_LIBS) @@ -37,7 +37,8 @@ find_package(hip REQUIRED) find_package(hiprtc REQUIRED) set(CMAKE_PREFIX_PATH "${REAL_CMAKE_PREFIX_PATH}") -# Supress compiler warnings from HIP headers +# Suppress compiler warnings from HIP headers (only when rocm runner is built) +if(MLIR_ENABLE_ROCM_RUNNER) check_cxx_compiler_flag(-Wno-c++98-compat-extra-semi CXX_SUPPORTS_NO_CXX98_COMPAT_EXTRA_SEMI_FLAG) if (CXX_SUPPORTS_CXX98_COMPAT_EXTRA_SEMI_FLAG) @@ -62,6 +63,7 @@ if (CXX_SUPPORTS_WNO_GNU_ANONYMOUS_STRUCT_FLAG) target_compile_options(mlir_rocm_runtime PRIVATE "-Wno-gnu-anonymous-struct") endif() +endif() set_property(TARGET rocmlir-tuning-driver PROPERTY INSTALL_RPATH_USE_LINK_PATH ON) diff --git a/mlir/utils/CMakeLists.txt b/mlir/utils/CMakeLists.txt index 408ca5ba0257..175632bd9ea5 100644 --- a/mlir/utils/CMakeLists.txt +++ b/mlir/utils/CMakeLists.txt @@ -4,6 +4,7 @@ # subdirectory leads to static library builds trying to find HIP, which # has caused fatal CMake errors in cases where ROCm is only partially # installed. -if (MLIR_ENABLE_ROCM_RUNNER) +# ROCMLIR_BUILD_TUNING_DRIVER also needs performance/common for benchmark-driver-utils. +if (MLIR_ENABLE_ROCM_RUNNER OR ROCMLIR_BUILD_TUNING_DRIVER) add_subdirectory(performance) endif()