diff --git a/amdsmi.spec b/amdsmi.spec index 62e05a312c7..bda96979a0f 100644 --- a/amdsmi.spec +++ b/amdsmi.spec @@ -1,22 +1,5 @@ ## INCLUDE rocm-config ### RPM external amdsmi %{rocm_version_num} - -Source: %{rocm_systems_source} Requires: rocm-core python3 - -%prep -%setup -q -n rocm-systems - -%build - -cmake \ - -S %{_builddir}/rocm-systems/projects/%{n} \ - -B %{_builddir}/build \ - -DCMAKE_INSTALL_PREFIX=%{i} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" \ - -DBUILD_TESTING=OFF - -make -C %{_builddir}/build %{makeprocesses} -%install -make -C %{_builddir}/build %{makeprocesses} install +%define cmake_args -DBUILD_TESTING=OFF +## INCLUDE rocm-systems-build diff --git a/aqlprofile.spec b/aqlprofile.spec index 4bd1921d395..9ee32a1ef32 100644 --- a/aqlprofile.spec +++ b/aqlprofile.spec @@ -1,21 +1,4 @@ ## INCLUDE rocm-config ### RPM external aqlprofile %{rocm_version_num} - -Source: %{rocm_systems_source} Requires: rocm-core rocr-runtime -%prep -%setup -q -n rocm-systems - -%build - -cmake \ - -S %{_builddir}/rocm-systems/projects/%{n} \ - -B %{_builddir}/build \ - -DCMAKE_INSTALL_PREFIX=%{i} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH=%{cmake_prefix_path} - -make -C %{_builddir}/build %{makeprocesses} - -%install -make -C %{_builddir}/build %{makeprocesses} install +## INCLUDE rocm-systems-build diff --git a/hipify.spec b/hipify.spec index 6608d3b01ff..61f34ef12b4 100644 --- a/hipify.spec +++ b/hipify.spec @@ -1,15 +1,15 @@ ## INCLUDE rocm-config ### RPM external hipify %{rocm_version_num} -Source0: https://github.com/ROCm/HIPIFY/archive/refs/tags/rocm-%{rocm_version_num}.tar.gz +Source0: git+https://github.com/ROCm/HIPIFY.git?obj=amd-develop/therock-%{rocm_version_num}&export=hipify&export=%{n}&submodules=1&output=/%{n}.tar.gz Requires: rocm-llvm %prep -%setup -q -n HIPIFY-rocm-%{realversion} +%setup -q -n %{n} %build CMAKE_ARGS=( -B %{_builddir}/build - -S %{_builddir}/HIPIFY-rocm-%{realversion} + -S %{_builddir}/%{n} -DCMAKE_INSTALL_PREFIX=%{i} -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_COMPILER=${ROCM_LLVM_ROOT}/lib/llvm/bin/clang \ diff --git a/miopen-ai-heuristic-guard-fix.patch b/miopen-ai-heuristic-guard-fix.patch new file mode 100644 index 00000000000..d082e797a01 --- /dev/null +++ b/miopen-ai-heuristic-guard-fix.patch @@ -0,0 +1,185 @@ +--- projects/miopen/src/solver/conv/conv_hip_implicit_gemm_grouped_fwd_xdlops.cpp ++++ projects/miopen/src/solver/conv/conv_hip_implicit_gemm_grouped_fwd_xdlops.cpp +@@ -31,11 +31,9 @@ + #include + #include + #include +-#if MIOPEN_ENABLE_AI_KERNEL_TUNING + #include + #include + #include +-#endif + #include + #include + MIOPEN_DECLARE_ENV_VAR_BOOL(MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_FWD_XDLOPS) +--- projects/miopen/src/solver/conv/conv_hip_implicit_gemm_grouped_bwd_xdlops.cpp ++++ projects/miopen/src/solver/conv/conv_hip_implicit_gemm_grouped_bwd_xdlops.cpp +@@ -32,11 +32,9 @@ + #include + #include + #include +-#if MIOPEN_ENABLE_AI_KERNEL_TUNING + #include + #include + #include +-#endif + #include + #include + MIOPEN_DECLARE_ENV_VAR_BOOL(MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_HIP_GROUP_BWD_XDLOPS) +--- projects/miopen/src/solver/conv/conv_hip_implicit_gemm_grouped_wrw_xdlops.cpp ++++ projects/miopen/src/solver/conv/conv_hip_implicit_gemm_grouped_wrw_xdlops.cpp +@@ -33,11 +33,9 @@ + #include + #include + #include +-#if MIOPEN_ENABLE_AI_KERNEL_TUNING + #include + #include + #include +-#endif + #include + MIOPEN_DECLARE_ENV_VAR_BOOL(MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS) + MIOPEN_DECLARE_ENV_VAR_BOOL(MIOPEN_DEBUG_GROUP_CONV_IMPLICIT_GEMM_HIP_WRW_XDLOPS_AI_HEUR) +--- projects/miopen/src/solver/conv/conv_hip_implicit_gemm_3d_grouped_fwd_xdlops.cpp ++++ projects/miopen/src/solver/conv/conv_hip_implicit_gemm_3d_grouped_fwd_xdlops.cpp +@@ -34,11 +34,9 @@ + #include + #include + #include +-#if MIOPEN_ENABLE_AI_KERNEL_TUNING + #include + #include + #include +-#endif + #include + #include + +--- projects/miopen/src/include/miopen/conv/heuristics/ai_conv_nd_kernel_tuning_utils.hpp ++++ projects/miopen/src/include/miopen/conv/heuristics/ai_conv_nd_kernel_tuning_utils.hpp +@@ -154,6 +154,50 @@ + } + }; + ++/** ++ * @brief Configuration state for heuristic initialization results ++ * ++ * This struct holds the output state from AI heuristics. It's designed to be ++ * passed by reference to the centralized heuristics function, which will ++ * populate it with results. ++ * ++ * @note Kept outside the MIOPEN_ENABLE_AI_KERNEL_TUNING guard below because ++ * solvers use it unconditionally for fallback (non-AI) kernel selection state. ++ */ ++struct HeuristicInitState ++{ ++ std::vector& valid_kernels; ++ int& index; ++ int& split_k; ++ std::string& kernel_id; ++ ++ HeuristicInitState(std::vector& vk, int& idx, int& sk, std::string& kid) ++ : valid_kernels(vk), index(idx), split_k(sk), kernel_id(kid) ++ { ++ } ++ ++ void Reset(bool uses_split_k) ++ { ++ index = 0; ++ kernel_id = ""; ++ split_k = uses_split_k ? 1 : 0; ++ } ++ ++ void SetResult(int idx, int sk, bool uses_split_k) ++ { ++ index = idx; ++ split_k = sk; ++ if(uses_split_k && idx >= 0 && idx < static_cast(valid_kernels.size())) ++ { ++ kernel_id = valid_kernels[idx] + "+" + std::to_string(sk); ++ } ++ else if(idx >= 0 && idx < static_cast(valid_kernels.size())) ++ { ++ kernel_id = valid_kernels[idx]; ++ } ++ } ++}; ++ + } // namespace conv + } // namespace solver + } // namespace miopen +@@ -257,47 +301,6 @@ + // Centralized AI Heuristics Runner + // ============================================================================ + +-/** +- * @brief Configuration state for heuristic initialization results +- * +- * This struct holds the output state from AI heuristics. It's designed to be +- * passed by reference to the centralized heuristics function, which will +- * populate it with results. +- */ +-struct HeuristicInitState +-{ +- std::vector& valid_kernels; +- int& index; +- int& split_k; +- std::string& kernel_id; +- +- HeuristicInitState(std::vector& vk, int& idx, int& sk, std::string& kid) +- : valid_kernels(vk), index(idx), split_k(sk), kernel_id(kid) +- { +- } +- +- void Reset(bool uses_split_k) +- { +- index = 0; +- kernel_id = ""; +- split_k = uses_split_k ? 1 : 0; +- } +- +- void SetResult(int idx, int sk, bool uses_split_k) +- { +- index = idx; +- split_k = sk; +- if(uses_split_k && idx >= 0 && idx < static_cast(valid_kernels.size())) +- { +- kernel_id = valid_kernels[idx] + "+" + std::to_string(sk); +- } +- else if(idx >= 0 && idx < static_cast(valid_kernels.size())) +- { +- kernel_id = valid_kernels[idx]; +- } +- } +-}; +- + // ============================================================================ + // Generic Helper Template for KTN Lambda Functions + // ============================================================================ +--- projects/miopen/src/solver/conv/conv_hip_implicit_gemm_3d_grouped_wrw_xdlops.cpp ++++ projects/miopen/src/solver/conv/conv_hip_implicit_gemm_3d_grouped_wrw_xdlops.cpp +@@ -39,11 +39,9 @@ + #include + #include + #include +-#if MIOPEN_ENABLE_AI_KERNEL_TUNING + #include + #include + #include +-#endif + #include + + namespace miopen { +--- projects/miopen/src/solver/conv/conv_hip_implicit_gemm_3d_grouped_bwd_xdlops.cpp ++++ projects/miopen/src/solver/conv/conv_hip_implicit_gemm_3d_grouped_bwd_xdlops.cpp +@@ -33,11 +33,9 @@ + #include + #include + #include +-#if MIOPEN_ENABLE_AI_KERNEL_TUNING + #include + #include + #include +-#endif + #include + #include + diff --git a/miopen-boost-optional-fix.patch b/miopen-boost-optional-fix.patch index 7685df999d2..0bcb5697e17 100644 --- a/miopen-boost-optional-fix.patch +++ b/miopen-boost-optional-fix.patch @@ -1,75 +1,75 @@ +--- projects/miopen/src/anyramdb.cpp ++++ projects/miopen/src/anyramdb.cpp +@@ -99,7 +99,7 @@ std::optional AnyRamDb::FindRecordUnsafe(const std::string& p + if(it == cache.end()) + return {}; + +- return it->second; ++ return std::make_optional(it->second); + } + + void AnyRamDb::UpdateCacheEntryUnsafe(const std::string& key, const TRecord& value) +--- projects/miopen/src/db.cpp ++++ projects/miopen/src/db.cpp +@@ -183,7 +183,7 @@ std::optional PlainTextDb::FindRecordUnsafe(const std::string& key, Re + pos->begin = line_begin; + pos->end = next_line_begin; + } +- return record; ++ return std::make_optional(record); + } + // Record was not found + return {}; +--- projects/miopen/src/find_controls.cpp ++++ projects/miopen/src/find_controls.cpp +@@ -159,7 +159,7 @@ std::optional> GetEnvFindOnlySolverImpl() + if(res.empty()) + return {}; + else +- return {res}; ++ return std::make_optional(res); + } + + } // namespace +--- projects/miopen/src/include/miopen/kern_db.hpp ++++ projects/miopen/src/include/miopen/kern_db.hpp +@@ -128,7 +128,7 @@ public: + auto new_md5 = md5(decompressed_blob); + if(new_md5 != md5_hash) + MIOPEN_THROW(miopenStatusInternalError, "Possible database corruption"); +- return decompressed_blob; ++ return std::make_optional(decompressed_blob); + } + else if(rc == SQLITE_DONE) + { --- projects/miopen/src/include/miopen/sqlite_db.hpp +++ projects/miopen/src/include/miopen/sqlite_db.hpp -@@ -463,7 +463,7 @@ class SQLitePerfDb +@@ -437,7 +437,7 @@ public: ovr_rec.SetValues(vals.at(0), vals.at(1)); } if(success) - return {ovr_rec}; -+ return boost::make_optional(ovr_rec); ++ return std::make_optional(ovr_rec); } std::string clause; std::vector values; -@@ -498,7 +498,7 @@ class SQLitePerfDb +@@ -472,7 +472,7 @@ public: if(rec.GetSize() == 0) - return boost::none; + return {}; else - return {rec}; -+ return boost::make_optional(rec); ++ return std::make_optional(rec); } - + /// Removes ID with associated VALUES from record with key PROBLEM_CONFIG from db. ---- projects/miopen/src/find_controls.cpp -+++ projects/miopen/src/find_controls.cpp -@@ -161,7 +161,7 @@ boost::optional> GetEnvFindOnlySolverImpl() - if(res.empty()) - return boost::none; - else -- return {res}; -+ return boost::make_optional(res); - } - - } // namespace --- projects/miopen/src/ramdb.cpp +++ projects/miopen/src/ramdb.cpp -@@ -272,7 +272,7 @@ boost::optional RamDb::FindRecordUnsafe(const std::string& pro - return boost::none; +@@ -271,7 +271,7 @@ std::optional RamDb::FindRecordUnsafe(const std::string& probl + return {}; } - + - return record; -+ return boost::make_optional(record); ++ return std::make_optional(record); } - + template ---- projects/miopen/src/db.cpp -+++ projects/miopen/src/db.cpp -@@ -209,7 +209,7 @@ boost::optional PlainTextDb::FindRecordUnsafe(const std::string& key, - pos->begin = line_begin; - pos->end = next_line_begin; - } -- return record; -+ return boost::make_optional(record); - } - // Record was not found - return boost::none; ---- projects/miopen/src/anyramdb.cpp -+++ projects/miopen/src/anyramdb.cpp -@@ -99,7 +99,7 @@ boost::optional AnyRamDb::FindRecordUnsafe(const std::string& - if(it == cache.end()) - return boost::none; - -- return it->second; -+ return boost::make_optional(it->second); - } - - void AnyRamDb::UpdateCacheEntryUnsafe(const std::string& key, const TRecord& value) ---- projects/miopen/src/include/miopen/kern_db.hpp -+++ projects/miopen/src/include/miopen/kern_db.hpp -@@ -136,7 +136,7 @@ struct KernDb - auto new_md5 = md5(decompressed_blob); - if(new_md5 != md5_hash) - MIOPEN_THROW(miopenStatusInternalError, "Possible database corruption"); -- return decompressed_blob; -+ return boost::make_optional(decompressed_blob); - } - else if(rc == SQLITE_DONE) - { diff --git a/miopen.spec b/miopen.spec index 494d1f300b6..b400eab9a53 100644 --- a/miopen.spec +++ b/miopen.spec @@ -2,12 +2,13 @@ ### RPM external miopen %{rocm_version_num} Source1: https://raw.githubusercontent.com/suruoxi/half/refs/heads/master/include/half.hpp Patch0: miopen-boost-optional-fix +Patch1: miopen-ai-heuristic-guard-fix BuildRequires: rocm-cmake Requires: rocm-hip rocm-core rocr-runtime rocminfo python3 roctracer sqlite hipblaslt hipblas rocblas rocrand bz2lib hipblas Requires: json hipblas-common boost zstd opencl rocm-llvm rocm-comgr %define ROCMPrePrep cp %{_sourcedir}/half.hpp %{_builddir} -%define ROCMPostPrep %patch0 -p2 +%define ROCMPostPrep patch -p0 -i %{PATCH0} ; patch -p0 -i %{PATCH1} %define ROCMPreBuild mkdir -p %{_builddir}/half-include/half && cp %{_sourcedir}/half.hpp %{_builddir}/half-include/half/ %define ROCMPreCMake printf 'macro(enable_clang_tidy)\\nendmacro()\\nmacro(clang_tidy_check)\\nendmacro()\\n' > %{_builddir}/rocm-libraries/projects/%{n}/cmake/ClangTidy.cmake %define ROCMPostCMake sed -i '827,830d' %{_builddir}/rocm-libraries/projects/%{n}/CMakeLists.txt diff --git a/patches/rocprofiler-systems-dyninst-tbb-boost-conflict.patch b/patches/rocprofiler-systems-dyninst-tbb-boost-conflict.patch new file mode 100644 index 00000000000..caa20ef8d71 --- /dev/null +++ b/patches/rocprofiler-systems-dyninst-tbb-boost-conflict.patch @@ -0,0 +1,42 @@ +--- a/projects/rocprofiler-systems/cmake/Packages.cmake ++++ b/projects/rocprofiler-systems/cmake/Packages.cmake +@@ -562,6 +562,21 @@ + else() + # Find Boost before finding Dyninst + find_package(Boost) ++ # Pre-create both Dyninst::Boost and Dyninst::Boost_headers. Dyninst's own ++ # installed tpls/DyninstBoost.cmake guards its target creation on ++ # "if(NOT TARGET Dyninst::Boost)" (not Boost_headers); if only Boost_headers ++ # is pre-created here, that guard is still false and Dyninst tries to ++ # add_library(Dyninst::Boost_headers) again, which fails because it already ++ # exists. Creating both here keeps Dyninst's guard satisfied. ++ if(NOT TARGET Dyninst::Boost) ++ add_library(Dyninst::Boost INTERFACE IMPORTED) ++ target_link_libraries(Dyninst::Boost INTERFACE ${Boost_LIBRARIES}) ++ target_include_directories( ++ Dyninst::Boost ++ SYSTEM ++ INTERFACE ${Boost_INCLUDE_DIRS} ++ ) ++ endif() + if(NOT TARGET Dyninst::Boost_headers) + add_library(Dyninst::Boost_headers INTERFACE IMPORTED) + target_include_directories( +--- a/projects/rocprofiler-systems/cmake/DyninstTBB.cmake ++++ b/projects/rocprofiler-systems/cmake/DyninstTBB.cmake +@@ -153,7 +153,14 @@ + set(TBB_LIBRARY "${TBB_ROOT_DIR}/lib") + set(TBB_INCLUDE_DIR "${TBB_ROOT_DIR}/include") + +- find_package(TBB ${TBB_MIN_VERSION} COMPONENTS ${_tbb_components}) ++ # Force CONFIG mode so this always resolves through TBB's real TBBConfig.cmake ++ # (creating all of its exported targets, e.g. TBB::tbbbind_2_5, in one pass) ++ # instead of this project's legacy Modules/FindTBB.cmake, which only knows ++ # about tbb/tbbmalloc/tbbmalloc_proxy. Otherwise, when Dyninst's own installed ++ # tpls/DyninstTBB.cmake later calls find_package(TBB) again and resolves via ++ # the real TBBConfig.cmake, CMake's generated TBBTargets.cmake finds some but ++ # not all of its expected targets already defined and errors out. ++ find_package(TBB ${TBB_MIN_VERSION} CONFIG COMPONENTS ${_tbb_components}) + + if(NOT TBB_FOUND) + if(STERILE_BUILD) diff --git a/patches/rocprofiler-systems-elfutils.patch b/patches/rocprofiler-systems-elfutils.patch index 4e175937cba..d635c80a9d9 100644 --- a/patches/rocprofiler-systems-elfutils.patch +++ b/patches/rocprofiler-systems-elfutils.patch @@ -1,13 +1,11 @@ -diff --git a/projects/rocprofiler-systems/cmake/DyninstElfUtils.cmake b/projects/rocprofiler-systems/cmake/DyninstElfUtils.cmake -index 1aedf49..fc10cc8 100644 --- a/projects/rocprofiler-systems/cmake/DyninstElfUtils.cmake +++ b/projects/rocprofiler-systems/cmake/DyninstElfUtils.cmake -@@ -186,7 +186,7 @@ else() +@@ -208,7 +208,7 @@ CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env CC=${CMAKE_C_COMPILER} CFLAGS=-fPIC\ -O3 CXX=${CMAKE_CXX_COMPILER} CXXFLAGS=-fPIC\ -O3 - [=[LDFLAGS=-Wl,-rpath='$$ORIGIN']=] /configure + /configure --enable-install-elfh --prefix=${_eu_root} --disable-libdebuginfod - --disable-debuginfod --enable-thread-safety ${ElfUtils_CONFIG_OPTIONS} - --libdir=${_eu_root}/lib + --disable-debuginfod --enable-thread-safety --disable-nls + ${ElfUtils_CONFIG_OPTIONS} --libdir=${_eu_root}/lib diff --git a/rccl.spec b/rccl.spec index b6cc017c2ff..4a5f20602f8 100644 --- a/rccl.spec +++ b/rccl.spec @@ -1,35 +1,8 @@ ## INCLUDE rocm-config ### RPM external rccl %{rocm_version_num} -Source0: https://github.com/ROCm/rccl/archive/refs/tags/%{rocm_version}.tar.gz - Requires: rocm-core rocm-llvm rocr-runtime amdsmi rocm-hip rocminfo rocprofiler-register rocm-smi-lib roctracer hipify rocm-comgr Requires: python3 roctracer +%define ROCMPreBuild export ROCM_PATH=${ROCM_LLVM_ROOT} export CC=${ROCM_LLVM_ROOT}/bin/amdclang export CXX=${ROCM_LLVM_ROOT}/bin/amdclang++ +%define cmake_args -DBUILD_TESTS=OFF -DROCM_PATH=${ROCM_HIP_ROOT} -DROCM_CORE_PATH=${ROCM_CORE_PATH} -DEXPLICIT_ROCM_VERSION="%{realversion}.0" -DGPU_TARGETS="%{rocm_targets}" -DCMAKE_CXX_FLAGS="--rocm-device-lib-path=${ROCM_LLVM_ROOT}/amdgcn/bitcode -I${ROCM_CORE_ROOT}/include -include __clang_hip_runtime_wrapper.h -I${ROCTRACER_ROOT}/include" -DCMAKE_EXE_LINKER_FLAGS="-L${ROCM_HIP_ROOT}/lib -L${ROCTRACER_ROOT}/lib64" -DCMAKE_SHARED_LINKER_FLAGS="-L${ROCM_HIP_ROOT}/lib -L${ROCTRACER_ROOT}/lib64" -DROCM_VERSION=71300 -%prep -%setup -q -n %{n}-%{rocm_version} - -%build -grep -q 'math(EXPR num_linker_jobs "(${memory_in_gb} + 15) / 16")' %{_builddir}/%{n}-%{rocm_version}/CMakeLists.txt -#sed -i 's/math(EXPR num_linker_jobs "(${memory_in_gb} + 15) \/ 16")/math(EXPR num_linker_jobs "${memory_in_gb} \/ 6*2")/' %{_builddir}/%{n}-%{rocm_version}/CMakeLists.txt -export ROCM_PATH=${ROCM_LLVM_ROOT} -export CC=${ROCM_LLVM_ROOT}/bin/amdclang -export CXX=${ROCM_LLVM_ROOT}/bin/amdclang++ -cmake \ - -S %{_builddir}/%{n}-%{rocm_version} \ - -B %{_builddir}/build \ - -DCMAKE_INSTALL_PREFIX=%{i} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" \ - -DBUILD_TESTS=OFF \ - -DROCM_PATH=${ROCM_HIP_ROOT} \ - -DROCM_CORE_PATH=${ROCM_CORE_PATH} \ - -DEXPLICIT_ROCM_VERSION="%{realversion}" \ - -DGPU_TARGETS="%{rocm_targets}" \ - -DCMAKE_CXX_FLAGS="--rocm-device-lib-path=${ROCM_LLVM_ROOT}/amdgcn/bitcode -I${ROCM_CORE_ROOT}/include -include __clang_hip_runtime_wrapper.h -I${ROCTRACER_ROOT}/include" \ - -DCMAKE_EXE_LINKER_FLAGS="-L${ROCM_HIP_ROOT}/lib -L${ROCTRACER_ROOT}/lib64" \ - -DCMAKE_SHARED_LINKER_FLAGS="-L${ROCM_HIP_ROOT}/lib -L${ROCTRACER_ROOT}/lib64" - -make -C %{_builddir}/build %{makeprocesses} VERBOSE=1 - -%install -make -C %{_builddir}/build %{makeprocesses} install +## INCLUDE rocm-systems-build diff --git a/rocdbgapi.spec b/rocdbgapi.spec index c35c861833c..fd3ac0f0649 100644 --- a/rocdbgapi.spec +++ b/rocdbgapi.spec @@ -1,23 +1,5 @@ ## INCLUDE rocm-config ### RPM external rocdbgapi %{rocm_version_num} - -Source: https://github.com/ROCm/ROCdbgapi/archive/refs/tags/%{rocm_version}.tar.gz Requires: rocr-runtime rocm-core rocm-comgr - -%prep -%setup -q -n ROCdbgapi-%{rocm_version} - -%build - -cmake \ - -B %{_builddir}/build \ - -S %{_builddir}/ROCdbgapi-%{rocm_version} \ - -DCMAKE_INSTALL_PREFIX=%{i} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" \ - -DCMAKE_CXX_FLAGS="-Wno-sfinae-incomplete" - -make -C %{_builddir}/build %{makeprocesses} - -%install -make -C %{_builddir}/build %{makeprocesses} install +%define cmake_args -DCMAKE_CXX_FLAGS="-Wno-sfinae-incomplete" +## INCLUDE rocm-systems-build diff --git a/rocm-cmake.spec b/rocm-cmake.spec index 6ef4b55b40f..a7cbfb8eee5 100644 --- a/rocm-cmake.spec +++ b/rocm-cmake.spec @@ -1,7 +1,7 @@ ## INCLUDE rocm-config ### RPM external rocm-cmake %{rocm_version_num} BuildRequires: cmake -Source: https://github.com/ROCm/%{n}/archive/refs/tags/%{rocm_version}.tar.gz +Source: https://github.com/ROCm/rocm-cmake/archive/refs/tags/therock-%{rocm_version_num}.tar.gz %prep %setup -q -n %{n}-%{rocm_version} diff --git a/rocm-comgr.spec b/rocm-comgr.spec index 278d48ee487..39c44ebd319 100644 --- a/rocm-comgr.spec +++ b/rocm-comgr.spec @@ -1,22 +1,21 @@ ## INCLUDE rocm-config ### RPM external rocm-comgr %{rocm_version_num} -Source0: https://github.com/ROCm/llvm-project/archive/refs/tags/rocm-%{realversion}.tar.gz +Source0: https://github.com/ROCm/llvm-project/archive/refs/tags/therock-%{realversion}.tar.gz BuildRequires: cmake ninja Requires: rocm-llvm rocm-core zlib zstd libxml2 -Patch0: patches/0001-comgr-link-with-static-llvm %prep -%setup -q -n llvm-project-rocm-%{realversion} -%patch0 -p1 +%setup -q -n llvm-project-therock-%{rocm_version_num} %build -grep -q 'TARGET clangFrontendTool' %{_builddir}/llvm-project-rocm-%{realversion}/amd/comgr/CMakeLists.txt -sed -i "s/TARGET clangFrontendTool/true/" %{_builddir}/llvm-project-rocm-%{realversion}/amd/comgr/CMakeLists.txt -grep -q '^\s*TargetParser\s*$' %{_builddir}/llvm-project-rocm-%{realversion}/amd/comgr/CMakeLists.txt -sed -i -e 's|^\s*TargetParser\s*$| TargetParser Coverage FrontendDriver FrontendHLSL LTO Option Symbolize WindowsDriver|' %{_builddir}/llvm-project-rocm-%{realversion}/amd/comgr/CMakeLists.txt + +grep -q 'if(NOT CLANG_LINK_CLANG_DYLIB)' %{_builddir}/llvm-project-therock-%{rocm_version_num}/amd/comgr/CMakeLists.txt +sed -i 's/if(NOT CLANG_LINK_CLANG_DYLIB)/if(TRUE)/' %{_builddir}/llvm-project-therock-%{rocm_version_num}/amd/comgr/CMakeLists.txt +grep -q '^\s*TargetParser\s*$' %{_builddir}/llvm-project-therock-%{rocm_version_num}/amd/comgr/CMakeLists.txt +sed -i -e 's|^\s*TargetParser\s*$| TargetParser Coverage FrontendDriver FrontendHLSL LTO Option Symbolize WindowsDriver|' %{_builddir}/llvm-project-therock-%{rocm_version_num}/amd/comgr/CMakeLists.txt cmake -G "Unix Makefiles" \ - -S %{_builddir}/llvm-project-rocm-%{realversion}/amd/comgr \ + -S %{_builddir}/llvm-project-therock-%{rocm_version_num}/amd/comgr \ -B %{_builddir}/build-comgr \ -DCMAKE_INSTALL_PREFIX=%{i} \ -DCMAKE_C_COMPILER=$ROCM_LLVM_ROOT/lib/llvm/bin/clang \ @@ -26,11 +25,15 @@ cmake -G "Unix Makefiles" \ -DCMAKE_INSTALL_LIBDIR=lib \ -DCOMGR_STATIC_LLVM=ON \ -DBUILD_TESTING=OFF \ - -DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" + -DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" + +LLVMLIBS="-L$ROCM_LLVM_ROOT/lib/llvm/lib $($ROCM_LLVM_ROOT/lib/llvm/bin/llvm-config --link-static --libs)" +grep -q -E ' [^ ]*libLLVM\.so(\.[0-9]+)+git( |$)' %{_builddir}/build-comgr/CMakeFiles/amd_comgr.dir/link.txt +sed -E -i \ + -e "s@[^ ]*libLLVM\.so(\.[0-9]+)+git@$LLVMLIBS@" \ + %{_builddir}/build-comgr/CMakeFiles/amd_comgr.dir/link.txt -grep -q -E ' [^ ]*libLLVM.so(\.[0-9]+)+git ' %{_builddir}/build-comgr/CMakeFiles/amd_comgr.dir/link.txt -sed -E -i -e 's@\s[^ ]*libLLVM.so(\.[0-9]+)+git\s@ @' %{_builddir}/build-comgr/CMakeFiles/amd_comgr.dir/link.txt make -C %{_builddir}/build-comgr %{makeprocesses} VERBOSE=1 %install -make -C %{_builddir}/build-comgr install VERBOSE=1 \ No newline at end of file +make -C %{_builddir}/build-comgr install VERBOSE=1 diff --git a/rocm-config.file b/rocm-config.file index 8e4dba26632..aeb1aedef35 100644 --- a/rocm-config.file +++ b/rocm-config.file @@ -1,8 +1,8 @@ ### FILE rocm-config # define the ROCm compilation flags in a way that can be shared by SCRAM-based and regular tools ## INCLUDE rocm-flags -%define rocm_version_num 7.2.4 -%define rocm_version rocm-%{rocm_version_num} -%define rocm_systems_source git+https://github.com/ROCm/rocm-systems.git?obj=release/rocm-rel-7.2/%{rocm_version}&export=rocm-systems&submodules=1&output=/rocm-systems.tar.gz +%define rocm_version_num 7.13 +%define rocm_version therock-%{rocm_version_num} +%define rocm_systems_source git+https://github.com/ROCm/rocm-systems.git?obj=develop/%{rocm_version}&export=rocm-systems&submodules=1&output=/rocm-systems.tar.gz %define rocm_libraries_source git+https://github.com/ROCm/rocm-libraries.git?obj=develop/%{rocm_version}&export=rocm-libraries&submodules=1&output=/rocm-libraries.tar.gz %define rocm_targets $(sed 's/:sramecc+//g; s/ /;/g' <<< "%rocm_archs") diff --git a/rocm-core.spec b/rocm-core.spec index b56d554b852..8382a2756cf 100644 --- a/rocm-core.spec +++ b/rocm-core.spec @@ -2,19 +2,5 @@ ### RPM external rocm-core %{rocm_version_num} BuildRequires: cmake Requires: python3 py3-prettytable py3-PyYAML - -Source: %{rocm_systems_source} -%prep -%setup -q -n rocm-systems - -%build - -cmake \ - -S %{_builddir}/rocm-systems/projects/%{n} \ - -B %{_builddir}/build \ - -DCMAKE_INSTALL_PREFIX=%{i} \ - -DROCM_VERSION=%{rocm_version_num} - -cmake --build %{_builddir}/build --parallel %{makeprocesses} -%install -cmake --install %{_builddir}/build +%define cmake_args -DROCM_VERSION="%{rocm_version_num}.0" +## INCLUDE rocm-systems-build diff --git a/rocm-hip.spec b/rocm-hip.spec index 87c50bf6be8..2025e8b3350 100644 --- a/rocm-hip.spec +++ b/rocm-hip.spec @@ -4,34 +4,9 @@ ## INITENV SET HIP_PATH %{i} ## INITENV SET HIP_CLANG_PATH ${ROCM_LLVM_ROOT}/lib/llvm/bin ## INITENV HIP_PLATFORM amd -Source0: https://github.com/ROCm/rocm-systems/archive/refs/tags/rocm-%{realversion}.tar.gz BuildRequires: py3-CppHeaderParser Requires: rocm-llvm rocm-core rocr-runtime rocprofiler-register numactl python3 rocm-comgr Provides: perl(URI::Escape) -%prep -%setup -q -n rocm-systems-rocm-%{realversion} -%build -mkdir -p %{_builddir}/build-hip -cd %{_builddir}/build-hip -cmake \ - -S %{_builddir}/rocm-systems-rocm-%{realversion}/projects/clr \ - -B %{_builddir}/build-hip \ - -DHIP_COMMON_DIR=%{_builddir}/rocm-systems-rocm-%{realversion}/projects/hip \ - -DHIP_PLATFORM=amd \ - -DCLR_BUILD_HIP=ON \ - -DCLR_BUILD_OCL=OFF \ - -DHIP_INSTALLS_HIPCC=ON \ - -DHIPCC_BIN_DIR=${ROCM_LLVM_ROOT}/bin \ - -DCMAKE_INSTALL_PREFIX=%{i} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" \ - -DCMAKE_C_COMPILER=${ROCM_LLVM_ROOT}/bin/amdclang \ - -DCMAKE_CXX_COMPILER=${ROCM_LLVM_ROOT}/bin/amdclang++ \ - -DCMAKE_INSTALL_LIBDIR=lib \ - -DHSA_PATH=${HSA_ROCR_ROOT} \ - -DROCM_PATH=${ROCM_LLVM_ROOT} \ - -DDEVICE_LIB_PATH=${ROCM_LLVM_ROOT}/amdgcn/bitcode \ - -DLLVM_DIR=${ROCM_LLVM_ROOT}/lib/llvm/lib/cmake/llvm -make %{makeprocesses} -%install -make -C %{_builddir}/build-hip %{makeprocesses} install +%define rocm_project clr +%define cmake_args -DHIP_COMMON_DIR=%{_builddir}/rocm-systems/projects/hip -DHIP_PLATFORM=amd -DCLR_BUILD_HIP=ON -DCLR_BUILD_OCL=OFF -DHIP_INSTALLS_HIPCC=ON -DHIPCC_BIN_DIR=${ROCM_LLVM_ROOT}/bin -DCMAKE_C_COMPILER=${ROCM_LLVM_ROOT}/bin/amdclang -DCMAKE_CXX_COMPILER=${ROCM_LLVM_ROOT}/bin/amdclang++ -DCMAKE_INSTALL_LIBDIR=lib -DHSA_PATH=${HSA_ROCR_ROOT} -DROCM_PATH=${ROCM_LLVM_ROOT} -DDEVICE_LIB_PATH=${ROCM_LLVM_ROOT}/amdgcn/bitcode -DLLVM_DIR=${ROCM_LLVM_ROOT}/lib/llvm/lib/cmake/llvm +## INCLUDE rocm-systems-build diff --git a/rocm-libraries-build.file b/rocm-libraries-build.file index b851046060f..4cb54692262 100644 --- a/rocm-libraries-build.file +++ b/rocm-libraries-build.file @@ -1,7 +1,7 @@ BuildRequires: rocm-cmake Requires: rocm-hip rocm-core rocm-llvm rocr-runtime rocm-comgr ## INCLUDE rocm-config -Source0: %{rocm_libraries_source} +Source0: git+https://github.com/ROCm/rocm-libraries.git?obj=develop/therock-%{rocm_version_num}&export=rocm-libraries&submodules=1&output=/rocm-libraries.tar.gz %prep %{?ROCMPrePrep:%ROCMPrePrep} diff --git a/rocm-llvm.spec b/rocm-llvm.spec index 1a2085653a1..83285edac3f 100644 --- a/rocm-llvm.spec +++ b/rocm-llvm.spec @@ -6,7 +6,7 @@ ## INCLUDE cpp-standard %define keep_archives true -Source0: git+https://github.com/ROCm/llvm-project?obj=amd-staging/%{rocm_version}&export=%{n}-%{realversion}&output=/source.tar.gz +Source0: git+https://github.com/ROCm/llvm-project?obj=amd-staging/therock-%{realversion}&export=%{n}-%{realversion}&output=/source.tar.gz Source1: %{rocm_systems_source} Patch0: rocm-llvm-iterator-gcc14 BuildRequires: cmake rocm-cmake @@ -14,7 +14,7 @@ Requires: ninja rocm-core libxml2 zlib rocprofiler-register %prep %setup -q -n %{n}-%{realversion} -%patch0 -p1 +#%patch0 -p1 %build mkdir -p %{_builddir}/rocm-systems diff --git a/rocm-rocprofiler-sdk.spec b/rocm-rocprofiler-sdk.spec index 1e58737b327..adb0d9ce5b9 100644 --- a/rocm-rocprofiler-sdk.spec +++ b/rocm-rocprofiler-sdk.spec @@ -1,44 +1,11 @@ ## INCLUDE rocm-config ### RPM external rocm-rocprofiler-sdk %{rocm_version_num} - -Source0: %{rocm_systems_source} -BuildRequires: rocm-cmake +BuildRequires: rocm-cmake cmake gmake Requires: rocm-core rocm-llvm rocr-runtime rocprofiler rocm-comgr Requires: fmt glog sqlite py3-pybind11 aqlprofile rocprofiler-register Patch0: rocm-rocprofiler-sdk -BuildRequires: cmake gmake - -%prep -%setup -q -n rocm-systems - -%build -pushd %{_builddir}/rocm-systems/projects/rocprofiler-sdk -patch -p1 < %{PATCH0} -sed -i '2i\include(CPack)' CMakeLists.txt -popd - -export CC=${ROCM_LLVM_ROOT}/bin/amdclang -export CXX=${ROCM_LLVM_ROOT}/bin/amdclang++ - -cmake \ - -B %{_builddir}/build \ - -S %{_builddir}/rocm-systems/projects/rocprofiler-sdk \ - -DCMAKE_INSTALL_PREFIX=%{i} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" \ - -DROCPROFILER_BUILD_TESTS=OFF \ - -DROCPROFILER_BUILD_FMT=OFF \ - -DROCPROFILER_BUILD_GHC_FS=OFF \ - -DROCPROFILER_BUILD_GLOG=OFF \ - -DROCPROFILER_BUILD_PYBIND11=OFF \ - -DROCPROFILER_BUILD_SQLITE3=OFF \ - -DCPACK_ENABLED=OFF \ - -DCMAKE_CXX_FLAGS="-include fstream -include array -include memory -include unistd.h -include cstdint -I$ROCM_LLVM_ROOT/lib/llvm/include -I$ROCM_LLVM_ROOT/include -I$ROCM_COMGR_ROOT/include" - -make -C %{_builddir}/build %{makeprocesses} VERBOSE=1 - -%install -make -C %{_builddir}/build %{makeprocesses} install - -%post -%{relocateConfig}/lib/cmake/rocprofiler-sdk/rocprofiler-sdk-config.cmake +%define rocm_project rocprofiler-sdk +%define ROCMPreBuild pushd %{_builddir}/rocm-systems/projects/rocprofiler-sdk; patch -p1 < %{PATCH0}; sed -i '2i\include(CPack)' CMakeLists.txt; popd; export CC=${ROCM_LLVM_ROOT}/bin/amdclang; export CXX=${ROCM_LLVM_ROOT}/bin/amdclang++ +%define cmake_args -DROCPROFILER_BUILD_TESTS=OFF -DROCPROFILER_BUILD_FMT=OFF -DROCPROFILER_BUILD_GHC_FS=OFF -DROCPROFILER_BUILD_GLOG=OFF -DROCPROFILER_BUILD_PYBIND11=OFF -DROCPROFILER_BUILD_SQLITE3=OFF -DCPACK_ENABLED=OFF -DCMAKE_CXX_FLAGS="-include fstream -include array -include memory -include unistd.h -include cstdint -I$ROCM_LLVM_ROOT/lib/llvm/include -I$ROCM_LLVM_ROOT/include -I$ROCM_COMGR_ROOT/include" +%define ROCMPostPost %{relocateConfig}/lib/cmake/rocprofiler-sdk/rocprofiler-sdk-config.cmake +## INCLUDE rocm-systems-build diff --git a/rocm-rocprofiler-systems.spec b/rocm-rocprofiler-systems.spec index f05afd7a952..5615907f922 100644 --- a/rocm-rocprofiler-systems.spec +++ b/rocm-rocprofiler-systems.spec @@ -1,53 +1,13 @@ ## INCLUDE rocm-config ### RPM external rocm-rocprofiler-systems %{rocm_version_num} -Source0: git+https://github.com/ROCm/rocm-systems.git?obj=release/rocm-rel-7.2/%{rocm_version}&export=rocm-systems&submodules=1&output=/rocm-systems.tar.gz -Source1: https://github.com/ROCm/rocm-systems/commit/6276d4d7ab8350531e84a24d3db65b9f98d85eb6.patch Patch0: patches/rocprofiler-systems-elfutils +Patch1: patches/rocprofiler-systems-dyninst-tbb-boost-conflict Requires: rocm-core rocr-runtime rocprofiler roctracer rocm-hip libxml2 Requires: libunwind dyninst bz2lib Requires: sqlite rocm-rocprofiler-sdk amdsmi zlib rocm-comgr boost tbb json py3-pybind11 BuildRequires: flex bison cmake libiberty rocm-llvm rocm-cmake - -%prep -%setup -q -n rocm-systems -patch -p1 <%{_sourcedir}/6276d4d7ab8350531e84a24d3db65b9f98d85eb6.patch -%patch0 -p1 - -%build - -export CPPFLAGS=-I${BZ2LIB_ROOT}/include -export LDFLAGS=-L${BZ2LIB_ROOT}/lib - -perl -i -0pe 's/#include \n#include /#include \n#include /' %{_builddir}/rocm-systems/projects/rocprofiler-systems/source/lib/binary/symbol.cpp - -cmake \ - -B %{_builddir}/build \ - -S %{_builddir}/rocm-systems/projects/rocprofiler-systems \ - -DCMAKE_INSTALL_PREFIX=%{i} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH="%{cmake_prefix_path};${LIBIBERTY_ROOT};${FLEX_ROOT};${BISON_ROOT}" \ - -DTBB_ROOT_DIR=${TBB_ROOT} \ - -DROCPROFSYS_USE_BFD=ON \ - -DROCPROFSYS_USE_PYTHON=ON \ - -DROCPROFSYS_BUILD_PYTHON=OFF \ - -DROCPROFSYS_BUILD_DYNINST=OFF \ - -DROCPROFSYS_BUILD_TBB=OFF \ - -DROCPROFSYS_BUILD_LIBUNWIND=OFF \ - -DROCPROFSYS_BUILD_BOOST=OFF \ - -DROCPROFSYS_BUILD_LIBIBERTY=OFF \ - -DROCPROFSYS_BUILD_ELFUTILS=OFF \ - -DElfUtils_ROOT_DIR=$GCC_ROOT \ - -DElfUtils_INCLUDEDIR=$GCC_PREFIX/include \ - -DElfUtils_LIBRARYDIR=$GCC_PREFIX/lib \ - -DROCPROFILER_BUILD_SQLITE3=OFF \ - -DROCPROFSYS_BUILD_NLOHMANN_JSON=OFF \ - -DROCPROFSYS_BUILD_EXAMPLES=OFF \ - -DROCPROFSYS_BUILD_TESTING=OFF \ - -DCMAKE_FIND_DEBUG_MODE=OFF \ - -DROCPROFSYS_USE_PAPI=OFF \ - -DPython3_ROOT_DIR=$PYTHON3_ROOT - -cmake --build %{_builddir}/build --parallel %{makeprocesses} --verbose - -%install -cmake --build %{_builddir}/build --target install +%define rocm_project rocprofiler-systems +%define ROCMPostPrep patch -p1 -i %{PATCH0} ; patch -p1 -i %{PATCH1} +%define ROCMPreBuild export CPPFLAGS=-I${BZ2LIB_ROOT}/include; export LDFLAGS=-L${BZ2LIB_ROOT}/lib; perl -i -0pe 's|#include \\n#include |#include \\n#include |' %{_builddir}/rocm-systems/projects/rocprofiler-systems/source/lib/binary/symbol.cpp +%define cmake_args -DCMAKE_PREFIX_PATH="%{cmake_prefix_path};${LIBIBERTY_ROOT};${FLEX_ROOT};${BISON_ROOT}" -DTBB_ROOT_DIR=${TBB_ROOT} -DROCPROFSYS_USE_BFD=ON -DROCPROFSYS_USE_PYTHON=ON -DROCPROFSYS_BUILD_PYTHON=OFF -DROCPROFSYS_BUILD_DYNINST=OFF -DROCPROFSYS_BUILD_TBB=OFF -DROCPROFSYS_BUILD_LIBUNWIND=OFF -DROCPROFSYS_BUILD_BOOST=OFF -DROCPROFSYS_BUILD_LIBIBERTY=OFF -DROCPROFSYS_BUILD_ELFUTILS=OFF -DElfUtils_ROOT_DIR=$GCC_ROOT -DElfUtils_INCLUDEDIR=$GCC_PREFIX/include -DElfUtils_LIBRARYDIR=$GCC_PREFIX/lib -DROCPROFILER_BUILD_SQLITE3=OFF -DROCPROFSYS_BUILD_NLOHMANN_JSON=OFF -DROCPROFSYS_BUILD_EXAMPLES=OFF -DROCPROFSYS_BUILD_TESTING=OFF -DCMAKE_FIND_DEBUG_MODE=OFF -DROCPROFSYS_USE_PAPI=OFF -DPython3_ROOT_DIR=$PYTHON3_ROOT +## INCLUDE rocm-systems-build diff --git a/rocm-smi-lib.spec b/rocm-smi-lib.spec index 4ff3ac12621..6e07779d047 100644 --- a/rocm-smi-lib.spec +++ b/rocm-smi-lib.spec @@ -1,22 +1,5 @@ ## INCLUDE rocm-config ### RPM external rocm-smi-lib %{rocm_version_num} - -Source: %{rocm_systems_source} -Requires: rocm-core rocr-runtime -%prep -%setup -q -n rocm-systems - -%build - -cmake \ - -S %{_builddir}/rocm-systems/projects/%{n} \ - -B %{_builddir}/build \ - -DCMAKE_INSTALL_PREFIX=%{i} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" \ - -DBUILD_TESTING=OFF - -make -C %{_builddir}/build %{makeprocesses} VERBOSE=1 - -%install -make -C %{_builddir}/build %{makeprocesses} install +Requires: rocm-core rocr-runtime +%define cmake_args -DBUILD_TESTING=OFF +## INCLUDE rocm-systems-build diff --git a/rocm-systems-build.file b/rocm-systems-build.file new file mode 100644 index 00000000000..a4ffc4df367 --- /dev/null +++ b/rocm-systems-build.file @@ -0,0 +1,48 @@ +# Common build recipe shared by the ROCm packages that are sourced from the +# ROCm/rocm-systems monorepo, mirroring rocm-libraries-build.file. +# +# Include it with "## INCLUDE rocm-systems-build" as the last line of a spec, +# after the per-package BuildRequires/Requires and any of the customisation +# points below: +# %{rocm_project} - subdirectory under projects/ to build (defaults to %{n}) +# %{cmake_args} - extra -D flags appended to the cmake invocation +# ROCMPre*/ROCMPost* - shell snippets injected around each build phase +Source0: %{rocm_systems_source} + +%prep +%{?ROCMPrePrep:%ROCMPrePrep} +%setup -q -n rocm-systems/projects/%{?rocm_project}%{!?rocm_project:%{n}} +%{?ROCMPostPrep:%ROCMPostPrep} + +%build +%{?ROCMPreBuild:%ROCMPreBuild} + +%{?ROCMPreCMake:%ROCMPreCMake} + +CMAKE_ARGS=( + -S %{_builddir}/rocm-systems/projects/%{?rocm_project}%{!?rocm_project:%{n}} + -B %{_builddir}/build + -DCMAKE_INSTALL_PREFIX=%{i} + -DCMAKE_BUILD_TYPE=%{cmake_build_type} + -DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" + %{cmake_args} +) + +cmake "${CMAKE_ARGS[@]}" +%{?ROCMPostCMake:%ROCMPostCMake} + +%{?ROCMPreMake:%ROCMPreMake} +make -C %{_builddir}/build %{makeprocesses} +%{?ROCMPostMake:%ROCMPostMake} + +%{?ROCMPostBuild:%ROCMPostBuild} + +%install +%{?ROCMPreInstall:%ROCMPreInstall} +make -C %{_builddir}/build %{makeprocesses} install +%{?ROCMPostInstall:%ROCMPostInstall} + +%post +%{?ROCMPrePost:%ROCMPrePost} +true +%{?ROCMPostPost:%ROCMPostPost} diff --git a/rocminfo.spec b/rocminfo.spec index 87934c918a6..ab1a788bc25 100644 --- a/rocminfo.spec +++ b/rocminfo.spec @@ -1,20 +1,4 @@ ## INCLUDE rocm-config ### RPM external rocminfo %{rocm_version_num} - -Source: %{rocm_systems_source} Requires: rocm-core rocr-runtime -%prep -%setup -q -n rocm-systems - -%build - -cmake \ - -S %{_builddir}/rocm-systems/projects/%{n} \ - -B %{_builddir}/build \ - -DCMAKE_INSTALL_PREFIX=%{i} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" - -make -C %{_builddir}/build %{makeprocesses} -%install -make -C %{_builddir}/build %{makeprocesses} install +## INCLUDE rocm-systems-build diff --git a/rocprofiler-compute.spec b/rocprofiler-compute.spec index 7682aa6bb14..c534b44589f 100644 --- a/rocprofiler-compute.spec +++ b/rocprofiler-compute.spec @@ -1,6 +1,5 @@ ## INCLUDE rocm-config ### RPM external rocprofiler-compute %{rocm_version_num} -Source: %{rocm_systems_source} BuildRequires: cmake rocm-cmake Requires: rocm-core rocm-llvm rocr-runtime python3 rocprofiler roctracer rocm-hip libxml2 rocm-rocprofiler-sdk Requires: py3-astunparse py3-colorlover py3-kaleido py3-matplotlib @@ -9,27 +8,7 @@ Requires: py3-plotext py3-plotille py3-pymongo Requires: py3-PyYAML py3-setuptools py3-sqlalchemy Requires: py3-tabulate py3-textual py3-tqdm py3-textual-plotext py3-textual-fspicker Requires: py3-dash-bootstrap-components py3-dash-svg py3-dash -%prep -%setup -q -n rocm-systems - -%build - -cmake \ - -S %{_builddir}/rocm-systems/projects/%{n} \ - -B %{_builddir}/build \ - -DCMAKE_INSTALL_PREFIX=%{i} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" \ - -DCMAKE_C_COMPILER=${ROCM_LLVM_ROOT}/bin/amdclang \ - -DCMAKE_CXX_COMPILER=${ROCM_LLVM_ROOT}/bin/amdclang++ \ - -DBUILD_TESTING=OFF - -make -C %{_builddir}/build %{makeprocesses} VERBOSE=1 - -%install -make -C %{_builddir}/build %{makeprocesses} install -rm -fr %{i}/bin/roofline-rhel8-rocm6 %{i}/bin/roofline-sles15sp6-rocm6 %{i}/bin/roofline-ubuntu22_04-rocm6 -rm -fr %{i}/bin/roofline-azurelinux3-rocm7 %{i}/bin/roofline-sles15sp6-rocm7 %{i}/bin/roofline-ubuntu22_04-rocm7 - -%post -%{relocateConfig}/share/rocprofiler-compute/modulefiles/rocprofiler-compute/*.lua +%define cmake_args -DCMAKE_C_COMPILER=${ROCM_LLVM_ROOT}/bin/amdclang -DCMAKE_CXX_COMPILER=${ROCM_LLVM_ROOT}/bin/amdclang++ -DBUILD_TESTING=OFF +%define ROCMPostInstall rm -fr %{i}/bin/roofline-rhel8-rocm6 %{i}/bin/roofline-sles15sp6-rocm6 %{i}/bin/roofline-ubuntu22_04-rocm6 %{i}/bin/roofline-azurelinux3-rocm7 %{i}/bin/roofline-sles15sp6-rocm7 %{i}/bin/roofline-ubuntu22_04-rocm7 +%define ROCMPostPost %{relocateConfig}/share/rocprofiler-compute/modulefiles/rocprofiler-compute/*.lua +## INCLUDE rocm-systems-build diff --git a/rocprofiler-register.spec b/rocprofiler-register.spec index 5f50b010edf..8f064c88f41 100644 --- a/rocprofiler-register.spec +++ b/rocprofiler-register.spec @@ -1,34 +1,9 @@ ## INCLUDE rocm-config ### RPM external rocprofiler-register %{rocm_version_num} ## INCLUDE cpp-standard - -Source0: %{rocm_systems_source} - BuildRequires: gmake cmake Requires: fmt AutoReq: no - -%prep -%setup -q -n rocm-systems - -%build -sed -i -e 's|add_subdirectory(external)|find_package(fmt REQUIRED)\nadd_subdirectory(external)|' %{_builddir}/rocm-systems/projects/%{n}/CMakeLists.txt -%if %{cms_cxx_standard} != 17 -grep -q 'CMAKE_CXX_STANDARD *17' %{_builddir}/rocm-systems/projects/%{n}/cmake/rocprofiler_register_options.cmake -sed -i -e 's|CMAKE_CXX_STANDARD *17|CMAKE_CXX_STANDARD %{cms_cxx_standard}|' %{_builddir}/rocm-systems/projects/%{n}/cmake/rocprofiler_register_options.cmake -%endif - -cmake \ - -S %{_builddir}/rocm-systems/projects/%{n} \ - -B %{_builddir}/build \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=%{i} \ - -DCMAKE_CXX_STANDARD=%{cms_cxx_standard} \ - -DCMAKE_VERBOSE_MAKEFILE=TRUE \ - -DROCPROFILER_REGISTER_BUILD_FMT=OFF \ - -DCMAKE_PREFIX_PATH="${FMT_ROOT}" - -make -C %{_builddir}/build %{makeprocesses} VERBOSE=1 - -%install -make -C %{_builddir}/build %{makeprocesses} install +%define ROCMPreCMake sed -i -e 's|add_subdirectory(external)|find_package(fmt REQUIRED)\\nadd_subdirectory(external)|' %{_builddir}/rocm-systems/projects/%{n}/CMakeLists.txt ; sed -i -e 's|CMAKE_CXX_STANDARD *17|CMAKE_CXX_STANDARD %{cms_cxx_standard}|' %{_builddir}/rocm-systems/projects/%{n}/cmake/rocprofiler_register_options.cmake +%define cmake_args -DCMAKE_CXX_STANDARD=%{cms_cxx_standard} -DCMAKE_VERBOSE_MAKEFILE=TRUE -DROCPROFILER_REGISTER_BUILD_FMT=OFF -DCMAKE_PREFIX_PATH="${FMT_ROOT}" +## INCLUDE rocm-systems-build diff --git a/rocprofiler.spec b/rocprofiler.spec index 89c6f9a2198..4397c57b52c 100644 --- a/rocprofiler.spec +++ b/rocprofiler.spec @@ -1,39 +1,8 @@ ## INCLUDE rocm-config ### RPM external rocprofiler %{rocm_version_num} -Source: %{rocm_systems_source} #Source1: https://github.com/google/perfetto/archive/eb5ef24c58d13cec289d733d03f0f3f0ed321b12.tar.gz BuildRequires: py3-barectf py3-CppHeaderParser rocm-cmake Requires: rocm-core rocr-runtime python3 aqlprofile rocm-hip numactl libxml2 roctracer py3-lxml py3-PyYAML rocm-comgr - -%prep -%setup -q -n rocm-systems - -%build -#tar -xzf %{_sourcedir}/eb5ef24c58d13cec289d733d03f0f3f0ed321b12.tar.gz -C %{_builddir}/rocm-systems/projects/%{n}/plugin/perfetto/perfetto --strip-components=1 -sed -i '1,7d' %{_builddir}/rocm-systems/projects/%{n}/plugin/perfetto/CMakeLists.txt #Downloads the submodule otherwise -#No otherway to turn off tests -sed -i \ - 's/^set(ROCPROFILER_BUILD_TESTS ON)/set(ROCPROFILER_BUILD_TESTS OFF)/' \ - %{_builddir}/rocm-systems/projects/%{n}/CMakeLists.txt - -sed -i \ - 's/^set(ROCPROFILER_BUILD_CI ON)/set(ROCPROFILER_BUILD_CI OFF)/' \ - %{_builddir}/rocm-systems/projects/%{n}/CMakeLists.txt - -cmake \ - -S %{_builddir}/rocm-systems/projects/%{n} \ - -B %{_builddir}/build \ - -DCMAKE_INSTALL_PREFIX=%{i} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" \ - -DGPU_TARGETS="%{rocm_targets}" \ - -DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" \ - -DCMAKE_CXX_FLAGS="-I${NUMACTL_ROOT}/include -I${ROCM_CORE_ROOT}/include" \ - -DCMAKE_C_FLAGS="-I${NUMACTL_ROOT}/include -I${ROCM_CORE_ROOT}/include" \ - -DCMAKE_SHARED_LINKER_FLAGS="-L${GCC_ROOT}/lib -L${NUMACTL_ROOT}/lib" \ - -DCMAKE_EXE_LINKER_FLAGS="-L${GCC_ROOT}/lib -L${NUMACTL_ROOT}/lib" - -make -C %{_builddir}/build %{makeprocesses} VERBOSE=1 - -%install -make -C %{_builddir}/build %{makeprocesses} install +%define ROCMPreCMake sed -i '1,7d' %{_builddir}/rocm-systems/projects/%{n}/plugin/perfetto/CMakeLists.txt ; sed -i 's/^set(ROCPROFILER_BUILD_TESTS ON)/set(ROCPROFILER_BUILD_TESTS OFF)/' %{_builddir}/rocm-systems/projects/%{n}/CMakeLists.txt ; sed -i 's/^set(ROCPROFILER_BUILD_CI ON)/set(ROCPROFILER_BUILD_CI OFF)/' %{_builddir}/rocm-systems/projects/%{n}/CMakeLists.txt +%define cmake_args -DGPU_TARGETS="%{rocm_targets}" -DCMAKE_CXX_FLAGS="-I${NUMACTL_ROOT}/include -I${ROCM_CORE_ROOT}/include" -DCMAKE_C_FLAGS="-I${NUMACTL_ROOT}/include -I${ROCM_CORE_ROOT}/include" -DCMAKE_SHARED_LINKER_FLAGS="-L${GCC_ROOT}/lib -L${NUMACTL_ROOT}/lib" -DCMAKE_EXE_LINKER_FLAGS="-L${GCC_ROOT}/lib -L${NUMACTL_ROOT}/lib" +## INCLUDE rocm-systems-build diff --git a/rocr-runtime.spec b/rocr-runtime.spec index 3bb316c1cb8..1882e1677b3 100644 --- a/rocr-runtime.spec +++ b/rocr-runtime.spec @@ -1,28 +1,7 @@ ## INCLUDE rocm-config ### RPM external rocr-runtime %{rocm_version_num} -Source: %{rocm_systems_source} Requires: rocm-core zlib libxml2 rocprofiler-register numactl rocm-llvm - -%prep -%setup -q -n rocm-systems - -%build -export ROCM_PATH=$ROCM_LLVM_ROOT -export ROCM_DEVICE_LIB_PATH=$ROCM_LLVM_ROOT/amdgcn/bitcode - -cmake \ - -S %{_builddir}/rocm-systems/projects/%{n} \ - -B %{_builddir}/build \ - -DCMAKE_CXX_COMPILER=$ROCM_LLVM_ROOT/lib/llvm/bin/clang++ \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=%{i} \ - -DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" \ - -DBUILD_SHARED_LIBS=ON \ - -DCMAKE_C_FLAGS="-I${NUMACTL_ROOT}/include" \ - -DCMAKE_CXX_FLAGS="-I${NUMACTL_ROOT}/include --rocm-path=$ROCM_LLVM_ROOT" - -make -C %{_builddir}/build %{makeprocesses} -%install -make -C %{_builddir}/build %{makeprocesses} install -%post -%{relocateConfig}/lib64/cmake/hsakmt/hsakmtTargets.cmake +%define ROCMPreBuild export ROCM_PATH=$ROCM_LLVM_ROOT; export ROCM_DEVICE_LIB_PATH=$ROCM_LLVM_ROOT/amdgcn/bitcode +%define cmake_args -DCMAKE_CXX_COMPILER=$ROCM_LLVM_ROOT/lib/llvm/bin/clang++ -DBUILD_SHARED_LIBS=ON -DCMAKE_C_FLAGS="-I${NUMACTL_ROOT}/include" -DCMAKE_CXX_FLAGS="-I${NUMACTL_ROOT}/include --rocm-path=$ROCM_LLVM_ROOT" +%define ROCMPostPost %{relocateConfig}/lib64/cmake/hsakmt/hsakmtTargets.cmake +## INCLUDE rocm-systems-build diff --git a/rocshmem.spec b/rocshmem.spec index 1059666085c..1de3ac5c2e4 100644 --- a/rocshmem.spec +++ b/rocshmem.spec @@ -1,27 +1,7 @@ ## INCLUDE rocm-config ### RPM external rocshmem %{rocm_version_num} - -Source0: https://github.com/ROCm/rocSHMEM/archive/refs/tags/%{rocm_version}.tar.gz BuildRequires: rocm-cmake Requires: rocm-core rocm-llvm rocr-runtime rocm-hip Requires: openmpi rocm-comgr - -%prep -%setup -q -n rocSHMEM-%{rocm_version} - -%build -cmake \ - -B %{_builddir}/build \ - -S %{_builddir}/rocSHMEM-%{rocm_version} \ - -DCMAKE_INSTALL_PREFIX=%{i} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH="%{cmake_prefix_path};$ROCM_CMAKE_ROOT" \ - -DROCM_PATH=$ROCM_LLVM_ROOT \ - -DUSE_EXTERNAL_MPI=ON \ - -DBUILD_TESTING=OFF \ - -DCMAKE_CXX_FLAGS="-I$ROCM_CORE_ROOT/include --rocm-device-lib-path=${ROCM_LLVM_ROOT}/amdgcn/bitcode" - -make -C %{_builddir}/build %{makeprocesses} VERBOSE=1 - -%install -make -C %{_builddir}/build %{makeprocesses} install +%define cmake_args -DCMAKE_PREFIX_PATH="%{cmake_prefix_path};$ROCM_CMAKE_ROOT" -DROCM_PATH=$ROCM_LLVM_ROOT -DUSE_EXTERNAL_MPI=ON -DBUILD_TESTING=OFF -DCMAKE_CXX_FLAGS="-I$ROCM_CORE_ROOT/include --rocm-device-lib-path=${ROCM_LLVM_ROOT}/amdgcn/bitcode" -DEXPLICIT_ROCM_VERSION=%{rocm_version_num}.0 +## INCLUDE rocm-systems-build diff --git a/rocsparse.spec b/rocsparse.spec index 7178a4df1f2..bcfb1424bb6 100644 --- a/rocsparse.spec +++ b/rocsparse.spec @@ -1,31 +1,6 @@ ## INCLUDE rocm-config ### RPM external rocsparse %{rocm_version_num} ## INCLUDE rocm-config -Source0: https://github.com/ROCm/rocSPARSE/archive/refs/tags/rocm-%{rocm_version_num}.tar.gz -BuildRequires: rocm-cmake -Requires: rocm-hip rocm-core rocm-llvm rocr-runtime rocm-comgr rocprim rocblas - -%prep -%setup -q -n rocSPARSE-%{rocm_version} - -%build -export HIP_DEVICE_LIB_PATH=$ROCM_LLVM_ROOT/amdgcn/bitcode -CMAKE_ARGS=( - -B %{_builddir}/build - -S %{_builddir}/rocSPARSE-%{rocm_version} - -DCMAKE_INSTALL_PREFIX=%{i} - -DCMAKE_C_COMPILER=$ROCM_LLVM_ROOT/bin/amdclang - -DCMAKE_CXX_COMPILER=$ROCM_LLVM_ROOT/bin/amdclang++ - -DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" - -DBUILD_CLIENTS_TESTS=off - -DHIP_ROOT=$ROCM_HIP_ROOT - -DGPU_TARGETS="%{rocm_targets}" - $LIB_ARGS -) - -cmake "${CMAKE_ARGS[@]}" - -make -C %{_builddir}/build %{makeprocesses} - -%install -make -C %{_builddir}/build %{makeprocesses} install +Requires: rocprim rocblas +%define ROCMPreBuild export HIP_DEVICE_LIB_PATH=$ROCM_LLVM_ROOT/amdgcn/bitcode +## INCLUDE rocm-libraries-build diff --git a/roctracer.spec b/roctracer.spec index 4d545c1d8ff..218afdf31ba 100644 --- a/roctracer.spec +++ b/roctracer.spec @@ -1,24 +1,7 @@ ## INCLUDE rocm-config ### RPM external roctracer %{rocm_version_num} -Source: %{rocm_systems_source} Requires: rocr-runtime rocm-hip rocm-comgr BuildRequires: py3-CppHeaderParser - -%prep -%setup -q -n rocm-systems - -%build -sed -i 's/add_subdirectory(test)/# add_subdirectory(test)/' %{_builddir}/rocm-systems/projects/%{n}/CMakeLists.txt - -cmake \ - -S %{_builddir}/rocm-systems/projects/%{n} \ - -B %{_builddir}/build \ - -DCMAKE_INSTALL_PREFIX=%{i} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH="%{cmake_prefix_path}" \ - -DBUILD_TESTS=OFF - -make -C %{_builddir}/build %{makeprocesses} - -%install -make -C %{_builddir}/build %{makeprocesses} install +%define ROCMPreCMake sed -i 's/add_subdirectory(test)/# add_subdirectory(test)/' %{_builddir}/rocm-systems/projects/%{n}/CMakeLists.txt +%define cmake_args -DBUILD_TESTS=OFF +## INCLUDE rocm-systems-build