From 2225897f268c0f62121a6237217ab1237dde13ce Mon Sep 17 00:00:00 2001 From: Stella Laurenzo Date: Tue, 11 Feb 2025 10:51:41 -0800 Subject: [PATCH] Fully parameterize the build. (#79) * Options are defined for every library. * Dependencies are specified so that it is safe to enable/disable any subset and have the build do the right thing. * Updates tests to adapt to feature availability. * Updates documentation, removing some obsolete docs and defining the flags. * Adds a THEROCK_VERBOSE=OFF flag and hides a lot of chatty (but useful for developers) CMake output behind it. --- .github/workflows/build_linux_packages.yml | 3 +- CMakeLists.txt | 95 ++- README.md | 63 +- cmake/therock_features.cmake | 103 +++ cmake/therock_subproject.cmake | 48 +- comm-libs/CMakeLists.txt | 8 +- compiler/CMakeLists.txt | 303 +++++---- core/CMakeLists.txt | 205 +++--- examples/CMakeLists.txt | 8 + examples/clean_configure_test_project.cmake | 9 + examples/cpp-sdk-user/CMakeLists.txt | 45 +- math-libs/CMakeLists.txt | 698 ++++++++++---------- ml-libs/CMakeLists.txt | 90 +-- 13 files changed, 954 insertions(+), 724 deletions(-) create mode 100644 cmake/therock_features.cmake diff --git a/.github/workflows/build_linux_packages.yml b/.github/workflows/build_linux_packages.yml index db84811..306fd61 100644 --- a/.github/workflows/build_linux_packages.yml +++ b/.github/workflows/build_linux_packages.yml @@ -75,7 +75,8 @@ jobs: cmake -B build -GNinja . \ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DTHEROCK_AMDGPU_FAMILIES=gfx110X-dgpu \ - -DTHEROCK_PACKAGE_VERSION="${package_version}" + -DTHEROCK_PACKAGE_VERSION="${package_version}" \ + -DTHEROCK_VERBOSE=ON ./build_tools/watch_top_processes.sh & cmake --build build --target therock-archives therock-dist kill %1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 926e987..5bfc319 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ include(CMakeDependentOption) include(ExternalProject) include(therock_amdgpu_targets) include(therock_artifacts) +include(therock_features) include(therock_subproject) include(therock_job_pools) @@ -38,10 +39,8 @@ message(STATUS "ROCM_GIT_DIR is set to: ${ROCM_GIT_DIR}") set(THEROCK_ARTIFACT_ARCHIVE_SUFFIX "" CACHE STRING "Suffix to add to artifact archive file stem names") set(THEROCK_ARTIFACT_ARCHIVE_TYPES "tar.xz" CACHE STRING "List of artifact archive types to generate") -# Library specific enable flags. -option(THEROCK_ENABLE_RCCL "Enable the comm_libs/rccl sub-project" ON) -option(THEROCK_ENABLE_MATH_LIBS "Enable building of math libraries" ON) -cmake_dependent_option(THEROCK_ENABLE_ML_LIBS "Enables building of ML frameworks" ON THEROCK_ENABLE_MATH_LIBS OFF) +# Overall build settings. +option(THEROCK_VERBOSE "Enables verbose CMake statuses" OFF) # Initialize the install directory. if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) @@ -53,6 +52,86 @@ set(ROCM_MAJOR_VERSION 6) set(ROCM_MINOR_VERSION 3) set(ROCM_PATCH_VERSION 1) +################################################################################ +# Feature selection +# Each feature added via therock_add_feature produces a boolean cache variable +# like `THEROCK_ENABLE_${feature_name}` that takes its default value from the +# `THEROCK_ENABLE_${group_name}` if a GROUP is present. +################################################################################ +option(THEROCK_ENABLE_ALL "Enables building of all feature groups" ON) +cmake_dependent_option(THEROCK_ENABLE_CORE "Enable building of core libraries" ON "THEROCK_ENABLE_ALL" OFF) +cmake_dependent_option(THEROCK_ENABLE_COMM_LIBS "Enable building of comm libraries" ON "THEROCK_ENABLE_ALL" OFF) +cmake_dependent_option(THEROCK_ENABLE_MATH_LIBS "Enable building of math libraries" ON "THEROCK_ENABLE_ALL" OFF) +cmake_dependent_option(THEROCK_ENABLE_ML_LIBS "Enable building of ML libraries" ON "THEROCK_ENABLE_ALL" OFF) +option(THEROCK_RESET_FEATURES "One-shot flag which forces all feature flags to their default state for this configuration run" OFF) + +# Base Features. +therock_add_feature(COMPILER + GROUP ALL + DESCRIPTION "Enables the AMDGPU+host compiler toolchain" +) +therock_add_feature(HIPIFY + GROUP ALL + DESCRIPTION "Enables the hipify tool" + REQUIRES COMPILER +) + +# Core Features. +therock_add_feature(CORE_RUNTIME + GROUP CORE + DESCRIPTION "Enables the core device runtime and tools" +) +therock_add_feature(HIP_RUNTIME + GROUP CORE + DESCRIPTION "Enables the HIP runtime" + REQUIRES COMPILER CORE_RUNTIME +) + +# Comm-libs Features. +therock_add_feature(RCCL + GROUP COMM_LIBS + DESCRIPTION "Enables rccl" + REQUIRES COMPILER HIP_RUNTIME HIPIFY +) + +# Math-libs Features. +therock_add_feature(PRIM + GROUP MATH_LIBS + DESCRIPTION "Enables prim libraries (rocprim)" + REQUIRES COMPILER HIP_RUNTIME +) +therock_add_feature(BLAS + GROUP MATH_LIBS + DESCRIPTION "Enables blas libraries (hipblaslt, rocblas, hipblas)" + REQUIRES COMPILER HIP_RUNTIME +) +therock_add_feature(RAND + GROUP MATH_LIBS + DESCRIPTION "Enables rand libraries (hiprand, rocrand)" + REQUIRES COMPILER HIP_RUNTIME +) +therock_add_feature(SOLVER + GROUP MATH_LIBS + DESCRIPTION "Enables solver libraries (hipsolver, rocsolver)" + REQUIRES COMPILER HIP_RUNTIME BLAS PRIM +) +therock_add_feature(SPARSE + GROUP MATH_LIBS + DESCRIPTION "Enables sparse libraries (hipsparse, rocsparse)" + REQUIRES COMPILER HIP_RUNTIME BLAS PRIM +) + +# ML-Libs Features. +therock_add_feature(MIOPEN + GROUP ML_LIBS + DESCRIPTION "Enables the MIOpen project (with minimal deps defaults to ON)" + REQUIRES COMPILER HIP_RUNTIME BLAS RAND +) + +# Finalize all feature flags. +therock_finalize_features() +therock_report_features() + ################################################################################ # GPU target selection # @@ -115,12 +194,8 @@ if(NOT WIN32) add_subdirectory(compiler) add_subdirectory(core) add_subdirectory(comm-libs) - if(THEROCK_ENABLE_MATH_LIBS) - add_subdirectory(math-libs) - endif() - if(THEROCK_ENABLE_ML_LIBS) - add_subdirectory(ml-libs) - endif() + add_subdirectory(math-libs) + add_subdirectory(ml-libs) else() # TODO(#36): Enable more project builds on Windows and/or make the full list configurable. endif() diff --git a/README.md b/README.md index 3f4370e..4c933b4 100644 --- a/README.md +++ b/README.md @@ -79,45 +79,50 @@ cmake -B build -GNinja . -DTHEROCK_AMDGPU_FAMILIES=gfx110X-dgpu # Or if iterating and wishing to cache: # cmake -Bbuild -GNinja -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache . cmake --build build - -# Install per component. -cmake --install build --component amdgpu-runtime -cmake --install build --component amdgpu-runtime-dev -cmake --install build --component amdgpu-compiler - -# Create archives. -(cd build && cpack -G TBZ2) ``` -## Sanity Checks +## Feature Flags -The following does not replace a robust test suite. However, it will tell you -whether the toolchain you have just crafted is viable at all (as in can load -and enumerate devices). +By default, the project builds everything available. The following group flags +allow enable/disable of selected subsets: -``` -./build/dlopen-hip install/lib/libamdhip64.so -``` +- `-DTHEROCK_ENABLE_ALL=OFF`: Disables all optional components. +- `-DTHEROCK_ENABLE_CORE=OFF`: Disables all core components. +- `-DTHEROCK_ENABLE_COMM_LIBS=OFF`: Disables all communication libraries. +- `-DTHEROCK_ENABLE_MATH_LIBS=OFF`: Disables all math libraries. +- `-DTHEROCK_ENABLE_ML_LIBS=OFF`: Disables all ML libraries. -HIP enabled IREE can also be used to enumerate: +Individual features can be controlled separately (typically in combination with +`-DTHEROCK_ENABLE_ALL=OFF` or `-DTHEROCK_RESET_FEATURES=ON` to force a +minimal build): -``` -LD_LIBRARY_PATH=install/lib iree-run-module --dump_devices=hip -``` +- `-DTHEROCK_ENABLE_COMPILER=ON`: Enables the GPU+host compiler toolchain. +- `-DTHEROCK_ENABLE_HIPIFY=ON`: Enables the hipify tool. +- `-DTHEROCK_ENABLE_CORE_RUNTIME=ON`: Enables the core runtime components and tools. +- `-DTHEROCK_ENABLE_HIP_RUNTIME=ON`: Enables the HIP runtime components. +- `-DTHEROCK_ENABLE_RCCL=ON`: Enables RCCL. +- `-DTHEROCK_ENABLE_PRIM=ON`: Enables the PRIM library. +- `-DTHEROCK_ENABLE_BLAS=ON`: Enables the BLAS libraries. +- `-DTHEROCK_ENABLE_RAND=ON`: Enables the RAND libraries. +- `-DTHEROCK_ENABLE_SOLVER=ON`: Enables the SOLVER libraries. +- `-DTHEROCK_ENABLE_SPARSE=ON`: Enables the SPARSE libraries. +- `-DTHEROCK_ENABLE_MIOPEN=ON`: Enables MIOpen. -# Development Notes +Enabling any features will implicitly enable its *minimum* dependencies. Some +libraries (like MIOpen) have a number of *optional* dependencies, which must +be enabled manually if enabling/disabling individual features. -## Building in a manylinux container +A report of enabled/disabled features and flags will be printed on every +CMake configure. -Our CI builds run in such a container, and it can be useful to run locally. - -``` -docker run --rm -it -v $PWD:$PWD --entrypoint /bin/bash ghcr.io/nod-ai/manylinux_ghr_x86_64:main -``` +## Sanity Checks -Packages needed: +Tests of the integrity of the build are enabled by default and can be run +with ctest: ``` -yum install -y numactl-devel elfutils-libelf-devel vim-common git-lfs -pip install CppHeaderParser +ctest --test-dir build ``` + +Testing functionality on an actual GPU is in progress and will be documented +separately. diff --git a/cmake/therock_features.cmake b/cmake/therock_features.cmake new file mode 100644 index 0000000..404c457 --- /dev/null +++ b/cmake/therock_features.cmake @@ -0,0 +1,103 @@ +# therock_features.cmake +# Registry of features that can be enabled/disabled when building TheRock. +# In this context, "feature" can refer to either a top-level component/project +# or some optional configuration of it (typically as "project_feature"). +# Features can have dependencies, which are a superset of the project +# dependencies and must be kept rationalized by hand. +# +# Each feature results in the following changes to the caller scope: +# THEROCK_ENABLE_${feature_name}: boolean of whether enabled/disabled +# THEROCK_REQUIRES_${feature_name}: List of features that are required to +# be enabled for this feature +# THEROCK_ALL_FEATURES: Added to this global list of features. +# +# A feature is enabled by default unless if the GROUP keyword is specified. +# In this case, it's default state is dependent on THEROCK_ENABLE_${group}. + +function(therock_add_feature feature_name) + cmake_parse_arguments(PARSE_ARGV 1 ARG + "" + "GROUP;DESCRIPTION" + "REQUIRES" + ) + + set(_default_enabled ON) + if(ARG_GROUP) + if(NOT "${THEROCK_ENABLE_${ARG_GROUP}}") + set(_default_enabled OFF) + endif() + endif() + if(THEROCK_RESET_FEATURES) + set(_force "FORCE") + endif() + + # Validate. + if("${feature_name}" IN_LIST THEROCK_ALL_FEATURES) + message(FATAL_ERROR "CMake feature already defined: ${feature_name}") + endif() + foreach(require ${ARG_REQUIRES}) + if(NOT DEFINED THEROCK_ENABLE_${require}) + message(FATAL_ERROR "CMake feature order error: ${feature_name} requires ${require} which was not defined first") + endif() + endforeach() + + # Set up the cache option and inject the effective value into the parent + # scope. + set(THEROCK_ENABLE_${feature_name} ${_default_enabled} CACHE BOOL "${ARG_DESCRIPTION}" ${_force}) + set(_actual $CACHE{THEROCK_ENABLE_${feature_name}}) + set(THEROCK_ENABLE_${feature_name} "${_actual}" PARENT_SCOPE) + set(THEROCK_REQUIRES_${feature_name} ${ARG_REQUIRES} PARENT_SCOPE) + set(_all_features ${THEROCK_ALL_FEATURES}) + list(APPEND _all_features "${feature_name}") + set(THEROCK_ALL_FEATURES ${_all_features} PARENT_SCOPE) +endfunction() + +function(therock_finalize_features) + # Force enable any features required of an enabled feature. + # These are processed in reverse declaration order, which ensures a DAG. + set(all_features_reversed ${THEROCK_ALL_FEATURES}) + list(REVERSE all_features_reversed) + set(_implicit_features) + foreach(feature_name ${all_features_reversed}) + if(THEROCK_ENABLE_${feature_name}) + foreach(require ${THEROCK_REQUIRES_${feature_name}}) + if(NOT THEROCK_ENABLE_${require}) + set(THEROCK_ENABLE_${require} ON PARENT_SCOPE) + set(THEROCK_ENABLE_${require} ON) + list(APPEND _implicit_features ${require}) + endif() + endforeach() + endif() + endforeach() + + if(_implicit_features) + list(REMOVE_DUPLICATES _implicit_features) + list(JOIN _implicit_features " " _implicit_features_spaces) + message(STATUS "Implicitly enabled features: ${_implicit_features_spaces}") + endif() +endfunction() + +function(therock_report_features) + # And report. + message(STATUS "Enabled features:") + set(_available_list) + foreach(feature_name ${THEROCK_ALL_FEATURES}) + if(THEROCK_ENABLE_${feature_name}) + message(STATUS " * ${feature_name} (-DTHEROCK_ENABLE_${feature_name}=ON)") + else() + list(APPEND _available_list "${feature_name}") + endif() + endforeach() + if(_available_list) + message(STATUS "Disabled features:") + foreach(feature_name ${_available_list}) + message(STATUS " * ${feature_name} (-DTHEROCK_ENABLE_${feature_name}=OFF)") + endforeach() + endif() + + # Reset the force disable flag. + if(THEROCK_RESET_FEATURES) + set(THEROCK_RESET_FEATURES OFF CACHE BOOL "" FORCE) + set(THEROCK_RESET_FEATURES OFF PARENT_SCOPE) + endif() +endfunction() diff --git a/cmake/therock_subproject.cmake b/cmake/therock_subproject.cmake index eec7ab6..ba6206b 100644 --- a/cmake/therock_subproject.cmake +++ b/cmake/therock_subproject.cmake @@ -271,7 +271,9 @@ function(therock_cmake_subproject_provide_package target_name package_name relat set_property(TARGET "${target_name}" APPEND PROPERTY THEROCK_PROVIDE_PACKAGES "${package_name}") set(_relpath_name THEROCK_PACKAGE_RELPATH_${package_name}) set_property(TARGET "${target_name}" PROPERTY ${_relpath_name} "${relative_path}") - message(STATUS "PROVIDE ${package_name} = ${relative_path} (from ${target_name})") + if(THEROCK_VERBOSE) + message(STATUS "PROVIDE ${package_name} = ${relative_path} (from ${target_name})") + endif() endfunction() # therock_cmake_subproject_activate @@ -323,7 +325,7 @@ function(therock_cmake_subproject_activate target_name) endif() # Report transitive runtime deps. - if(_runtime_deps) + if(_runtime_deps AND THEROCK_VERBOSE) list(JOIN _runtime_deps " " _runtime_deps_pretty) message(STATUS " RUNTIME_DEPS: ${_runtime_deps_pretty}") endif() @@ -340,9 +342,11 @@ function(therock_cmake_subproject_activate target_name) # _init.cmake. if(_private_program_dirs) set(CMAKE_PROGRAM_PATH ${_private_program_dirs} ${CMAKE_PROGRAM_PATH}) - foreach(_message_contents ${_private_program_dirs}) - message(STATUS " PROGRAM_DIR: ${_message_contents}") - endforeach() + if(THEROCK_VERBOSE) + foreach(_message_contents ${_private_program_dirs}) + message(STATUS " PROGRAM_DIR: ${_message_contents}") + endforeach() + endif() endif() # Generate the project_init.cmake @@ -359,7 +363,9 @@ function(therock_cmake_subproject_activate target_name) string(APPEND _init_contents "${_deps_contents}") string(APPEND _init_contents "set(THEROCK_IGNORE_PACKAGES \"@_ignore_packages@\")\n") foreach(_private_link_dir ${_private_link_dirs}) - message(STATUS " LINK_DIR: ${_private_link_dir}") + if(THEROCK_VERBOSE) + message(STATUS " LINK_DIR: ${_private_link_dir}") + endif() string(APPEND _init_contents "string(APPEND CMAKE_EXE_LINKER_FLAGS \" -Wl,-rpath-link,${_private_link_dir}\")\n") string(APPEND _init_contents "string(APPEND CMAKE_SHARED_LINKER_FLAGS \" -Wl,-rpath-link,${_private_link_dir}\")\n") endforeach() @@ -388,7 +394,9 @@ function(therock_cmake_subproject_activate target_name) endif() # configure target - message(STATUS " CONFIGURE_DEPENDS: ${_transitive_configure_depend_files} ") + if(THEROCK_VERBOSE) + message(STATUS " CONFIGURE_DEPENDS: ${_transitive_configure_depend_files} ") + endif() set(_configure_stamp_file "${_stamp_dir}/configure.stamp") set(_configure_comment_suffix " (in background)") set(_terminal_option) @@ -397,7 +405,9 @@ function(therock_cmake_subproject_activate target_name) set(_terminal_option "USES_TERMINAL") set(_configure_comment_suffix) elseif(_build_pool) - message(STATUS " JOB_POOL: ${_build_pool}") + if(THEROCK_VERBOSE) + message(STATUS " JOB_POOL: ${_build_pool}") + endif() set(_build_terminal_option JOB_POOL "${_build_pool}") set(_build_comment_suffix " (in background)") endif() @@ -633,7 +643,9 @@ function(_therock_cmake_subproject_setup_deps out_contents) endif() set(_find_package_path "${_stage_dir}") cmake_path(APPEND _find_package_path "${_relpath}") - message(STATUS "INJECT ${_package_name} = ${_find_package_path} (from ${dep_target})") + if(THEROCK_VERBOSE) + message(STATUS "INJECT ${_package_name} = ${_find_package_path} (from ${dep_target})") + endif() string(APPEND _contents "set(THEROCK_PACKAGE_DIR_${_package_name} \"${_find_package_path}\")\n") string(APPEND _contents "list(APPEND THEROCK_PROVIDED_PACKAGES ${_package_name})\n") endforeach() @@ -789,12 +801,14 @@ function(_therock_cmake_subproject_setup_toolchain compiler_toolchain toolchain_ string(APPEND _toolchain_contents "set(GPU_TARGETS @THEROCK_AMDGPU_TARGETS@ CACHE STRING \"From super-project\" FORCE)\n") string(APPEND _toolchain_contents "string(APPEND CMAKE_CXX_FLAGS_INIT \" ${_amd_llvm_cxx_flags_spaces}\")\n") - message(STATUS "Compiler toolchain ${compiler_toolchain}:") - string(APPEND CMAKE_MESSAGE_INDENT " ") - message(STATUS "CMAKE_C_COMPILER = ${AMD_LLVM_C_COMPILER}") - message(STATUS "CMAKE_CXX_COMPILER = ${AMD_LLVM_CXX_COMPILER}") - message(STATUS "CMAKE_LINKER = ${AMD_LLVM_LINKER}") - message(STATUS "GPU_TARGETS = ${THEROCK_AMDGPU_TARGETS_SPACES}") + if(THEROCK_VERBOSE) + message(STATUS "Compiler toolchain ${compiler_toolchain}:") + string(APPEND CMAKE_MESSAGE_INDENT " ") + message(STATUS "CMAKE_C_COMPILER = ${AMD_LLVM_C_COMPILER}") + message(STATUS "CMAKE_CXX_COMPILER = ${AMD_LLVM_CXX_COMPILER}") + message(STATUS "CMAKE_LINKER = ${AMD_LLVM_LINKER}") + message(STATUS "GPU_TARGETS = ${THEROCK_AMDGPU_TARGETS_SPACES}") + endif() else() message(FATAL_ERROR "Unsupported COMPILER_TOOLCHAIN = ${compiler_toolchain} (supported: 'amd-llvm' or none)") endif() @@ -809,7 +823,9 @@ function(_therock_cmake_subproject_setup_toolchain compiler_toolchain toolchain_ list(APPEND _compiler_toolchain_addl_depends "${_hip_stamp_dir}/dist.stamp") string(APPEND _toolchain_contents "string(APPEND CMAKE_CXX_FLAGS_INIT \" --hip-path=@_hip_dist_dir@\")\n") string(APPEND _toolchain_contents "string(APPEND CMAKE_CXX_FLAGS_INIT \" --hip-device-lib-path=@_amd_llvm_device_lib_path@\")\n") - message(STATUS "HIP_DIR = ${_hip_dist_dir}") + if(THEROCK_VERBOSE) + message(STATUS "HIP_DIR = ${_hip_dist_dir}") + endif() endif() set(_compiler_toolchain_addl_depends "${_compiler_toolchain_addl_depends}" PARENT_SCOPE) diff --git a/comm-libs/CMakeLists.txt b/comm-libs/CMakeLists.txt index 8b0dbdf..974602d 100644 --- a/comm-libs/CMakeLists.txt +++ b/comm-libs/CMakeLists.txt @@ -1,7 +1,7 @@ if(THEROCK_ENABLE_RCCL) - ################################################################################# + ############################################################################## # rccl - ################################################################################# + ############################################################################## therock_cmake_subproject_declare(rccl EXTERNAL_SOURCE_DIR "rccl" @@ -47,6 +47,4 @@ if(THEROCK_ENABLE_RCCL) SUBPROJECT_DEPS rccl ) -else() - message(STATUS "Not building RCCL (THEROCK_ENABLE_RCCL=OFF)") -endif() +endif(THEROCK_ENABLE_RCCL) diff --git a/compiler/CMakeLists.txt b/compiler/CMakeLists.txt index 80288b4..d8a916e 100644 --- a/compiler/CMakeLists.txt +++ b/compiler/CMakeLists.txt @@ -1,152 +1,151 @@ -################################################################################ -# amd-llvm -# Everything built as part of LLVM installs to lib/llvm -# This includes the device-libs, since they must be findable by the compiler -# frontend. -################################################################################ - -set(_extra_llvm_cmake_args) -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - list(APPEND _extra_llvm_cmake_args "-DLLVM_ENABLE_PEDANTIC=OFF") -endif() - -therock_cmake_subproject_declare(amd-llvm - EXTERNAL_SOURCE_DIR "amd-llvm" - # Note that LLVM top level CMakeLists.txt is in the llvm subdir of the - # monorepo. - CMAKE_LISTS_RELPATH "llvm" - INTERFACE_PROGRAM_DIRS - lib/llvm/bin - CMAKE_ARGS - # LIBCXX - -DLIBCXX_ENABLE_SHARED=OFF - -DLIBCXX_ENABLE_STATIC=ON - -DLIBCXX_INSTALL_LIBRARY=OFF - -DLIBCXX_INSTALL_HEADERS=OFF - -DLIBCXXABI_ENABLE_SHARED=OFF - -DLIBCXXABI_ENABLE_STATIC=ON - - # Features - -DLLVM_INCLUDE_TESTS=OFF - -DLLVM_ENABLE_ZLIB=ON - -DLLVM_ENABLE_Z3_SOLVER=OFF - -DLLVM_AMDGPU_ALLOW_NPI_TARGETS=ON - -DCLANG_DEFAULT_LINKER=lld - -DCLANG_DEFAULT_RTLIB=compiler-rt - -DCLANG_DEFAULT_UNWINDLIB=libgcc - -DCLANG_ENABLE_AMDCLANG=ON - - ${_extra_llvm_cmake_args} - BUILD_DEPS - rocm-cmake - # The entire LLVM install tree is placed inside of the overall ROCM lib/llvm - # directory. - INSTALL_DESTINATION "lib/llvm" - INTERFACE_LINK_DIRS - "lib/llvm/lib" -) -# Note that we do not trigger on LLVM source changes because the monorepo is -# too large to glob like that. Consider having a project dev mode option for -# enabling better ergonomics here. - -therock_cmake_subproject_provide_package(amd-llvm AMDDeviceLibs lib/llvm/lib/cmake/AMDDeviceLibs) -therock_cmake_subproject_provide_package(amd-llvm Clang lib/llvm/lib/cmake/clang) -therock_cmake_subproject_provide_package(amd-llvm LLD lib/llvm/lib/cmake/lld) -therock_cmake_subproject_provide_package(amd-llvm LLVM lib/llvm/lib/cmake/llvm) -therock_cmake_subproject_activate(amd-llvm) - - -################################################################################# -# comgr -# A client of libLLVM which provides an in-process compiler API to the HIP -# runtime. -################################################################################# - -therock_cmake_subproject_declare(amd-comgr - EXTERNAL_SOURCE_DIR "amd-llvm/amd/comgr" - BINARY_DIR "amd-comgr" - BACKGROUND_BUILD - CMAKE_ARGS - # TODO: Currently unstable. Enable in >6.4. - -DCOMGR_DISABLE_SPIRV=ON - -DLLVM_LINK_LLVM_DYLIB=ON - # The comgr tests have a circular dependency on the HIP runtime. - # https://github.com/nod-ai/TheRock/issues/67 - -DBUILD_TESTING=OFF - BUILD_DEPS - rocm-cmake - RUNTIME_DEPS - amd-llvm -) -therock_cmake_subproject_provide_package(amd-comgr amd_comgr lib/cmake/amd_comgr) -therock_cmake_subproject_activate(amd-comgr) - -################################################################################# -# hipcc -# Provides hipcc and hipconfig -################################################################################# - -therock_cmake_subproject_declare(hipcc - EXTERNAL_SOURCE_DIR "amd-llvm/amd/hipcc" - BINARY_DIR "hipcc" - BACKGROUND_BUILD - CMAKE_ARGS - -DHIPCC_BACKWARD_COMPATIBILITY=OFF - BUILD_DEPS - rocm-cmake - RUNTIME_DEPS - amd-llvm -) -therock_cmake_subproject_activate(hipcc) - -################################################################################# -# HIPIFY -################################################################################# - -therock_cmake_subproject_declare(hipify - EXTERNAL_SOURCE_DIR "hipify" - BACKGROUND_BUILD - INTERFACE_PROGRAM_DIRS - bin - CMAKE_ARGS - -DHIPIFY_INSTALL_CLANG_HEADERS=OFF - BUILD_DEPS - rocm-cmake - RUNTIME_DEPS - amd-llvm -) -therock_cmake_subproject_glob_c_sources(hipify - SUBDIRS - src -) -therock_cmake_subproject_activate(hipify) - - -################################################################################ -# Artifacts -################################################################################ - -therock_provide_artifact(amd-llvm - TARGET_NEUTRAL - DESCRIPTOR artifact-amd-llvm.toml - COMPONENTS - dbg - dev - doc - lib - run - SUBPROJECT_DEPS - amd-llvm - amd-comgr - hipcc -) - -therock_provide_artifact(hipify - TARGET_NEUTRAL - DESCRIPTOR artifact-hipify.toml - COMPONENTS - run - dbg - SUBPROJECT_DEPS - hipify -) +if(THEROCK_ENABLE_COMPILER) + ############################################################################## + # amd-llvm + # Everything built as part of LLVM installs to lib/llvm + # This includes the device-libs, since they must be findable by the compiler + # frontend. + ############################################################################## + + set(_extra_llvm_cmake_args) + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + list(APPEND _extra_llvm_cmake_args "-DLLVM_ENABLE_PEDANTIC=OFF") + endif() + + therock_cmake_subproject_declare(amd-llvm + EXTERNAL_SOURCE_DIR "amd-llvm" + # Note that LLVM top level CMakeLists.txt is in the llvm subdir of the + # monorepo. + CMAKE_LISTS_RELPATH "llvm" + INTERFACE_PROGRAM_DIRS + lib/llvm/bin + CMAKE_ARGS + # LIBCXX + -DLIBCXX_ENABLE_SHARED=OFF + -DLIBCXX_ENABLE_STATIC=ON + -DLIBCXX_INSTALL_LIBRARY=OFF + -DLIBCXX_INSTALL_HEADERS=OFF + -DLIBCXXABI_ENABLE_SHARED=OFF + -DLIBCXXABI_ENABLE_STATIC=ON + + # Features + -DLLVM_INCLUDE_TESTS=OFF + -DLLVM_ENABLE_ZLIB=ON + -DLLVM_ENABLE_Z3_SOLVER=OFF + -DLLVM_AMDGPU_ALLOW_NPI_TARGETS=ON + -DCLANG_DEFAULT_LINKER=lld + -DCLANG_DEFAULT_RTLIB=compiler-rt + -DCLANG_DEFAULT_UNWINDLIB=libgcc + -DCLANG_ENABLE_AMDCLANG=ON + + ${_extra_llvm_cmake_args} + BUILD_DEPS + rocm-cmake + # The entire LLVM install tree is placed inside of the overall ROCM lib/llvm + # directory. + INSTALL_DESTINATION "lib/llvm" + INTERFACE_LINK_DIRS + "lib/llvm/lib" + ) + # Note that we do not trigger on LLVM source changes because the monorepo is + # too large to glob like that. Consider having a project dev mode option for + # enabling better ergonomics here. + + therock_cmake_subproject_provide_package(amd-llvm AMDDeviceLibs lib/llvm/lib/cmake/AMDDeviceLibs) + therock_cmake_subproject_provide_package(amd-llvm Clang lib/llvm/lib/cmake/clang) + therock_cmake_subproject_provide_package(amd-llvm LLD lib/llvm/lib/cmake/lld) + therock_cmake_subproject_provide_package(amd-llvm LLVM lib/llvm/lib/cmake/llvm) + therock_cmake_subproject_activate(amd-llvm) + + + ############################################################################## + # comgr + # A client of libLLVM which provides an in-process compiler API to the HIP + # runtime. + ############################################################################## + + therock_cmake_subproject_declare(amd-comgr + EXTERNAL_SOURCE_DIR "amd-llvm/amd/comgr" + BINARY_DIR "amd-comgr" + BACKGROUND_BUILD + CMAKE_ARGS + # TODO: Currently unstable. Enable in >6.4. + -DCOMGR_DISABLE_SPIRV=ON + -DLLVM_LINK_LLVM_DYLIB=ON + # The comgr tests have a circular dependency on the HIP runtime. + # https://github.com/nod-ai/TheRock/issues/67 + -DBUILD_TESTING=OFF + BUILD_DEPS + rocm-cmake + RUNTIME_DEPS + amd-llvm + ) + therock_cmake_subproject_provide_package(amd-comgr amd_comgr lib/cmake/amd_comgr) + therock_cmake_subproject_activate(amd-comgr) + + ############################################################################## + # hipcc + # Provides hipcc and hipconfig + ############################################################################## + + therock_cmake_subproject_declare(hipcc + EXTERNAL_SOURCE_DIR "amd-llvm/amd/hipcc" + BINARY_DIR "hipcc" + BACKGROUND_BUILD + CMAKE_ARGS + -DHIPCC_BACKWARD_COMPATIBILITY=OFF + BUILD_DEPS + rocm-cmake + RUNTIME_DEPS + amd-llvm + ) + therock_cmake_subproject_activate(hipcc) + + therock_provide_artifact(amd-llvm + TARGET_NEUTRAL + DESCRIPTOR artifact-amd-llvm.toml + COMPONENTS + dbg + dev + doc + lib + run + SUBPROJECT_DEPS + amd-llvm + amd-comgr + hipcc + ) +endif(THEROCK_ENABLE_COMPILER) + +if(THEROCK_ENABLE_HIPIFY) + ############################################################################## + # HIPIFY + ############################################################################## + + therock_cmake_subproject_declare(hipify + EXTERNAL_SOURCE_DIR "hipify" + BACKGROUND_BUILD + INTERFACE_PROGRAM_DIRS + bin + CMAKE_ARGS + -DHIPIFY_INSTALL_CLANG_HEADERS=OFF + BUILD_DEPS + rocm-cmake + RUNTIME_DEPS + amd-llvm + ) + therock_cmake_subproject_glob_c_sources(hipify + SUBDIRS + src + ) + therock_cmake_subproject_activate(hipify) + + therock_provide_artifact(hipify + TARGET_NEUTRAL + DESCRIPTOR artifact-hipify.toml + COMPONENTS + run + dbg + SUBPROJECT_DEPS + hipify + ) +endif(THEROCK_ENABLE_HIPIFY) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index e52f67a..cd5a2f2 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -1,112 +1,111 @@ -################################################################################ -# ROCR-Runtime -################################################################################ +if(THEROCK_ENABLE_CORE_RUNTIME) + ############################################################################## + # ROCR-Runtime + ############################################################################## -therock_cmake_subproject_declare(ROCR-Runtime - EXTERNAL_SOURCE_DIR "ROCR-Runtime" - BACKGROUND_BUILD - CMAKE_ARGS - "-DBUILD_SHARED_LIBS=ON" - BUILD_DEPS - amd-llvm - RUNTIME_DEPS - rocprofiler-register - INTERFACE_LINK_DIRS - "lib" -) -therock_cmake_subproject_glob_c_sources(ROCR-Runtime - SUBDIRS - libhsakmt - runtime -) -therock_cmake_subproject_provide_package(ROCR-Runtime hsakmt lib/cmake/hsakmt) -therock_cmake_subproject_provide_package(ROCR-Runtime hsa-runtime64 lib/cmake/hsa-runtime64) -therock_cmake_subproject_activate(ROCR-Runtime) + therock_cmake_subproject_declare(ROCR-Runtime + EXTERNAL_SOURCE_DIR "ROCR-Runtime" + BACKGROUND_BUILD + CMAKE_ARGS + "-DBUILD_SHARED_LIBS=ON" + BUILD_DEPS + amd-llvm + RUNTIME_DEPS + rocprofiler-register + INTERFACE_LINK_DIRS + "lib" + ) + therock_cmake_subproject_glob_c_sources(ROCR-Runtime + SUBDIRS + libhsakmt + runtime + ) + therock_cmake_subproject_provide_package(ROCR-Runtime hsakmt lib/cmake/hsakmt) + therock_cmake_subproject_provide_package(ROCR-Runtime hsa-runtime64 lib/cmake/hsa-runtime64) + therock_cmake_subproject_activate(ROCR-Runtime) + ############################################################################## + # rocminfo + ############################################################################## -################################################################################ -# clr -# The primary HIP compiler and runtime target. This is also the project used -# to root the "amd-hip" compiler toolchain and is a superset of amd-llvm. -# As a particularly sharp edge, the `hipconfig` tool is really only fully -# functional from this project (which contributes version and metadata). -################################################################################ + therock_cmake_subproject_declare(rocminfo + EXTERNAL_SOURCE_DIR "rocminfo" + BACKGROUND_BUILD + RUNTIME_DEPS + ROCR-Runtime + ) + therock_cmake_subproject_glob_c_sources(rocminfo SUBDIRS .) + therock_cmake_subproject_activate(rocminfo) -therock_cmake_subproject_declare(hip-clr - EXTERNAL_SOURCE_DIR "clr" - INTERFACE_PROGRAM_DIRS - bin - BACKGROUND_BUILD - CMAKE_ARGS - -DHIP_PLATFORM=amd - "-DHIP_COMMON_DIR=${CMAKE_CURRENT_SOURCE_DIR}/HIP" - -DCLR_BUILD_HIP=ON - # Legacy: Disable various auto-detection logic that breaks out of jail - # and can use local machine tools. - -DHIPCC_BIN_DIR= - BUILD_DEPS - rocm-cmake - RUNTIME_DEPS - amd-llvm - amd-comgr - hipcc # For hipconfig - rocm-core - rocprofiler-register - ROCR-Runtime - INTERFACE_LINK_DIRS - "lib" -) -therock_cmake_subproject_glob_c_sources(hip-clr SUBDIRS .) -therock_cmake_subproject_provide_package(hip-clr hip lib/cmake/hip) -# TODO: Some projects resolve "hip" vs "HIP" so we advertise both, but this isn't -# great. -therock_cmake_subproject_provide_package(hip-clr HIP lib/cmake/hip) -therock_cmake_subproject_provide_package(hip-clr hip-lang lib/cmake/hip-lang) -therock_cmake_subproject_provide_package(hip-clr hiprtc lib/cmake/hiprtc) -therock_cmake_subproject_activate(hip-clr) + therock_provide_artifact(core-runtime + TARGET_NEUTRAL + DESCRIPTOR artifact-core-runtime.toml + COMPONENTS + dbg + dev + doc + lib + run + SUBPROJECT_DEPS + ROCR-Runtime + rocminfo + ) +endif(THEROCK_ENABLE_CORE_RUNTIME) -################################################################################ -# rocminfo -################################################################################ +if(THEROCK_ENABLE_HIP_RUNTIME) + ############################################################################## + # clr + # The primary HIP compiler and runtime target. This is also the project used + # to root the "amd-hip" compiler toolchain and is a superset of amd-llvm. + # As a particularly sharp edge, the `hipconfig` tool is really only fully + # functional from this project (which contributes version and metadata). + ############################################################################## -therock_cmake_subproject_declare(rocminfo - EXTERNAL_SOURCE_DIR "rocminfo" - BACKGROUND_BUILD - RUNTIME_DEPS - ROCR-Runtime -) -therock_cmake_subproject_glob_c_sources(rocminfo SUBDIRS .) -therock_cmake_subproject_activate(rocminfo) + therock_cmake_subproject_declare(hip-clr + EXTERNAL_SOURCE_DIR "clr" + INTERFACE_PROGRAM_DIRS + bin + BACKGROUND_BUILD + CMAKE_ARGS + -DHIP_PLATFORM=amd + "-DHIP_COMMON_DIR=${CMAKE_CURRENT_SOURCE_DIR}/HIP" + -DCLR_BUILD_HIP=ON + # Legacy: Disable various auto-detection logic that breaks out of jail + # and can use local machine tools. + -DHIPCC_BIN_DIR= + BUILD_DEPS + rocm-cmake + RUNTIME_DEPS + amd-llvm + amd-comgr + hipcc # For hipconfig + rocm-core + rocprofiler-register + ROCR-Runtime + INTERFACE_LINK_DIRS + "lib" + ) + therock_cmake_subproject_glob_c_sources(hip-clr SUBDIRS .) + therock_cmake_subproject_provide_package(hip-clr hip lib/cmake/hip) + # TODO: Some projects resolve "hip" vs "HIP" so we advertise both, but this isn't + # great. + therock_cmake_subproject_provide_package(hip-clr HIP lib/cmake/hip) + therock_cmake_subproject_provide_package(hip-clr hip-lang lib/cmake/hip-lang) + therock_cmake_subproject_provide_package(hip-clr hiprtc lib/cmake/hiprtc) + therock_cmake_subproject_activate(hip-clr) -################################################################################ -# Artifacts -################################################################################ - -therock_provide_artifact(core-runtime - TARGET_NEUTRAL - DESCRIPTOR artifact-core-runtime.toml - COMPONENTS - dbg - dev - doc - lib - run - SUBPROJECT_DEPS - ROCR-Runtime - rocminfo -) - -therock_provide_artifact(core-hip - TARGET_NEUTRAL - DESCRIPTOR artifact-core-hip.toml - COMPONENTS - dbg - dev - doc - lib - run - SUBPROJECT_DEPS - hip-clr -) + therock_provide_artifact(core-hip + TARGET_NEUTRAL + DESCRIPTOR artifact-core-hip.toml + COMPONENTS + dbg + dev + doc + lib + run + SUBPROJECT_DEPS + hip-clr + ) +endif(THEROCK_ENABLE_HIP_RUNTIME) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 5d6514c..b629cd7 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -6,5 +6,13 @@ add_test( "-DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/cpp-sdk-user" "-DBINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/cpp-sdk-user" "-DGENERATOR=${CMAKE_GENERATOR}" + "-DTHEROCK_ENABLE_BLAS=${THEROCK_ENABLE_BLAS}" + "-DTHEROCK_ENABLE_HIP=${THEROCK_ENABLE_HIP_RUNTIME}" + "-DTHEROCK_ENABLE_MIOPEN=${THEROCK_ENABLE_MIOPEN}" + "-DTHEROCK_ENABLE_PRIM=${THEROCK_ENABLE_PRIM}" + "-DTHEROCK_ENABLE_RAND=${THEROCK_ENABLE_RAND}" + "-DTHEROCK_ENABLE_RCCL=${THEROCK_ENABLE_RCCL}" + "-DTHEROCK_ENABLE_SOLVER=${THEROCK_ENABLE_SOLVER}" + "-DTHEROCK_ENABLE_SPARSE=${THEROCK_ENABLE_SPARSE}" -P "${CMAKE_CURRENT_SOURCE_DIR}/clean_configure_test_project.cmake" ) diff --git a/examples/clean_configure_test_project.cmake b/examples/clean_configure_test_project.cmake index c27211c..00422a6 100644 --- a/examples/clean_configure_test_project.cmake +++ b/examples/clean_configure_test_project.cmake @@ -8,6 +8,15 @@ execute_process( "${SOURCE_DIR}" "${BINARY_DIR}" --build-generator "${GENERATOR}" + --build-options + "-DTHEROCK_ENABLE_BLAS=${THEROCK_ENABLE_BLAS}" + "-DTHEROCK_ENABLE_HIP=${THEROCK_ENABLE_HIP}" + "-DTHEROCK_ENABLE_MIOPEN=${THEROCK_ENABLE_MIOPEN}" + "-DTHEROCK_ENABLE_PRIM=${THEROCK_ENABLE_PRIM}" + "-DTHEROCK_ENABLE_RAND=${THEROCK_ENABLE_RAND}" + "-DTHEROCK_ENABLE_RCCL=${THEROCK_ENABLE_RCCL}" + "-DTHEROCK_ENABLE_SOLVER=${THEROCK_ENABLE_SOLVER}" + "-DTHEROCK_ENABLE_SPARSE=${THEROCK_ENABLE_SPARSE}" --test-command "${CMAKE_CTEST_COMMAND}" --output-on-failure RESULT_VARIABLE CMD_RESULT ) diff --git a/examples/cpp-sdk-user/CMakeLists.txt b/examples/cpp-sdk-user/CMakeLists.txt index ccf4d2a..c1be380 100644 --- a/examples/cpp-sdk-user/CMakeLists.txt +++ b/examples/cpp-sdk-user/CMakeLists.txt @@ -12,55 +12,60 @@ enable_testing() set(CMAKE_CXX_STANDARD 17) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -option(HAVE_BLAS "Whether hipblas/hipblaslt/rocblas are available" ON) -option(HAVE_HIP "Whether the HIP runtime and compiler are available" ON) -option(HAVE_MIOPEN "Whether MIOpen is available" ON) -option(HAVE_PRIM "Whether rocprim is available" ON) -option(HAVE_RAND "Whether rocrand/hiprand are available" ON) -option(HAVE_RCCL "Whether rccl is available" ON) -option(HAVE_SOLVER "Whether rocsolver/hipsolver are available" ON) -option(HAVE_SPARSE "Whether rocsparse/hipsparse are available" ON) +# If defining a new option, ensure it is in the outer CMakeLists.txt and +# the clean_configure_test_project.cmake to ensure it is passed from the +# parent when testing. +option(THEROCK_ENABLE_BLAS "Whether hipblas/hipblaslt/rocblas are available" ON) +option(THEROCK_ENABLE_HIP "Whether the HIP runtime and compiler are available" ON) +option(THEROCK_ENABLE_MIOPEN "Whether MIOpen is available" ON) +option(THEROCK_ENABLE_PRIM "Whether rocprim is available" ON) +option(THEROCK_ENABLE_RAND "Whether rocrand/hiprand are available" ON) +option(THEROCK_ENABLE_RCCL "Whether rccl is available" ON) +option(THEROCK_ENABLE_SOLVER "Whether rocsolver/hipsolver are available" ON) +option(THEROCK_ENABLE_SPARSE "Whether rocsparse/hipsparse are available" ON) # Because we use this project as a test, we include validation that the found # packages are sound. Users do not need to include this or call any of the # `validate_*` functions. include(validate_rocm_sdk) -# TODO: Don't require HIP_PLATFORM https://github.com/nod-ai/TheRock/issues/68 -set(HIP_PLATFORM "amd") -find_package(hip CONFIG REQUIRED) -validate_hip_package_found() +if(THEROCK_ENABLE_HIP) + # TODO: Don't require HIP_PLATFORM https://github.com/nod-ai/TheRock/issues/68 + set(HIP_PLATFORM "amd") + find_package(hip CONFIG REQUIRED) + validate_hip_package_found() +endif() -if(HAVE_RAND) +if(THEROCK_ENABLE_RAND) find_package(hiprand CONFIG REQUIRED) find_package(rocrand CONFIG REQUIRED) message(STATUS "hiprand version: ${hiprand_VERSION}") message(STATUS "rocrand version: ${rocrand_VERSION}") endif() -if(HAVE_SPARSE) +if(THEROCK_ENABLE_SPARSE) find_package(hipsparse CONFIG REQUIRED) find_package(rocsparse CONFIG REQUIRED) message(STATUS "hipsparse version: ${hipsparse_VERSION}") message(STATUS "rocsparse version: ${rocsparse_VERSION}") endif() -if(HAVE_PRIM) +if(THEROCK_ENABLE_PRIM) find_package(rocprim CONFIG REQUIRED) message(STATUS "rocprim version: ${rocprim_VERSION}") endif() -if(HAVE_SOLVER) +if(THEROCK_ENABLE_SOLVER) find_package(rocsolver CONFIG REQUIRED) message(STATUS "rocsolver version: ${rocsolver_VERSION}") endif() -if(HAVE_RCCL) +if(THEROCK_ENABLE_RCCL) find_package(rccl CONFIG REQUIRED) message(STATUS "rccl version: ${rccl_VERSION}") endif() -if(HAVE_BLAS) +if(THEROCK_ENABLE_BLAS) find_package(hipblaslt CONFIG REQUIRED) find_package(hipblas CONFIG REQUIRED) find_package(rocblas CONFIG REQUIRED) @@ -69,12 +74,12 @@ if(HAVE_BLAS) message(STATUS "rocblas version: ${rocblas_VERSION}") endif() -if(HAVE_MIOPEN) +if(THEROCK_ENABLE_MIOPEN) find_package(miopen CONFIG REQUIRED) message(STATUS "miopen version: ${miopen_VERSION}") endif() -if(HAVE_HIP) +if(THEROCK_ENABLE_HIP) add_executable( hip-host-test hip-host-test.cpp diff --git a/math-libs/CMakeLists.txt b/math-libs/CMakeLists.txt index ff844c6..4fc141c 100644 --- a/math-libs/CMakeLists.txt +++ b/math-libs/CMakeLists.txt @@ -1,375 +1,385 @@ -# Many things need to be configured with paths to additional LLVM tools. -# If a project is using an amd-hip or amd-llvm toolchain, then it will already -# have an implicit dep on the toolchain, so it is safe to reference binaries -# here without worrying about build deps. -therock_cmake_subproject_dist_dir(_hip_dir hip-clr) -cmake_path(APPEND _hip_dir lib/llvm OUTPUT_VARIABLE _toolchain_dir) +if(THEROCK_ENABLE_BLAS) + # Many things need to be configured with paths to additional LLVM tools. + # If a project is using an amd-hip or amd-llvm toolchain, then it will already + # have an implicit dep on the toolchain, so it is safe to reference binaries + # here without worrying about build deps. + therock_cmake_subproject_dist_dir(_blas_hack_hip_dir hip-clr) + cmake_path(APPEND _blas_hack_hip_dir lib/llvm OUTPUT_VARIABLE _toolchain_dir) -################################################################################# -# hipBLAS-common -################################################################################# -set(_blas_subproject_names) + ############################################################################## + # hipBLAS-common + ############################################################################## + set(_blas_subproject_names) -therock_cmake_subproject_declare(hipBLAS-common - EXTERNAL_SOURCE_DIR "hipBLAS-common" - BACKGROUND_BUILD - CMAKE_ARGS - -DROCM_PATH= - -DROCM_DIR= - COMPILER_TOOLCHAIN - amd-hip - IGNORE_PACKAGES - # The current version of rccl needs to download a 2y old version of rocm-cmake - # to work and it will only do so if the system resolver reports it not found - # without any other error (which due to the signature, our resolver will - # hard fail). Once fixed, `rocm-core` should be added to the BUILD_DEPS - # and this removed: https://github.com/nod-ai/TheRock/issues/18 - ROCM - RUNTIME_DEPS - hip-clr -) -therock_cmake_subproject_glob_c_sources(hipBLAS-common - SUBDIRS - library -) -therock_cmake_subproject_provide_package(hipBLAS-common hipblas-common lib/cmake/hipblas-common) -therock_cmake_subproject_activate(hipBLAS-common) -list(APPEND _blas_subproject_names hipBLAS-common) + therock_cmake_subproject_declare(hipBLAS-common + EXTERNAL_SOURCE_DIR "hipBLAS-common" + BACKGROUND_BUILD + CMAKE_ARGS + -DROCM_PATH= + -DROCM_DIR= + COMPILER_TOOLCHAIN + amd-hip + IGNORE_PACKAGES + # The current version of rccl needs to download a 2y old version of rocm-cmake + # to work and it will only do so if the system resolver reports it not found + # without any other error (which due to the signature, our resolver will + # hard fail). Once fixed, `rocm-core` should be added to the BUILD_DEPS + # and this removed: https://github.com/nod-ai/TheRock/issues/18 + ROCM + RUNTIME_DEPS + hip-clr + ) + therock_cmake_subproject_glob_c_sources(hipBLAS-common + SUBDIRS + library + ) + therock_cmake_subproject_provide_package(hipBLAS-common hipblas-common lib/cmake/hipblas-common) + therock_cmake_subproject_activate(hipBLAS-common) + list(APPEND _blas_subproject_names hipBLAS-common) -################################################################################# -# hipBLASLt -################################################################################# + ############################################################################## + # hipBLASLt + ############################################################################## -therock_cmake_subproject_declare(hipBLASLt - EXTERNAL_SOURCE_DIR "hipBLASLt" - BACKGROUND_BUILD - CMAKE_ARGS - -DHIP_PLATFORM=amd - -DROCM_PATH= - -DROCM_DIR= - -DTensile_LOGIC= - -DTensile_CODE_OBJECT_VERSION=default - -DTensile_CPU_THREADS= - -DTensile_LIBRARY_FORMAT=msgpack - -DTensile_HIP_CONFIG=${_hip_dir}/bin/hipconfig - "-DTensile_C_COMPILER=${_toolchain_dir}/bin/clang" - "-DTensile_CXX_COMPILER=${_toolchain_dir}/bin/clang++" - "-DTensile_ASSEMBLER=${_toolchain_dir}/bin/clang++" - "-DTensile_OFFLOAD_BUNDLER=${_toolchain_dir}/bin/clang-offload-bundler" - # TODO(#55): Enable once roctracer is added - -DHIPBLASLT_ENABLE_MARKER=OFF - # TODO: Enable clients. - COMPILER_TOOLCHAIN - amd-hip - BUILD_DEPS - hipBLAS-common - therock-msgpack-cxx - RUNTIME_DEPS - hip-clr -) -therock_cmake_subproject_glob_c_sources(hipBLASLt - SUBDIRS - . -) -therock_cmake_subproject_provide_package(hipBLASLt hipblaslt lib/cmake/hipblaslt) -therock_cmake_subproject_activate(hipBLASLt) -list(APPEND _blas_subproject_names hipBLASLt) + therock_cmake_subproject_declare(hipBLASLt + EXTERNAL_SOURCE_DIR "hipBLASLt" + BACKGROUND_BUILD + CMAKE_ARGS + -DHIP_PLATFORM=amd + -DROCM_PATH= + -DROCM_DIR= + -DTensile_LOGIC= + -DTensile_CODE_OBJECT_VERSION=default + -DTensile_CPU_THREADS= + -DTensile_LIBRARY_FORMAT=msgpack + -DTensile_HIP_CONFIG=${_blas_hack_hip_dir}/bin/hipconfig + "-DTensile_C_COMPILER=${_toolchain_dir}/bin/clang" + "-DTensile_CXX_COMPILER=${_toolchain_dir}/bin/clang++" + "-DTensile_ASSEMBLER=${_toolchain_dir}/bin/clang++" + "-DTensile_OFFLOAD_BUNDLER=${_toolchain_dir}/bin/clang-offload-bundler" + # TODO(#55): Enable once roctracer is added + -DHIPBLASLT_ENABLE_MARKER=OFF + # TODO: Enable clients. + COMPILER_TOOLCHAIN + amd-hip + BUILD_DEPS + hipBLAS-common + therock-msgpack-cxx + RUNTIME_DEPS + hip-clr + ) + therock_cmake_subproject_glob_c_sources(hipBLASLt + SUBDIRS + . + ) + therock_cmake_subproject_provide_package(hipBLASLt hipblaslt lib/cmake/hipblaslt) + therock_cmake_subproject_activate(hipBLASLt) + list(APPEND _blas_subproject_names hipBLASLt) -################################################################################# -# rocBLAS -################################################################################# + ############################################################################## + # rocBLAS + ############################################################################## -therock_cmake_subproject_declare(rocBLAS - EXTERNAL_SOURCE_DIR "rocBLAS" - BACKGROUND_BUILD - CMAKE_ARGS - -DHIP_PLATFORM=amd - -DROCM_PATH= - -DROCM_DIR= - # TODO: Fix passing TENSILE_ROCM_ASSEMBLER_PATH. - # Enable building with hipBLASLt afterwards. - -DBUILD_WITH_TENSILE=OFF - -DBUILD_WITH_HIPBLASLT=OFF - # -DTensile_LOGIC= - # -DTensile_CODE_OBJECT_VERSION=default - # -DTensile_CPU_THREADS= - # -DTensile_LIBRARY_FORMAT=msgpack - # "-DTensile_ROCM_ASSEMBLER_PATH=${_toolchain_dir}/bin/clang++" - # "-DTensile_ROCM_OFFLOAD_BUNDLER_PATH=${_toolchain_dir}/bin/clang-offload-bundler" - # TODO: Enable clients. - IGNORE_PACKAGES - ROCM - COMPILER_TOOLCHAIN - amd-hip - RUNTIME_DEPS - #hipBLAS-common - #hipBLASLt - hip-clr -) -therock_cmake_subproject_glob_c_sources(rocBLAS - SUBDIRS - . -) -therock_cmake_subproject_provide_package(rocBLAS rocblas lib/cmake/rocblas) -therock_cmake_subproject_activate(rocBLAS) -list(APPEND _blas_subproject_names rocBLAS) + therock_cmake_subproject_declare(rocBLAS + EXTERNAL_SOURCE_DIR "rocBLAS" + BACKGROUND_BUILD + CMAKE_ARGS + -DHIP_PLATFORM=amd + -DROCM_PATH= + -DROCM_DIR= + # TODO: Fix passing TENSILE_ROCM_ASSEMBLER_PATH. + # Enable building with hipBLASLt afterwards. + -DBUILD_WITH_TENSILE=OFF + -DBUILD_WITH_HIPBLASLT=OFF + # -DTensile_LOGIC= + # -DTensile_CODE_OBJECT_VERSION=default + # -DTensile_CPU_THREADS= + # -DTensile_LIBRARY_FORMAT=msgpack + # "-DTensile_ROCM_ASSEMBLER_PATH=${_toolchain_dir}/bin/clang++" + # "-DTensile_ROCM_OFFLOAD_BUNDLER_PATH=${_toolchain_dir}/bin/clang-offload-bundler" + # TODO: Enable clients. + IGNORE_PACKAGES + ROCM + COMPILER_TOOLCHAIN + amd-hip + RUNTIME_DEPS + #hipBLAS-common + #hipBLASLt + hip-clr + ) + therock_cmake_subproject_glob_c_sources(rocBLAS + SUBDIRS + . + ) + therock_cmake_subproject_provide_package(rocBLAS rocblas lib/cmake/rocblas) + therock_cmake_subproject_activate(rocBLAS) + list(APPEND _blas_subproject_names rocBLAS) -################################################################################# -# hipBLAS -################################################################################# + ############################################################################## + # hipBLAS + ############################################################################## -therock_cmake_subproject_declare(hipBLAS - EXTERNAL_SOURCE_DIR "hipBLAS" - BACKGROUND_BUILD - CMAKE_ARGS - -DHIP_PLATFORM=amd - -DROCM_PATH= - -DROCM_DIR= - -DBUILD_WITH_SOLVER=OFF # TODO: add/enable rocSOLVER - COMPILER_TOOLCHAIN - amd-hip - BUILD_DEPS - hipBLAS-common - RUNTIME_DEPS - hip-clr - rocBLAS -) -therock_cmake_subproject_glob_c_sources(hipBLAS - SUBDIRS - . -) -therock_cmake_subproject_provide_package(hipBLAS hipblas lib/cmake/hipblas) -therock_cmake_subproject_activate(hipBLAS) -list(APPEND _blas_subproject_names hipBLAS) + therock_cmake_subproject_declare(hipBLAS + EXTERNAL_SOURCE_DIR "hipBLAS" + BACKGROUND_BUILD + CMAKE_ARGS + -DHIP_PLATFORM=amd + -DROCM_PATH= + -DROCM_DIR= + -DBUILD_WITH_SOLVER=OFF # TODO: add/enable rocSOLVER + COMPILER_TOOLCHAIN + amd-hip + BUILD_DEPS + hipBLAS-common + RUNTIME_DEPS + hip-clr + rocBLAS + ) + therock_cmake_subproject_glob_c_sources(hipBLAS + SUBDIRS + . + ) + therock_cmake_subproject_provide_package(hipBLAS hipblas lib/cmake/hipblas) + therock_cmake_subproject_activate(hipBLAS) + list(APPEND _blas_subproject_names hipBLAS) -################################################################################# -# blas artifact -################################################################################# + ############################################################################## + # blas artifact + ############################################################################## -therock_provide_artifact(blas - DESCRIPTOR artifact-blas.toml - COMPONENTS - dbg - dev - doc - lib - run - SUBPROJECT_DEPS ${_blas_subproject_names} -) + therock_provide_artifact(blas + DESCRIPTOR artifact-blas.toml + COMPONENTS + dbg + dev + doc + lib + run + SUBPROJECT_DEPS ${_blas_subproject_names} + ) +endif(THEROCK_ENABLE_BLAS) -################################################################################# -# rocRAND -################################################################################# -set(_rand_subproject_names) +if(THEROCK_ENABLE_RAND) + ############################################################################## + # rocRAND + ############################################################################## + set(_rand_subproject_names) -therock_cmake_subproject_declare(rocRAND - EXTERNAL_SOURCE_DIR "rocRAND" - BACKGROUND_BUILD - CMAKE_ARGS - -DHIP_PLATFORM=amd - -DROCM_PATH= - -DROCM_DIR= - COMPILER_TOOLCHAIN - amd-hip - RUNTIME_DEPS - hip-clr -) -therock_cmake_subproject_glob_c_sources(rocRAND - SUBDIRS - . -) -therock_cmake_subproject_provide_package(rocRAND rocrand lib/cmake/rocrand) -therock_cmake_subproject_activate(rocRAND) -list(APPEND _rand_subproject_names rocRAND) + therock_cmake_subproject_declare(rocRAND + EXTERNAL_SOURCE_DIR "rocRAND" + BACKGROUND_BUILD + CMAKE_ARGS + -DHIP_PLATFORM=amd + -DROCM_PATH= + -DROCM_DIR= + COMPILER_TOOLCHAIN + amd-hip + RUNTIME_DEPS + hip-clr + ) + therock_cmake_subproject_glob_c_sources(rocRAND + SUBDIRS + . + ) + therock_cmake_subproject_provide_package(rocRAND rocrand lib/cmake/rocrand) + therock_cmake_subproject_activate(rocRAND) + list(APPEND _rand_subproject_names rocRAND) -################################################################################# -# hipRAND -################################################################################# + ############################################################################## + # hipRAND + ############################################################################## -therock_cmake_subproject_declare(hipRAND - EXTERNAL_SOURCE_DIR "hipRAND" - BACKGROUND_BUILD - CMAKE_ARGS - -DHIP_PLATFORM=amd - -DROCM_PATH= - -DROCM_DIR= - COMPILER_TOOLCHAIN - amd-hip - BUILD_DEPS - rocRAND - RUNTIME_DEPS - hip-clr -) -therock_cmake_subproject_glob_c_sources(hipRAND - SUBDIRS - . -) -therock_cmake_subproject_provide_package(hipRAND hiprand lib/cmake/hiprand) -therock_cmake_subproject_activate(hipRAND) -list(APPEND _rand_subproject_names hipRAND) + therock_cmake_subproject_declare(hipRAND + EXTERNAL_SOURCE_DIR "hipRAND" + BACKGROUND_BUILD + CMAKE_ARGS + -DHIP_PLATFORM=amd + -DROCM_PATH= + -DROCM_DIR= + COMPILER_TOOLCHAIN + amd-hip + BUILD_DEPS + rocRAND + RUNTIME_DEPS + hip-clr + ) + therock_cmake_subproject_glob_c_sources(hipRAND + SUBDIRS + . + ) + therock_cmake_subproject_provide_package(hipRAND hiprand lib/cmake/hiprand) + therock_cmake_subproject_activate(hipRAND) + list(APPEND _rand_subproject_names hipRAND) -################################################################################# -# rand artifact -################################################################################# + ############################################################################## + # rand artifact + ############################################################################## -therock_provide_artifact(rand - DESCRIPTOR artifact-rand.toml - COMPONENTS - dbg - dev - doc - lib - run - SUBPROJECT_DEPS ${_rand_subproject_names} -) + therock_provide_artifact(rand + DESCRIPTOR artifact-rand.toml + COMPONENTS + dbg + dev + doc + lib + run + SUBPROJECT_DEPS ${_rand_subproject_names} + ) +endif(THEROCK_ENABLE_RAND) -################################################################################# -# rocPRIM -################################################################################# +if(THEROCK_ENABLE_PRIM) + ############################################################################## + # rocPRIM + ############################################################################## -therock_cmake_subproject_declare(rocPRIM - EXTERNAL_SOURCE_DIR "rocPRIM" - BACKGROUND_BUILD - CMAKE_ARGS - -DHIP_PLATFORM=amd - -DROCM_PATH= - -DROCM_DIR= - COMPILER_TOOLCHAIN - amd-hip - RUNTIME_DEPS - hip-clr -) -therock_cmake_subproject_glob_c_sources(rocPRIM - SUBDIRS - . -) -therock_cmake_subproject_provide_package(rocPRIM rocprim lib/cmake/rocprim) -therock_cmake_subproject_activate(rocPRIM) + therock_cmake_subproject_declare(rocPRIM + EXTERNAL_SOURCE_DIR "rocPRIM" + BACKGROUND_BUILD + CMAKE_ARGS + -DHIP_PLATFORM=amd + -DROCM_PATH= + -DROCM_DIR= + COMPILER_TOOLCHAIN + amd-hip + RUNTIME_DEPS + hip-clr + ) + therock_cmake_subproject_glob_c_sources(rocPRIM + SUBDIRS + . + ) + therock_cmake_subproject_provide_package(rocPRIM rocprim lib/cmake/rocprim) + therock_cmake_subproject_activate(rocPRIM) -therock_provide_artifact(prim - DESCRIPTOR artifact-prim.toml - COMPONENTS - dev - doc - SUBPROJECT_DEPS rocPRIM -) + therock_provide_artifact(prim + DESCRIPTOR artifact-prim.toml + COMPONENTS + dev + doc + SUBPROJECT_DEPS rocPRIM + ) +endif(THEROCK_ENABLE_PRIM) -################################################################################# -# rocSPARSE -################################################################################# -set(_sparse_subproject_names) +if(THEROCK_ENABLE_SPARSE) + ############################################################################## + # rocSPARSE + ############################################################################## + set(_sparse_subproject_names) -therock_cmake_subproject_declare(rocSPARSE - EXTERNAL_SOURCE_DIR "rocSPARSE" - BACKGROUND_BUILD - CMAKE_ARGS - -DHIP_PLATFORM=amd - -DROCM_PATH= - -DROCM_DIR= - -DBUILD_WITH_ROCBLAS=ON - -DBUILD_CLIENTS_SAMPLES=OFF - -DBUILD_CLIENTS_BENCHMARKS=OFF - -DBUILD_CLIENTS_SAMPLES=OFF - COMPILER_TOOLCHAIN - amd-hip - BUILD_DEPS - rocBLAS - rocPRIM - RUNTIME_DEPS - hip-clr -) -therock_cmake_subproject_glob_c_sources(rocSPARSE - SUBDIRS - . -) -therock_cmake_subproject_provide_package(rocSPARSE rocsparse lib/cmake/rocsparse) -therock_cmake_subproject_activate(rocSPARSE) -list(APPEND _sparse_subproject_names rocSPARSE) + therock_cmake_subproject_declare(rocSPARSE + EXTERNAL_SOURCE_DIR "rocSPARSE" + BACKGROUND_BUILD + CMAKE_ARGS + -DHIP_PLATFORM=amd + -DROCM_PATH= + -DROCM_DIR= + -DBUILD_WITH_ROCBLAS=ON + -DBUILD_CLIENTS_SAMPLES=OFF + -DBUILD_CLIENTS_BENCHMARKS=OFF + -DBUILD_CLIENTS_SAMPLES=OFF + COMPILER_TOOLCHAIN + amd-hip + BUILD_DEPS + rocBLAS + rocPRIM + RUNTIME_DEPS + hip-clr + ) + therock_cmake_subproject_glob_c_sources(rocSPARSE + SUBDIRS + . + ) + therock_cmake_subproject_provide_package(rocSPARSE rocsparse lib/cmake/rocsparse) + therock_cmake_subproject_activate(rocSPARSE) + list(APPEND _sparse_subproject_names rocSPARSE) -################################################################################# -# hipSPARSE -################################################################################# + ############################################################################## + # hipSPARSE + ############################################################################## -therock_cmake_subproject_declare(hipSPARSE - EXTERNAL_SOURCE_DIR "hipSPARSE" - BACKGROUND_BUILD - CMAKE_ARGS - -DHIP_PLATFORM=amd - -DROCM_PATH= - -DROCM_DIR= - -DBUILD_CLIENTS_SAMPLES=OFF - -DBUILD_CLIENTS_BENCHMARKS=OFF - -DBUILD_CLIENTS_SAMPLES=OFF - COMPILER_TOOLCHAIN - amd-hip - BUILD_DEPS - rocSPARSE - RUNTIME_DEPS - hip-clr -) -therock_cmake_subproject_glob_c_sources(hipSPARSE - SUBDIRS - . -) -therock_cmake_subproject_provide_package(hipSPARSE hipsparse lib/cmake/hipsparse) -therock_cmake_subproject_activate(hipSPARSE) -list(APPEND _sparse_subproject_names hipSPARSE) + therock_cmake_subproject_declare(hipSPARSE + EXTERNAL_SOURCE_DIR "hipSPARSE" + BACKGROUND_BUILD + CMAKE_ARGS + -DHIP_PLATFORM=amd + -DROCM_PATH= + -DROCM_DIR= + -DBUILD_CLIENTS_SAMPLES=OFF + -DBUILD_CLIENTS_BENCHMARKS=OFF + -DBUILD_CLIENTS_SAMPLES=OFF + COMPILER_TOOLCHAIN + amd-hip + BUILD_DEPS + rocSPARSE + RUNTIME_DEPS + hip-clr + ) + therock_cmake_subproject_glob_c_sources(hipSPARSE + SUBDIRS + . + ) + therock_cmake_subproject_provide_package(hipSPARSE hipsparse lib/cmake/hipsparse) + therock_cmake_subproject_activate(hipSPARSE) + list(APPEND _sparse_subproject_names hipSPARSE) -################################################################################# -# sparse artifact -################################################################################# + ############################################################################## + # sparse artifact + ############################################################################## -therock_provide_artifact(sparse - DESCRIPTOR artifact-sparse.toml - COMPONENTS - dbg - dev - doc - lib - run - SUBPROJECT_DEPS ${_sparse_subproject_names} -) + therock_provide_artifact(sparse + DESCRIPTOR artifact-sparse.toml + COMPONENTS + dbg + dev + doc + lib + run + SUBPROJECT_DEPS ${_sparse_subproject_names} + ) +endif(THEROCK_ENABLE_SPARSE) -################################################################################# -# rocSOLVER -################################################################################# +if(THEROCK_ENABLE_SOLVER) + ############################################################################## + # rocSOLVER + ############################################################################## -therock_cmake_subproject_declare(rocSOLVER - EXTERNAL_SOURCE_DIR "rocSOLVER" - BACKGROUND_BUILD - CMAKE_ARGS - -DHIP_PLATFORM=amd - -DROCM_PATH= - -DROCM_DIR= - # Requires LAPACK - -DBUILD_CLIENTS_BENCHMARKS=OFF - -DBUILD_CLIENTS_TESTS=OFF - COMPILER_TOOLCHAIN - amd-hip - BUILD_DEPS - rocBLAS - rocPRIM - therock-fmt - RUNTIME_DEPS - hip-clr -) -therock_cmake_subproject_glob_c_sources(rocSOLVER - SUBDIRS - . -) -therock_cmake_subproject_provide_package(rocSOLVER rocsolver lib/cmake/rocsolver) -therock_cmake_subproject_activate(rocSOLVER) + therock_cmake_subproject_declare(rocSOLVER + EXTERNAL_SOURCE_DIR "rocSOLVER" + BACKGROUND_BUILD + CMAKE_ARGS + -DHIP_PLATFORM=amd + -DROCM_PATH= + -DROCM_DIR= + # Requires LAPACK + -DBUILD_CLIENTS_BENCHMARKS=OFF + -DBUILD_CLIENTS_TESTS=OFF + COMPILER_TOOLCHAIN + amd-hip + BUILD_DEPS + rocBLAS + rocPRIM + therock-fmt + RUNTIME_DEPS + hip-clr + ) + therock_cmake_subproject_glob_c_sources(rocSOLVER + SUBDIRS + . + ) + therock_cmake_subproject_provide_package(rocSOLVER rocsolver lib/cmake/rocsolver) + therock_cmake_subproject_activate(rocSOLVER) -therock_provide_artifact(solver - DESCRIPTOR artifact-solver.toml - COMPONENTS - dbg - dev - doc - lib - run - SUBPROJECT_DEPS rocSOLVER -) + therock_provide_artifact(solver + DESCRIPTOR artifact-solver.toml + COMPONENTS + dbg + dev + doc + lib + run + SUBPROJECT_DEPS rocSOLVER + ) +endif(THEROCK_ENABLE_SOLVER) diff --git a/ml-libs/CMakeLists.txt b/ml-libs/CMakeLists.txt index 51660d6..8fd5a91 100644 --- a/ml-libs/CMakeLists.txt +++ b/ml-libs/CMakeLists.txt @@ -1,47 +1,49 @@ -################################################################################# -# MIOpen -################################################################################# +if(THEROCK_ENABLE_MIOPEN) + ############################################################################## + # MIOpen + ############################################################################## -therock_cmake_subproject_declare(MIOpen - EXTERNAL_SOURCE_DIR "MIOpen" - BACKGROUND_BUILD - CMAKE_ARGS - -DHIP_PLATFORM=amd - -DROCM_PATH= - -DROCM_DIR= - -DMIOPEN_USE_COMPOSABLEKERNEL=OFF # TODO: enable - -DMIOPEN_USE_MLIR=OFF # TODO: enable - -DMIOPEN_BUILD_DRIVER=OFF # TODO: enable - -DMIOPEN_USE_ROCTRACER=OFF # TODO: enable - COMPILER_TOOLCHAIN - amd-hip - BUILD_DEPS - hipBLAS-common - rocm-cmake - rocm-half - therock-boost - therock-eigen - therock-frugally-deep - therock-nlohmann-json - therock-FunctionalPlus - RUNTIME_DEPS - hip-clr - hipBLAS - hipBLASLt - rocBLAS - rocRAND -) + therock_cmake_subproject_declare(MIOpen + EXTERNAL_SOURCE_DIR "MIOpen" + BACKGROUND_BUILD + CMAKE_ARGS + -DHIP_PLATFORM=amd + -DROCM_PATH= + -DROCM_DIR= + -DMIOPEN_USE_COMPOSABLEKERNEL=OFF # TODO: enable + -DMIOPEN_USE_MLIR=OFF # TODO: enable + -DMIOPEN_BUILD_DRIVER=OFF # TODO: enable + -DMIOPEN_USE_ROCTRACER=OFF # TODO: enable + COMPILER_TOOLCHAIN + amd-hip + BUILD_DEPS + hipBLAS-common + rocm-cmake + rocm-half + therock-boost + therock-eigen + therock-frugally-deep + therock-nlohmann-json + therock-FunctionalPlus + RUNTIME_DEPS + hip-clr + hipBLAS + hipBLASLt + rocBLAS + rocRAND + ) -therock_cmake_subproject_activate(MIOpen) + therock_cmake_subproject_activate(MIOpen) -therock_provide_artifact(miopen - DESCRIPTOR artifact-miopen.toml - COMPONENTS - dbg - dev - doc - lib - run - SUBPROJECT_DEPS - MIOpen -) + therock_provide_artifact(miopen + DESCRIPTOR artifact-miopen.toml + COMPONENTS + dbg + dev + doc + lib + run + SUBPROJECT_DEPS + MIOpen + ) +endif(THEROCK_ENABLE_MIOPEN)