Bug#1077789: clblas: please apply upstream patch clBLAS aborts with OpenCL Error -11 in makeGemmKernel Edit

Gianfranco Costamagna locutusofborg at debian.org
Fri Aug 2 08:38:06 BST 2024


Package: clblas
Version: 2.12-5
Severity: important
Tags: patch

Executing any of the clblas.gemm functions in libclBLAS.so.2.12.0 (libclblas2 2.12-1build1 on bionic) aborts the calling program with this error message:

OpenCL error -11 [...] clblas-2.12/src/library/blas/xgemm.cc:244: void makeGemmKernel(_cl_kernel**, cl_command_queue, const char*, const char*, const unsigned char**, size_t*, const char*): Assertion `false' failed.

The error occurs when the backend is an OpenCL 1.1 device. This includes all GPUs supported by libclc through mesa-opencl-icd (Clover), that is effectively all AMD GPUs.

The error can be easily reproduced by running the example from the upstream README.md[1] on a machine with an AMD GPU, with environment entry OCL_ICD_VENDORS=mesa.icd.

This bug also affects all BLAS functionality in libarrayfire-opencl3, as can be seen by running e.g. examples/benchmarks/blas or any of the lin_algebra examples from the libarrayfire-doc package.

The good news is, there is a fix :-) I have submitted this PR[2] upstream, and am attaching a dquilt-ready patch as upstream releases (and even pulls to master) are very infrequent.

[1] https://github.com/clMathLibraries/clBLAS#example
[2] https://github.com/clMathLibraries/clBLAS/pull/342

from: https://bugs.launchpad.net/ubuntu/+source/clblas/+bug/1816887

diff -Nru clblas-2.12/debian/patches/342.patch clblas-2.12/debian/patches/342.patch
--- clblas-2.12/debian/patches/342.patch	1970-01-01 01:00:00.000000000 +0100
+++ clblas-2.12/debian/patches/342.patch	2024-08-02 09:32:06.000000000 +0200
@@ -0,0 +1,34 @@
+From 8dd6df3f1bf543db3765383b4f9646df50d23d08 Mon Sep 17 00:00:00 2001
+From: Marco van Zwetselaar <io at zwets.it>
+Date: Wed, 20 Feb 2019 15:48:19 +0300
+Subject: [PATCH] Do not pass the -cl-std option to kernel builds
+
+- Resolves the abort in xgemm.cc:244 for OpenCL 1.1 devices
+---
+ src/library/blas/AutoGemm/Includes.py | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/library/blas/AutoGemm/Includes.py b/src/library/blas/AutoGemm/Includes.py
+index 0f616956..e32694d8 100644
+--- a/src/library/blas/AutoGemm/Includes.py
++++ b/src/library/blas/AutoGemm/Includes.py
+@@ -272,8 +272,8 @@ def addKernel(self, kernel):
+     kernelName = kernel.getName()
+     self.incStr += "extern const char * const %s_srcBuildOptions;\n" \
+         % kernelName
+-    self.cppStr += "const char * const %s_srcBuildOptions = \"-cl-std=CL%s\";\n" \
+-        % (kernelName, Common.getClCompilerVersion() )
++    self.cppStr += "const char * const %s_srcBuildOptions = \"\";\n" \
++        % kernelName
+
+     self.incFile.write( self.incStr )
+     self.incStr = ""
+@@ -314,7 +314,7 @@ def __init__(self):
+   def addKernel(self, kernel):
+     kernelName = kernel.getName()
+     self.incStr += "extern const char * const %s_binBuildOptions;\n" % kernelName
+-    self.cppStr += "const char * const %s_binBuildOptions = \"-cl-std=CL%s\";\n" % (kernelName, Common.getClCompilerVersion() )
++    self.cppStr += "const char * const %s_binBuildOptions = \"\";\n" % kernelName
+
+     self.incFile.write( self.incStr )
+     self.incStr = ""


thanks for considering it.

Gianfranco
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/debian-science-maintainers/attachments/20240802/4c648f43/attachment-0001.sig>


More information about the debian-science-maintainers mailing list