[Beignet] [PATCH] Runtime: because double's built-ins haven't completely support, so disable it by default.

Yang Rong rong.r.yang at intel.com
Tue Dec 22 00:36:32 PST 2015


Add a cmake option for it, cmake with option -DEXPERIMENTAL_DOUBLE=true to enable it.
---
 CMakeLists.txt     |  6 ++++++
 src/cl_device_id.c | 21 +++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8762f7c..97725ca 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -219,11 +219,17 @@ ENDIF(OCLIcd_FOUND)
 
 Find_Package(PythonInterp)
 
+OPTION(EXPERIMENTAL_DOUBLE "Enable experimental double support" OFF)
+IF(EXPERIMENTAL_DOUBLE)
+  ADD_DEFINITIONS(-DENABLE_FP64)
+ENDIF(EXPERIMENTAL_DOUBLE)
+
 OPTION(BUILD_EXAMPLES "Build examples" OFF)
 IF(BUILD_EXAMPLES)
 IF(NOT X11_FOUND)
   MESSAGE(FATAL_ERROR "XLib is necessary for examples - not found")
 ENDIF(NOT X11_FOUND)
+
 # libva & libva-x11
 #pkg_check_modules(LIBVA REQUIRED libva>=0.36.0)
 pkg_check_modules(LIBVA REQUIRED libva)
diff --git a/src/cl_device_id.c b/src/cl_device_id.c
index a98523f..c01e3d4 100644
--- a/src/cl_device_id.c
+++ b/src/cl_device_id.c
@@ -418,7 +418,9 @@ brw_gt1_break:
       intel_brw_gt1_device.platform = cl_get_platform_default();
       ret = &intel_brw_gt1_device;
       cl_intel_platform_get_default_extension(ret);
+#ifdef ENABLE_FP64
       cl_intel_platform_enable_extension(ret, cl_khr_fp64_ext_id);
+#endif
       cl_intel_platform_enable_extension(ret, cl_khr_fp16_ext_id);
       break;
 
@@ -437,7 +439,9 @@ brw_gt2_break:
       intel_brw_gt2_device.platform = cl_get_platform_default();
       ret = &intel_brw_gt2_device;
       cl_intel_platform_get_default_extension(ret);
+#ifdef ENABLE_FP64
       cl_intel_platform_enable_extension(ret, cl_khr_fp64_ext_id);
+#endif
       cl_intel_platform_enable_extension(ret, cl_khr_fp16_ext_id);
       break;
 
@@ -458,7 +462,9 @@ brw_gt3_break:
       intel_brw_gt3_device.platform = cl_get_platform_default();
       ret = &intel_brw_gt3_device;
       cl_intel_platform_get_default_extension(ret);
+#ifdef ENABLE_FP64
       cl_intel_platform_enable_extension(ret, cl_khr_fp64_ext_id);
+#endif
       cl_intel_platform_enable_extension(ret, cl_khr_fp16_ext_id);
       break;
 
@@ -472,6 +478,9 @@ chv_break:
       intel_chv_device.platform = cl_get_platform_default();
       ret = &intel_chv_device;
       cl_intel_platform_get_default_extension(ret);
+#ifdef ENABLE_FP64
+      cl_intel_platform_enable_extension(ret, cl_khr_fp64_ext_id);
+#endif
       cl_intel_platform_enable_extension(ret, cl_khr_fp16_ext_id);
       break;
 
@@ -490,6 +499,9 @@ skl_gt1_break:
       intel_skl_gt1_device.device_id = device_id;
       intel_skl_gt1_device.platform = cl_get_platform_default();
       ret = &intel_skl_gt1_device;
+#ifdef ENABLE_FP64
+      cl_intel_platform_enable_extension(ret, cl_khr_fp64_ext_id);
+#endif
       cl_intel_platform_get_default_extension(ret);
       cl_intel_platform_enable_extension(ret, cl_khr_fp16_ext_id);
       break;
@@ -510,6 +522,9 @@ skl_gt2_break:
       intel_skl_gt2_device.device_id = device_id;
       intel_skl_gt2_device.platform = cl_get_platform_default();
       ret = &intel_skl_gt2_device;
+#ifdef ENABLE_FP64
+      cl_intel_platform_enable_extension(ret, cl_khr_fp64_ext_id);
+#endif
       cl_intel_platform_get_default_extension(ret);
       cl_intel_platform_enable_extension(ret, cl_khr_fp16_ext_id);
       break;
@@ -525,6 +540,9 @@ skl_gt3_break:
       intel_skl_gt3_device.platform = cl_get_platform_default();
       ret = &intel_skl_gt3_device;
       cl_intel_platform_get_default_extension(ret);
+#ifdef ENABLE_FP64
+      cl_intel_platform_enable_extension(ret, cl_khr_fp64_ext_id);
+#endif
       cl_intel_platform_enable_extension(ret, cl_khr_fp16_ext_id);
       break;
 
@@ -536,6 +554,9 @@ skl_gt4_break:
       intel_skl_gt4_device.device_id = device_id;
       intel_skl_gt4_device.platform = cl_get_platform_default();
       ret = &intel_skl_gt4_device;
+#ifdef ENABLE_FP64
+      cl_intel_platform_enable_extension(ret, cl_khr_fp64_ext_id);
+#endif
       cl_intel_platform_get_default_extension(ret);
       cl_intel_platform_enable_extension(ret, cl_khr_fp16_ext_id);
       break;
-- 
2.1.4



More information about the Beignet mailing list