commit:     462ef1543682881ba43c755db473b60d4436a579
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Dec  5 04:20:26 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Dec  5 04:20:26 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=462ef154

dev-libs/pocl: fix build w/ cuda

Closes: https://bugs.gentoo.org/862633
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/pocl/files/pocl-3.0-cuda.patch | 48 +++++++++++++++++++++++++++++++++
 dev-libs/pocl/pocl-3.0.ebuild           |  1 +
 2 files changed, 49 insertions(+)

diff --git a/dev-libs/pocl/files/pocl-3.0-cuda.patch 
b/dev-libs/pocl/files/pocl-3.0-cuda.patch
new file mode 100644
index 000000000000..d6729b0fedce
--- /dev/null
+++ b/dev-libs/pocl/files/pocl-3.0-cuda.patch
@@ -0,0 +1,48 @@
+https://github.com/pocl/pocl/pull/1146
+
+From 978afab0ba9f90fbdb39ed4ffc52f8ca46d2bfa9 Mon Sep 17 00:00:00 2001
+From: Sam James <s...@gentoo.org>
+Date: Mon, 5 Dec 2022 04:17:05 +0000
+Subject: [PATCH] pocl-cuda: fix build with -DPOCL_DEBUG_MESSAGES=OFF
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fixes build failure:
+```
+/var/tmp/portage2/portage/dev-libs/pocl-3.0/work/pocl-3.0/lib/CL/devices/cuda/pocl-cuda.c:
 In function ‘load_or_generate_kernel’:
+/var/tmp/portage2/portage/dev-libs/pocl-3.0/work/pocl-3.0/lib/CL/devices/cuda/pocl-cuda.c:981:9:
 error: ‘pocl_debug_messages_filter’ undeclared (first use in this function)
+  981 |   if (!(pocl_debug_messages_filter & POCL_DEBUG_FLAG_CUDA))
+      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
+```
+
+Bug: https://bugs.gentoo.org/862633
+--- a/lib/CL/devices/cuda/pocl-cuda.c
++++ b/lib/CL/devices/cuda/pocl-cuda.c
+@@ -1093,6 +1093,7 @@ load_or_generate_kernel (cl_kernel kernel, cl_device_id 
device,
+   /* TODO: When can we unload the module? */
+   CUmodule module;
+ 
++#ifdef POCL_DEBUG_MESSAGES
+   if (!(pocl_debug_messages_filter & POCL_DEBUG_FLAG_CUDA))
+     {
+       result = cuModuleLoad (&module, ptx_filename);
+@@ -1100,6 +1101,7 @@ load_or_generate_kernel (cl_kernel kernel, cl_device_id 
device,
+     }
+   else
+     {
++#endif
+       struct stat st;
+       stat (ptx_filename, &st);
+ 
+@@ -1132,7 +1134,9 @@ load_or_generate_kernel (cl_kernel kernel, cl_device_id 
device,
+ 
+       free (log);
+       free (buffer);
++#ifdef POCL_DEBUG_MESSAGES
+     }
++#endif
+ 
+   /* Get kernel function */
+   CUfunction function;
+

diff --git a/dev-libs/pocl/pocl-3.0.ebuild b/dev-libs/pocl/pocl-3.0.ebuild
index 51f20465bc25..7f94d77e1958 100644
--- a/dev-libs/pocl/pocl-3.0.ebuild
+++ b/dev-libs/pocl/pocl-3.0.ebuild
@@ -47,6 +47,7 @@ BDEPEND="${CLANG_DEPS}
 PATCHES=(
        "${FILESDIR}"/${P}-icd.patch
        "${FILESDIR}"/${P}-fix-version.patch
+       "${FILESDIR}"/${P}-cuda.patch
 )
 
 python_check_deps() {

Reply via email to