me
/
guix
Archived
1
0
Fork 0

gnu: Add rocm-opencl-runtime.

* gnu/packages/rocm.scm (rocm-opencl-runtime): New variable.
* gnu/packages/patches/rocm-opencl-runtime-3.10.0-add-rocclr-include-directories.patch,
gnu/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch,
gnu/packages/patches/rocm-opencl-runtime-4.3-nocltrace.patch,
gnu/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch: New files.
* gnu/local.mk (dist_patch_DATA): Add them.
Lars-Dominik Braun 2021-08-06 08:27:32 +02:00
parent 7221722dd5
commit c0f10a5dd4
No known key found for this signature in database
GPG Key ID: F663943E08D8092A
6 changed files with 185 additions and 0 deletions

View File

@ -1702,6 +1702,10 @@ dist_patch_DATA = \
%D%/packages/patches/rnp-disable-ruby-rnp-tests.patch \
%D%/packages/patches/rnp-unbundle-googletest.patch \
%D%/packages/patches/rocm-comgr-3.1.0-dependencies.patch \
%D%/packages/patches/rocm-opencl-runtime-3.10.0-add-rocclr-include-directories.patch \
%D%/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch \
%D%/packages/patches/rocm-opencl-runtime-4.3-nocltrace.patch \
%D%/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch \
%D%/packages/patches/ruby-sanitize-system-libxml.patch \
%D%/packages/patches/rust-1.19-mrustc.patch \
%D%/packages/patches/rust-1.25-accept-more-detailed-gdb-lines.patch \

View File

@ -0,0 +1,14 @@
Add missing include dirs for ROCclr.
--- a/amdocl/CMakeLists.txt 2020-12-05 22:05:55.838529158 +0100
+++ b/amdocl/CMakeLists.txt 2020-12-05 22:07:35.677524507 +0100
@@ -23,6 +23,9 @@
include_directories(${CMAKE_CURRENT_LIST_DIR}/../khronos)
include_directories(${CMAKE_CURRENT_LIST_DIR}/../khronos/headers)
include_directories(${CMAKE_CURRENT_LIST_DIR}/../khronos/headers/opencl2.2)
+include_directories(${ROCclr_DIR}/../../../include)
+include_directories(${ROCclr_DIR}/../../../include/compiler/lib/include/)
+include_directories(${ROCclr_DIR}/../../../include/elf/)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR
(CMAKE_${COMPILER}_COMPILER_ID MATCHES "Clang"))

View File

@ -0,0 +1,28 @@
Do not build and install clinfo.
diff --git a/CMakeLists.txt.orig b/CMakeLists.txt
index 76847d3..3f62bfe 100644
--- a/CMakeLists.txt.orig
+++ b/CMakeLists.txt
@@ -72,7 +72,7 @@ find_package(ROCclr REQUIRED CONFIG
add_subdirectory(khronos/icd)
add_subdirectory(amdocl)
-add_subdirectory(tools/clinfo)
+#add_subdirectory(tools/clinfo)
add_subdirectory(tools/cltrace)
if(BUILD_TESTS)
add_subdirectory(tests/ocltst)
@@ -108,9 +108,9 @@ endif()
###--- Packaging ------------------------------------------------------------###
# MAIN package
-install(PROGRAMS $<TARGET_FILE:clinfo>
- DESTINATION bin
- COMPONENT MAIN)
+#install(PROGRAMS $<TARGET_FILE:clinfo>
+# DESTINATION bin
+# COMPONENT MAIN)
install(PROGRAMS $<TARGET_FILE:cltrace>
DESTINATION lib
COMPONENT MAIN)

View File

@ -0,0 +1,25 @@
Do not build and install cltrace.
diff --git a/CMakeLists.txt.orig b/CMakeLists.txt
index c449db4..9cff673 100644
--- a/CMakeLists.txt.orig
+++ b/CMakeLists.txt
@@ -73,7 +73,7 @@ find_package(ROCclr REQUIRED CONFIG
#add_subdirectory(khronos/icd)
add_subdirectory(amdocl)
#add_subdirectory(tools/clinfo)
-add_subdirectory(tools/cltrace)
+#add_subdirectory(tools/cltrace)
if(BUILD_TESTS)
add_subdirectory(tests/ocltst)
endif()
@@ -108,9 +108,6 @@ endif()
#install(PROGRAMS $<TARGET_FILE:clinfo>
# DESTINATION bin
# COMPONENT MAIN)
-install(PROGRAMS $<TARGET_FILE:cltrace>
- DESTINATION lib
- COMPONENT MAIN)
install(PROGRAMS $<TARGET_FILE:amdocl64>
DESTINATION lib
COMPONENT MAIN)

View File

@ -0,0 +1,63 @@
Do not build and install libOpenCL.
--- b/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -70,7 +70,7 @@
${ROCclr_DIR}
${LIBROCclr_STATIC_DIR})
-add_subdirectory(khronos/icd)
+#add_subdirectory(khronos/icd)
add_subdirectory(amdocl)
#add_subdirectory(tools/clinfo)
add_subdirectory(tools/cltrace)
@@ -93,9 +93,6 @@
OUTPUT_VARIABLE OPENCL_VERSION_GITDATE
OUTPUT_STRIP_TRAILING_WHITESPACE)
-get_target_property(OPENCL_LIB_VERSION_MAJOR OpenCL SOVERSION)
-get_target_property(OPENCL_LIB_VERSION_STRING OpenCL VERSION)
-
find_package(ROCM QUIET CONFIG PATHS /opt/rocm)
if(ROCM_FOUND)
@@ -117,25 +114,6 @@
install(PROGRAMS $<TARGET_FILE:amdocl64>
DESTINATION lib
COMPONENT MAIN)
-install(PROGRAMS $<TARGET_FILE:OpenCL>
- DESTINATION lib
- COMPONENT MAIN)
-install(PROGRAMS $<TARGET_SONAME_FILE:OpenCL>
- DESTINATION lib
- COMPONENT MAIN)
-
-# DEV package
-install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/khronos/headers/opencl2.2/CL"
- DESTINATION include
- COMPONENT DEV
- USE_SOURCE_PERMISSIONS
- PATTERN cl_d3d10.h EXCLUDE
- PATTERN cl_d3d11.h EXCLUDE
- PATTERN cl_dx9_media_sharing.h EXCLUDE
- PATTERN cl_egl.h EXCLUDE)
-install(PROGRAMS $<TARGET_LINKER_FILE:OpenCL>
- DESTINATION lib
- COMPONENT DEV)
#############################
# Packaging steps
--- a/khronos/icd/CMakeLists.txt 2020-06-07 16:05:32.425022904 +0200
+++ b/khronos/icd/CMakeLists.txt 2020-06-07 16:06:03.273022786 +0200
@@ -132,7 +132,7 @@
add_subdirectory (test)
endif()
-install (TARGETS OpenCL
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+#install (TARGETS OpenCL
+# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -253,3 +253,54 @@ applications to launch compute kernels to available HSA ROCm kernel agents.")
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")
(version %rocm-version)
(source (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"))
(patches
(search-patches
"rocm-opencl-runtime-3.10.0-add-rocclr-include-directories.patch"
;; Do not install libOpenCL, which ocl-icd provides.
"rocm-opencl-runtime-4.3-noopencl.patch"
;; Guix includes a program clinfo already.
"rocm-opencl-runtime-4.3-noclinfo.patch"
;; cltrace linking fails, remove it.
"rocm-opencl-runtime-4.3-nocltrace.patch"))))
(build-system cmake-build-system)
(arguments
`(#:tests? #f ; Not sure how to run them.
#:phases
(modify-phases %standard-phases
(add-after 'install 'create-icd
;; Manually install ICD, which simply consists of dumping
;; the path of the .so into the correct file.
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(vendors (string-append out "/etc/OpenCL/vendors"))
(sopath (string-append out "/lib/libamdocl64.so")))
(mkdir-p vendors)
(with-output-to-file (string-append vendors "/amdocl64.icd")
(lambda _ (display sopath)))))))))
(inputs
`(("mesa" ,mesa)
("rocm-comgr" ,rocm-comgr)
("rocr-runtime" ,rocr-runtime)
("rocclr" ,rocclr)
("ocl-icd" ,ocl-icd)
("glew" ,glew)))
(native-inputs `())
(home-page "https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime")
(synopsis "ROCm OpenCL Runtime")
(description "OpenCL 2.0 compatible language runtime, supporting offline
and in-process/in-memory compilation.")
(license license:ncsa)))