GBE: remove the useless get sampler info function.
authorZhigang Gong <zhigang.gong@intel.com>
Fri, 21 Feb 2014 05:09:20 +0000 (13:09 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Mon, 24 Feb 2014 06:58:34 +0000 (14:58 +0800)
We don't need to get the sampler info dynamically, so
remove the corresponding instruction.

Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
12 files changed:
backend/src/backend/context.cpp
backend/src/backend/gen_insn_selection.cpp
backend/src/backend/program.h
backend/src/ir/instruction.cpp
backend/src/ir/instruction.hpp
backend/src/ir/instruction.hxx
backend/src/ir/profile.cpp
backend/src/ir/profile.hpp
backend/src/llvm/llvm_gen_backend.cpp
backend/src/llvm/llvm_gen_ocl_function.hxx
backend/src/ocl_stdlib.tmpl.h
src/cl_command_queue_gen7.c

index 2125bd1..51a0628 100644 (file)
@@ -30,7 +30,6 @@
 #include "ir/liveness.hpp"
 #include "ir/value.hpp"
 #include "ir/image.hpp"
-#include "ir/sampler.hpp"
 #include "sys/cvar.hpp"
 #include <algorithm>
 
@@ -435,9 +434,9 @@ namespace gbe
 
     // We insert the block IP mask first
     this->insertCurbeReg(ir::ocl::blockip, this->newCurbeEntry(GBE_CURBE_BLOCK_IP, 0, this->simdWidth*sizeof(uint16_t)));
-    this->insertCurbeReg(ir::ocl::emask, this->newCurbeEntry(GBE_CURBE_EMASK, 0,  sizeof(uint32_t)));
-    this->insertCurbeReg(ir::ocl::notemask, this->newCurbeEntry(GBE_CURBE_NOT_EMASK, 0, sizeof(uint32_t)));
-    this->insertCurbeReg(ir::ocl::barriermask, this->newCurbeEntry(GBE_CURBE_BARRIER_MASK, 0, sizeof(uint32_t)));
+    this->insertCurbeReg(ir::ocl::emask, this->newCurbeEntry(GBE_CURBE_EMASK, 0,  sizeof(uint16_t)));
+    this->insertCurbeReg(ir::ocl::notemask, this->newCurbeEntry(GBE_CURBE_NOT_EMASK, 0, sizeof(uint16_t)));
+    this->insertCurbeReg(ir::ocl::barriermask, this->newCurbeEntry(GBE_CURBE_BARRIER_MASK, 0, sizeof(uint16_t)));
 
     // Go over the arguments and find the related patch locations
     const uint32_t argNum = fn.argNum();
@@ -484,12 +483,6 @@ namespace gbe
             insertCurbeReg(imageInfo, offset);
           }
           continue;
-        } else if (insn.getOpcode() == ir::OP_GET_SAMPLER_INFO) {
-          /* change the src to sampler information register. */
-          GBE_ASSERT(insn.getSrc(0) == ir::ocl::samplerinfo);
-          if (curbeRegs.find(insn.getSrc(0)) == curbeRegs.end())
-            insertCurbeReg(insn.getSrc(0), this->newCurbeEntry(GBE_CURBE_SAMPLER_INFO, 0, 32));
-          continue;
         }
         if (fn.isSpecialReg(reg) == false) continue;
         if (curbeRegs.find(reg) != curbeRegs.end()) continue;
index fc8f1b1..d5d86de 100644 (file)
@@ -3126,22 +3126,6 @@ namespace gbe
     DECL_CTOR(GetImageInfoInstruction, 1, 1);
   };
 
-  /*! get sampler info instruction pattern. */
-  DECL_PATTERN(GetSamplerInfoInstruction)
-  {
-    INLINE bool emitOne(Selection::Opaque &sel, const ir::GetSamplerInfoInstruction &insn) const
-    {
-      using namespace ir;
-      GenRegister dst, src;
-      dst = sel.selReg(insn.getDst(0), TYPE_U16);
-      src = GenRegister::offset(GenRegister::uw1grf(insn.getSrc(0)), 0, insn.getSamplerIndex() * 2);
-      src.subphysical = 1;
-      sel.MOV(dst, src);
-      return true;
-    }
-    DECL_CTOR(GetSamplerInfoInstruction, 1, 1);
-  };
-
   /*! Branch instruction pattern */
   DECL_PATTERN(BranchInstruction)
   {
@@ -3365,7 +3349,6 @@ namespace gbe
     this->insert<SelectModifierInstructionPattern>();
     this->insert<SampleInstructionPattern>();
     this->insert<GetImageInfoInstructionPattern>();
-    this->insert<GetSamplerInfoInstructionPattern>();
 
     // Sort all the patterns with the number of instructions they output
     for (uint32_t op = 0; op < ir::OP_INVALID; ++op)
index e6436c3..5f308ad 100644 (file)
@@ -70,7 +70,6 @@ enum gbe_curbe_type {
   GBE_CURBE_GROUP_NUM_Y,
   GBE_CURBE_GROUP_NUM_Z,
   GBE_CURBE_WORK_DIM,
-  GBE_CURBE_SAMPLER_INFO,
   GBE_CURBE_IMAGE_INFO,
   GBE_CURBE_STACK_POINTER,
   GBE_CURBE_KERNEL_ARGUMENT,
index 95bcff5..2d2b34b 100644 (file)
@@ -581,39 +581,6 @@ namespace ir {
       Register dst[0];               //!< No dest register
     };
 
-    class ALIGNED_INSTRUCTION GetSamplerInfoInstruction :
-      public BasePolicy,
-      public NSrcPolicy<GetSamplerInfoInstruction, 1>,
-      public NDstPolicy<GetSamplerInfoInstruction, 1>
-    {
-    public:
-      GetSamplerInfoInstruction( Register dst,
-                                 Register samplerInfo,
-                                 uint8_t samplerIdx)
-      {
-        this->opcode = OP_GET_SAMPLER_INFO;
-        this->dst[0] = dst;
-        this->src[0] = samplerInfo;
-        this->samplerIdx = samplerIdx;
-      }
-
-      INLINE bool wellFormed(const Function &fn, std::string &why) const;
-      INLINE void out(std::ostream &out, const Function &fn) const {
-        this->outOpcode(out);
-        out  << " %" << this->getDst(fn, 0)
-             << " %" << this->getSrc(fn, 0)
-             << " sampler idx " << (int)this->samplerIdx;
-      }
-      INLINE const uint8_t getSamplerIndex() const {
-        return this->samplerIdx;
-      }
-
-      Register src[1];                  //!< sampler to get info
-      Register dst[1];                  //!< return value
-      uint8_t samplerIdx;               //!< sampler slot index.
-      static const uint32_t dstNum = 1;
-    };
-
     class ALIGNED_INSTRUCTION GetImageInfoInstruction :
       public BasePolicy,
       public NSrcPolicy<GetImageInfoInstruction, 1>,
@@ -1007,8 +974,6 @@ namespace ir {
     { return true; }
     INLINE bool GetImageInfoInstruction::wellFormed(const Function &fn, std::string &why) const
     { return true; }
-    INLINE bool GetSamplerInfoInstruction::wellFormed(const Function &fn, std::string &why) const
-    { return true; }
 
 
     // Ensure that types and register family match
@@ -1288,10 +1253,6 @@ START_INTROSPECTION(GetImageInfoInstruction)
 #include "ir/instruction.hxx"
 END_INTROSPECTION(GetImageInfoInstruction)
 
-START_INTROSPECTION(GetSamplerInfoInstruction)
-#include "ir/instruction.hxx"
-END_INTROSPECTION(GetSamplerInfoInstruction)
-
 START_INTROSPECTION(LoadImmInstruction)
 #include "ir/instruction.hxx"
 END_INTROSPECTION(LoadImmInstruction)
@@ -1500,7 +1461,6 @@ DECL_MEM_FN(TypedWriteInstruction, const uint8_t, getImageIndex(void), getImageI
 DECL_MEM_FN(TypedWriteInstruction, const bool, is3D(void), is3D())
 DECL_MEM_FN(GetImageInfoInstruction, uint32_t, getInfoType(void), getInfoType())
 DECL_MEM_FN(GetImageInfoInstruction, const uint8_t, getImageIndex(void), getImageIndex())
-DECL_MEM_FN(GetSamplerInfoInstruction, const uint8_t, getSamplerIndex(void), getSamplerIndex())
 
 #undef DECL_MEM_FN
 
@@ -1690,10 +1650,6 @@ DECL_MEM_FN(GetSamplerInfoInstruction, const uint8_t, getSamplerIndex(void), get
     return internal::GetImageInfoInstruction(infoType, dst, imageIndex, infoReg).convert();
   }
 
-  Instruction GET_SAMPLER_INFO(Register dst, Register samplerInfo, uint8_t samplerIdx) {
-    return internal::GetSamplerInfoInstruction(dst, samplerInfo, samplerIdx).convert();
-  }
-
   std::ostream &operator<< (std::ostream &out, const Instruction &insn) {
     const Function &fn = insn.getFunction();
     switch (insn.getOpcode()) {
index 8e2cd11..f9f5e68 100644 (file)
@@ -411,15 +411,6 @@ namespace ir {
     static bool isClassOf(const Instruction &insn);
   };
 
-  /*! Get image information */
-  class GetSamplerInfoInstruction : public Instruction {
-  public:
-
-    const uint8_t getSamplerIndex(void) const;
-    /*! Return true if the given instruction is an instance of this class */
-    static bool isClassOf(const Instruction &insn);
-  };
-
   /*! Branch instruction is the unified way to branch (with or without
    *  predicate)
    */
@@ -671,8 +662,6 @@ namespace ir {
   Instruction SAMPLE(uint8_t imageIndex, Tuple dst, Tuple src, bool dstIsFloat, bool srcIsFloat, uint8_t sampler, uint8_t samplerOffset, bool is3D);
   /*! get image information , such as width/height/depth/... */
   Instruction GET_IMAGE_INFO(int infoType, Register dst, uint8_t imageIndex, Register infoReg);
-  /*! get sampler information  */
-  Instruction GET_SAMPLER_INFO(Register dst, Register samplerInfo, uint8_t index);
   /*! label labelIndex */
   Instruction LABEL(LabelIndex labelIndex);
 
index bb5229a..bebceff 100644 (file)
@@ -78,7 +78,6 @@ DECL_INSN(SAMPLE, SampleInstruction)
 DECL_INSN(SYNC, SyncInstruction)
 DECL_INSN(LABEL, LabelInstruction)
 DECL_INSN(GET_IMAGE_INFO, GetImageInfoInstruction)
-DECL_INSN(GET_SAMPLER_INFO, GetSamplerInfoInstruction)
 DECL_INSN(MUL_HI, BinaryInstruction)
 DECL_INSN(I64_MUL_HI, BinaryInstruction)
 DECL_INSN(FBH, UnaryInstruction)
index ef3ea28..708bc4d 100644 (file)
@@ -40,7 +40,7 @@ namespace ir {
         "stack_pointer",
         "block_ip",
         "barrier_id", "thread_number",
-        "work_dimension", "sampler_info",
+        "work_dimension",
         "emask", "notemask", "barriermask", "retVal"
     };
 
@@ -77,7 +77,6 @@ namespace ir {
       DECL_NEW_REG(FAMILY_DWORD, barrierid);
       DECL_NEW_REG(FAMILY_DWORD, threadn);
       DECL_NEW_REG(FAMILY_DWORD, workdim);
-      DECL_NEW_REG(FAMILY_WORD, samplerinfo);
       DECL_NEW_REG(FAMILY_WORD, emask);
       DECL_NEW_REG(FAMILY_WORD, notemask);
       DECL_NEW_REG(FAMILY_WORD, barriermask);
index d84c48a..cda5edf 100644 (file)
@@ -64,12 +64,11 @@ namespace ir {
     static const Register barrierid = Register(20);// barrierid
     static const Register threadn = Register(21);  // number of threads
     static const Register workdim = Register(22);  // work dimention.
-    static const Register samplerinfo = Register(23); // store sampler info.
-    static const Register emask = Register(24);    // store the emask bits for the branching fix.
-    static const Register notemask = Register(25); // store the !emask bits for the branching fix.
-    static const Register barriermask = Register(26); // software mask for barrier.
-    static const Register retVal = Register(27);   // helper register to do data flow analysis.
-    static const uint32_t regNum = 28;             // number of special registers
+    static const Register emask = Register(23);    // store the emask bits for the branching fix.
+    static const Register notemask = Register(24); // store the !emask bits for the branching fix.
+    static const Register barriermask = Register(25); // software mask for barrier.
+    static const Register retVal = Register(26);   // helper register to do data flow analysis.
+    static const uint32_t regNum = 27;             // number of special registers
     extern const char *specialRegMean[];           // special register name.
   } /* namespace ocl */
 
index 77aee20..4d6b0c7 100644 (file)
@@ -2056,7 +2056,6 @@ namespace gbe
       case GEN_OCL_GET_IMAGE_CHANNEL_DATA_TYPE:
       case GEN_OCL_GET_IMAGE_CHANNEL_ORDER:
       case GEN_OCL_GET_IMAGE_DEPTH:
-      case GEN_OCL_GET_SAMPLER_INFO:
       case GEN_OCL_ATOMIC_ADD0:
       case GEN_OCL_ATOMIC_ADD1:
       case GEN_OCL_ATOMIC_SUB0:
@@ -2365,14 +2364,6 @@ namespace gbe
             ctx.GET_IMAGE_INFO(infoType, reg, surfaceID, infoReg);
             break;
           }
-          case GEN_OCL_GET_SAMPLER_INFO:
-          {
-            GBE_ASSERT(AI != AE);
-            const uint8_t index = this->appendSampler(AI); ++AI;
-            const ir::Register reg = this->getRegister(&I, 0);
-            ctx.GET_SAMPLER_INFO(reg, ir::ocl::samplerinfo, index);
-            break;
-          }
           case GEN_OCL_READ_IMAGE_I:
           case GEN_OCL_READ_IMAGE_UI:
           case GEN_OCL_READ_IMAGE_F:
index 750344a..00d69f0 100644 (file)
@@ -134,9 +134,6 @@ DECL_LLVM_GEN_FUNCTION(UPSAMPLE_SHORT, _Z18__gen_ocl_upsampless)
 DECL_LLVM_GEN_FUNCTION(UPSAMPLE_INT, _Z18__gen_ocl_upsampleii)
 DECL_LLVM_GEN_FUNCTION(UPSAMPLE_LONG, _Z18__gen_ocl_upsamplell)
 
-// get sampler info
-DECL_LLVM_GEN_FUNCTION(GET_SAMPLER_INFO, __gen_ocl_get_sampler_info)
-
 // saturate convert
 DECL_LLVM_GEN_FUNCTION(SAT_CONV_U8_TO_I8,  _Z16convert_char_sath)
 DECL_LLVM_GEN_FUNCTION(SAT_CONV_I16_TO_I8, _Z16convert_char_sats)
index cde9cfb..3b6eb32 100755 (executable)
@@ -4507,7 +4507,6 @@ int __gen_ocl_get_image_height(uint surface_id);
 int __gen_ocl_get_image_channel_data_type(uint surface_id);
 int __gen_ocl_get_image_channel_order(uint surface_id);
 int __gen_ocl_get_image_depth(uint surface_id);
-ushort __gen_ocl_get_sampler_info(sampler_t sampler);
 
 #define GET_IMAGE(cl_image, surface_id) \
     uint surface_id = (uint)cl_image
index 348211c..891d6f1 100644 (file)
@@ -192,15 +192,6 @@ cl_curbe_fill(cl_kernel ker,
   UPLOAD(GBE_CURBE_WORK_DIM, work_dim);
 #undef UPLOAD
 
-  /* Upload sampler information. */
-  offset = gbe_kernel_get_curbe_offset(ker->opaque, GBE_CURBE_SAMPLER_INFO, 0);
-  if (offset >= 0) {
-    uint32_t i;
-    for(i = 0; i < ker->sampler_sz; i++, offset += 2) {
-      *((uint16_t *) (ker->curbe + offset)) = ker->samplers[i] & 0xFF;
-    }
-  }
-
   /* Write identity for the stack pointer. This is required by the stack pointer
    * computation in the kernel
    */