public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm-roc/files/, sys-devel/llvm-roc/
@ 2019-12-29 22:22 Craig Andrews
  0 siblings, 0 replies; 6+ messages in thread
From: Craig Andrews @ 2019-12-29 22:22 UTC (permalink / raw
  To: gentoo-commits

commit:     3ee99c860e04f770f755bd1ec34404e9bd8797d5
Author:     Wilfried Holzke <gentoo <AT> holzke <DOT> net>
AuthorDate: Sat Dec 28 12:18:10 2019 +0000
Commit:     Craig Andrews <candrews <AT> gentoo <DOT> org>
CommitDate: Sun Dec 29 22:21:54 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ee99c86

sys-devel/llvm-roc: New ebuild for llvm-roc 3.0.0

Signed-off-by: Wilfried Holzke <gentoo <AT> holzke.net>
Package-Manager: Portage-2.3.79, Repoman-2.3.16
Closes: https://github.com/gentoo/gentoo/pull/14149
Signed-off-by: Craig Andrews <candrews <AT> gentoo.org>

 sys-devel/llvm-roc/Manifest                        |  1 +
 .../files/llvm-roc-3.0.0-add_libraries.patch       | 20 ++++++++
 sys-devel/llvm-roc/llvm-roc-3.0.0.ebuild           | 57 ++++++++++++++++++++++
 3 files changed, 78 insertions(+)

diff --git a/sys-devel/llvm-roc/Manifest b/sys-devel/llvm-roc/Manifest
index 395040255d9..ded021d5a92 100644
--- a/sys-devel/llvm-roc/Manifest
+++ b/sys-devel/llvm-roc/Manifest
@@ -13,3 +13,4 @@ DIST llvm-roc-ocl-2.6.0.tar.gz 48417665 BLAKE2B 9b7ff7cc57d98b2076994d3a55855634
 DIST llvm-roc-ocl-2.7.0.tar.gz 50008043 BLAKE2B 7cbb6f0e268991bbeae6dd5f38f00ee35a3d04f563212a6a3c32676574668ca84e44ae5acc14d1a77ea6985e70b47a0faff86d86521fb3a7375aa58a043d65ec SHA512 ae1547d1547345be56f547c59a6ddd09e68bb1eaea1f3c8eb4911dee1f2616b43384a296a2e2754bf2a833ef4906da4463820e4fe734c3bcfd7a602ef3c2de17
 DIST llvm-roc-ocl-2.8.0.tar.gz 50245388 BLAKE2B 29aa4fdb08b5c3ca1ec41f8948b48d4655768632cd07b217e742e32fcfe0e306130697cd18d4c481aec440686464271b380b5a1a7f02bba84ee8cb98c13d2a7f SHA512 51eb98160d556aa0b60fdce95af54f57529e218899874df0a59e583dad5a8fbcad822c3d778668ce0ec4897b28ff3423cde4d55e18719cf4edfb56735cb3d80b
 DIST llvm-roc-ocl-2.9.0.tar.gz 50246154 BLAKE2B 5ed8faf4582a41dac3bdc71a9fc6e12e3f70652fe80d4659315589e5c6f6326bc03853cea1d3e7acf6b210dd4c83056bae27aded3e173756d6f7c2c5694ae386 SHA512 e29767bb92bf719b7f3b6d2853dc61d6cb968e3f0dc54714ee6a78ff5340139935ce0d1cf3124c5757d96f93af01e0f9927e72d29a35b84229e44e7a69e6d391
+DIST llvm-roc-ocl-3.0.0.tar.gz 117363122 BLAKE2B a85e456e715629fbb3349e13e50a62aee7c82c6479127d7e46ff2de13f0eab108dd0332136aa736c30ed46c1563207b7ab22df0f7f53404315d51f0a172b5e86 SHA512 7d1281fc1628e4e88ddd740ccf03107cdccf86178046dfe79efd6b503193b3be4e23a67363f24f1d6250a156da86fe0d93933d9c67510b755d1e454e7bbedb68

diff --git a/sys-devel/llvm-roc/files/llvm-roc-3.0.0-add_libraries.patch b/sys-devel/llvm-roc/files/llvm-roc-3.0.0-add_libraries.patch
new file mode 100644
index 00000000000..120ab819f5b
--- /dev/null
+++ b/sys-devel/llvm-roc/files/llvm-roc-3.0.0-add_libraries.patch
@@ -0,0 +1,20 @@
+diff -Naur a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt
+--- a/clang/lib/Basic/CMakeLists.txt	2019-12-28 07:42:49.119055933 +0100
++++ b/clang/lib/Basic/CMakeLists.txt	2019-12-28 07:42:13.265056070 +0100
+@@ -2,6 +2,7 @@
+   Core
+   MC
+   Support
++  Option
+   )
+ 
+ find_first_existing_vc_file("${LLVM_MAIN_SRC_DIR}" llvm_vc)
+diff -Naur a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
+--- a/clang/lib/Driver/CMakeLists.txt	2019-12-28 07:41:39.521056199 +0100
++++ b/clang/lib/Driver/CMakeLists.txt	2019-12-28 07:40:23.998056487 +0100
+@@ -79,4 +79,5 @@
+   LINK_LIBS
+   clangBasic
+   ${system_libs}
++  pthread
+   )

diff --git a/sys-devel/llvm-roc/llvm-roc-3.0.0.ebuild b/sys-devel/llvm-roc/llvm-roc-3.0.0.ebuild
new file mode 100644
index 00000000000..af16a02096e
--- /dev/null
+++ b/sys-devel/llvm-roc/llvm-roc-3.0.0.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake-utils
+
+DESCRIPTION="Radeon Open Compute llvm,lld,clang"
+HOMEPAGE="https://github.com/RadeonOpenCompute/ROCm/"
+SRC_URI="https://github.com/RadeonOpenCompute/llvm-project/archive/roc-ocl-${PV}.tar.gz -> llvm-roc-ocl-${PV}.tar.gz"
+
+LICENSE="UoI-NCSA rc BSD public-domain"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="debug"
+
+RDEPEND="virtual/cblas
+	 dev-libs/rocr-runtime"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/llvm-project-roc-ocl-${PV}/llvm"
+
+CMAKE_BUILD_TYPE=RelWithDebInfo
+
+src_prepare() {
+	cd "${WORKDIR}/llvm-project-roc-ocl-${PV}"
+	eapply "${FILESDIR}/${P}-add_libraries.patch"
+	eapply_user
+	cmake-utils_src_prepare
+}
+
+src_configure() {
+	local mycmakeargs=(
+		-DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/roc"
+		-DLLVM_ENABLE_PROJECTS="clang;lld"
+		-DLLVM_TARGETS_TO_BUILD="AMDGPU;X86"
+		-DLLVM_BUILD_DOCS=NO
+		-DLLVM_ENABLE_OCAMLDOC=OFF
+		-DLLVM_ENABLE_SPHINX=NO
+		-DLLVM_ENABLE_DOXYGEN=OFF
+		-DLLVM_INSTALL_UTILS=ON
+		-DLLVM_VERSION_SUFFIX=roc
+		-DOCAMLFIND=NO
+	)
+
+	use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
+
+	cmake-utils_src_configure
+}
+
+src_install(){
+	cmake-utils_src_install
+	cat > "99${PN}" <<-EOF
+		LDPATH="${EROOT}/usr/lib/llvm/roc/lib"
+	EOF
+	doenvd "99${PN}"
+}


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm-roc/files/, sys-devel/llvm-roc/
@ 2020-09-08 17:57 Craig Andrews
  0 siblings, 0 replies; 6+ messages in thread
From: Craig Andrews @ 2020-09-08 17:57 UTC (permalink / raw
  To: gentoo-commits

commit:     d8573370e0da40d6a506d564af24a47927923dc2
Author:     Craig Andrews <candrews <AT> gentoo <DOT> org>
AuthorDate: Tue Sep  8 17:57:27 2020 +0000
Commit:     Craig Andrews <candrews <AT> gentoo <DOT> org>
CommitDate: Tue Sep  8 17:57:46 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d8573370

sys-devel/llvm-roc: Fix undefined reference to current_pos()

Closes: https://bugs.gentoo.org/741118
Package-Manager: Portage-3.0.6, Repoman-3.0.1
Signed-off-by: Craig Andrews <candrews <AT> gentoo.org>

 .../files/llvm-roc-3.7.0-current_pos.patch         | 32 ++++++++++++++++++++++
 sys-devel/llvm-roc/llvm-roc-3.7.0-r1.ebuild        |  4 +++
 2 files changed, 36 insertions(+)

diff --git a/sys-devel/llvm-roc/files/llvm-roc-3.7.0-current_pos.patch b/sys-devel/llvm-roc/files/llvm-roc-3.7.0-current_pos.patch
new file mode 100644
index 00000000000..a0d3c1df6d9
--- /dev/null
+++ b/sys-devel/llvm-roc/files/llvm-roc-3.7.0-current_pos.patch
@@ -0,0 +1,32 @@
+https://bugs.llvm.org/show_bug.cgi?id=43235
+
+diff --git a/llvm/include/llvm/Support/raw_ostream.h b/llvm/include/llvm/Support/raw_ostream.h
+index 705f1790b1d..a0314b2c46a 100644
+--- a/include/llvm/Support/raw_ostream.h
++++ b/include/llvm/Support/raw_ostream.h
+@@ -507,9 +507,7 @@ class raw_string_ostream : public raw_ostream {
+   /// See raw_ostream::write_impl.
+   void write_impl(const char *Ptr, size_t Size) override;
+ 
+-  /// Return the current position within the stream, not counting the bytes
+-  /// currently in the buffer.
+-  uint64_t current_pos() const override { return OS.size(); }
++  uint64_t current_pos() const override;
+ 
+ public:
+   explicit raw_string_ostream(std::string &O) : OS(O) {}
+diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
+index 4bb315f824a..742e2aced39 100644
+--- a/lib/Support/raw_ostream.cpp
++++ b/lib/Support/raw_ostream.cpp
+@@ -895,6 +895,10 @@ raw_ostream &llvm::nulls() {
+ //  raw_string_ostream
+ //===----------------------------------------------------------------------===//
+ 
++/// Return the current position within the stream, not counting the bytes
++/// currently in the buffer.
++uint64_t raw_string_ostream::current_pos() const { return OS.size(); }
++
+ raw_string_ostream::~raw_string_ostream() {
+   flush();
+ }

diff --git a/sys-devel/llvm-roc/llvm-roc-3.7.0-r1.ebuild b/sys-devel/llvm-roc/llvm-roc-3.7.0-r1.ebuild
index ec60b28f085..6586ec782b7 100644
--- a/sys-devel/llvm-roc/llvm-roc-3.7.0-r1.ebuild
+++ b/sys-devel/llvm-roc/llvm-roc-3.7.0-r1.ebuild
@@ -23,6 +23,10 @@ PDEPEND="dev-libs/rocr-runtime"
 
 S="${WORKDIR}/llvm-project-rocm-${PV}/llvm"
 
+PATCHES=(
+	"${FILESDIR}/${P}-current_pos.patch"
+)
+
 CMAKE_BUILD_TYPE=RelWithDebInfo
 
 src_prepare() {


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm-roc/files/, sys-devel/llvm-roc/
@ 2020-11-18 17:56 Craig Andrews
  0 siblings, 0 replies; 6+ messages in thread
From: Craig Andrews @ 2020-11-18 17:56 UTC (permalink / raw
  To: gentoo-commits

commit:     a8ad5900db1f02b75ce25108ea867806abf07095
Author:     Craig Andrews <candrews <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 18 17:53:45 2020 +0000
Commit:     Craig Andrews <candrews <AT> gentoo <DOT> org>
CommitDate: Wed Nov 18 17:56:01 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a8ad5900

sys-devel/llvm-roc: Fix compile when tensorflow is installed

Closes: https://bugs.gentoo.org/754276
Package-Manager: Portage-3.0.9, Repoman-3.0.2
Signed-off-by: Craig Andrews <candrews <AT> gentoo.org>

 .../llvm-roc/files/llvm-roc-3.9.0-tensorflow.patch | 35 ++++++++++++++++++++++
 sys-devel/llvm-roc/llvm-roc-3.9.0.ebuild           |  1 +
 2 files changed, 36 insertions(+)

diff --git a/sys-devel/llvm-roc/files/llvm-roc-3.9.0-tensorflow.patch b/sys-devel/llvm-roc/files/llvm-roc-3.9.0-tensorflow.patch
new file mode 100644
index 00000000000..3e1124457ad
--- /dev/null
+++ b/sys-devel/llvm-roc/files/llvm-roc-3.9.0-tensorflow.patch
@@ -0,0 +1,35 @@
+--- llvm-project-rocm-3.9.0.orig/CMakeLists.txt	2020-11-12 22:03:09.902293395 +0100
++++ llvm-project-rocm-3.9.0/CMakeLists.txt	2020-11-12 22:07:28.185294853 +0100
+@@ -824,6 +824,11 @@
+   ${LLVM_INCLUDE_DIR}/llvm/Config/Targets.def
+   )
+ 
++# They are not referenced. See set_output_directory().
++set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/bin )
++set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
++set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
++
+ # For up-to-date instructions for installing the Tensorflow dependency, refer to
+ # the bot setup script: https://github.com/google/ml-compiler-opt/blob/master/buildbot/buildbot_init.sh
+ # In this case, the latest C API library is available for download from
+@@ -832,18 +837,13 @@
+ # LLVM_HAVE_TF_API, through llvm-config.h, so that a user of the LLVM library may
+ # also leverage the dependency.
+ set(TENSORFLOW_C_LIB_PATH "" CACHE PATH "Path to TensorFlow C library install")
+-find_library(tensorflow_c_api tensorflow PATHS ${TENSORFLOW_C_LIB_PATH}/lib)
+ 
+-if (tensorflow_c_api)
++if (TENSORFLOW_C_LIB_PATH)
++  find_library(tensorflow_c_api tensorflow PATHS ${TENSORFLOW_C_LIB_PATH}/lib NO_DEFAULT_PATH REQUIRED)
+   set(LLVM_HAVE_TF_API "ON" CACHE BOOL "Full Tensorflow API available")
+   include_directories(${TENSORFLOW_C_LIB_PATH}/include)
+ endif()
+ 
+-# They are not referenced. See set_output_directory().
+-set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/bin )
+-set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
+-set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
+-
+ # For up-to-date instructions for installing the Tensorflow dependency, refer to
+ # the bot setup script: https://github.com/google/ml-compiler-opt/blob/master/buildbot/buildbot_init.sh
+ # Specifically, assuming python3 is installed:

diff --git a/sys-devel/llvm-roc/llvm-roc-3.9.0.ebuild b/sys-devel/llvm-roc/llvm-roc-3.9.0.ebuild
index 8bcc3f8ce0e..bc0fdfcde77 100644
--- a/sys-devel/llvm-roc/llvm-roc-3.9.0.ebuild
+++ b/sys-devel/llvm-roc/llvm-roc-3.9.0.ebuild
@@ -25,6 +25,7 @@ S="${WORKDIR}/llvm-project-rocm-${PV}/llvm"
 
 PATCHES=(
 	"${FILESDIR}/${PN}-3.7.0-current_pos.patch"
+	"${FILESDIR}/${P}-tensorflow.patch"
 )
 
 CMAKE_BUILD_TYPE=RelWithDebInfo


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm-roc/files/, sys-devel/llvm-roc/
@ 2021-01-20  5:36 Benda XU
  0 siblings, 0 replies; 6+ messages in thread
From: Benda XU @ 2021-01-20  5:36 UTC (permalink / raw
  To: gentoo-commits

commit:     1ec9b7d4bb0cce7a501686733565b0221ee1db69
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 19 14:34:10 2021 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Wed Jan 20 04:51:53 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1ec9b7d4

sys-devel/llvm-roc: replace HIP finder with Gentoo paths.

remove isystem include path.

Set USE=runtime as default.

Suggested-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
Suggested-by: Wilfried Holzke <gentoo <AT> holzke.net>
Reference: https://github.com/justxi/rocm/issues/174#issuecomment-749479598
Package-Manager: Portage-3.0.12, Repoman-3.0.1
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 .../files/llvm-roc-4.0.0-hip-location.patch        | 47 +++++++++++
 ...llvm-roc-4.0.0-remove-isystem-usr-include.patch | 29 +++++++
 sys-devel/llvm-roc/llvm-roc-4.0.0-r1.ebuild        | 94 ++++++++++++++++++++++
 3 files changed, 170 insertions(+)

diff --git a/sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch b/sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch
new file mode 100644
index 00000000000..8342299f113
--- /dev/null
+++ b/sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch
@@ -0,0 +1,47 @@
+replace hardcoded hip finder with Gentoo paths.
+
+Author: Benda Xu <heroxbd@gentoo.org>
+
+Index: llvm-project-rocm-4.0.0/clang/lib/Driver/ToolChains/AMDGPU.cpp
+===================================================================
+--- llvm-project-rocm-4.0.0.orig/clang/lib/Driver/ToolChains/AMDGPU.cpp
++++ llvm-project-rocm-4.0.0/clang/lib/Driver/ToolChains/AMDGPU.cpp
+@@ -116,37 +116,8 @@ RocmInstallationDetector::getInstallatio
+     return Candidates;
+   }
+ 
+-  // Try to find relative to the compiler binary.
+-  const char *InstallDir = D.getInstalledDir();
++  Candidates.emplace_back(D.SysRoot + "/usr/lib/hip", /*StrictChecking=*/true);
+ 
+-  // Check both a normal Unix prefix position of the clang binary, as well as
+-  // the Windows-esque layout the ROCm packages use with the host architecture
+-  // subdirectory of bin.
+-
+-  // Strip off directory (usually bin)
+-  StringRef ParentDir = llvm::sys::path::parent_path(InstallDir);
+-  StringRef ParentName = llvm::sys::path::filename(ParentDir);
+-
+-  // Some builds use bin/{host arch}, so go up again.
+-  if (ParentName == "bin") {
+-    ParentDir = llvm::sys::path::parent_path(ParentDir);
+-    ParentName = llvm::sys::path::filename(ParentDir);
+-  }
+-
+-  // Some versions of the rocm llvm package install to /opt/rocm/llvm/bin
+-  if (ParentName == "llvm")
+-    ParentDir = llvm::sys::path::parent_path(ParentDir);
+-
+-  Candidates.emplace_back(ParentDir.str(), /*StrictChecking=*/true);
+-
+-  // Device library may be installed in clang resource directory.
+-  Candidates.emplace_back(D.ResourceDir, /*StrictChecking=*/true);
+-
+-  Candidates.emplace_back(D.SysRoot + "/opt/rocm", /*StrictChecking=*/true);
+-  if (ParentName.startswith("aomp")) {
+-    // Some versions of the aomp package install to /opt/rocm/aomp/bin
+-    Candidates.emplace_back(ParentDir.str());
+-  }
+   return Candidates;
+ }
+ 

diff --git a/sys-devel/llvm-roc/files/llvm-roc-4.0.0-remove-isystem-usr-include.patch b/sys-devel/llvm-roc/files/llvm-roc-4.0.0-remove-isystem-usr-include.patch
new file mode 100644
index 00000000000..f14ec4ac0db
--- /dev/null
+++ b/sys-devel/llvm-roc/files/llvm-roc-4.0.0-remove-isystem-usr-include.patch
@@ -0,0 +1,29 @@
+Author: Wilfried (justxi) Holzke
+
+Adopted from https://github.com/justxi/rocm/blob/master/sys-devel/llvm-roc/files/llvm-roc-4.0.0-remove-isystem-usr-include.patch
+
+Index: llvm-project-rocm-4.0.0/clang/lib/Driver/ToolChains/AMDGPU.cpp
+===================================================================
+--- llvm-project-rocm-4.0.0.orig/clang/lib/Driver/ToolChains/AMDGPU.cpp
++++ llvm-project-rocm-4.0.0/clang/lib/Driver/ToolChains/AMDGPU.cpp
+@@ -326,11 +326,6 @@ void RocmInstallationDetector::AddHIPInc
+     //
+     // ROCm 3.5 does not fully support the wrapper headers. Therefore it needs
+     // a workaround.
+-    SmallString<128> P(D.ResourceDir);
+-    if (UsesRuntimeWrapper)
+-      llvm::sys::path::append(P, "include", "cuda_wrappers");
+-    CC1Args.push_back("-internal-isystem");
+-    CC1Args.push_back(DriverArgs.MakeArgString(P));
+   }
+ 
+   if (DriverArgs.hasArg(options::OPT_nogpuinc))
+@@ -341,8 +336,6 @@ void RocmInstallationDetector::AddHIPInc
+     return;
+   }
+ 
+-  CC1Args.push_back("-internal-isystem");
+-  CC1Args.push_back(DriverArgs.MakeArgString(getIncludePath()));
+   if (UsesRuntimeWrapper)
+     CC1Args.append({"-include", "__clang_hip_runtime_wrapper.h"});
+ }

diff --git a/sys-devel/llvm-roc/llvm-roc-4.0.0-r1.ebuild b/sys-devel/llvm-roc/llvm-roc-4.0.0-r1.ebuild
new file mode 100644
index 00000000000..5714ae9b719
--- /dev/null
+++ b/sys-devel/llvm-roc/llvm-roc-4.0.0-r1.ebuild
@@ -0,0 +1,94 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake
+
+DESCRIPTION="Radeon Open Compute llvm,lld,clang"
+HOMEPAGE="https://github.com/RadeonOpenCompute/ROCm/"
+SRC_URI="https://github.com/RadeonOpenCompute/llvm-project/archive/rocm-${PV}.tar.gz -> llvm-rocm-ocl-${PV}.tar.gz"
+
+LICENSE="UoI-NCSA rc BSD public-domain"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="debug +runtime"
+
+RDEPEND="virtual/cblas
+	dev-libs/libxml2
+	sys-libs/zlib
+	sys-libs/ncurses:="
+DEPEND="${RDEPEND}"
+PDEPEND="dev-libs/rocr-runtime"
+
+S="${WORKDIR}/llvm-project-rocm-${PV}/llvm"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-3.7.0-current_pos.patch"
+	"${FILESDIR}/${PN}-3.9.0-tensorflow.patch"
+)
+
+CMAKE_BUILD_TYPE=RelWithDebInfo
+
+src_prepare() {
+	cd "${WORKDIR}/llvm-project-rocm-${PV}" || die
+	eapply "${FILESDIR}/${PN}-3.0.0-add_libraries.patch"
+	eapply "${FILESDIR}/${PN}-4.0.0-remove-isystem-usr-include.patch"
+	eapply "${FILESDIR}/${PN}-4.0.0-hip-location.patch"
+
+	if [[ -n ${EPREFIX} ]]; then
+		pushd "${S}"/../clang >/dev/null || die
+		sed -i -e "s@DEFAULT_SYSROOT \"\"@DEFAULT_SYSROOT \"${EPREFIX}\"@" CMakeLists.txt
+		eend $?
+		ebegin "Use ${EPREFIX} as default sysroot"
+		cd lib/Driver/ToolChains >/dev/null || die
+		ebegin "Use dynamic linker from ${EPREFIX}"
+		sed -i -e "/LibDir.*Loader/s@return \"\/\"@return \"${EPREFIX}/\"@" Linux.cpp
+		eend $?
+
+		ebegin "Remove --sysroot call on ld for native toolchain"
+		sed -i -e "$(grep -n -B1 sysroot= Gnu.cpp | sed -ne '{1s/-.*//;1p}'),+1 d" Gnu.cpp
+		eend $?
+		popd >/dev/null || die
+	fi
+
+	# handled by sysroot, don't prefixify here.
+	sed -e 's:/opt/rocm:/usr/lib/hip:' \
+		-i "${S}"/../clang/lib/Driver/ToolChains/AMDGPU.cpp
+
+	eapply_user
+	cmake_src_prepare
+}
+
+src_configure() {
+	PROJECTS="clang;lld"
+
+	if usex runtime; then
+		PROJECTS+=";compiler-rt"
+	fi
+
+	local mycmakeargs=(
+		-DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/roc"
+		-DLLVM_ENABLE_PROJECTS="${PROJECTS}"
+		-DLLVM_TARGETS_TO_BUILD="AMDGPU;X86"
+		-DLLVM_BUILD_DOCS=NO
+		-DLLVM_ENABLE_OCAMLDOC=OFF
+		-DLLVM_ENABLE_SPHINX=NO
+		-DLLVM_ENABLE_DOXYGEN=OFF
+		-DLLVM_INSTALL_UTILS=ON
+		-DLLVM_VERSION_SUFFIX=roc
+		-DOCAMLFIND=NO
+	)
+
+	use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
+
+	cmake_src_configure
+}
+
+src_install() {
+	cmake_src_install
+	cat > "99${PN}" <<-EOF
+		LDPATH="${EROOT}/usr/lib/llvm/roc/lib"
+	EOF
+	doenvd "99${PN}"
+}


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm-roc/files/, sys-devel/llvm-roc/
@ 2021-02-06 17:26 Benda XU
  0 siblings, 0 replies; 6+ messages in thread
From: Benda XU @ 2021-02-06 17:26 UTC (permalink / raw
  To: gentoo-commits

commit:     1f254242a3cbefe3f657384c06de728191633a28
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Sat Feb  6 17:24:02 2021 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Sat Feb  6 17:26:15 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1f254242

sys-devel/llvm-roc: set default device-libs.

Disable HIP runtime check, it is not needed for Gentoo.

Only the patch is updated, directly move 4.0.0-r1 to -r2.

Closes: https://bugs.gentoo.org/769005
Package-Manager: Portage-3.0.12, Repoman-3.0.1
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 .../files/llvm-roc-4.0.0-hip-location.patch        | 39 +++++++++++++++++++++-
 ...oc-4.0.0-r1.ebuild => llvm-roc-4.0.0-r2.ebuild} |  0
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch b/sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch
index 8342299f113..225adc70966 100644
--- a/sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch
+++ b/sys-devel/llvm-roc/files/llvm-roc-4.0.0-hip-location.patch
@@ -1,5 +1,7 @@
 replace hardcoded hip finder with Gentoo paths.
 
+It is not necessary to check HIP runtime each time.
+
 Author: Benda Xu <heroxbd@gentoo.org>
 
 Index: llvm-project-rocm-4.0.0/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -12,7 +14,7 @@ Index: llvm-project-rocm-4.0.0/clang/lib/Driver/ToolChains/AMDGPU.cpp
  
 -  // Try to find relative to the compiler binary.
 -  const char *InstallDir = D.getInstalledDir();
-+  Candidates.emplace_back(D.SysRoot + "/usr/lib/hip", /*StrictChecking=*/true);
++  Candidates.emplace_back(D.SysRoot + "/usr", /*StrictChecking=*/true);
  
 -  // Check both a normal Unix prefix position of the clang binary, as well as
 -  // the Windows-esque layout the ROCm packages use with the host architecture
@@ -45,3 +47,38 @@ Index: llvm-project-rocm-4.0.0/clang/lib/Driver/ToolChains/AMDGPU.cpp
    return Candidates;
  }
  
+@@ -273,33 +244,7 @@ void RocmInstallationDetector::detectDev
+ }
+ 
+ void RocmInstallationDetector::detectHIPRuntime() {
+-  auto Candidates = getInstallationPathCandidates();
+-  auto &FS = D.getVFS();
+-
+-  for (const auto &Candidate : Candidates) {
+-    InstallPath = Candidate.Path;
+-    if (InstallPath.empty() || !FS.exists(InstallPath))
+-      continue;
+-
+-    BinPath = InstallPath;
+-    llvm::sys::path::append(BinPath, "bin");
+-    IncludePath = InstallPath;
+-    llvm::sys::path::append(IncludePath, "include");
+-    LibPath = InstallPath;
+-    llvm::sys::path::append(LibPath, "lib");
+-
+-    llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> VersionFile =
+-        FS.getBufferForFile(BinPath + "/.hipVersion");
+-    if (!VersionFile && Candidate.StrictChecking)
+-      continue;
+-
+-    if (HIPVersionArg.empty() && VersionFile)
+-      ParseHIPVersionFile((*VersionFile)->getBuffer());
+-
+-    HasHIPRuntime = true;
+-    return;
+-  }
+-  HasHIPRuntime = false;
++  HasHIPRuntime = true;
+ }
+ 
+ void RocmInstallationDetector::print(raw_ostream &OS) const {

diff --git a/sys-devel/llvm-roc/llvm-roc-4.0.0-r1.ebuild b/sys-devel/llvm-roc/llvm-roc-4.0.0-r2.ebuild
similarity index 100%
rename from sys-devel/llvm-roc/llvm-roc-4.0.0-r1.ebuild
rename to sys-devel/llvm-roc/llvm-roc-4.0.0-r2.ebuild


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm-roc/files/, sys-devel/llvm-roc/
@ 2021-08-26 12:39 Benda XU
  0 siblings, 0 replies; 6+ messages in thread
From: Benda XU @ 2021-08-26 12:39 UTC (permalink / raw
  To: gentoo-commits

commit:     e78aa10a00b855cc9ab96fb36d1cebec991530ac
Author:     YiyangWu <xgreenlandforwyy <AT> gmail <DOT> com>
AuthorDate: Sat Aug 21 11:00:55 2021 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Thu Aug 26 12:38:58 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e78aa10a

sys-devel/llvm-roc: add hip-location.patch back

Clang from llvm-roc-4.3.0 throws error during compilation of rocm
packages for GPU devices (e.g. rocBLAS).  The missing of $ROCM_PATH
and deprecation of hip-location.patch together causes in this
situation.

This commit update the hip-location.patch so it can be used again.

Closes: https://bugs.gentoo.org/809392
Closes: https://github.com/gentoo/gentoo/pull/22060
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 .../files/llvm-roc-4.3.0-hip-location.patch        | 189 +++++++++++++++++++++
 ...m-roc-4.3.0.ebuild => llvm-roc-4.3.0-r1.ebuild} |   1 +
 2 files changed, 190 insertions(+)

diff --git a/sys-devel/llvm-roc/files/llvm-roc-4.3.0-hip-location.patch b/sys-devel/llvm-roc/files/llvm-roc-4.3.0-hip-location.patch
new file mode 100644
index 00000000000..1fe93a33db3
--- /dev/null
+++ b/sys-devel/llvm-roc/files/llvm-roc-4.3.0-hip-location.patch
@@ -0,0 +1,189 @@
+replace hardcoded hip finder with Gentoo paths.
+
+It is not necessary to check HIP runtime each time.
+
+Author: Benda Xu <heroxbd@gentoo.org>
+Author: Yiyang Wu <xgreenlandforwyy@gmail.com>
+
+--- orig/clang/lib/Driver/ToolChains/AMDGPU.cpp
++++ llvm-project-rocm-4.3.0/clang/lib/Driver/ToolChains/AMDGPU.cpp
+@@ -165,133 +165,8 @@ bool RocmInstallationDetector::parseHIPV
+ /// cached and populated only once.
+ const SmallVectorImpl<RocmInstallationDetector::Candidate> &
+ RocmInstallationDetector::getInstallationPathCandidates() {
+-
+-  // Return the cached candidate list if it has already been populated.
+-  if (!ROCmSearchDirs.empty())
+-    return ROCmSearchDirs;
+-
+-  auto DoPrintROCmSearchDirs = [&]() {
+-    if (PrintROCmSearchDirs)
+-      for (auto Cand : ROCmSearchDirs) {
+-        llvm::errs() << "ROCm installation search path";
+-        if (Cand.isSPACK())
+-          llvm::errs() << " (Spack " << Cand.SPACKReleaseStr << ")";
+-        llvm::errs() << ": " << Cand.Path << '\n';
+-      }
+-  };
+-
+-  // For candidate specified by --rocm-path we do not do strict check, i.e.,
+-  // checking existence of HIP version file and device library files.
+-  if (!RocmPathArg.empty()) {
+-    ROCmSearchDirs.emplace_back(RocmPathArg.str());
+-    DoPrintROCmSearchDirs();
+-    return ROCmSearchDirs;
+-  } else if (const char *RocmPathEnv = ::getenv("ROCM_PATH")) {
+-    if (!StringRef(RocmPathEnv).empty()) {
+-      ROCmSearchDirs.emplace_back(RocmPathEnv);
+-      DoPrintROCmSearchDirs();
+-      return ROCmSearchDirs;
+-    }
+-  }
+-
+-  // Try to find relative to the compiler binary.
+-  const char *InstallDir = D.getInstalledDir();
+-
+-  // Check both a normal Unix prefix position of the clang binary, as well as
+-  // the Windows-esque layout the ROCm packages use with the host architecture
+-  // subdirectory of bin.
+-  auto DeduceROCmPath = [](StringRef ClangPath) {
+-    // Strip off directory (usually bin)
+-    StringRef ParentDir = llvm::sys::path::parent_path(ClangPath);
+-    StringRef ParentName = llvm::sys::path::filename(ParentDir);
+-
+-    // Some builds use bin/{host arch}, so go up again.
+-    if (ParentName == "bin") {
+-      ParentDir = llvm::sys::path::parent_path(ParentDir);
+-      ParentName = llvm::sys::path::filename(ParentDir);
+-    }
+-
+-    // Detect ROCm packages built with SPACK.
+-    // clang is installed at
+-    // <rocm_root>/llvm-amdgpu-<rocm_release_string>-<hash>/bin directory.
+-    // We only consider the parent directory of llvm-amdgpu package as ROCm
+-    // installation candidate for SPACK.
+-    if (ParentName.startswith("llvm-amdgpu-")) {
+-      auto SPACKPostfix =
+-          ParentName.drop_front(strlen("llvm-amdgpu-")).split('-');
+-      auto SPACKReleaseStr = SPACKPostfix.first;
+-      if (!SPACKReleaseStr.empty()) {
+-        ParentDir = llvm::sys::path::parent_path(ParentDir);
+-        return Candidate(ParentDir.str(), /*StrictChecking=*/true,
+-                         SPACKReleaseStr);
+-      }
+-    }
+-
+-    // Some versions of the rocm llvm package install to /opt/rocm/llvm/bin
+-    // Some versions of the aomp package install to /opt/rocm/aomp/bin
+-    if (ParentName == "llvm" || ParentName.startswith("aomp"))
+-      ParentDir = llvm::sys::path::parent_path(ParentDir);
+-
+-    return Candidate(ParentDir.str(), /*StrictChecking=*/true);
+-  };
+-
+-  // Deduce ROCm path by the path used to invoke clang. Do not resolve symbolic
+-  // link of clang itself.
+-  ROCmSearchDirs.emplace_back(DeduceROCmPath(InstallDir));
+-
+-  // Deduce ROCm path by the real path of the invoked clang, resolving symbolic
+-  // link of clang itself.
+-  llvm::SmallString<256> RealClangPath;
+-  llvm::sys::fs::real_path(D.getClangProgramPath(), RealClangPath);
+-  auto ParentPath = llvm::sys::path::parent_path(RealClangPath);
+-  if (ParentPath != InstallDir)
+-    ROCmSearchDirs.emplace_back(DeduceROCmPath(ParentPath));
+-
+-  // Device library may be installed in clang resource directory.
+-  ROCmSearchDirs.emplace_back(D.ResourceDir,
+-                              /*StrictChecking=*/true);
+-
+-  ROCmSearchDirs.emplace_back(D.SysRoot + "/opt/rocm",
+-                              /*StrictChecking=*/true);
+-
+-  // Find the latest /opt/rocm-{release} directory.
+-  std::error_code EC;
+-  std::string LatestROCm;
+-  llvm::VersionTuple LatestVer;
+-  // Get ROCm version from ROCm directory name.
+-  auto GetROCmVersion = [](StringRef DirName) {
+-    llvm::VersionTuple V;
+-    std::string VerStr = DirName.drop_front(strlen("rocm-")).str();
+-    // The ROCm directory name follows the format of
+-    // rocm-{major}.{minor}.{subMinor}[-{build}]
+-    std::replace(VerStr.begin(), VerStr.end(), '-', '.');
+-    V.tryParse(VerStr);
+-    return V;
+-  };
+-  for (llvm::vfs::directory_iterator
+-           File = D.getVFS().dir_begin(D.SysRoot + "/opt", EC),
+-           FileEnd;
+-       File != FileEnd && !EC; File.increment(EC)) {
+-    llvm::StringRef FileName = llvm::sys::path::filename(File->path());
+-    if (!FileName.startswith("rocm-"))
+-      continue;
+-    if (LatestROCm.empty()) {
+-      LatestROCm = FileName.str();
+-      LatestVer = GetROCmVersion(LatestROCm);
+-      continue;
+-    }
+-    auto Ver = GetROCmVersion(FileName);
+-    if (LatestVer < Ver) {
+-      LatestROCm = FileName.str();
+-      LatestVer = Ver;
+-    }
+-  }
+-  if (!LatestROCm.empty())
+-    ROCmSearchDirs.emplace_back(D.SysRoot + "/opt/" + LatestROCm,
+-                                /*StrictChecking=*/true);
+-
+-  DoPrintROCmSearchDirs();
+-  return ROCmSearchDirs;
++	ROCmSearchDirs.emplace_back(D.SysRoot + "/usr", /*StrictChecking=*/true);
++	return ROCmSearchDirs;
+ }
+ 
+ RocmInstallationDetector::RocmInstallationDetector(
+@@ -423,42 +298,7 @@ void RocmInstallationDetector::detectDev
+ }
+ 
+ void RocmInstallationDetector::detectHIPRuntime() {
+-  SmallVector<Candidate, 4> HIPSearchDirs;
+-  if (!HIPPathArg.empty())
+-    HIPSearchDirs.emplace_back(HIPPathArg.str(), /*StrictChecking=*/true);
+-  else
+-    HIPSearchDirs.append(getInstallationPathCandidates());
+-  auto &FS = D.getVFS();
+-
+-  for (const auto &Candidate : HIPSearchDirs) {
+-    InstallPath = Candidate.Path;
+-    if (InstallPath.empty() || !FS.exists(InstallPath))
+-      continue;
+-    // HIP runtime built by SPACK is installed to
+-    // <rocm_root>/hip-<rocm_release_string>-<hash> directory.
+-    auto SPACKPath = findSPACKPackage(Candidate, "hip");
+-    InstallPath = SPACKPath.empty() ? InstallPath : SPACKPath;
+-
+-    BinPath = InstallPath;
+-    llvm::sys::path::append(BinPath, "bin");
+-    IncludePath = InstallPath;
+-    llvm::sys::path::append(IncludePath, "include");
+-    LibPath = InstallPath;
+-    llvm::sys::path::append(LibPath, "lib");
+-
+-    llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> VersionFile =
+-        FS.getBufferForFile(BinPath + "/.hipVersion");
+-    if (!VersionFile && Candidate.StrictChecking)
+-      continue;
+-
+-    if (HIPVersionArg.empty() && VersionFile)
+-      if (parseHIPVersionFile((*VersionFile)->getBuffer()))
+-        continue;
+-
+-    HasHIPRuntime = true;
+-    return;
+-  }
+-  HasHIPRuntime = false;
++  HasHIPRuntime = true;
+ }
+ 
+ void RocmInstallationDetector::print(raw_ostream &OS) const {

diff --git a/sys-devel/llvm-roc/llvm-roc-4.3.0.ebuild b/sys-devel/llvm-roc/llvm-roc-4.3.0-r1.ebuild
similarity index 97%
rename from sys-devel/llvm-roc/llvm-roc-4.3.0.ebuild
rename to sys-devel/llvm-roc/llvm-roc-4.3.0-r1.ebuild
index f055da5b939..34567ada192 100644
--- a/sys-devel/llvm-roc/llvm-roc-4.3.0.ebuild
+++ b/sys-devel/llvm-roc/llvm-roc-4.3.0-r1.ebuild
@@ -33,6 +33,7 @@ src_prepare() {
 	cd "${WORKDIR}/llvm-project-rocm-${PV}" || die
 	eapply "${FILESDIR}/${PN}-3.0.0-add_libraries.patch"
 	eapply "${FILESDIR}/${PN}-4.0.0-remove-isystem-usr-include.patch"
+	eapply "${FILESDIR}/${PN}-4.3.0-hip-location.patch"
 	eapply "${FILESDIR}/${PN}-4.2.0-cyclades.patch"
 
 	if [[ -n ${EPREFIX} ]]; then


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-26 12:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-08 17:57 [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm-roc/files/, sys-devel/llvm-roc/ Craig Andrews
  -- strict thread matches above, loose matches on Subject: below --
2021-08-26 12:39 Benda XU
2021-02-06 17:26 Benda XU
2021-01-20  5:36 Benda XU
2020-11-18 17:56 Craig Andrews
2019-12-29 22:22 Craig Andrews

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox