diff --git a/gnu/packages/rocm-tools.scm b/gnu/packages/rocm-tools.scm index 35776b595b..9b441df3e1 100644 --- a/gnu/packages/rocm-tools.scm +++ b/gnu/packages/rocm-tools.scm @@ -21,10 +21,20 @@ #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) #: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) #:use-module (gnu packages pciutils) #:use-module (gnu packages perl) - #:use-module (gnu packages rocm)) + #:use-module (gnu packages python) + #:use-module (gnu packages python-science) + #:use-module (gnu packages python-xyz) + #:use-module (gnu packages rocm) + #:use-module (gnu packages xml) + #:use-module (gnu packages xorg)) ;; 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 @@ -83,3 +93,76 @@ 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)))