[beignet] 08/12: Default to standard-compliant precision

Rebecca Palmer rnpalmer-guest at moszumanska.debian.org
Wed Mar 18 21:37:46 UTC 2015


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

rnpalmer-guest pushed a commit to branch master
in repository beignet.

commit 7290d6d72374b40e42e31a7392389964b64f1cc8
Author: Rebecca N. Palmer <rebecca_palmer at zoho.com>
Date:   Wed Mar 18 16:48:11 2015 +0000

    Default to standard-compliant precision
---
 debian/README.Debian                           | 14 +++++
 debian/changelog                               |  1 +
 debian/patches/Enable-test-debug.patch         |  2 +-
 debian/patches/default-to-full-precision.patch | 81 ++++++++++++++++++++++++++
 debian/patches/series                          |  1 +
 5 files changed, 98 insertions(+), 1 deletion(-)

diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644
index 0000000..ab09048
--- /dev/null
+++ b/debian/README.Debian
@@ -0,0 +1,14 @@
+Precision vs. Speed
+-------------------
+
+Debian's beignet 1.0.2+ (unlike the upstream version) defaults to
+OpenCL-standard-compliant precision, to avoid breaking applications written
+on other hardware that may assume this.
+
+This slows down some of the math functions as they cannot use the
+(lower-precision) native instructions: most only moderately (eg. ~30%
+for sin/cos) but ~10-fold for pow and rootn (though not pown or sqrt).
+Applications that prefer speed to precision may use the native_* functions.
+
+The tgamma function is implemented as exp(lgamma) and is hence
+precision non-compliant for large outputs.
diff --git a/debian/changelog b/debian/changelog
index 5ec3865..a6145ec 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,7 @@ beignet (1.0.2-1) UNRELEASED; urgency=medium
   * Give a single helpful error message, not many confusing ones,
     on unsupported hardware.
   * Fix crash if /dev/dri/card0 is inaccessible.
+  * Enable standard-compliant precision by default.
 
  -- Andreas Beckmann <anbe at debian.org>  Tue, 17 Mar 2015 23:29:43 +0100
 
diff --git a/debian/patches/Enable-test-debug.patch b/debian/patches/Enable-test-debug.patch
index d040c87..0619892 100644
--- a/debian/patches/Enable-test-debug.patch
+++ b/debian/patches/Enable-test-debug.patch
@@ -201,7 +201,7 @@ Author: Rebecca N. Palmer <rebecca_palmer at zoho.com>
  export OCL_GBE_PATH=@LOCAL_GBE_OBJECT_DIR@
  export OCL_INTERP_PATH=@LOCAL_INTERP_OBJECT_DIR@
 +obj-`dpkg-architecture -qDEB_HOST_MULTIARCH`/utests/utest_run -a
-+export OCL_STRICT_CONFORMANCE=1
++export OCL_STRICT_CONFORMANCE=0
 +obj-`dpkg-architecture -qDEB_HOST_MULTIARCH`/utests/utest_run -a
 --- a/utests/utest_generator.py
 +++ b/utests/utest_generator.py
diff --git a/debian/patches/default-to-full-precision.patch b/debian/patches/default-to-full-precision.patch
new file mode 100644
index 0000000..dfd1fb0
--- /dev/null
+++ b/debian/patches/default-to-full-precision.patch
@@ -0,0 +1,81 @@
+Description: Default to standard-compliant precision
+
+The OpenCL specification requires that any fast-but-imprecise mode
+be off by default: being too slow is usually more obvious than
+being too inaccurate.
+
+Author: Rebecca N. Palmer <rebecca_palmer at zoho.com>
+
+--- beignet-1.0.2.orig/backend/src/backend/program.cpp
++++ beignet-1.0.2/backend/src/backend/program.cpp
+@@ -113,7 +113,7 @@ namespace gbe {
+ 
+ #ifdef GBE_COMPILER_AVAILABLE
+   BVAR(OCL_OUTPUT_GEN_IR, false);
+-  BVAR(OCL_STRICT_CONFORMANCE, false);
++  BVAR(OCL_STRICT_CONFORMANCE, true);
+ 
+   bool Program::buildFromLLVMFile(const char *fileName, const void* module, std::string &error, int optLevel) {
+     ir::Unit *unit = new ir::Unit();
+--- beignet-1.0.2.orig/docs/Beignet.mdwn
++++ beignet-1.0.2/docs/Beignet.mdwn
+@@ -169,8 +169,10 @@ Known Issues
+ * Precision issue.
+   Currently Gen does not provide native support of high precision math functions
+   required by OpenCL. We provide a software version to achieve high precision,
+-  which you can turn on through `export OCL_STRICT_CONFORMANCE=1`.
+-  But be careful, this would make your CL kernel run a little longer.
++  controlled by the OCL_STRICT_CONFORMANCE environment variable. Default is
++  1 (high-precision) in Debian beignet but 0 (high-speed) in upstream beignet.
++
++  The native_* functions are always high-speed/low-precision.
+ 
+ * cl\_khr\_gl\_sharing.
+   This extension highly depends on mesa support. It seems that mesa would not provide
+--- beignet-1.0.2.orig/docs/Beignet/Backend.mdwn
++++ beignet-1.0.2/docs/Beignet/Backend.mdwn
+@@ -37,9 +37,8 @@ Environment variables are used all over
+   precision math instructions compliant with OpenCL Spec. So we provide a
+   software version to meet the high precision requirement. Obviously the
+   software version's performance is not as good as native version supported by
+-  GEN hardware. What's more, most graphics application don't need this high
+-  precision, so we choose 0 as the default value. So OpenCL apps do not suffer
+-  the performance penalty for using high precision math functions.
++  GEN hardware.  Default is 1 (high-precision) in Debian beignet but
++  0 (high-speed) in upstream beignet.
+ 
+ - `OCL_SIMD_WIDTH` `(8 or 16)`. Select the number of lanes per hardware thread,
+   Normally, you don't need to set it, we will select suitable simd width for
+--- beignet-1.0.2.orig/utests/builtin_pow.cpp
++++ beignet-1.0.2/utests/builtin_pow.cpp
+@@ -40,7 +40,7 @@ static void builtin_pow(void)
+ 
+   const char* env_strict = getenv("OCL_STRICT_CONFORMANCE");
+   float ULPSIZE_FACTOR = 16.0;
+-  if (env_strict == NULL || strcmp(env_strict, "0") == 0)
++  if (env_strict != NULL && strcmp(env_strict, "0") == 0)
+     ULPSIZE_FACTOR = 10000.;
+ 
+   OCL_CREATE_KERNEL("builtin_pow");
+--- beignet-1.0.2.orig/utests/builtin_tgamma.cpp
++++ beignet-1.0.2/utests/builtin_tgamma.cpp
+@@ -17,7 +17,7 @@ void builtin_tgamma(void)
+   locals[0] = 16;
+   const char* env_strict = getenv("OCL_STRICT_CONFORMANCE");
+   float ULPSIZE_FACTOR = 16.0;
+-  if (env_strict == NULL || strcmp(env_strict, "0") == 0)
++  if (env_strict != NULL && strcmp(env_strict, "0") == 0)
+     ULPSIZE_FACTOR = 10000.;
+ 
+   for (int j = 0; j < 1024; j ++) {
+--- beignet-1.0.2.orig/utests/utest_generator.py
++++ beignet-1.0.2/utests/utest_generator.py
+@@ -109,7 +109,7 @@ def udebug(ulpSize,returnType,function):
+ 
+     const char* env_strict = getenv("OCL_STRICT_CONFORMANCE");
+ 
+-    if (env_strict == NULL || strcmp(env_strict, "0") == 0)
++    if (env_strict != NULL && strcmp(env_strict, "0") == 0)
+       ULPSIZE_FACTOR = 1000;
+     else
+       ULPSIZE_FACTOR = %s;
diff --git a/debian/patches/series b/debian/patches/series
index 97860fc..308c69a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,3 +6,4 @@ force-llvm-3.5.patch
 support-kfreebsd.patch
 reduce-notfound-output.patch
 fail-gracefully-no-hardware.patch
+default-to-full-precision.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/beignet.git



More information about the Pkg-opencl-commits mailing list