[Beignet] [PATCH] GBE: remove the user defined macro cl_khr_fp64.

Zhigang Gong zhigang.gong at intel.com
Wed Sep 3 21:32:18 PDT 2014


This is not a predefined macro according to the spec. Let's not
define it by default. This patch also disable the fp64 when enter
user kernels.

Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
 backend/src/backend/program.cpp        | 2 --
 backend/src/libocl/CMakeLists.txt      | 2 +-
 backend/src/libocl/include/ocl.h       | 3 +++
 backend/src/libocl/include/ocl_types.h | 4 ----
 4 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
index 42cd989..98e8a34 100644
--- a/backend/src/backend/program.cpp
+++ b/backend/src/backend/program.cpp
@@ -516,8 +516,6 @@ namespace gbe {
     }
 
     args.push_back("-cl-kernel-arg-info");
-    args.push_back("-Dcl_khr_fp64");
-
     args.push_back("-mllvm");
     args.push_back("-inline-threshold=200000");
 #ifdef GEN7_SAMPLER_CLAMP_BORDER_WORKAROUND
diff --git a/backend/src/libocl/CMakeLists.txt b/backend/src/libocl/CMakeLists.txt
index d4e3a53..fb93da1 100644
--- a/backend/src/libocl/CMakeLists.txt
+++ b/backend/src/libocl/CMakeLists.txt
@@ -129,7 +129,7 @@ FOREACH(M ${OCL_BASH_GENERATED_MODULES})
 ENDFOREACH(M) 
 
 
-SET (CLANG_OCL_FLAGS -fno-builtin -Dcl_khr_fp64 -ffp-contract=off -cl-kernel-arg-info -DGEN7_SAMPLER_CLAMP_BORDER_WORKAROUND)
+SET (CLANG_OCL_FLAGS -fno-builtin -ffp-contract=off -cl-kernel-arg-info -DGEN7_SAMPLER_CLAMP_BORDER_WORKAROUND)
 
 MACRO(ADD_CL_TO_BC_TARGET _file)
     # CMake seems can not add pattern rule, use MACRO to replace.
diff --git a/backend/src/libocl/include/ocl.h b/backend/src/libocl/include/ocl.h
index a7d03e6..a6c3b24 100644
--- a/backend/src/libocl/include/ocl.h
+++ b/backend/src/libocl/include/ocl.h
@@ -1,6 +1,7 @@
 #ifndef __OCL_H__
 #define __OCL_H__
 
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
 #include "ocl_defines.h"
 #include "ocl_types.h"
 #include "ocl_as.h"
@@ -19,5 +20,7 @@
 #include "ocl_sync.h"
 #include "ocl_vload.h"
 #include "ocl_workitem.h"
+#pragma OPENCL EXTENSION cl_khr_fp64 : disable
+
 
 #endif
diff --git a/backend/src/libocl/include/ocl_types.h b/backend/src/libocl/include/ocl_types.h
index 05a2dae..dde3993 100644
--- a/backend/src/libocl/include/ocl_types.h
+++ b/backend/src/libocl/include/ocl_types.h
@@ -1,10 +1,6 @@
 #ifndef __OCL_TYPES_H__
 #define __OCL_TYPES_H__
 
-#ifdef cl_khr_fp64
-#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-#endif
-
 #include "ocl_defines.h"
 
 #define NULL ((void*)0)
-- 
1.8.3.2



More information about the Beignet mailing list