From 28c28d2ec8afb3514d4af3772407dd2c598b43f6 Mon Sep 17 00:00:00 2001 From: Cayetano Santos Date: Sun, 15 Feb 2026 12:07:08 +0100 Subject: [PATCH] gnu: rocprofiler: Move to rocm and switch sources. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/rocm-tools.scm (rocprofiler): Move from here ... * gnu/packages/rocm.scm (rocprofiler): ... to here. [home-page]: Update. [source]: Update. [arguments]<#:configure-flags>: Complete. <#:phases>: Add ’chdir; shift "after ’unpack" to "after ’chdir". [native-inputs]: Add ’perfetto. Merges guix/guix!6448 Change-Id: I57e83327c73ecb05db18f509a7c1f88f04014ed0 --- gnu/packages/rocm-tools.scm | 79 +------------------------------------ gnu/packages/rocm.scm | 72 +++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 78 deletions(-) diff --git a/gnu/packages/rocm-tools.scm b/gnu/packages/rocm-tools.scm index deee36f5a0..7de025b0b3 100644 --- a/gnu/packages/rocm-tools.scm +++ b/gnu/packages/rocm-tools.scm @@ -23,7 +23,6 @@ #:use-module (guix packages) #:use-module (gnu packages check) #:use-module (gnu packages elf) - #:use-module (gnu packages instrumentation) #:use-module (gnu packages libffi) #:use-module (gnu packages linux) #:use-module (gnu packages llvm) @@ -34,9 +33,7 @@ #:use-module (gnu packages python-science) #:use-module (gnu packages python-xyz) #:use-module (gnu packages rocm) - #:use-module (gnu packages xdisorg) - #:use-module (gnu packages xml) - #:use-module (gnu packages xorg)) + #:use-module (gnu packages xdisorg)) ;; The components are tightly integrated and can only be upgraded as a unit. If ;; you want to upgrade ROCm, bump this version number and the version number in @@ -95,77 +92,3 @@ translate CUDA source code into portable HIP C++.") (home-page "https://github.com/ROCm/HIPIFY") (license license:ncsa))) - -;; XXX: replace with rocprofiler-sdk from rocm-systems -(define-public rocprofiler - (package - (name "rocprofiler") - (version %rocm-version) - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/ROCm/rocprofiler") - (commit (string-append "rocm-" version)) - ;; XXX: unbundle perfetto - (recursive? #t))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "1lh6jmnwkswsczgppvw50gymjvih2mahblniap6ny1g67zl3xqap")))) - (build-system cmake-build-system) - (arguments - (list - #:tests? #f ; requires GPU - #:build-type "Release" - #:configure-flags - #~(list - (string-append "-DCMAKE_CXX_COMPILER=clang++") - (string-append "-DCMAKE_C_COMPILER=clang") - "-DROCPROFILER_LD_AQLPROFILE=ON") - #:phases - #~(modify-phases %standard-phases - (add-after 'unpack 'disable-tests - (lambda _ - (substitute* "CMakeLists.txt" - (("set.*ROCPROFILER_BUILD_(TESTS|CI).*") "")))) - (add-after 'unpack 'disable-git - (lambda _ - (substitute* "plugin/perfetto/CMakeLists.txt" - (("rocprofiler_checkout_git_submodule") "message")))) - (add-after 'unpack 'fix-experimental - (lambda _ - (substitute* (find-files "." "\\.(h|cpp)$") - (("experimental(/|::)") "")))) - (add-after 'unpack 'fix-script-path - (lambda _ - (substitute* "bin/rocprofv2" - (("ROCM_DIR=.*") - (string-append "ROCM_DIR=" #$output "\n")) - (("LD_LIBRARY_PATH=.*") - (string-append - "LD_LIBRARY_PATH=" #$(this-package-input "aqlprofile") "/lib" - ":$LD_LIBRARY_PATH\n"))))) - (add-after 'install 'remove-rocprof - (lambda _ - (delete-file (string-append #$output "/bin/rocprof"))))))) - (propagated-inputs (list roctracer)) - (inputs - (list aqlprofile - barectf - elfutils - libffi - libpciaccess - numactl - rocm-hip-runtime)) - (native-inputs - (list python - python-cppheaderparser - python-lxml - python-pyyaml - rocm-cmake - rocm-toolchain)) - (home-page "https://github.com/ROCm/rocprofiler") - (synopsis "ROC profiler library") - (description "ROC profiler library. Profiling with perf-counters -and derived metrics.") - (license license:expat))) diff --git a/gnu/packages/rocm.scm b/gnu/packages/rocm.scm index 441079354f..823808ecb0 100644 --- a/gnu/packages/rocm.scm +++ b/gnu/packages/rocm.scm @@ -35,6 +35,7 @@ #:use-module (gnu packages elf) #:use-module (gnu packages gcc) #:use-module (gnu packages gl) + #:use-module (gnu packages instrumentation) #:use-module (gnu packages linux) #:use-module (gnu packages llvm) #:use-module (gnu packages logging) @@ -46,7 +47,10 @@ #:use-module (gnu packages version-control) #:use-module (gnu packages vim) #:use-module (gnu packages perl) + #:use-module (gnu packages profiling) #:use-module (gnu packages xdisorg) + #:use-module (gnu packages xml) + #:use-module (gnu packages xorg) #:use-module (gnu packages libffi) #:use-module (ice-9 match) #:export (%default-amd-gpu-targets @@ -541,6 +545,74 @@ information about the system's drivers and GPUs. It also provides a command-line tool, @command{amd-smi}, which can be used to do the same.") (license (list license:expat license:ncsa)))) +(define-public rocprofiler + (package + (name "rocprofiler") + (version %rocm-version) + (home-page %rocm-systems-url) + (source %rocm-systems-origin) + (build-system cmake-build-system) + (arguments + (list + #:tests? #f ; requires GPU + #:build-type "Release" + #:configure-flags + #~(list + "-DROCPROFILER_BUILD_PLUGIN_PERFETTO=OFF" + (string-append "-DCMAKE_CXX_COMPILER=clang++") + (string-append "-DCMAKE_C_COMPILER=clang") + "-DROCPROFILER_LD_AQLPROFILE=ON") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda _ + (chdir "projects/rocprofiler"))) + (add-after 'chdir 'disable-tests + (lambda _ + (substitute* "CMakeLists.txt" + (("set.*ROCPROFILER_BUILD_(TESTS|CI).*") "")))) + (add-after 'chdir 'disable-git + (lambda _ + (substitute* "plugin/perfetto/CMakeLists.txt" + (("rocprofiler_checkout_git_submodule") "message")))) + (add-after 'chdir 'fix-experimental + (lambda _ + (substitute* (find-files "." "\\.(h|cpp)$") + (("experimental(/|::)") "")))) + (add-after 'chdir 'fix-script-path + (lambda _ + (substitute* "bin/rocprofv2" + (("ROCM_DIR=.*") + (string-append "ROCM_DIR=" #$output "\n")) + (("LD_LIBRARY_PATH=.*") + (string-append + "LD_LIBRARY_PATH=" #$(this-package-input "aqlprofile") "/lib" + ":$LD_LIBRARY_PATH\n"))))) + (add-after 'install 'remove-rocprof + (lambda _ + (delete-file (string-append #$output "/bin/rocprof"))))))) + (propagated-inputs (list roctracer)) + (inputs + (list aqlprofile + barectf + elfutils + libffi + libpciaccess + numactl + rocm-hip-runtime)) + (native-inputs + (list perfetto + python + python-cppheaderparser + python-lxml + python-pyyaml + rocm-cmake + rocm-toolchain)) + (synopsis "ROC profiler library") + (description "ROC profiler library. Profiling with perf-counters +and derived metrics.") + (license license:expat))) + (define-public rocprofiler-register (package (name "rocprofiler-register")