[Beignet] [PATCH 2/3] GBE: increase maximum src/dst operands to 32.

Zhigang Gong zhigang.gong at intel.com
Tue Oct 21 06:17:37 PDT 2014


As we may bitcast a <16 * i64> to/from <32 * i32> due to
the legalize pass, we have to increase the maximum operands
number to 32 and fix some assertions accordingly.

Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
 backend/src/backend/gen_insn_selection.cpp |  2 +-
 backend/src/ir/instruction.cpp             |  2 +-
 backend/src/ir/instruction.hpp             |  4 ++--
 backend/src/llvm/llvm_scalarize.cpp        | 10 +++++-----
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp
index 5ca363a..e7e301b 100644
--- a/backend/src/backend/gen_insn_selection.cpp
+++ b/backend/src/backend/gen_insn_selection.cpp
@@ -245,7 +245,7 @@ namespace gbe
   public:
     INLINE SelectionDAG(const ir::Instruction &insn) :
       insn(insn), mergeable(0), childNum(insn.getSrcNum()), isRoot(0) {
-      GBE_ASSERT(insn.getSrcNum() < 127);
+      GBE_ASSERT(insn.getSrcNum() <= ir::Instruction::MAX_SRC_NUM);
       for (uint32_t childID = 0; childID < childNum; ++childID)
         this->child[childID] = NULL;
       computeBool = false;
diff --git a/backend/src/ir/instruction.cpp b/backend/src/ir/instruction.cpp
index 6c37f29..4e9bf63 100644
--- a/backend/src/ir/instruction.cpp
+++ b/backend/src/ir/instruction.cpp
@@ -261,7 +261,7 @@ namespace ir {
         this->src = src;
         this->dstFamily = getFamily(dstType);
         this->srcFamily = getFamily(srcType);
-        GBE_ASSERT(srcNum <= 16 && dstNum <= 16);
+        GBE_ASSERT(srcNum <= Instruction::MAX_SRC_NUM && dstNum <= Instruction::MAX_DST_NUM);
         this->dstNum = dstNum;
         this->srcNum = srcNum;
       }
diff --git a/backend/src/ir/instruction.hpp b/backend/src/ir/instruction.hpp
index 1c31171..fd79a44 100644
--- a/backend/src/ir/instruction.hpp
+++ b/backend/src/ir/instruction.hpp
@@ -189,8 +189,8 @@ namespace ir {
       return T::isClassOf(*this);
     }
     /*! max_src for store instruction (vec16 + addr) */
-    static const uint32_t MAX_SRC_NUM = 17;
-    static const uint32_t MAX_DST_NUM = 16;
+    static const uint32_t MAX_SRC_NUM = 32;
+    static const uint32_t MAX_DST_NUM = 32;
   protected:
     BasicBlock *parent;      //!< The basic block containing the instruction
     GBE_CLASS(Instruction);  //!< Use internal allocators
diff --git a/backend/src/llvm/llvm_scalarize.cpp b/backend/src/llvm/llvm_scalarize.cpp
index 3e48fbf..66ccf24 100644
--- a/backend/src/llvm/llvm_scalarize.cpp
+++ b/backend/src/llvm/llvm_scalarize.cpp
@@ -106,18 +106,18 @@ namespace gbe {
 
     void setComponent(int c, llvm::Value* val)
     {
-      assert(c >= 0 && c < 16 && "Out of bounds component");
+      assert(c >= 0 && c < 32 && "Out of bounds component");
       vals[c] = val;
     }
     llvm::Value* getComponent(int c)
     {
-      assert(c >= 0 && c < 16 && "Out of bounds component");
+      assert(c >= 0 && c < 32 && "Out of bounds component");
       assert(vals[c] && "Requesting non-existing component");
       return vals[c];
     }
 
     // {Value* x, Value* y, Value* z, Value* w}
-    llvm::Value* vals[16];
+    llvm::Value* vals[32];
   };
 
   class Scalarize : public FunctionPass {
@@ -441,7 +441,7 @@ namespace gbe {
 
   void Scalarize::makeScalarizedCalls(Function* f, ArrayRef<Value*> args, int count, VectorValues& vVals)
   {
-    assert(count > 0 && count <= 16 && "invalid number of vector components");
+    assert(count > 0 && count <= 32 && "invalid number of vector components");
     for (int i = 0; i < count; ++i) {
       Value* res;
       SmallVector<Value*, 8> callArgs(args.begin(), args.end());
@@ -455,7 +455,7 @@ namespace gbe {
   void Scalarize::makePerComponentScalarizedCalls(Instruction* inst, ArrayRef<Value*> args)
   {
     int count = GetComponentCount(inst);
-    assert(count > 0 && count <= 16 && "invalid number of vector components");
+    assert(count > 0 && count <= 32 && "invalid number of vector components");
     assert((inst->getNumOperands() == args.size() || isa<PHINode>(inst))
            && "not enough arguments passed for instruction");
 
-- 
1.8.3.2



More information about the Beignet mailing list