diff options
author | Sv. Lockal <lockalsash@gmail.com> | 2024-05-13 14:16:52 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2024-06-26 10:19:03 +0100 |
commit | fcfa315ab6a05ff14d40df19a411b9db3b439ad9 (patch) | |
tree | 0dfe5cc8f8b313e362b980db37ae19c8c9f64744 /dev-libs | |
parent | dev-libs/rocm-device-libs: ensure correct clang selected (diff) | |
download | gentoo-fcfa315ab6a05ff14d40df19a411b9db3b439ad9.tar.gz gentoo-fcfa315ab6a05ff14d40df19a411b9db3b439ad9.tar.bz2 gentoo-fcfa315ab6a05ff14d40df19a411b9db3b439ad9.zip |
dev-libs/rocm-comgr: include and call external hipcc to fix tests
fix-comgr-default-flags.patch supersedes HIPIncludePath-not-needed.patch
enforce-oop-compiler.patch calls external hipcc to avoid issues (e.g.
name_expression_map_test ), which means hipcc should be in RDEPEND.
Bug: https://github.com/ROCm/clr/issues/82
Signed-off-by: Sv. Lockal <lockalsash@gmail.com>
Signed-off-by: Yiyang Wu <xgreenlandforwyy@gmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-libs')
4 files changed, 77 insertions, 16 deletions
diff --git a/dev-libs/rocm-comgr/files/rocm-comgr-6.1.0-HIPIncludePath-not-needed.patch b/dev-libs/rocm-comgr/files/rocm-comgr-6.1.0-HIPIncludePath-not-needed.patch deleted file mode 100644 index f098527d470a..000000000000 --- a/dev-libs/rocm-comgr/files/rocm-comgr-6.1.0-HIPIncludePath-not-needed.patch +++ /dev/null @@ -1,15 +0,0 @@ -Index: comgr/src/comgr-compiler.cpp -=================================================================== ---- comgr.orig/src/comgr-compiler.cpp -+++ comgr/src/comgr-compiler.cpp -@@ -1054,10 +1054,6 @@ amd_comgr_status_t AMDGPUCompiler::addCo - Args.push_back("-target"); - Args.push_back("x86_64-unknown-linux-gnu"); - Args.push_back("--cuda-device-only"); -- Args.push_back("-isystem"); -- Args.push_back(ROCMIncludePath.c_str()); -- Args.push_back("-isystem"); -- Args.push_back(HIPIncludePath.c_str()); - break; - default: - return AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT; diff --git a/dev-libs/rocm-comgr/files/rocm-comgr-6.1.0-enforce-oop-compiler.patch b/dev-libs/rocm-comgr/files/rocm-comgr-6.1.0-enforce-oop-compiler.patch new file mode 100644 index 000000000000..99cbf2f22ce6 --- /dev/null +++ b/dev-libs/rocm-comgr/files/rocm-comgr-6.1.0-enforce-oop-compiler.patch @@ -0,0 +1,26 @@ +In-process compilation breaks compile_source_to_executable test, as it attempts to +build .so as fatbin, and some options does not work with unpatched LLVM. +--- a/src/comgr-compiler.cpp ++++ b/src/comgr-compiler.cpp +@@ -1226,10 +1226,7 @@ amd_comgr_status_t AMDGPUCompiler::compileToFatBin() { + return AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT; + } + +- // This is a workaround to support HIP OOP Fatbin Compilation +- CompileOOP = true; + auto Status = processFiles(AMD_COMGR_DATA_KIND_FATBIN, ".fatbin"); +- CompileOOP = false; + + return Status; + } +--- a/src/comgr-compiler.h ++++ b/src/comgr-compiler.h +@@ -102,7 +102,7 @@ class AMDGPUCompiler { + std::string ClangIncludePath; + std::string ClangIncludePath2; + /// Perform out-of-process compilation. +- bool CompileOOP = false; ++ bool CompileOOP = true; + /// Precompiled header file paths. + llvm::SmallVector<llvm::SmallString<128>, 2> PrecompiledHeaders; + /// Arguments common to all driver invocations in the current action. diff --git a/dev-libs/rocm-comgr/files/rocm-comgr-6.1.0-fix-comgr-default-flags.patch b/dev-libs/rocm-comgr/files/rocm-comgr-6.1.0-fix-comgr-default-flags.patch new file mode 100644 index 000000000000..9bad87a68c3d --- /dev/null +++ b/dev-libs/rocm-comgr/files/rocm-comgr-6.1.0-fix-comgr-default-flags.patch @@ -0,0 +1,43 @@ +Remove HIP/ROCM includes ("-isystem /usr/include"), as they break inclusion of <math.h>. +Add inclusion of Clang resource dir (e.g. /usr/lib/clang/17), as it is used in hip runtime like that. +Issue: https://github.com/ROCm/clr/issues/82 +--- a/src/comgr-compiler.cpp ++++ b/src/comgr-compiler.cpp +@@ -1028,9 +1028,8 @@ AMDGPUCompiler::addTargetIdentifierFlags(llvm::StringRef IdentStr, + } + + amd_comgr_status_t AMDGPUCompiler::addCompilationFlags() { +- HIPIncludePath = (Twine(env::getHIPPath()) + "/include").str(); +- // HIP headers depend on hsa.h which is in ROCM_DIR/include. +- ROCMIncludePath = (Twine(env::getROCMPath()) + "/include").str(); ++ // Allow to include <include/cuda_wrappers/algorithm> (used in some hip files) ++ ClangIncludePath = @CLANG_RESOURCE_DIR@; + + Args.push_back("-x"); + +@@ -1055,9 +1054,7 @@ amd_comgr_status_t AMDGPUCompiler::addCompilationFlags() { + Args.push_back("x86_64-unknown-linux-gnu"); + Args.push_back("--cuda-device-only"); + Args.push_back("-isystem"); +- Args.push_back(ROCMIncludePath.c_str()); +- Args.push_back("-isystem"); +- Args.push_back(HIPIncludePath.c_str()); ++ Args.push_back(ClangIncludePath.c_str()); + break; + default: + return AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT; +--- a/src/comgr-compiler.h ++++ b/src/comgr-compiler.h +@@ -95,12 +95,7 @@ class AMDGPUCompiler { + /// User supplied target GPU Arch. + std::string GPUArch; + std::string OffloadArch; +- /// ROCM include Path +- std::string ROCMIncludePath; +- /// HIP and Clang Include Paths +- std::string HIPIncludePath; + std::string ClangIncludePath; +- std::string ClangIncludePath2; + /// Perform out-of-process compilation. + bool CompileOOP = false; + /// Precompiled header file paths. diff --git a/dev-libs/rocm-comgr/rocm-comgr-6.1.1.ebuild b/dev-libs/rocm-comgr/rocm-comgr-6.1.1.ebuild index 505a2b959fe9..b52f76a962ea 100644 --- a/dev-libs/rocm-comgr/rocm-comgr-6.1.1.ebuild +++ b/dev-libs/rocm-comgr/rocm-comgr-6.1.1.ebuild @@ -29,7 +29,8 @@ PATCHES=( "${FILESDIR}/${PN}-5.7.1-correct-license-install-dir.patch" "${FILESDIR}/${PN}-6.0.0-extend-isa-compatibility-check.patch" "${FILESDIR}/${PN}-6.0.0-llvm-18-compat.patch" - "${FILESDIR}/${PN}-6.1.0-HIPIncludePath-not-needed.patch" + "${FILESDIR}/${PN}-6.1.0-enforce-oop-compiler.patch" + "${FILESDIR}/${PN}-6.1.0-fix-comgr-default-flags.patch" "${FILESDIR}/${PN}-6.1.0-clang18-option-use-visibility.patch" "${FILESDIR}/${PN}-6.1.0-clang18-code-object-v5.patch" "${FILESDIR}/${PN}-6.1.0-clang18-log_remarks_test.patch" @@ -47,6 +48,7 @@ RDEPEND=">=dev-libs/rocm-device-libs-${PV} sys-devel/clang:${LLVM_SLOT}= sys-devel/lld:${LLVM_SLOT}= ') + dev-util/hipcc " DEPEND="${RDEPEND}" @@ -70,7 +72,12 @@ src_prepare() { sed '/sys::path::append(HIPPath/s,"hip","",' -i src/comgr-env.cpp || die sed "/return LLVMPath;/s,LLVMPath,llvm::SmallString<128>(\"$(get_llvm_prefix)\")," -i src/comgr-env.cpp || die eapply $(prefixify_ro "${FILESDIR}"/${PN}-5.0-rocm_path.patch) + cmake_src_prepare + + # Replace @CLANG_RESOURCE_DIR@ in patches + local CLANG_RESOURCE_DIR="$("$(get_llvm_prefix)"/bin/clang -print-resource-dir)" + sed "s,@CLANG_RESOURCE_DIR@,\"${CLANG_RESOURCE_DIR}\"," -i src/comgr-compiler.cpp || die } src_configure() { |