[ocl-icd] 07/13: New upstream version 2.2.11

Vincent Danjean vdanjean at debian.org
Wed Nov 29 09:16:51 UTC 2017


This is an automated email from the git hooks/post-receive script.

vdanjean pushed a commit to branch master
in repository ocl-icd.

commit dbecca08c12fb74e9538a0805f7f6061f61ccbbc
Author: Vincent Danjean <Vincent.Danjean at ens-lyon.org>
Date:   Fri Jan 20 07:00:56 2017 +0100

    New upstream version 2.2.11
---
 Makefile.am                                 |  3 +-
 Makefile.in                                 |  4 +-
 NEWS                                        | 17 ++++++
 configure                                   | 72 ++++++++++++++++++----
 configure.ac                                | 33 +++++++++--
 doc/Makefile.am                             | 18 +++++-
 doc/Makefile.in                             | 18 +++++-
 doc/{libOpenCL.7.txt => libOpenCL.7.txt.in} | 38 ++++++++----
 ocl_icd_loader.c                            | 92 +++++++++++++++++++++--------
 tests/Makefile.in                           |  1 +
 tests/package.m4                            |  4 +-
 tests/testsuite                             | 12 ++--
 12 files changed, 245 insertions(+), 67 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 845e89d..5f4d609 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -41,7 +41,8 @@ stamp-generator: icd_generator.rb
 
 # ignore the warning in OpenCL headers when using old interface
 libOpenCL_la_CFLAGS= $(NO_DEPRECATED_DECLARATIONS_FLAGS) \
-	$(AM_CFLAGS) $(PTHREAD_CFLAGS)
+	$(AM_CFLAGS) $(PTHREAD_CFLAGS) \
+	-DETC_OPENCL_VENDORS=\"@OCL_ICD_VENDORDIR@\"
 
 libOpenCL_la_SOURCES = ocl_icd_loader.c ocl_icd_loader.h ocl_icd_debug.h
 nodist_libOpenCL_la_SOURCES = ocl_icd_loader_gen.c ocl_icd.h
diff --git a/Makefile.in b/Makefile.in
index 8f95ac9..41a0d24 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -408,6 +408,7 @@ NMEDIT = @NMEDIT@
 NO_DEPRECATED_DECLARATIONS_FLAGS = @NO_DEPRECATED_DECLARATIONS_FLAGS@
 OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OCL_ICD_VENDORDIR = @OCL_ICD_VENDORDIR@
 OPENCL_VERSION = @OPENCL_VERSION@
 OTOOL = @OTOOL@
 OTOOL64 = @OTOOL64@
@@ -512,7 +513,8 @@ CLEANFILES = $(FILES_FROM_DATABASE) stamp-generator \
 
 # ignore the warning in OpenCL headers when using old interface
 libOpenCL_la_CFLAGS = $(NO_DEPRECATED_DECLARATIONS_FLAGS) \
-	$(AM_CFLAGS) $(PTHREAD_CFLAGS)
+	$(AM_CFLAGS) $(PTHREAD_CFLAGS) \
+	-DETC_OPENCL_VENDORS=\"@OCL_ICD_VENDORDIR@\"
 
 libOpenCL_la_SOURCES = ocl_icd_loader.c ocl_icd_loader.h ocl_icd_debug.h
 nodist_libOpenCL_la_SOURCES = ocl_icd_loader_gen.c ocl_icd.h
diff --git a/NEWS b/NEWS
index 139c60b..9c8c79c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,21 @@
 
+Version 2.2.11
+==============
+Andreas Kloeckner (3):
+      Add autoconf option for custom vendors .icd path
+      Make vendordir relative to
+      Hack the docs to reflect configured vendordir
+
+Vincent Danjean (8):
+      Revert "By default, use platforme specific clGetPlatformInfo"
+      Do not deference the plateform structure before checking it is an ICD
+      Cleanup --enable-custom-vendordir usage
+      [doc] ensure that files are correctly distributed and/or cleaned up
+      [doc] improve doc
+      [build] add notice message about what is choosen
+      Merge branch 'rel-vendor'
+      Release 2.2.11
+
 Version 2.2.10
 ==============
 Giuseppe Bilotta (2):
diff --git a/configure b/configure
index 6855bf5..b59976d 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for OpenCL ICD Loader 2.2.10.
+# Generated by GNU Autoconf 2.69 for OpenCL ICD Loader 2.2.11.
 #
 # Report bugs to <ocl-icd-devel at lists.forge.imag.fr>.
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='OpenCL ICD Loader'
 PACKAGE_TARNAME='ocl-icd'
-PACKAGE_VERSION='2.2.10'
-PACKAGE_STRING='OpenCL ICD Loader 2.2.10'
+PACKAGE_VERSION='2.2.11'
+PACKAGE_STRING='OpenCL ICD Loader 2.2.11'
 PACKAGE_BUGREPORT='ocl-icd-devel at lists.forge.imag.fr'
 PACKAGE_URL=''
 
@@ -637,6 +637,7 @@ am__EXEEXT_TRUE
 LTLIBOBJS
 USE_MAP_FALSE
 USE_MAP_TRUE
+OCL_ICD_VENDORDIR
 UPDATE_DATABASE_FALSE
 UPDATE_DATABASE_TRUE
 AM_CPPFLAGS
@@ -781,6 +782,7 @@ enable_pthread_once
 enable_official_khronos_headers
 enable_debug
 enable_update_database
+enable_custom_vendordir
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1341,7 +1343,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures OpenCL ICD Loader 2.2.10 to adapt to many kinds of systems.
+\`configure' configures OpenCL ICD Loader 2.2.11 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1412,7 +1414,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of OpenCL ICD Loader 2.2.10:";;
+     short | recursive ) echo "Configuration of OpenCL ICD Loader 2.2.11:";;
    esac
   cat <<\_ACEOF
 
@@ -1443,6 +1445,9 @@ Optional Features:
                           update the YAML database from the currently
                           installed ICD Loader and OpenCL headers (root access
                           required)
+  --enable-custom-vendordir
+                          use the given directory instead of
+                          /etc/OpenCL/vendors to look for .icd files
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -1529,7 +1534,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-OpenCL ICD Loader configure 2.2.10
+OpenCL ICD Loader configure 2.2.11
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1952,7 +1957,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by OpenCL ICD Loader $as_me 2.2.10, which was
+It was created by OpenCL ICD Loader $as_me 2.2.11, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2819,7 +2824,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='ocl-icd'
- VERSION='2.2.10'
+ VERSION='2.2.11'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -12086,10 +12091,22 @@ $as_echo "no" >&6; }
 fi
 
 
- if \
-	test x"$ASCIIDOC" != x && \
+if 	test x"$ASCIIDOC" != x && \
 	test x"$A2X" != x && \
-	test x"$XMLTO" != x ; then
+	test x"$XMLTO" != x ; then :
+
+  gen_doc=1
+  { $as_echo "$as_me:${as_lineno-$LINENO}: generating documentation" >&5
+$as_echo "$as_me: generating documentation" >&6;}
+
+else
+
+  gen_doc=0
+  { $as_echo "$as_me:${as_lineno-$LINENO}: documentation generation disabled" >&5
+$as_echo "$as_me: documentation generation disabled" >&6;}
+
+fi
+ if  test x"$gen_doc" = x1 ; then
   GEN_DOC_TRUE=
   GEN_DOC_FALSE='#'
 else
@@ -13017,6 +13034,35 @@ else
 fi
 
 
+# --enable-custom-vendordir
+# Check whether --enable-custom-vendordir was given.
+if test "${enable_custom_vendordir+set}" = set; then :
+  enableval=$enable_custom_vendordir; case "$enableval" in #(
+  yes) :
+    OCL_ICD_VENDORDIR="$sysconfdir/OpenCL/vendors" ;; #(
+  no) :
+    OCL_ICD_VENDORDIR='/etc/OpenCL/vendors' ;; #(
+  *) :
+    OCL_ICD_VENDORDIR=$enableval ;;
+esac
+else
+  OCL_ICD_VENDORDIR=/etc/OpenCL/vendors
+fi
+
+
+
+if test x"$OCL_ICD_VENDORDIR" = x"/etc/OpenCL/vendors" ; then :
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: using the official default vendors directory ($OCL_ICD_VENDORDIR)" >&5
+$as_echo "$as_me: using the official default vendors directory ($OCL_ICD_VENDORDIR)" >&6;}
+
+else
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: using an unofficial custom default vendors directory ($OCL_ICD_VENDORDIR)" >&5
+$as_echo "$as_me: using an unofficial custom default vendors directory ($OCL_ICD_VENDORDIR)" >&6;}
+
+fi
+
 # always use versionned symbols (check required for MacOSX)
  if true; then
   USE_MAP_TRUE=
@@ -13571,7 +13617,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by OpenCL ICD Loader $as_me 2.2.10, which was
+This file was extended by OpenCL ICD Loader $as_me 2.2.11, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -13637,7 +13683,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-OpenCL ICD Loader config.status 2.2.10
+OpenCL ICD Loader config.status 2.2.11
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index 1f8df37..c3def69 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,7 +6,7 @@
 
 
 AC_PREREQ([2.67])
-AC_INIT([OpenCL ICD Loader], [2.2.10], [ocl-icd-devel at lists.forge.imag.fr], [ocl-icd])
+AC_INIT([OpenCL ICD Loader], [2.2.11], [ocl-icd-devel at lists.forge.imag.fr], [ocl-icd])
 AC_CONFIG_SRCDIR([ocl_icd_loader.c])
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_HEADERS([config.h])
@@ -33,10 +33,18 @@ AM_PROG_CC_C_O
 AC_PATH_PROG([ASCIIDOC], [asciidoc], [])
 AC_PATH_PROG([A2X], [a2x], [])
 AC_PATH_PROG([XMLTO], [xmlto], [])
-AM_CONDITIONAL([GEN_DOC], [\
-	test x"$ASCIIDOC" != x && \
+AS_IF([	test x"$ASCIIDOC" != x && \
 	test x"$A2X" != x && \
-	test x"$XMLTO" != x ])
+	test x"$XMLTO" != x ],
+[
+  gen_doc=1
+  AC_MSG_NOTICE([generating documentation])
+],
+[
+  gen_doc=0
+  AC_MSG_NOTICE([documentation generation disabled])
+])
+AM_CONDITIONAL([GEN_DOC], [ test x"$gen_doc" = x1 ])
 
 # Checks for libraries.
 AC_CHECK_LIB([dl], [dlopen])
@@ -145,6 +153,23 @@ AC_ARG_ENABLE([update-database],
   [update_database=no])
 AM_CONDITIONAL([UPDATE_DATABASE], [test x"$update_database" != xno])
 
+# --enable-custom-vendordir
+AC_ARG_ENABLE([custom-vendordir],
+  [AS_HELP_STRING([--enable-custom-vendordir],
+                  [use the given directory instead of /etc/OpenCL/vendors to look for .icd files])],
+  [AS_CASE(["$enableval"],
+    [yes], [OCL_ICD_VENDORDIR="$sysconfdir/OpenCL/vendors"],
+    [no], [OCL_ICD_VENDORDIR='/etc/OpenCL/vendors'],
+    [OCL_ICD_VENDORDIR=$enableval])],
+  [OCL_ICD_VENDORDIR=/etc/OpenCL/vendors])
+AC_SUBST([OCL_ICD_VENDORDIR])
+
+AS_IF([test x"$OCL_ICD_VENDORDIR" = x"/etc/OpenCL/vendors" ], [
+  AC_MSG_NOTICE([using the official default vendors directory ($OCL_ICD_VENDORDIR)])
+], [
+  AC_MSG_NOTICE([using an unofficial custom default vendors directory ($OCL_ICD_VENDORDIR)])
+])
+
 # always use versionned symbols (check required for MacOSX)
 AM_CONDITIONAL([USE_MAP], [true])
 
diff --git a/doc/Makefile.am b/doc/Makefile.am
index fced778..536f511 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -4,9 +4,10 @@ MAN7 = libOpenCL.7 libOpenCL.so.7
 MAN_DOC = $(MAN7)
 
 MAN_TXT  = libOpenCL.7.txt
+MAN_TXT_IN  = libOpenCL.7.txt.in
 MAN_HTML = libOpenCL.html
 
-EXTRA_DIST = $(MAN_TXT)
+EXTRA_DIST = $(MAN_TXT_IN)
 
 if GEN_DOC
 htmldocdir=$(docdir)/html
@@ -14,10 +15,22 @@ htmldocdir=$(docdir)/html
 man_MANS = $(MAN_DOC)
 htmldoc_DATA = $(MAN_HTML)
 
-CLEANFILES = $(MAN_DOC) $(MAN_HTML)
+CLEANFILES = $(MAN_DOC) $(MAN_HTML) $(MAN_TXT)
 
 SUFFIXES=.html .7.txt .7
 
+libOpenCL.7.txt: libOpenCL.7.txt.in Makefile
+	$(AM_V_GEN)if [ "${OCL_ICD_VENDORDIR}" = '/etc/OpenCL/vendors' ]; then \
+		KEEP=OFFICIAL ; REMOVE=CUSTOM ; \
+	else \
+		KEEP=CUSTOM ; REMOVE=OFFICIAL ; \
+	fi && \
+	$(SED) \
+	    -e 's|[@]OCL_ICD_VENDORDIR@|@OCL_ICD_VENDORDIR@|g' \
+	    -e "/^@@$$REMOVE: /d" \
+	    -e "s/^@@$$KEEP: //" \
+	    < "$<" > "$@"
+
 .7.txt.html:
 	$(AM_V_GEN)$(ASCIIDOC) -d manpage -b xhtml11 -o$@ $<
 .7.txt.7:
@@ -27,4 +40,3 @@ SUFFIXES=.html .7.txt .7
 libOpenCL.so.7: libOpenCL.7
 	@: already create by a2x when generating libOpenCL.7
 endif
-
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 32bc3dd..eaba8d7 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -207,6 +207,7 @@ NMEDIT = @NMEDIT@
 NO_DEPRECATED_DECLARATIONS_FLAGS = @NO_DEPRECATED_DECLARATIONS_FLAGS@
 OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OCL_ICD_VENDORDIR = @OCL_ICD_VENDORDIR@
 OPENCL_VERSION = @OPENCL_VERSION@
 OTOOL = @OTOOL@
 OTOOL64 = @OTOOL64@
@@ -285,12 +286,13 @@ top_srcdir = @top_srcdir@
 MAN7 = libOpenCL.7 libOpenCL.so.7
 MAN_DOC = $(MAN7)
 MAN_TXT = libOpenCL.7.txt
+MAN_TXT_IN = libOpenCL.7.txt.in
 MAN_HTML = libOpenCL.html
-EXTRA_DIST = $(MAN_TXT)
+EXTRA_DIST = $(MAN_TXT_IN)
 @GEN_DOC_TRUE at htmldocdir = $(docdir)/html
 @GEN_DOC_TRUE at man_MANS = $(MAN_DOC)
 @GEN_DOC_TRUE at htmldoc_DATA = $(MAN_HTML)
- at GEN_DOC_TRUE@CLEANFILES = $(MAN_DOC) $(MAN_HTML)
+ at GEN_DOC_TRUE@CLEANFILES = $(MAN_DOC) $(MAN_HTML) $(MAN_TXT)
 @GEN_DOC_TRUE at SUFFIXES = .html .7.txt .7
 all: all-am
 
@@ -557,6 +559,18 @@ uninstall-man: uninstall-man7
 .PRECIOUS: Makefile
 
 
+ at GEN_DOC_TRUE@libOpenCL.7.txt: libOpenCL.7.txt.in Makefile
+ at GEN_DOC_TRUE@	$(AM_V_GEN)if [ "${OCL_ICD_VENDORDIR}" = '/etc/OpenCL/vendors' ]; then \
+ at GEN_DOC_TRUE@		KEEP=OFFICIAL ; REMOVE=CUSTOM ; \
+ at GEN_DOC_TRUE@	else \
+ at GEN_DOC_TRUE@		KEEP=CUSTOM ; REMOVE=OFFICIAL ; \
+ at GEN_DOC_TRUE@	fi && \
+ at GEN_DOC_TRUE@	$(SED) \
+ at GEN_DOC_TRUE@	    -e 's|[@]OCL_ICD_VENDORDIR@|@OCL_ICD_VENDORDIR@|g' \
+ at GEN_DOC_TRUE@	    -e "/^@@$$REMOVE: /d" \
+ at GEN_DOC_TRUE@	    -e "s/^@@$$KEEP: //" \
+ at GEN_DOC_TRUE@	    < "$<" > "$@"
+
 @GEN_DOC_TRUE at .7.txt.html:
 @GEN_DOC_TRUE@	$(AM_V_GEN)$(ASCIIDOC) -d manpage -b xhtml11 -o$@ $<
 @GEN_DOC_TRUE at .7.txt.7:
diff --git a/doc/libOpenCL.7.txt b/doc/libOpenCL.7.txt.in
similarity index 68%
rename from doc/libOpenCL.7.txt
rename to doc/libOpenCL.7.txt.in
index 21d2590..a335992 100644
--- a/doc/libOpenCL.7.txt
+++ b/doc/libOpenCL.7.txt.in
@@ -19,10 +19,17 @@ any OpenCL implementation itself, but merly act as a dispatcher to real OpenCL
 implementations provided as OpenCL Installable Client Driver (ICD).
 An ICD loader should be able to load ICDs provided by any vendors.
 
-According to OpenCL specifications from Khronos (see [Khronos]), the ICD Loader
-looks for files into '`/etc/OpenCL/vendors/`' directory and, for each file
-whose name ends with '`.icd`', the ICD Loader loads with **dlopen**(3) the
-shared library whose name is on the first line of the '`.icd`' file.
+
+@@OFFICIAL: According to OpenCL specifications from Khronos (see [Khronos]), the
+@@CUSTOM: The
+ICD Loader looks for files into '`@OCL_ICD_VENDORDIR@`' directory
+and, for each file whose name ends with '`.icd`', the ICD Loader loads
+with **dlopen**(3) the shared library whose name is on the first line
+of the '`.icd`' file.
+@@CUSTOM: According to OpenCL specifications from Khronos (see
+@@CUSTOM: [Khronos]), the default path for this purpose is
+@@CUSTOM: '`/etc/OpenCL/vendors`', but this OCL-ICD version has been
+@@CUSTOM: configurated otherwise.
 
 Each shared library name in ".icd" files can have its path, or it can be a plain
 filename. In the latter case, the ICD shared library will be looked for into the
@@ -34,7 +41,7 @@ Some environment variables can be used modify the default behavior of
 libOpenCL.
 
 *OPENCL_VENDOR_PATH*::
-This variable allows one to modify the defaut '`/etc/OpenCL/vendors/`' path.
+This variable allows one to modify the defaut '`@OCL_ICD_VENDORDIR@`' path.
 It is compatible with some other ICD loaders (but not all of them, as the
 variable is not part of the standard). Note that *$OCL_ICD_VENDORS* (see below)
 is used in priority if defined and not empty.
@@ -44,7 +51,7 @@ This variable allows one to change the way ICD are searched on the system.
 Several cases are considered:
 
 a. if *$OCL_ICD_VENDORS* is a directory path, then this path replaces the
-  "/etc/OpenCL/vendors" path in the standard behavior: the loader will use the
+  "@OCL_ICD_VENDORDIR@" path in the standard behavior: the loader will use the
   '`.icd`' files in this directory;
 b. else, if *$OCL_ICD_VENDORS* ends with '`.icd`', libOpenCL.so will only load
   the ICD whose shared library name is wrote into the specified ".icd"
@@ -52,7 +59,7 @@ b. else, if *$OCL_ICD_VENDORS* ends with '`.icd`', libOpenCL.so will only load
   +
   If there is no slashes into
   *$OCL_ICD_VENDORS*, libOpenCL.so will first try to use
-  '`/etc/OpenCL/vendors/`'*$OCL_ICD_VENDORS* (or
+  '`@OCL_ICD_VENDORDIR@`'*$OCL_ICD_VENDORS* (or
   *$OPENCL_VENDOR_PATH*'`/`'*$OCL_ICD_VENDORS* if *OPENCL_VENDOR_PATH* is
   defined).
   If this fail or if there are shashes, it uses *$OCL_ICD_VENDORS* (as a
@@ -61,10 +68,17 @@ c. else libOpenCL.so will try to load *$OCL_ICD_VENDORS* as the ICD shared
   library itself (i.e. to load it directly with **dlopen**(3)).
 
 *OCL_ICD_ASSUME_ICD_EXTENSION*::
-If set, contrary the Khronos specification, the loader will not check that
-the loaded ICDs declare the `cl_khr_icd` extension. You may need to define
-this environment variable if you are using the Intel ICD together with
-*optirun*(1). Else, a bug into the Intel ICD will make the application crash.
+If set to an non-empty value, contrary the Khronos specification, the
+loader will not check that the loaded ICDs declare the `cl_khr_icd`
+extension. It will also use the clGetPlatformInfo from the dispatch
+table if no such function is globally available. You may need to
+define this environment variable if you are using not (fully)
+compliant ICD, or if you are using the Intel ICD together with
+*optirun*(1). In the latter case, a bug into the Intel ICD will make
+the application crash.
+
+If set to the '`debug`' value, some additional messages will be
+printed in debug mode (see *OCL_ICD_DEBUG* below).
 
 *OCL_ICD_PLATFORM_SORT*::
 Allows one to choose the way platforms are sorted when presented to programs
@@ -99,4 +113,4 @@ development.
 
 SEE ALSO
 --------
-http://www.khronos.org/registry/cl/[Khronos OpenCL registry website]
+\\http://www.khronos.org/registry/cl/[Khronos OpenCL registry website]
diff --git a/ocl_icd_loader.c b/ocl_icd_loader.c
index 831f2a7..225e61d 100644
--- a/ocl_icd_loader.c
+++ b/ocl_icd_loader.c
@@ -49,8 +49,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #define DEBUG_OCL_ICD_PROVIDE_DUMP_FIELD
 #include "ocl_icd_debug.h"
 
-#define ETC_OPENCL_VENDORS "/etc/OpenCL/vendors"
-
 int debug_ocl_icd_mask=0;
 
 typedef __typeof__(clGetPlatformInfo) *clGetPlatformInfo_fn;
@@ -384,6 +382,27 @@ static void _sort_platforms(struct platform_icd *picds, int npicds) {
 	}
 }
 
+#define ASSUME_ICD_EXTENSION_UNKNOWN ((int)-1)
+#define ASSUME_ICD_EXTENSION_NO ((int)0)
+#define ASSUME_ICD_EXTENSION_YES ((int)1)
+#define ASSUME_ICD_EXTENSION_YES_AND_QUIET ((int)2)
+
+
+static int _assume_ICD_extension() {
+	static int val=ASSUME_ICD_EXTENSION_UNKNOWN;
+	if (val == ASSUME_ICD_EXTENSION_UNKNOWN) {
+		const char* str=getenv("OCL_ICD_ASSUME_ICD_EXTENSION");
+		if (! str || str[0]==0) {
+			val=ASSUME_ICD_EXTENSION_NO;
+		} else if (strcmp(str, "debug")==0) {
+			val=ASSUME_ICD_EXTENSION_YES;
+		} else {
+			val=ASSUME_ICD_EXTENSION_YES_AND_QUIET;
+		}
+	}
+	return val;
+}
+
 static inline void _find_and_check_platforms(cl_uint num_icds) {
   cl_uint i;
   _num_icds = 0;
@@ -400,9 +419,27 @@ static inline void _find_and_check_platforms(cl_uint num_icds) {
       debug(D_WARN, "Missing symbols in ICD, skipping it");
       continue;
     }
-    int plt_info_global_ptr_queried = 0;
-    clGetPlatformInfo_fn plt_info_global_ptr = NULL;
+    clGetPlatformInfo_fn plt_info_ptr =
       _get_function_addr(dlh, picd->ext_fn_ptr,	"clGetPlatformInfo");
+    if (plt_info_ptr == NULL) {
+	    switch (_assume_ICD_extension()) {
+	    case ASSUME_ICD_EXTENSION_NO:
+		    debug(D_WARN, "Missing 'clGetPlatformInfo' symbol in ICD, skipping it (use OCL_ICD_ASSUME_ICD_EXTENSION to ignore this check)");
+		    continue;
+	    case ASSUME_ICD_EXTENSION_YES:
+		    debug(D_LOG, "Missing 'clGetPlatformInfo' symbol in ICD, but still continuing due to OCL_ICD_ASSUME_ICD_EXTENSION");
+		    /* Fall through */
+	    case ASSUME_ICD_EXTENSION_YES_AND_QUIET:
+		    /* Assuming an ICD extension, so we will try to
+		     * find the ICD specific version of
+		     * clGetPlatformInfo before knowing for sure that
+		     * the cl_khr_icd is really present */
+		    break;
+	    default:
+		    debug(D_ALWAYS, "Internal error in _assume_ICD_extension, please report");
+		    break;
+	    }
+    }
     cl_uint num_platforms=0;
     cl_int error;
     error = (*plt_fn_ptr)(0, NULL, &num_platforms);
@@ -433,22 +470,15 @@ static inline void _find_and_check_platforms(cl_uint num_icds) {
       p->vicd=&_icds[i];
       p->pid=platforms[j];
 
-      /* By default, we try to use the plateform-specific
-       * clGetPlatformInfo (from the dispatch table).
-       * If missing, we fail back on the global one (if any)
+      /* If clGetPlatformInfo is not exported and we are here, it
+       * means that OCL_ICD_ASSUME_ICD_EXTENSION. Si we try to take it
+       * from the dispatch * table. If that fails too, we have to
+       * bail.
        */
-      clGetPlatformInfo_fn plt_info_ptr = p->pid->dispatch->clGetPlatformInfo;
-
       if (plt_info_ptr == NULL) {
-        if (! plt_info_global_ptr_queried) {
-          plt_info_global_ptr =
-            _get_function_addr(dlh, picd->ext_fn_ptr, "clGetPlatformInfo");
-            plt_info_global_ptr_queried = 1;
-        }
-        if (plt_info_global_ptr) {
-          plt_info_ptr = plt_info_global_ptr;
-        } else {
-          debug(D_WARN, "Missing clGetPlatformInfo in ICD, skipping it");
+        plt_info_ptr = p->pid->dispatch->clGetPlatformInfo;
+        if (plt_info_ptr == NULL) {
+          debug(D_WARN, "Missing clGetPlatformInfo even in ICD dispatch table, skipping it");
           continue;
         }
       }
@@ -462,11 +492,9 @@ static inline void _find_and_check_platforms(cl_uint num_icds) {
       }
 #endif
       {
-	      /* Allow to workaround a bug in the Intel ICD used
-	       * with optirun (search for NVidia Optimus for more info)
-	       */
-	      const char* str=getenv("OCL_ICD_ASSUME_ICD_EXTENSION");
-	      if (! str || str[0]==0) {
+	      switch (_assume_ICD_extension()) {
+	      case ASSUME_ICD_EXTENSION_NO:
+		      /* checking the extension as required by the specs */
 		      param_value=_malloc_clGetPlatformInfo(plt_info_ptr, p->pid, CL_PLATFORM_EXTENSIONS, "extensions");
 		      if (param_value == NULL){
 			      debug(D_WARN, "Skipping platform %i", j);
@@ -479,6 +507,24 @@ static inline void _find_and_check_platforms(cl_uint num_icds) {
 			      continue;
 		      }
 		      free(param_value);
+		      break;
+	      case ASSUME_ICD_EXTENSION_YES:
+		      /* Allow to workaround a bug in the Intel ICD used
+		       * with optirun :
+		       * - https://software.intel.com/en-us/forums/opencl/topic/328091
+		       * - https://sourceforge.net/p/virtualgl/bugs/54/
+		       */
+		      debug(D_LOG, "Assuming cl_khr_icd extension without checking for it");
+		      /* Fall through */
+	      case ASSUME_ICD_EXTENSION_YES_AND_QUIET:
+		      /* Assuming an ICD extension, so we will try to
+		       * find the ICD specific version of
+		       * clGetPlatformInfo before knowing for sure that
+		       * the cl_khr_icd is really present */
+		      break;
+	      default:
+		      debug(D_ALWAYS, "Internal error in _assume_ICD_extension, please report");
+		      break;
 	      }
       }
       param_value=_malloc_clGetPlatformInfo(plt_info_ptr, p->pid, CL_PLATFORM_ICD_SUFFIX_KHR, "suffix");
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 2161b11..3234fc2 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -174,6 +174,7 @@ NMEDIT = @NMEDIT@
 NO_DEPRECATED_DECLARATIONS_FLAGS = @NO_DEPRECATED_DECLARATIONS_FLAGS@
 OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OCL_ICD_VENDORDIR = @OCL_ICD_VENDORDIR@
 OPENCL_VERSION = @OPENCL_VERSION@
 OTOOL = @OTOOL@
 OTOOL64 = @OTOOL64@
diff --git a/tests/package.m4 b/tests/package.m4
index 8ca77d3..dbb9b3d 100644
--- a/tests/package.m4
+++ b/tests/package.m4
@@ -4,9 +4,9 @@ m4_define([AT_PACKAGE_NAME],
 m4_define([AT_PACKAGE_TARNAME],
   [ocl-icd])
 m4_define([AT_PACKAGE_VERSION],
-  [2.2.10])
+  [2.2.11])
 m4_define([AT_PACKAGE_STRING],
-  [OpenCL ICD Loader 2.2.10])
+  [OpenCL ICD Loader 2.2.11])
 m4_define([AT_PACKAGE_BUGREPORT],
   [ocl-icd-devel at lists.forge.imag.fr])
 m4_define([AT_PACKAGE_URL],
diff --git a/tests/testsuite b/tests/testsuite
index c168e72..91b6c6c 100755
--- a/tests/testsuite
+++ b/tests/testsuite
@@ -931,7 +931,7 @@ fi
 # List of tests.
 if $at_list_p; then
   cat <<_ATEOF || at_write_fail=1
-OpenCL ICD Loader 2.2.10 test suite test groups:
+OpenCL ICD Loader 2.2.11 test suite test groups:
 
  NUM: FILE-NAME:LINE     TEST-GROUP-NAME
       KEYWORDS
@@ -972,7 +972,7 @@ _ATEOF
   exit $at_write_fail
 fi
 if $at_version_p; then
-  $as_echo "$as_me (OpenCL ICD Loader 2.2.10)" &&
+  $as_echo "$as_me (OpenCL ICD Loader 2.2.11)" &&
   cat <<\_ATEOF || at_write_fail=1
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1158,11 +1158,11 @@ exec 5>>"$at_suite_log"
 
 # Banners and logs.
 $as_echo "## ------------------------------------ ##
-## OpenCL ICD Loader 2.2.10 test suite. ##
+## OpenCL ICD Loader 2.2.11 test suite. ##
 ## ------------------------------------ ##"
 {
   $as_echo "## ------------------------------------ ##
-## OpenCL ICD Loader 2.2.10 test suite. ##
+## OpenCL ICD Loader 2.2.11 test suite. ##
 ## ------------------------------------ ##"
   echo
 
@@ -2006,7 +2006,7 @@ _ASBOX
   $as_echo "Please send $at_msg and all information you think might help:
 
    To: <ocl-icd-devel at lists.forge.imag.fr>
-   Subject: [OpenCL ICD Loader 2.2.10] $as_me: $at_fail_list${at_fail_list:+ failed${at_xpass_list:+, }}$at_xpass_list${at_xpass_list:+ passed unexpectedly}
+   Subject: [OpenCL ICD Loader 2.2.11] $as_me: $at_fail_list${at_fail_list:+ failed${at_xpass_list:+, }}$at_xpass_list${at_xpass_list:+ passed unexpectedly}
 
 You may investigate any problem if you feel able to do so, in which
 case the test suite provides a good starting point.  Its output may
@@ -2755,7 +2755,7 @@ at_status=$? at_failed=false
 $at_check_filter
 at_fn_diff_devnull "$at_stderr" || at_failed=:
 echo >>"$at_stdout"; $as_echo "ocl_version: OpenCL 2.1
-version: 2.2.10
+version: 2.2.11
 name: OpenCL ICD Loader
 vendor: OCL Icd free software
 " | \

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/ocl-icd.git



More information about the Pkg-opencl-commits mailing list