Updating patch to enable flag mcode-object-version=none (#40367)

* Updating patch to add flag mcode-object-version=none when
   device libs is buils as part of llvm-amdgpu
* Limiting patch to +rocm-device-libs variant and adding
   appropriate comment for the patch
* Updating llvmpatch as per the mailine code
   Updating hsa-rocr patch as per the latest code
   Updating the if elif condition for the hip test src path
* Updating flags for 5.5 relases and above
* Updating build flags and patches
This commit is contained in:
renjithravindrankannath 2023-10-16 10:25:10 -07:00 committed by GitHub
parent 22405fbb68
commit 74bbb1ef1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 64 additions and 30 deletions

View file

@ -715,11 +715,10 @@ def cache_test_sources(self):
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
if self.spec.satisfies("@:5.1.0"): if self.spec.satisfies("@:5.1.0"):
return return
else: elif self.spec.satisfies("@5.1:5.5"):
if "@:5.5" in self.spec: self.test_src_dir = "samples"
self.test_src_dir = "samples" elif self.spec.satisfies("@5.6:"):
else: self.test_src_dir = "hip-tests/samples"
self.test_src_dir = "hip-tests/samples"
self.cache_extra_test_sources([self.test_src_dir]) self.cache_extra_test_sources([self.test_src_dir])
def test_samples(self): def test_samples(self):

View file

@ -1,17 +1,17 @@
From b5a49e6de81e7a6cba86694ee5ba2486cd999976 Mon Sep 17 00:00:00 2001 From fb6bc54d50ec511118557bfad7f1b892adcc1a1d Mon Sep 17 00:00:00 2001
From: Harmen Stoppels <harmenstoppels@gmail.com> From: Renjith Ravindran <Renjith.RavindranKannath@amd.com>
Date: Fri, 28 Aug 2020 18:26:54 +0200 Date: Tue, 10 Oct 2023 01:15:08 +0000
Subject: [PATCH] Remove explicit RPATH again Subject: [PATCH] Updating patch for the latest code
--- ---
src/CMakeLists.txt | 3 --- src/CMakeLists.txt | 3 ---
1 file changed, 3 deletions(-) 1 file changed, 3 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9de7842..66c6880 100644 index 8fb02b1..b40c972 100644
--- a/src/CMakeLists.txt --- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt +++ b/src/CMakeLists.txt
@@ -134,9 +134,6 @@ target_include_directories( ${CORE_RUNTIME_TARGET} @@ -122,9 +122,6 @@ target_include_directories( ${CORE_RUNTIME_TARGET}
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/libamdhsacode ) ${CMAKE_CURRENT_SOURCE_DIR}/libamdhsacode )
@ -19,8 +19,8 @@ index 9de7842..66c6880 100644
-set_property(TARGET ${CORE_RUNTIME_TARGET} PROPERTY INSTALL_RPATH "$ORIGIN;$ORIGIN/../../lib;$ORIGIN/../../lib64;$ORIGIN/../lib64" ) -set_property(TARGET ${CORE_RUNTIME_TARGET} PROPERTY INSTALL_RPATH "$ORIGIN;$ORIGIN/../../lib;$ORIGIN/../../lib64;$ORIGIN/../lib64" )
- -
## ------------------------- Linux Compiler and Linker options ------------------------- ## ------------------------- Linux Compiler and Linker options -------------------------
set ( HSA_CXX_FLAGS ${HSA_COMMON_CXX_FLAGS} -Werror -fexceptions -fno-rtti -fvisibility=hidden -Wno-error=missing-braces -Wno-error=sign-compare -Wno-sign-compare -Wno-write-strings -Wno-conversion-null -fno-math-errno -fno-threadsafe-statics -fmerge-all-constants -fms-extensions -Wno-error=comment -Wno-comment -Wno-error=pointer-arith -Wno-pointer-arith -Wno-error=unused-variable -Wno-error=unused-function ) set ( HSA_CXX_FLAGS ${HSA_COMMON_CXX_FLAGS} -fexceptions -fno-rtti -fvisibility=hidden -Wno-error=missing-braces -Wno-error=sign-compare -Wno-sign-compare -Wno-write-strings -Wno-conversion-null -fno-math-errno -fno-threadsafe-statics -fmerge-all-constants -fms-extensions -Wno-error=comment -Wno-comment -Wno-error=pointer-arith -Wno-pointer-arith -Wno-error=unused-variable -Wno-error=unused-function )
-- --
2.25.1 2.31.1

View file

@ -162,7 +162,7 @@ class HsaRocrDev(CMakePackage):
# Both 3.5.0 and 3.7.0 force INSTALL_RPATH in different ways # Both 3.5.0 and 3.7.0 force INSTALL_RPATH in different ways
patch("0001-Do-not-set-an-explicit-rpath-by-default-since-packag.patch", when="@3.5.0") patch("0001-Do-not-set-an-explicit-rpath-by-default-since-packag.patch", when="@3.5.0")
patch("0002-Remove-explicit-RPATH-again.patch", when="@3.7.0:5.5") patch("0002-Remove-explicit-RPATH-again.patch", when="@3.7.0:5.6")
root_cmakelists_dir = "src" root_cmakelists_dir = "src"

View file

@ -132,8 +132,11 @@ def install_targets(self):
else: else:
return ["install"] return ["install"]
def cmake_args(self): args = []
args = [self.define_from_variant("BUILD_SHARED_LIBS", "shared")] if self.spec.satisfies("@:5.4.3"):
args.append(self.define_from_variant("BUILD_SHARED_LIBS", "shared"))
else:
args.append(self.define("BUILD_SHARED_LIBS", False))
if self.spec.satisfies("@5.4.3:"): if self.spec.satisfies("@5.4.3:"):
args.append("-DCMAKE_INSTALL_LIBDIR=lib") args.append("-DCMAKE_INSTALL_LIBDIR=lib")
return args return args

View file

@ -162,13 +162,17 @@ class LlvmAmdgpu(CMakePackage):
# as per 5.2.0 llvm code. It used to be llvm/bin/../lib/libdevice. # as per 5.2.0 llvm code. It used to be llvm/bin/../lib/libdevice.
# Below patch is to look in the old path. # Below patch is to look in the old path.
patch("adjust-openmp-bitcode-directory-for-llvm-link.patch", when="@5.2.0:") patch("adjust-openmp-bitcode-directory-for-llvm-link.patch", when="@5.2.0:")
patch("patch-llvm-5.5.0.patch", when="@5.5:")
# Below patch is to set the flag -mcode-object-version=none until
# the below fix is available in device-libs release code.
# https://github.com/RadeonOpenCompute/ROCm-Device-Libs/commit/f0356159dbdc93ea9e545f9b61a7842f9c881fdf
patch("patch-llvm-5.5.0.patch", when="@5.5: +rocm-device-libs")
# i1 muls can sometimes happen after SCEV. # i1 muls can sometimes happen after SCEV.
# They resulted in ISel failures because we were missing the patterns for them. # They resulted in ISel failures because we were missing the patterns for them.
# This fix is targeting 6.1 rocm release. # This fix is targeting 6.1 rocm release.
# Need patch until https://github.com/llvm/llvm-project/pull/67291 is merged. # Need patch until https://github.com/llvm/llvm-project/pull/67291 is merged.
patch("001-Add-i1-mul-patterns.patch", when="@5.6:") patch("001-Add-i1-mul-patterns.patch", when="@5.6")
conflicts("^cmake@3.19.0") conflicts("^cmake@3.19.0")
@ -285,6 +289,9 @@ def cmake_args(self):
args.append(self.define("GCC_INSTALL_PREFIX", self.compiler.prefix)) args.append(self.define("GCC_INSTALL_PREFIX", self.compiler.prefix))
if self.spec.satisfies("@5.4.3:"): if self.spec.satisfies("@5.4.3:"):
args.append("-DCMAKE_INSTALL_LIBDIR=lib") args.append("-DCMAKE_INSTALL_LIBDIR=lib")
if self.spec.satisfies("@5.5.0:"):
args.append("-DCLANG_DEFAULT_RTLIB=compiler-rt")
args.append("-DCLANG_DEFAULT_UNWINDLIB=libgcc")
return args return args
@run_after("install") @run_after("install")

View file

@ -1,13 +1,38 @@
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td From 7010d5da727825321d31863ceb9e2fe9eb22b5b9 Mon Sep 17 00:00:00 2001
index bb4374b..36e7f7b 100644 From: Renjith Ravindran <Renjith.RavindranKannath@amd.com>
--- a/clang/include/clang/Driver/Options.td Date: Tue, 10 Oct 2023 05:16:47 +0000
+++ b/clang/include/clang/Driver/Options.td Subject: [PATCH] Condition check for enabling the flag
@@ -3739,7 +3739,7 @@ def mcode_object_version_EQ : Joined<["-"], "mcode-object-version=">, Group<m_Gr -mcode-object-version=none is failing in spack when device-libsis built with
Values<"none,2,3,4,5">, llvm-amdgpu. The flag is required here as well as standalon build.
NormalizedValuesScope<"TargetOptions">,
NormalizedValues<["COV_None", "COV_2", "COV_3", "COV_4", "COV_5"]>, ---
- MarshallingInfoEnum<TargetOpts<"CodeObjectVersion">, "COV_5">; rocm-device-libs/cmake/OCL.cmake | 13 ++-----------
+ MarshallingInfoEnum<TargetOpts<"CodeObjectVersion">, "COV_4">; 1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/rocm-device-libs/cmake/OCL.cmake b/rocm-device-libs/cmake/OCL.cmake
index 773c6f62e..30f60030b 100644
--- a/rocm-device-libs/cmake/OCL.cmake
+++ b/rocm-device-libs/cmake/OCL.cmake
@@ -30,17 +30,8 @@ if (WIN32)
set(CLANG_OCL_FLAGS ${CLANG_OCL_FLAGS} -fshort-wchar)
endif()
defm code_object_v3_legacy : SimpleMFlag<"code-object-v3", -# Disable code object version module flag if available.
"Legacy option to specify code object ABI V3", -file(WRITE ${CMAKE_BINARY_DIR}/tmp.cl "")
-execute_process (
- COMMAND ${LLVM_TOOLS_BINARY_DIR}/clang${EXE_SUFFIX} ${CLANG_OCL_FLAGS} -Xclang -mcode-object-version=none ${CMAKE_BINARY_DIR}/tmp.cl
- RESULT_VARIABLE TEST_CODE_OBJECT_VERSION_NONE_RESULT
- ERROR_QUIET
-)
-file(REMOVE ${CMAKE_BINARY_DIR}/tmp.cl)
-if (NOT TEST_CODE_OBJECT_VERSION_NONE_RESULT)
- set(CLANG_OCL_FLAGS ${CLANG_OCL_FLAGS} -Xclang -mcode-object-version=none)
-endif()
+# Disable code object version module flag.
+set(CLANG_OCL_FLAGS ${CLANG_OCL_FLAGS} -Xclang -mcode-object-version=none)
set (BC_EXT .bc)
set (LIB_SUFFIX ".lib${BC_EXT}")
--
2.31.1