From 31c1c7847314e2bb371dd927bee1f0a49103360c Mon Sep 17 00:00:00 2001 From: Zhigang Gong Date: Sat, 29 Dec 2012 20:42:07 +0800 Subject: [PATCH] Insert ocl_common_defines to the cl source file. Remove the duplicate definitions in the ocl_stdlib.h. As we may need to refer these two macros, we put it to the ocl_common_defins.h which could be included by host application. The two macros are as below: Signed-off-by: Zhigang Gong Reviewed-by: Lu Guanqun --- backend/src/backend/program.cpp | 2 ++ backend/src/ocl_stdlib.h | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp index 0378de7..3597a0a 100644 --- a/backend/src/backend/program.cpp +++ b/backend/src/backend/program.cpp @@ -98,6 +98,7 @@ namespace gbe { } extern std::string ocl_stdlib_str; + extern std::string ocl_common_defines_str; static gbe_program programNewFromSource(const char *source, size_t stringSize, const char *options, @@ -111,6 +112,7 @@ namespace gbe { // Write the source to the cl file FILE *clFile = fopen(clName.c_str(), "w"); FATAL_IF(clFile == NULL, "Failed to open temporary file"); + fwrite(ocl_common_defines_str.c_str(), strlen(ocl_common_defines_str.c_str()), 1, clFile); fwrite(ocl_stdlib_str.c_str(), strlen(ocl_stdlib_str.c_str()), 1, clFile); fwrite(source, strlen(source), 1, clFile); fclose(clFile); diff --git a/backend/src/ocl_stdlib.h b/backend/src/ocl_stdlib.h index 32ed118..ea63830 100644 --- a/backend/src/ocl_stdlib.h +++ b/backend/src/ocl_stdlib.h @@ -615,10 +615,6 @@ DECL_VECTOR_1OP(__gen_ocl_internal_log, float); DECL_VECTOR_1OP(__gen_ocl_internal_log2, float); DECL_VECTOR_1OP(__gen_ocl_internal_log10, float); #undef DECL_VECTOR_1OP -// Synchronization, explicit memory fence -///////////////////////////////////////////////////////////////////////////// -#define CLK_LOCAL_MEM_FENCE 1 -#define CLK_GLOBAL_MEM_FENCE 2 ///////////////////////////////////////////////////////////////////////////// // Arithmetic functions ///////////////////////////////////////////////////////////////////////////// -- 2.7.4