[PATCH 0/2] gnu: Update rocm to 5.1.3.

  • Done
  • quality assurance status badge
Details
3 participants
  • John Kehayias
  • Lars-Dominik Braun
  • Ludovic Courtès
Owner
unassigned
Submitted by
John Kehayias
Severity
normal

Debbugs page

John Kehayias wrote 3 years ago
(name . Guix-patches)(address . guix-patches@gnu.org)
ForlI9pwyimRYtR94XmPipgXx6bzs-Y1jQCExNj9rQaTxBedIjgvrK4nW2nEzO2YbLkDH79uRpzxmlC128hf7Tcy3Jnf7U6SNUAjRg36Xwk=@protonmail.com
Hi Guixers,

Incoming are two patches to update the rocm packages (AMD's OpenCL stuff) to the latest version. With this I can use OpenCL in Darktable with my current gen GPU (note: I'm not on linux-libre, which likely impacts what cards can be used).

I tested that everything builds and darktable-cltest reports successful output, as well as rocminfo. E.g. running

./pre-inst-env guix shell rocm-opencl-runtime rocm-device-libs opencl-icd-loader darktable -- darktable-cltest

A few quick notes on these patches. Most of this was discussed on IRC recently, but for the record:

1. llvm-for-rocm: The first patch updates this to use llvm-14, which is what the current rocm version is based on.

2. rocm: All of the packages are updated in one commit as they share a version number and there some interdependencies.

3. rocclr: This is no longer meant as a standalone package: cmake will output a warning and there is no install to be done. It is meant to be included in packages that use it. I've made a plain origin for the rocclr source that is needed (see rocm-opencl-runtime that uses it) and renamed the old version to rocclr-4 since that will still build/install in case it is of use.

This is the commit that changed the build behavior, active since v4.5 at least: https://github.com/ROCm-Developer-Tools/ROCclr/commit/df1449608e92c9e42b4ce5799e6eb51934ae7d4a

4. Relatedly, both Arch and Gentoo build rocclr before building rocm-opencl-runtime, but this doesn't seem to do anything. Unfortunately the rocm readmes are unclear/not up to date on exactly what is needed. From my testing, just setting a configure flag to point to the rocclr source is all that is needed.

The Arch and Gentoo recipes are here:



We can do the same thing by adding in this phase for rocm-opencl-runtime. I did not see any change in the final output and everything (with Darktable) seemed fine without it. It will take a little longer to build as it does build rocclr explicitly. Anyway, in case it is of use to anyone, here is the code

(add-before 'configure 'configure-rocclr
(lambda* (#:key inputs #:allow-other-keys)
(invoke "cmake" (string-append "-DAMD_OPENCL_PATH="
#$(package-source this-package))
"-B build-rocclr" "-S" #$rocclr-src)
(invoke "make" "-C" "build-rocclr")))

Okay, that's it! Overall is mostly updating hashes and some patches, other than the rocclr notes above. I hope I got the (long) commit message correct on the second patch. The changes work well for me locally.

Thanks!
John
John Kehayias wrote 3 years ago
[PATCH 1/2] gnu: Update llvm-for-rocm to 5.1.3.
(name . 55948@debbugs.gnu.org)(address . 55948@debbugs.gnu.org)
ZPzTkbGFoM3QlIk5ZlQkjzhPZX9kfyzWSxSPt7LFVmkqWxIm0phcnzans3rIZLUC4myOvDqkJ51zFiT1akRqwpco6AABdwzg6omPLgSX6GE=@protonmail.com
Empty Message
John Kehayias wrote 3 years ago
[PATCH 2/2] gnu: rocm: Update to 5.1.3.
(name . 55948@debbugs.gnu.org)(address . 55948@debbugs.gnu.org)
0Lex6E3kVY8eDx6QwUBXpTCvDjY_V_gBBkbFE253mPSFzaVeI27X0EKOlk3FyF_Qa9n3e1L5cjvt9no0LvuQmjArS2_79dE22nDUbhxxWiU=@protonmail.com
Empty Message
Ludovic Courtès wrote 3 years ago
Re: bug#55948: [PATCH 0/2] gnu: Update rocm to 5.1.3.
(name . John Kehayias)(address . john.kehayias@protonmail.com)(address . 55948-done@debbugs.gnu.org)
87sfo4lu22.fsf@gnu.org
Hello John,

Pushed!

67c30ff8ad gnu: rocm: Update to 5.1.3.
25809f5a40 gnu: Update llvm-for-rocm: Update to 5.1.3.

John Kehayias <john.kehayias@protonmail.com> skribis:

Toggle quote (2 lines)
> Okay, that's it! Overall is mostly updating hashes and some patches, other than the rocclr notes above. I hope I got the (long) commit message correct on the second patch. The changes work well for me locally.

Thanks for the explanations, it’s great to know the context and things
you addressed.

Ludo’.
Closed
Lars-Dominik Braun wrote 3 years ago
(address . 55948@debbugs.gnu.org)(address . ludo@gnu.org)(address . john.kehayias@protonmail.com)
YqscOHyKZ/XpL8ZS@noor.fritz.box
Hi Ludo,

Toggle quote (1 lines)
> Pushed!
aw, I’m too late. I was going to propose the attached changes.

Lars
Toggle diff (77 lines)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 7b197bb67b..f5d3eac588 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1127,14 +1127,9 @@ (define-public llvm-for-rocm
(search-patches "llvm-roc-5.0.0-linkdl.patch"
"llvm-roc-4.0.0-remove-isystem-usr-include.patch"))))
(arguments
- (substitute-keyword-arguments (package-arguments llvm-12)
- ((#:phases phases '%standard-phases)
- `(modify-phases ,phases
- (add-after 'unpack 'chdir
- (lambda _
- (chdir "llvm")))))
+ (substitute-keyword-arguments (package-arguments llvm-14)
((#:configure-flags flags)
- ''("-DLLVM_ENABLE_PROJECTS=llvm;clang;lld"
+ #~(list"-DLLVM_ENABLE_PROJECTS=llvm;clang;lld"
"-DLLVM_TARGETS_TO_BUILD=AMDGPU;X86"
"-DCMAKE_SKIP_BUILD_RPATH=FALSE"
"-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE"
diff --git a/gnu/packages/rocm.scm b/gnu/packages/rocm.scm
index 6c1a83cc88..b85b39d783 100644
--- a/gnu/packages/rocm.scm
+++ b/gnu/packages/rocm.scm
@@ -193,51 +193,6 @@ (define rocclr-src
(base32
"0x1frzpz9j1s516vscbdm9g5cqirvv5w7wmq2kyljcygnci7yqar"))))
-(define-public rocclr-4
- (package
- (name "rocclr-4")
- (version "4.3.0")
- (source (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/ROCm-Developer-Tools/ROCclr.git")
- (commit (string-append "rocm-" version))))
- (file-name (git-file-name name version))
- (sha256
- (base32
- "1pm1y020zriz7zmi95w0rcpka0jrsc7wwh81sssnysi8wxk3nnfy"))))
- (build-system cmake-build-system)
- (arguments
- `(#:tests? #f ; No tests.
- #:configure-flags
- `(,(string-append
- "-DOPENCL_DIR="
- (assoc-ref %build-inputs "rocm-opencl-runtime-src")))))
- (inputs
- `(("mesa" ,mesa)
- ("rocm-comgr" ,rocm-comgr)
- ("llvm" ,llvm-for-rocm)
- ("rocm-device-libs" ,rocm-device-libs)
- ("rocr-runtime" ,rocr-runtime)
- ("rocm-cmake" ,rocm-cmake)
- ;; rocclr depends on a few headers provided by rocm-opencl-runtime.
- ("rocm-opencl-runtime-src"
- ,(origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime.git")
- (commit (string-append "rocm-" version))))
- (file-name (git-file-name name version))
- (sha256
- (base32
- "1cglpiaj3ny1z74ssmy6j63vj92sfy4q38ix6qsga0mg3b2wvqz3"))))))
- (home-page "https://github.com/ROCm-Developer-Tools/ROCclr")
- (synopsis "Radeon Open Compute Common Language Runtime")
- (description "ROCclr is a virtual device interface that compute runtimes
-interact with to different backends such as ROCr or PAL. This abstraction
-allows runtimes to work on Windows as well as on Linux without much effort.")
- (license license:ncsa)))
-
(define-public rocm-opencl-runtime
(package
(name "rocm-opencl-runtime")
Ludovic Courtès wrote 3 years ago
(name . Lars-Dominik Braun)(address . lars@6xq.net)(address . john.kehayias@protonmail.com)(address . 55948@debbugs.gnu.org)
87fsk4ls4e.fsf@gnu.org
Hi,

Lars-Dominik Braun <lars@6xq.net> skribis:

Toggle quote (3 lines)
>> Pushed!
> aw, I’m too late. I was going to propose the attached changes.

Oh sorry; it’s never too late though.

Toggle quote (22 lines)
> diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
> index 7b197bb67b..f5d3eac588 100644
> --- a/gnu/packages/llvm.scm
> +++ b/gnu/packages/llvm.scm
> @@ -1127,14 +1127,9 @@ (define-public llvm-for-rocm
> (search-patches "llvm-roc-5.0.0-linkdl.patch"
> "llvm-roc-4.0.0-remove-isystem-usr-include.patch"))))
> (arguments
> - (substitute-keyword-arguments (package-arguments llvm-12)
> - ((#:phases phases '%standard-phases)
> - `(modify-phases ,phases
> - (add-after 'unpack 'chdir
> - (lambda _
> - (chdir "llvm")))))
> + (substitute-keyword-arguments (package-arguments llvm-14)
> ((#:configure-flags flags)
> - ''("-DLLVM_ENABLE_PROJECTS=llvm;clang;lld"
> + #~(list"-DLLVM_ENABLE_PROJECTS=llvm;clang;lld"
> "-DLLVM_TARGETS_TO_BUILD=AMDGPU;X86"
> "-DCMAKE_SKIP_BUILD_RPATH=FALSE"
> "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE"

John, WDYT?

Toggle quote (5 lines)
> -(define-public rocclr-4
> - (package
> - (name "rocclr-4")
> - (version "4.3.0")

Fine with me; John?

Lars, feel free to push these if John agrees.

Ludo’.
John Kehayias wrote 3 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 55948@debbugs.gnu.org)(name . Lars-Dominik Braun)(address . lars@6xq.net)
p7UDsBfkXQB0KbipxDmXapQM1kxe1QIiAeJoUzBDMns-Zb0pBYJxKth92VCHEiwzTorjfPPrVwMK6f0553bGgxpci2_AwWF16OmBoDH6M2E=@protonmail.com
Hi Ludo’ and Lars,

Thanks for the review and assistance (Lars and I discussed this on IRC a few days ago).

------- Original Message -------
On Thursday, June 16th, 2022 at 8:17 AM, Ludovic Courtès <ludo@gnu.org> wrote:

Toggle quote (26 lines)
> > diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
> > index 7b197bb67b..f5d3eac588 100644
> > --- a/gnu/packages/llvm.scm
> > +++ b/gnu/packages/llvm.scm
> > @@ -1127,14 +1127,9 @@ (define-public llvm-for-rocm
> > (search-patches "llvm-roc-5.0.0-linkdl.patch"
> > "llvm-roc-4.0.0-remove-isystem-usr-include.patch"))))
> > (arguments
> > - (substitute-keyword-arguments (package-arguments llvm-12)
> > - ((#:phases phases '%standard-phases)
> > - `(modify-phases ,phases
> > - (add-after 'unpack 'chdir
> > - (lambda _
> > - (chdir "llvm")))))
> > + (substitute-keyword-arguments (package-arguments llvm-14)
> > ((#:configure-flags flags)
> > - ''("-DLLVM_ENABLE_PROJECTS=llvm;clang;lld"
> > + #~(list"-DLLVM_ENABLE_PROJECTS=llvm;clang;lld"
> > "-DLLVM_TARGETS_TO_BUILD=AMDGPU;X86"
> > "-DCMAKE_SKIP_BUILD_RPATH=FALSE"
> > "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE"
>
>
> John, WDYT?
>

Fine with me! (I'm assuming Lars had built this version locally as this just seems like a clean up and better inheritance structure.)

Toggle quote (8 lines)
> > -(define-public rocclr-4
> > - (package
> > - (name "rocclr-4")
> > - (version "4.3.0")
>
> Fine with me; John?
>

Likewise! For some context, Lars and I had discussed on IRC about ROCm dropping support in later v4 (and now v5) for hardware he uses. Unfortunately, figuring out what is supported or works in this space is very difficult as they cater to more workstation setups. We have time machine and guix past at least, though maybe we can keep older versions explicitly. Since Lars might be one of the few (only?) that uses the older ROCm, I left it to him. rocclr v4 is probably not useful on its own, so I'm fine with dropping it.

Toggle quote (4 lines)
> Lars, feel free to push these if John agrees.
>
> Ludo’.

By the way, I forgot I had to make a kernel change to use this, see https://issues.guix.gnu.org/55111Let me try again with these patches having landed and report back on that issue directly at #55111.

Thanks everyone!
John
Lars-Dominik Braun wrote 3 years ago
(name . John Kehayias)(address . john.kehayias@protonmail.com)(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 55948-done@debbugs.gnu.org)
YrrkaLKFrBXQMG61@noor.fritz.box
Hi,

thanks for having a look. Pushed as:

453b0670a6 gnu: llvm-for-rocm: Inherit from llvm-14
b7c99f2b88 gnu: rocclr-4: Remove package.

Cheers,
Lars
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 55948@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 55948
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help