From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 23304158241 for ; Sun, 19 Nov 2023 02:18:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 24E572BC02F; Sun, 19 Nov 2023 02:18:42 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 037332BC02F for ; Sun, 19 Nov 2023 02:18:42 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 03C8C335D2E for ; Sun, 19 Nov 2023 02:18:41 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3689A13A4 for ; Sun, 19 Nov 2023 02:18:39 +0000 (UTC) From: "Benda XU" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Benda XU" Message-ID: <1700360301.74964e47d7cb86d9cbb992f02e9de25a554727ac.heroxbd@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/hip/files/, dev-util/hip/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-util/hip/files/hip-5.7.1-disable-stack-protector.patch dev-util/hip/files/hip-5.7.1-exec-stack.patch dev-util/hip/files/hip-5.7.1-fix-unaligned-access.patch dev-util/hip/files/hip-5.7.1-no_asan_doc.patch dev-util/hip/hip-5.7.1.ebuild X-VCS-Directories: dev-util/hip/ dev-util/hip/files/ X-VCS-Committer: heroxbd X-VCS-Committer-Name: Benda XU X-VCS-Revision: 74964e47d7cb86d9cbb992f02e9de25a554727ac X-VCS-Branch: master Date: Sun, 19 Nov 2023 02:18:39 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: efca4735-7a95-483c-9efd-aed1629ded10 X-Archives-Hash: e4ed71ee7a416cf3a7bc78ff9d866efc commit: 74964e47d7cb86d9cbb992f02e9de25a554727ac Author: Sv. Lockal gmail com> AuthorDate: Wed Oct 18 18:34:10 2023 +0000 Commit: Benda XU gentoo org> CommitDate: Sun Nov 19 02:18:21 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=74964e47 dev-util/hip: fix crashes and QA issues. - add fix-unaligned-memcpy.patch - add exec-stack.patch - add disable-stack-protector patch - drop asan doc from the build system. Closes: https://bugs.gentoo.org/915969 Bug: https://github.com/ROCm-Developer-Tools/clr/issues/18 Bug: https://github.com/gentoo/gentoo/pull/33400 Bug: https://github.com/ROCm-Developer-Tools/clr/issues/22 Bug: https://github.com/ROCm-Developer-Tools/clr/issues/21 Bug: https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/issues/61 Signed-off-by: Sv. Lockal gmail.com> Signed-off-by: Benda Xu gentoo.org> .../files/hip-5.7.1-disable-stack-protector.patch | 13 +++++ dev-util/hip/files/hip-5.7.1-exec-stack.patch | 31 ++++++++++ .../hip/files/hip-5.7.1-fix-unaligned-access.patch | 67 ++++++++++++++++++++++ dev-util/hip/files/hip-5.7.1-no_asan_doc.patch | 17 ++++++ dev-util/hip/hip-5.7.1.ebuild | 9 ++- 5 files changed, 134 insertions(+), 3 deletions(-) diff --git a/dev-util/hip/files/hip-5.7.1-disable-stack-protector.patch b/dev-util/hip/files/hip-5.7.1-disable-stack-protector.patch new file mode 100644 index 000000000000..49d944ef4bc9 --- /dev/null +++ b/dev-util/hip/files/hip-5.7.1-disable-stack-protector.patch @@ -0,0 +1,13 @@ +Disable stack-protector (which is enabled by default gentoo-hardened) in device code. +This is not required after https://github.com/llvm/llvm-project/pull/70799, but helps with older clang. +Upstream bug: https://github.com/ROCm-Developer-Tools/clr/issues/21 +--- a/hipamd/src/hiprtc/hiprtcInternal.cpp ++++ b/hipamd/src/hiprtc/hiprtcInternal.cpp +@@ -144,6 +144,7 @@ RTCCompileProgram::RTCCompileProgram(std::string name_) : RTCProgram(name_), fgp + compile_options_.push_back("-nogpuinc"); + compile_options_.push_back("-Wno-gnu-line-marker"); + compile_options_.push_back("-Wno-missing-prototypes"); ++ compile_options_.push_back("-fno-stack-protector"); + #ifdef _WIN32 + compile_options_.push_back("-target"); + compile_options_.push_back("x86_64-pc-windows-msvc"); diff --git a/dev-util/hip/files/hip-5.7.1-exec-stack.patch b/dev-util/hip/files/hip-5.7.1-exec-stack.patch new file mode 100644 index 000000000000..744ca7b953c3 --- /dev/null +++ b/dev-util/hip/files/hip-5.7.1-exec-stack.patch @@ -0,0 +1,31 @@ +Upstream bug: https://github.com/ROCm-Developer-Tools/clr/issues/22 +--- a/hipamd/src/hip_embed_pch.sh ++++ b/hipamd/src/hip_embed_pch.sh +@@ -178,6 +178,7 @@ EOF + + echo "// Automatically generated script for HIP RTC." > $mcinFile + if [[ $isWindows -eq 0 ]]; then ++ echo " .section .note.GNU-stack,"",%progbits" >> $mcinFile + echo " .type __hipRTC_header,@object" >> $mcinFile + echo " .type __hipRTC_header_size,@object" >> $mcinFile + fi +--- a/hipamd/src/hiprtc/cmake/HIPRTC.cmake ++++ b/hipamd/src/hiprtc/cmake/HIPRTC.cmake +@@ -98,6 +98,7 @@ macro(generate_hiprtc_mcin HiprtcMcin HiprtcPreprocessedInput) + set(HIPRTC_TYPE_LINUX_ONLY "") + else() + set(HIPRTC_TYPE_LINUX_ONLY ++ " .section .note.GNU-stack,\"\",%progbits\n" + " .type __hipRTC_header,@object\n" + " .type __hipRTC_header_size,@object") + endif() +--- a/hipamd/src/hip_embed_pch.sh ++++ b/hipamd/src/hip_embed_pch.sh +@@ -111,6 +111,7 @@ cat >$tmp/hip_pch.h <$tmp/hip_pch.mcin <(dst)++, +- *reinterpret_cast(src)++); +- } +- size = size % sizeof(__m512i); +- #endif +- +- #if defined(__AVX__) +- for (auto i = 0u; i != size / sizeof(__m256i); ++i) { +- _mm256_stream_si256(reinterpret_cast<__m256i* __restrict&>(dst)++, +- *reinterpret_cast(src)++); +- } +- size = size % sizeof(__m256i); +- #endif +- +- for (auto i = 0u; i != size / sizeof(__m128i); ++i) { +- _mm_stream_si128(reinterpret_cast<__m128i* __restrict&>(dst)++, +- *(reinterpret_cast(src)++)); +- } +- size = size % sizeof(__m128i); +- +- for (auto i = 0u; i != size / sizeof(long long); ++i) { +- _mm_stream_si64(reinterpret_cast(dst)++, +- *reinterpret_cast(src)++); +- } +- size = size % sizeof(long long); +- +- for (auto i = 0u; i != size / sizeof(int); ++i) { +- _mm_stream_si32(reinterpret_cast(dst)++, +- *reinterpret_cast(src)++); +- } +-} +- + // ================================================================================================ + bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes, + const amd::Kernel& kernel, const_address parameters, void* eventHandle, +@@ -3096,7 +3058,7 @@ bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes, + argBuffer = reinterpret_cast
(allocKernArg(gpuKernel.KernargSegmentByteSize(), + gpuKernel.KernargSegmentAlignment())); + // Load all kernel arguments +- nontemporalMemcpy(argBuffer, parameters, ++ memcpy(argBuffer, parameters, + std::min(gpuKernel.KernargSegmentByteSize(), + signature.paramsSize())); + } diff --git a/dev-util/hip/files/hip-5.7.1-no_asan_doc.patch b/dev-util/hip/files/hip-5.7.1-no_asan_doc.patch new file mode 100644 index 000000000000..40de416334be --- /dev/null +++ b/dev-util/hip/files/hip-5.7.1-no_asan_doc.patch @@ -0,0 +1,17 @@ +Donot install -asan documents. + +Reference: +https://github.com/RadeonOpenCompute/llvm-project/commit/e782e09f7b113a0f896c6cec7240d411aca1d73f +https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/issues/61 + +--- a/hipamd/packaging/CMakeLists.txt 2023-11-18 23:25:45.000000000 +0800 ++++ b/hipamd/packaging/CMakeLists.txt 2023-11-18 23:27:27.230354665 +0800 +@@ -36,8 +36,6 @@ + ###Set License#### + set(CPACK_RESOURCE_FILE_LICENSE ${hip_SOURCE_DIR}/LICENSE.txt) + install(FILES ${CPACK_RESOURCE_FILE_LICENSE} DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT binary) +-# install license file in share/doc/hip-asan folder +-install(FILES ${CPACK_RESOURCE_FILE_LICENSE} DESTINATION ${CMAKE_INSTALL_DOCDIR}-asan COMPONENT asan) + set(CPACK_RPM_PACKAGE_LICENSE "MIT") + #Begin binary files install + if(HIP_PLATFORM STREQUAL "amd" ) diff --git a/dev-util/hip/hip-5.7.1.ebuild b/dev-util/hip/hip-5.7.1.ebuild index 0bba0d2f560b..c9094afe5ba6 100644 --- a/dev-util/hip/hip-5.7.1.ebuild +++ b/dev-util/hip/hip-5.7.1.ebuild @@ -35,8 +35,12 @@ RDEPEND="${DEPEND} >=dev-libs/roct-thunk-interface-5" PATCHES=( - "${FILESDIR}/hip-5.7.0-install.patch" - ) + "${FILESDIR}/${PN}-5.7.0-install.patch" + "${FILESDIR}/${PN}-5.7.1-fix-unaligned-access.patch" + "${FILESDIR}/${PN}-5.7.1-exec-stack.patch" + "${FILESDIR}/${PN}-5.7.1-disable-stack-protector.patch" + "${FILESDIR}/${PN}-5.7.1-no_asan_doc.patch" +) S="${WORKDIR}/clr-rocm-${PV}/" @@ -72,7 +76,6 @@ src_compile() { } src_install() { - cmake_src_install rm "${ED}/usr/include/hip/hcc_detail" || die