[Beignet] [PATCH] [PATCH]enable icc compiler

Lv Meng meng.lv at intel.com
Thu Jul 31 18:27:54 PDT 2014


Signed-off-by: Lv Meng <meng.lv at intel.com>
---
 CMakeLists.txt                             | 32 +++++++++++---
 backend/CMakeLists.txt                     | 67 +-----------------------------
 backend/src/backend/gen_context.hpp        |  4 +-
 backend/src/backend/gen_program.cpp        |  2 +-
 backend/src/backend/gen_program.hpp        |  2 +-
 backend/src/backend/gen_reg_allocation.cpp |  2 +-
 backend/src/backend/program.hpp            |  2 +-
 backend/src/ir/function.hpp                |  2 +-
 backend/src/ir/image.cpp                   |  5 +--
 backend/src/ir/image.hpp                   |  4 +-
 backend/src/ir/instruction.cpp             | 20 ++++-----
 backend/src/ir/instruction.hpp             | 11 ++---
 backend/src/ir/register.hpp                |  2 +-
 backend/src/llvm/llvm_to_gen.cpp           |  5 ++-
 backend/src/sys/alloc.hpp                  |  3 +-
 src/cl_api.c                               |  8 ++--
 src/cl_mem.h                               |  1 +
 utests/utest_generator.py                  |  2 +-
 utests/utest_helper.cpp                    |  4 +-
 utests/utest_helper.hpp                    |  4 +-
 20 files changed, 73 insertions(+), 109 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 969c9de..67f1b3b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,16 @@
 #          Copyright (C) 2009 Intel Corporation. All Rights Reserved.       #
 #############################################################################
 
+# compiler choose,now support ICC,GCC compiler
+set (COMPILER "ICC" CACHE INT "Compiler to choose on Linux (GCC,ICC)")
+if (COMPILER STREQUAL "GCC")
+elseif (COMPILER STREQUAL "ICC")
+  find_program(CMAKE_C_COMPILER NAMES icc)
+  find_program(CMAKE_CXX_COMPILER NAMES icpc)
+  find_program(CMAKE_AR NAMES xiar)
+  find_program(CMAKE_LINKER NAMES xild)
+endif ()
+
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
 PROJECT(OCL)
 set (LIBCL_DRIVER_VERSION_MAJOR 0)
@@ -41,9 +51,23 @@ if (NOT CMAKE_BUILD_TYPE)
 endif (NOT CMAKE_BUILD_TYPE)
 set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "assure config" FORCE)
 message(STATUS "Building mode: " ${CMAKE_BUILD_TYPE})
-
-SET(CMAKE_CXX_FLAGS_DEBUGO0 "-O0 -g")
-SET(CMAKE_C_FLAGS_DEBUGO0 "-O0 -g")
+# compiler flag setting
+if (COMPILER STREQUAL "GCC")
+  set (CMAKE_C_CXX_FLAGS "${CMAKE_C_CXX_FLAGS} -funroll-loops -fstrict-aliasing -msse2 -msse3 -mssse3 -msse4.1 -fPIC -Wall -mfpmath=sse -Wcast-align -Wl,-E")
+elseif (COMPILER STREQUAL "ICC")
+  set (CMAKE_C_CXX_FLAGS "${CMAKE_C_CXX_FLAGS}  -wd2928 -Wall -fPIC -fstrict-aliasing -fp-model fast -msse4.1 -Wl,-E")
+endif ()
+set (CMAKE_CXX_FLAGS "${CMAKE_C_CXX_FLAGS} -std=c++0x -Wno-invalid-offsetof -fno-rtti")
+set (CMAKE_C_FLAGS "${CMAKE_C_CXX_FLAGS}")
+set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${LLVM_LFLAGS}")
+set (CMAKE_CXX_FLAGS_DEBUG          "-O0 -g -DGBE_DEBUG=1")
+set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DGBE_DEBUG=1")
+set (CMAKE_CXX_FLAGS_MINSIZEREL     "-Os -DNDEBUG -DGBE_DEBUG=0")
+set (CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG -DGBE_DEBUG=0")
+set (CMAKE_C_FLAGS_DEBUG          "-O0 -g -DGBE_DEBUG=1")
+set (CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -DGBE_DEBUG=1")
+set (CMAKE_C_FLAGS_MINSIZEREL     "-Os -DNDEBUG -DGBE_DEBUG=0")
+set (CMAKE_C_FLAGS_RELEASE        "-O2 -DNDEBUG -DGBE_DEBUG=0")
 
 IF (EMULATE_HSW)
   SET (USE_FULSIM "true")
@@ -68,8 +92,6 @@ ELSE (USE_FULSIM)
   ADD_DEFINITIONS(-DUSE_FULSIM=0)
 ENDIF (USE_FULSIM)
 
-SET(CMAKE_CXX_FLAGS "-Wall -Wno-invalid-offsetof -mfpmath=sse -fno-rtti -Wcast-align -std=c++0x -msse2 -msse3 -mssse3 -msse4.1 ${CMAKE_CXX_FLAGS}")
-SET(CMAKE_C_FLAGS "-Wall -mfpmath=sse -msse2 -Wcast-align -msse2 -msse3 -mssse3 -msse4.1 ${CMAKE_C_FLAGS}")
 
 # Front end stuff we need
 #INCLUDE(CMake/FindLLVM.cmake)
diff --git a/backend/CMakeLists.txt b/backend/CMakeLists.txt
index ca674cf..e19f92d 100644
--- a/backend/CMakeLists.txt
+++ b/backend/CMakeLists.txt
@@ -13,12 +13,6 @@ set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${GBE_CMAKE_DIR}")
 set (GBE_DEBUG_MEMORY false CACHE bool "Activate the memory debugger")
 set (GBE_USE_BLOB false CACHE bool "Compile everything from one big file")
 
-##############################################################
-# Compiler
-##############################################################
-if (UNIX)
-  set (COMPILER "GCC" CACHE INT "Compiler to choose on Linux (GCC,ICC,CLANG)")
-endif (UNIX)
 
 # Force Release with debug info
 if (NOT CMAKE_BUILD_TYPE)
@@ -34,65 +28,8 @@ else (GBE_DEBUG_MEMORY)
 endif (GBE_DEBUG_MEMORY)
 
 # Hide all symbols and allows the symbols declared as visible to be exported
-set (CMAKE_C_CXX_FLAGS "-fvisibility=hidden ${CMAKE_C_CXX_FLAGS}")
-
-set (CMAKE_C_CXX_FLAGS -DGBE_COMPILER_AVAILABLE=1)
-
-if (COMPILER STREQUAL "GCC")
-  set (CMAKE_C_CXX_FLAGS "${CMAKE_C_CXX_FLAGS} -funroll-loops -Wstrict-aliasing=2 -fstrict-aliasing -msse2 -msse3 -mssse3 -msse4.1 -fPIC -Wall")
-  set (CMAKE_C_CXX_FLAGS "${CMAKE_C_CXX_FLAGS}  ${LLVM_CFLAGS}")
-  set (CMAKE_CXX_FLAGS "${CMAKE_C_CXX_FLAGS}  -Wno-invalid-offsetof -fno-rtti -std=c++0x")
-  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GBE_DEBUG_MEMORY_FLAG}")
-  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GBE_COMPILE_UTESTS_FLAG}")
-  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-E")
-  set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${LLVM_LFLAGS}")
-  set (CMAKE_CXX_FLAGS_DEBUG          "-g -DGBE_DEBUG=1")
-  set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DGBE_DEBUG=1")
-  set (CMAKE_CXX_FLAGS_MINSIZEREL     "-Os -DNDEBUG -DGBE_DEBUG=0")
-  set (CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG -DGBE_DEBUG=0")
-  set (CMAKE_C_FLAGS "${CMAKE_C_CXX_FLAGS}")
-  set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GBE_DEBUG_MEMORY_FLAG}")
-  set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GBE_COMPILE_UTESTS_FLAG}")
-  set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-E")
-  set (CMAKE_C_FLAGS_DEBUG          "-g -DGBE_DEBUG=1")
-  set (CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -DGBE_DEBUG=1")
-  set (CMAKE_C_FLAGS_MINSIZEREL     "-Os -DNDEBUG -DGBE_DEBUG=0")
-  set (CMAKE_C_FLAGS_RELEASE        "-O2 -DNDEBUG -DGBE_DEBUG=0")
-elseif (COMPILER STREQUAL "CLANG")
-  set (CMAKE_C_COMPILER             "clang")
-  set (CMAKE_C_FLAGS                "-Wall -std=c99")
-  set (CMAKE_C_FLAGS_DEBUG          "-g -DGBE_DEBUG=1")
-  set (CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -DGBE_DEBUG=1")
-  set (CMAKE_C_FLAGS_MINSIZEREL     "-Os -DNDEBUG -DGBE_DEBUG=0")
-  set (CMAKE_C_FLAGS_RELEASE        "-O2 -DNDEBUG -DGBE_DEBUG=0")
-  set (CMAKE_CXX_COMPILER             "clang++")
-  set (CMAKE_CXX_FLAGS "-fstrict-aliasing -msse2 -fPIC -Wall -Wno-format-security -Wno-invalid-offsetof -std=c++0x")
-  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GBE_DEBUG_MEMORY_FLAG}")
-  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GBE_COMPILE_UTESTS_FLAG}")
-  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VISIBILITY_FLAG}")
-  set (CMAKE_CXX_FLAGS_DEBUG          "-g -DGBE_DEBUG=1")
-  set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DGBE_DEBUG=1")
-  set (CMAKE_CXX_FLAGS_MINSIZEREL     "-Os -DNDEBUG -DGBE_DEBUG=0")
-  set (CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG -DGBE_DEBUG=0")
-  set (CMAKE_AR      "/usr/bin/llvm-ar")
-  set (CMAKE_LINKER  "/usr/bin/llvm-ld")
-  set (CMAKE_NM      "/usr/bin/llvm-nm")
-  set (CMAKE_OBJDUMP "/usr/bin/llvm-objdump")
-  set (CMAKE_RANLIB  "ranlib")
-elseif (COMPILER STREQUAL "ICC")
-  set (CMAKE_CXX_COMPILER "icpc")
-  set (CMAKE_C_COMPILER "icc")
-  set (CMAKE_CXX_FLAGS "-std=c++0x -wd2928 -Wall -fPIC -fstrict-aliasing -fp-model fast -xSSE2")
-  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GBE_DEBUG_MEMORY_FLAG}")
-  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GBE_COMPILE_UTESTS_FLAG}")
-  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VISIBILITY_FLAG} -Wl,-E")
-  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GBE_DEBUG_MODE_FLAG}")
-  set (CMAKE_CXX_FLAGS_DEBUG "-g -O0 -DGBE_DEBUG=1")
-  set (CCMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O2 -DGBE_DEBUG=1")
-  set (CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O2 -DGBE_DEBUG=0")
-  set (CCMAKE_CXX_FLAGS_MINSIZEREL "-Os -DGBE_DEBUG=0")
-  set (CMAKE_EXE_LINKER_FLAGS "")
-endif ()
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLVM_CFLAGS} ${GBE_DEBUG_MEMORY_FLAG} ${GBE_COMPILE_UTESTS_FLAG} -DGBE_COMPILER_AVAILABLE=1 -fvisibility=hidden")
+set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LLVM_CFLAGS} ${GBE_DEBUG_MEMORY_FLAG} ${GBE_COMPILE_UTESTS_FLAG} -DGBE_COMPILER_AVAILABLE=1")
 
 include_directories (${CMAKE_CURRENT_BINARY_DIR})
 ##############################################################
diff --git a/backend/src/backend/gen_context.hpp b/backend/src/backend/gen_context.hpp
index 02c83d0..f2a3b93 100644
--- a/backend/src/backend/gen_context.hpp
+++ b/backend/src/backend/gen_context.hpp
@@ -192,9 +192,9 @@ namespace gbe
     uint32_t reservedSpillRegs;
     bool limitRegisterPressure;
     bool relaxMath;
-    const bool getIFENDIFFix(void) const { return ifEndifFix; }
+    bool getIFENDIFFix(void) const { return ifEndifFix; }
     void setIFENDIFFix(bool fix) { ifEndifFix = fix; }
-    const CompileErrorCode getErrCode() { return errCode; }
+    CompileErrorCode getErrCode() { return errCode; }
 
   protected:
     virtual GenEncoder* generateEncoder(void) {
diff --git a/backend/src/backend/gen_program.cpp b/backend/src/backend/gen_program.cpp
index 3e16fd6..ce43fd0 100644
--- a/backend/src/backend/gen_program.cpp
+++ b/backend/src/backend/gen_program.cpp
@@ -74,7 +74,7 @@ namespace gbe {
   {}
   GenKernel::~GenKernel(void) { GBE_SAFE_DELETE_ARRAY(insns); }
   const char *GenKernel::getCode(void) const { return (const char*) insns; }
-  const void GenKernel::setCode(const char * ins, size_t size) {
+  void GenKernel::setCode(const char * ins, size_t size) {
     insns = (GenInstruction *)ins;
     insnNum = size / sizeof(GenInstruction);
   }
diff --git a/backend/src/backend/gen_program.hpp b/backend/src/backend/gen_program.hpp
index 1b5136e..8e8989b 100644
--- a/backend/src/backend/gen_program.hpp
+++ b/backend/src/backend/gen_program.hpp
@@ -44,7 +44,7 @@ namespace gbe
     /*! Implements base class */
     virtual const char *getCode(void) const;
     /*! Set the instruction stream (to be implemented) */
-    virtual const void setCode(const char *, size_t size);
+    virtual void setCode(const char *, size_t size);
     /*! Implements get the code size */
     virtual size_t getCodeSize(void) const;
     /*! Implements printStatus*/
diff --git a/backend/src/backend/gen_reg_allocation.cpp b/backend/src/backend/gen_reg_allocation.cpp
index b7fbc93..3d59077 100644
--- a/backend/src/backend/gen_reg_allocation.cpp
+++ b/backend/src/backend/gen_reg_allocation.cpp
@@ -60,7 +60,7 @@ namespace gbe
     const ir::Register getReg() const {
       return (ir::Register)(key & 0xFFFF);
     }
-    const int32_t getMaxID() const {
+    int32_t getMaxID() const {
       return key >> 16;
     }
     uint64_t key;
diff --git a/backend/src/backend/program.hpp b/backend/src/backend/program.hpp
index b780c42..2e3b953 100644
--- a/backend/src/backend/program.hpp
+++ b/backend/src/backend/program.hpp
@@ -80,7 +80,7 @@ namespace gbe {
     /*! Return the instruction stream (to be implemented) */
     virtual const char *getCode(void) const = 0;
     /*! Set the instruction stream.*/
-    virtual const void setCode(const char *, size_t size) = 0;
+    virtual void setCode(const char *, size_t size) = 0;
     /*! Return the instruction stream size (to be implemented) */
     virtual size_t getCodeSize(void) const = 0;
     /*! Get the kernel name */
diff --git a/backend/src/ir/function.hpp b/backend/src/ir/function.hpp
index 2710b17..cad7868 100644
--- a/backend/src/ir/function.hpp
+++ b/backend/src/ir/function.hpp
@@ -406,7 +406,7 @@ namespace ir {
     /*! Get required work group size. */
     const size_t *getCompileWorkGroupSize(void) const {return compileWgSize;}
     /*! Get stack size. */
-    INLINE const uint32_t getStackSize(void) const { return this->stackSize; }
+    INLINE uint32_t getStackSize(void) const { return this->stackSize; }
     /*! Push stack size. */
     INLINE void pushStackSize(uint32_t step) { this->stackSize += step; }
     /*! add the loop info for later liveness analysis */
diff --git a/backend/src/ir/image.cpp b/backend/src/ir/image.cpp
index ee80a3d..03104ac 100644
--- a/backend/src/ir/image.cpp
+++ b/backend/src/ir/image.cpp
@@ -76,8 +76,7 @@ namespace ir {
       imageInfo->channelOrderSlot = -1;
     }
   }
-
-  const int32_t ImageSet::getInfoOffset(ImageInfoKey key) const
+  int32_t ImageSet::getInfoOffset(ImageInfoKey key) const
   {
     auto it = indexMap.find(key.index);
     if (it == indexMap.end())
@@ -86,7 +85,7 @@ namespace ir {
     return getInfoOffset4Type(imageInfo, key.type);
   }
 
-  const uint32_t ImageSet::getIdx(const Register imageReg) const
+  uint32_t ImageSet::getIdx(const Register imageReg) const
   {
     auto it = regMap.find(imageReg);
     GBE_ASSERT(it != regMap.end());
diff --git a/backend/src/ir/image.hpp b/backend/src/ir/image.hpp
index 82fee56..00005a6 100644
--- a/backend/src/ir/image.hpp
+++ b/backend/src/ir/image.hpp
@@ -52,11 +52,11 @@ namespace ir {
     /*! clear image info. */
     void clearInfo();
     /*! Get the image's index(actual location). */
-    const uint32_t getIdx(const Register imageReg) const;
+    uint32_t getIdx(const Register imageReg) const;
     size_t getDataSize(void) { return regMap.size(); }
     size_t getDataSize(void) const { return regMap.size(); }
 
-    const int32_t getInfoOffset(ImageInfoKey key) const;
+    int32_t getInfoOffset(ImageInfoKey key) const;
     void getData(struct ImageInfo *imageInfos) const;
     void operator = (const ImageSet& other) {
       regMap.insert(other.regMap.begin(), other.regMap.end());
diff --git a/backend/src/ir/instruction.cpp b/backend/src/ir/instruction.cpp
index 3006893..5c50521 100644
--- a/backend/src/ir/instruction.cpp
+++ b/backend/src/ir/instruction.cpp
@@ -519,11 +519,11 @@ namespace ir {
       Tuple src;
       Tuple dst;
 
-      INLINE const uint8_t getImageIndex(void) const { return this->imageIdx; }
+      INLINE uint8_t getImageIndex(void) const { return this->imageIdx; }
       INLINE Type getSrcType(void) const { return this->srcIsFloat ? TYPE_FLOAT : TYPE_S32; }
       INLINE Type getDstType(void) const { return this->dstIsFloat ? TYPE_FLOAT : TYPE_U32; }
-      INLINE const uint8_t getSamplerIndex(void) const { return this->samplerIdx; }
-      INLINE const uint8_t getSamplerOffset(void) const { return this->samplerOffset; }
+      INLINE uint8_t getSamplerIndex(void) const { return this->samplerIdx; }
+      INLINE uint8_t getSamplerOffset(void) const { return this->samplerOffset; }
       uint8_t srcIsFloat:1;
       uint8_t dstIsFloat:1;
       uint8_t samplerIdx:4;
@@ -566,7 +566,7 @@ namespace ir {
       uint8_t coordType;
       uint8_t imageIdx;
 
-      INLINE const uint8_t getImageIndex(void) const { return this->imageIdx; }
+      INLINE uint8_t getImageIndex(void) const { return this->imageIdx; }
       INLINE Type getSrcType(void) const { return (Type)this->srcType; }
       INLINE Type getCoordType(void) const { return (Type)this->coordType; }
       // bti, u, v, w, 4 data elements
@@ -602,7 +602,7 @@ namespace ir {
             << " info reg %" << this->getSrc(fn, 0);
       }
 
-      INLINE const uint8_t getImageIndex(void) const { return imageIdx; }
+      INLINE uint8_t getImageIndex(void) const { return imageIdx; }
 
       uint8_t infoType;                 //!< Type of the requested information.
       uint8_t imageIdx;                //!< surface index.
@@ -1443,14 +1443,14 @@ DECL_MEM_FN(BranchInstruction, LabelIndex, getLabelIndex(void), getLabelIndex())
 DECL_MEM_FN(SyncInstruction, uint32_t, getParameters(void), getParameters())
 DECL_MEM_FN(SampleInstruction, Type, getSrcType(void), getSrcType())
 DECL_MEM_FN(SampleInstruction, Type, getDstType(void), getDstType())
-DECL_MEM_FN(SampleInstruction, const uint8_t, getSamplerIndex(void), getSamplerIndex())
-DECL_MEM_FN(SampleInstruction, const uint8_t, getSamplerOffset(void), getSamplerOffset())
-DECL_MEM_FN(SampleInstruction, const uint8_t, getImageIndex(void), getImageIndex())
+DECL_MEM_FN(SampleInstruction, uint8_t, getSamplerIndex(void), getSamplerIndex())
+DECL_MEM_FN(SampleInstruction, uint8_t, getSamplerOffset(void), getSamplerOffset())
+DECL_MEM_FN(SampleInstruction, uint8_t, getImageIndex(void), getImageIndex())
 DECL_MEM_FN(TypedWriteInstruction, Type, getSrcType(void), getSrcType())
 DECL_MEM_FN(TypedWriteInstruction, Type, getCoordType(void), getCoordType())
-DECL_MEM_FN(TypedWriteInstruction, const uint8_t, getImageIndex(void), getImageIndex())
+DECL_MEM_FN(TypedWriteInstruction, uint8_t, getImageIndex(void), getImageIndex())
 DECL_MEM_FN(GetImageInfoInstruction, uint32_t, getInfoType(void), getInfoType())
-DECL_MEM_FN(GetImageInfoInstruction, const uint8_t, getImageIndex(void), getImageIndex())
+DECL_MEM_FN(GetImageInfoInstruction, uint8_t, getImageIndex(void), getImageIndex())
 
 #undef DECL_MEM_FN
 
diff --git a/backend/src/ir/instruction.hpp b/backend/src/ir/instruction.hpp
index ada780f..1a54ab9 100644
--- a/backend/src/ir/instruction.hpp
+++ b/backend/src/ir/instruction.hpp
@@ -128,6 +128,7 @@ namespace ir {
       InstructionBase(reinterpret_cast<const char*>(&other.opcode)) {
       parent = other.parent;
     }
+
   private:
     /*! To be consistant with copy constructor */
     INLINE Instruction &operator= (const Instruction &other) { return *this; }
@@ -352,7 +353,7 @@ namespace ir {
   public:
     /*! Return true if the given instruction is an instance of this class */
     static bool isClassOf(const Instruction &insn);
-    const uint8_t getImageIndex() const;
+    uint8_t getImageIndex() const;
     Type getSrcType(void) const;
     Type getCoordType(void) const;
   };
@@ -360,9 +361,9 @@ namespace ir {
   /*! Load texels from a texture */
   class SampleInstruction : public Instruction {
   public:
-    const uint8_t getImageIndex() const;
-    const uint8_t getSamplerIndex(void) const;
-    const uint8_t getSamplerOffset(void) const;
+    uint8_t getImageIndex() const;
+    uint8_t getSamplerIndex(void) const;
+    uint8_t getSamplerOffset(void) const;
     Type getSrcType(void) const;
     Type getDstType(void) const;
     /*! Return true if the given instruction is an instance of this class */
@@ -404,7 +405,7 @@ namespace ir {
      return 0;
    }
 
-    const uint8_t getImageIndex() const;
+    uint8_t getImageIndex() const;
     uint32_t getInfoType() const;
     /*! Return true if the given instruction is an instance of this class */
     static bool isClassOf(const Instruction &insn);
diff --git a/backend/src/ir/register.hpp b/backend/src/ir/register.hpp
index 7bd4f6e..5995ba5 100644
--- a/backend/src/ir/register.hpp
+++ b/backend/src/ir/register.hpp
@@ -83,7 +83,7 @@ namespace ir {
     /*! Nothing really happens here */
     INLINE ~RegisterData(void) {}
     RegisterFamily family;            //!< Register size or if it is a flag
-    INLINE const bool isUniform() const { return uniform; }
+    INLINE bool isUniform() const { return uniform; }
     INLINE void setUniform(bool uni) { uniform = uni; }
   private:
     bool uniform;
diff --git a/backend/src/llvm/llvm_to_gen.cpp b/backend/src/llvm/llvm_to_gen.cpp
index 3527491..805b23e 100644
--- a/backend/src/llvm/llvm_to_gen.cpp
+++ b/backend/src/llvm/llvm_to_gen.cpp
@@ -186,7 +186,10 @@ namespace gbe
 
     // Get the module from its file
     llvm::SMDiagnostic Err;
-    std::auto_ptr<Module> M;
+	//In C++0x std::auto_ptr will be deprecated in favor of std::unique_ptr
+    //std::auto_ptr<Module> M;
+    std::unique_ptr<Module> M;
+
     if(fileName){
       // only when module is null, Get the global LLVM context
       llvm::LLVMContext& c = llvm::getGlobalContext();
diff --git a/backend/src/sys/alloc.hpp b/backend/src/sys/alloc.hpp
index 8fcb3a7..7189d8b 100644
--- a/backend/src/sys/alloc.hpp
+++ b/backend/src/sys/alloc.hpp
@@ -79,7 +79,8 @@ public: \
   void* operator new(size_t size, void *p) { return p; } \
   void* operator new[](size_t size, void *p) { return p; } \
   void  operator delete(void* ptr) { return gbe::alignedFree(ptr); } \
-  void  operator delete[](void* ptr) { return gbe::alignedFree(ptr); }
+  void  operator delete[](void* ptr) { return gbe::alignedFree(ptr); } \
+  void  operator delete(void* ptr,void *p) { }
 
 /*! Macros to handle allocation position */
 #define GBE_NEW(T,...) \
diff --git a/src/cl_api.c b/src/cl_api.c
index 177a7e8..d74df40 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -90,10 +90,10 @@ handle_events(cl_command_queue queue, cl_int num, const cl_event *wait_list,
 }
 
 /* The following code checking overlap is from Appendix of openCL spec 1.1 */
-inline cl_bool check_copy_overlap(const size_t src_offset[3],
-                                  const size_t dst_offset[3],
-                                  const size_t region[3],
-                                  size_t row_pitch, size_t slice_pitch)
+cl_bool check_copy_overlap(const size_t src_offset[3],
+                           const size_t dst_offset[3],
+                           const size_t region[3],
+                           size_t row_pitch, size_t slice_pitch)
 {
   const size_t src_min[] = {src_offset[0], src_offset[1], src_offset[2]};
   const size_t src_max[] = {src_offset[0] + region[0],
diff --git a/src/cl_mem.h b/src/cl_mem.h
index 4477240..57f38f1 100644
--- a/src/cl_mem.h
+++ b/src/cl_mem.h
@@ -25,6 +25,7 @@
 #include "CL/cl.h"
 #include "cl_khr_icd.h"
 #include <assert.h>
+#include <pthread.h>
 
 #ifndef CL_VERSION_1_2
 #define CL_MEM_OBJECT_IMAGE1D                       0x10F4
diff --git a/utests/utest_generator.py b/utests/utest_generator.py
index 7522001..5da2752 100644
--- a/utests/utest_generator.py
+++ b/utests/utest_generator.py
@@ -135,7 +135,7 @@ which can print more values and information to assist debuging the issue.
 
 #include "utest_helper.hpp"
 #include <stdio.h>
-#include <math.h>
+#include <cmath>
 #include <algorithm>
 #include <string.h>
 
diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp
index cb4dd66..90cd11e 100644
--- a/utests/utest_helper.cpp
+++ b/utests/utest_helper.cpp
@@ -655,7 +655,7 @@ int cl_check_image(const int *img, int w, int h, const char *bmp)
   return (float(discrepancy) / float(n) > max_error_ratio) ? 0 : 1;
 }
 
-const float cl_FLT_ULP(float float_number)
+float cl_FLT_ULP(float float_number)
 {
   SF floatBin, ulpBin, ulpBinBase;
   floatBin.f = float_number;
@@ -668,7 +668,7 @@ const float cl_FLT_ULP(float float_number)
   return ulpBin.f - ulpBinBase.f;
 }
 
-const int cl_INT_ULP(int int_number)
+int cl_INT_ULP(int int_number)
 {
   return 0;
 }
diff --git a/utests/utest_helper.hpp b/utests/utest_helper.hpp
index de4d277..a434fb4 100644
--- a/utests/utest_helper.hpp
+++ b/utests/utest_helper.hpp
@@ -225,10 +225,10 @@ extern void cl_write_bmp(const int *data, int width, int height, const char *fil
 extern int cl_check_image(const int *img, int w, int h, const char *bmp);
 
 /* Calculator ULP of each FLOAT value */
-extern const float cl_FLT_ULP(float float_number);
+extern float cl_FLT_ULP(float float_number);
 
 /* Calculator ULP of each INT value */
-extern const int cl_INT_ULP(int int_number);
+extern int cl_INT_ULP(int int_number);
 
 #endif /* __UTEST_HELPER_HPP__ */
 
-- 
1.8.3.2



More information about the Beignet mailing list