[Beignet] [PATCH 2/2] GBE: Update program binary format.

Ruiling Song ruiling.song at intel.com
Thu Oct 10 00:13:51 PDT 2013


1. Remove useless 'reg' field of constant.
2. Add slmSize for local variables defined in kernel function.

Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
 backend/src/backend/program.cpp |    3 +++
 backend/src/ir/constant.cpp     |    9 ++-------
 backend/src/ir/constant.hpp     |    8 ++------
 3 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
index 24029c7..b81644b 100644
--- a/backend/src/backend/program.cpp
+++ b/backend/src/backend/program.cpp
@@ -245,6 +245,7 @@ namespace gbe {
     OUT_UPDATE_SZ(simdWidth);
     OUT_UPDATE_SZ(stackSize);
     OUT_UPDATE_SZ(useSLM);
+    OUT_UPDATE_SZ(slmSize);
 
     /* samplers. */
     if (samplerSet) {
@@ -332,6 +333,7 @@ namespace gbe {
     IN_UPDATE_SZ(simdWidth);
     IN_UPDATE_SZ(stackSize);
     IN_UPDATE_SZ(useSLM);
+    IN_UPDATE_SZ(slmSize);
 
     IN_UPDATE_SZ(has_samplerset);
     if (has_samplerset) {
@@ -407,6 +409,7 @@ namespace gbe {
     outs << spaces_nl << "  simdWidth: " << simdWidth << "\n";
     outs << spaces_nl << "  stackSize: " << stackSize << "\n";
     outs << spaces_nl << "  useSLM: " << useSLM << "\n";
+    outs << spaces_nl << "  slmSize: " << slmSize << "\n";
 
     outs << spaces_nl << "  Argument Number is " << argNum << "\n";
     for (uint32_t i = 0; i < argNum; i++) {
diff --git a/backend/src/ir/constant.cpp b/backend/src/ir/constant.cpp
index 7a8f80f..a38d392 100644
--- a/backend/src/ir/constant.cpp
+++ b/backend/src/ir/constant.cpp
@@ -61,8 +61,7 @@ namespace ir {
                      + cnst.getName().size()*sizeof(char) //name
                      + sizeof(cnst.getSize())             //size
                      + sizeof(cnst.getAlignment())        //alignment
-                     + sizeof(cnst.getOffset())	          //offset
-                     + sizeof(cnst.getReg());             //reg
+                     + sizeof(cnst.getOffset());	        //offset
       OUT_UPDATE_SZ(bytes);
 
       OUT_UPDATE_SZ(cnst.getName().size());
@@ -71,7 +70,6 @@ namespace ir {
       OUT_UPDATE_SZ(cnst.getSize());
       OUT_UPDATE_SZ(cnst.getAlignment());
       OUT_UPDATE_SZ(cnst.getOffset());
-      OUT_UPDATE_SZ(cnst.getReg());
     }
 
     OUT_UPDATE_SZ(magic_end);
@@ -111,21 +109,18 @@ namespace ir {
       c_name[name_len] = 0;
 
       uint32_t size, align, offset;
-      uint16_t reg;
       IN_UPDATE_SZ(size);
       IN_UPDATE_SZ(align);
       IN_UPDATE_SZ(offset);
-      IN_UPDATE_SZ(reg);
 
       ir::Constant constant(c_name, size, align, offset);
-      constant.setReg(reg);
       constants.push_back(constant);
 
       delete[] c_name;
 
       /* Saint check */
       if (bytes != sizeof(name_len) + sizeof(char)*name_len + sizeof(size)
-              + sizeof(align) + sizeof(offset) + sizeof(reg))
+              + sizeof(align) + sizeof(offset))
         return 0;
     }
 
diff --git a/backend/src/ir/constant.hpp b/backend/src/ir/constant.hpp
index 4bb549e..70d09aa 100644
--- a/backend/src/ir/constant.hpp
+++ b/backend/src/ir/constant.hpp
@@ -36,17 +36,16 @@ namespace ir {
   public:
     /*! Build a constant description */
     INLINE Constant(const std::string &name, uint32_t size, uint32_t alignment, uint32_t offset) :
-      name(name), size(size), alignment(alignment), offset(offset), reg(0) {}
+      name(name), size(size), alignment(alignment), offset(offset) {}
     /*! Copy constructor */
     INLINE Constant(const Constant &other) :
-      name(other.name), size(other.size), alignment(other.alignment), offset(other.offset), reg(other.reg) {}
+      name(other.name), size(other.size), alignment(other.alignment), offset(other.offset) {}
     /*! Copy operator */
     INLINE Constant& operator= (const Constant &other) {
       this->name = other.name;
       this->size = other.size;
       this->alignment = other.alignment;
       this->offset = other.offset;
-      this->reg = other.reg;
       return *this;
     }
     /*! Nothing happens here */
@@ -55,14 +54,11 @@ namespace ir {
     uint32_t getSize (void) const { return size; }
     uint32_t getAlignment (void) const { return alignment; }
     uint32_t getOffset(void) const { return offset; }
-    uint16_t getReg(void) const { return reg; }
-    void setReg(uint16_t reg) { this->reg = reg; }
   private:
     std::string name; //!< Optional name of the constant
     uint32_t size;      //!< Size of the constant
     uint32_t alignment; //!< Alignment required for each constant
     uint32_t offset;    //!< Offset of the constant in the data segment
-    uint16_t reg; //!< Virtual register number
     GBE_CLASS(Constant);
   };
 
-- 
1.7.9.5



More information about the Beignet mailing list