[Beignet] [PATCH 2/2] GBE: remove the useless get sampler info function.
Zhigang Gong
zhigang.gong at intel.com
Thu Feb 20 21:11:12 PST 2014
We don't need to get the sampler info dynamically, so
remove the corresponding instruction.
Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
backend/src/backend/context.cpp | 13 ++-------
backend/src/backend/gen_insn_selection.cpp | 17 ------------
backend/src/backend/program.h | 1 -
backend/src/ir/instruction.cpp | 44 ------------------------------
backend/src/ir/instruction.hpp | 11 --------
backend/src/ir/instruction.hxx | 1 -
backend/src/ir/profile.cpp | 3 +-
backend/src/ir/profile.hpp | 11 ++++----
backend/src/llvm/llvm_gen_backend.cpp | 9 ------
backend/src/llvm/llvm_gen_ocl_function.hxx | 3 --
backend/src/ocl_stdlib.tmpl.h | 1 -
src/cl_command_queue_gen7.c | 9 ------
12 files changed, 9 insertions(+), 114 deletions(-)
diff --git a/backend/src/backend/context.cpp b/backend/src/backend/context.cpp
index 2125bd1..51a0628 100644
--- a/backend/src/backend/context.cpp
+++ b/backend/src/backend/context.cpp
@@ -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;
diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp
index fc8f1b1..d5d86de 100644
--- a/backend/src/backend/gen_insn_selection.cpp
+++ b/backend/src/backend/gen_insn_selection.cpp
@@ -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)
diff --git a/backend/src/backend/program.h b/backend/src/backend/program.h
index e6436c3..5f308ad 100644
--- a/backend/src/backend/program.h
+++ b/backend/src/backend/program.h
@@ -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,
diff --git a/backend/src/ir/instruction.cpp b/backend/src/ir/instruction.cpp
index 95bcff5..2d2b34b 100644
--- a/backend/src/ir/instruction.cpp
+++ b/backend/src/ir/instruction.cpp
@@ -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()) {
diff --git a/backend/src/ir/instruction.hpp b/backend/src/ir/instruction.hpp
index 8e2cd11..f9f5e68 100644
--- a/backend/src/ir/instruction.hpp
+++ b/backend/src/ir/instruction.hpp
@@ -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);
diff --git a/backend/src/ir/instruction.hxx b/backend/src/ir/instruction.hxx
index bb5229a..bebceff 100644
--- a/backend/src/ir/instruction.hxx
+++ b/backend/src/ir/instruction.hxx
@@ -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)
diff --git a/backend/src/ir/profile.cpp b/backend/src/ir/profile.cpp
index ef3ea28..708bc4d 100644
--- a/backend/src/ir/profile.cpp
+++ b/backend/src/ir/profile.cpp
@@ -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);
diff --git a/backend/src/ir/profile.hpp b/backend/src/ir/profile.hpp
index d84c48a..cda5edf 100644
--- a/backend/src/ir/profile.hpp
+++ b/backend/src/ir/profile.hpp
@@ -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 */
diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp
index 4eecae5..438fa07 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -2055,7 +2055,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:
@@ -2364,14 +2363,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:
diff --git a/backend/src/llvm/llvm_gen_ocl_function.hxx b/backend/src/llvm/llvm_gen_ocl_function.hxx
index 750344a..00d69f0 100644
--- a/backend/src/llvm/llvm_gen_ocl_function.hxx
+++ b/backend/src/llvm/llvm_gen_ocl_function.hxx
@@ -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)
diff --git a/backend/src/ocl_stdlib.tmpl.h b/backend/src/ocl_stdlib.tmpl.h
index cde9cfb..3b6eb32 100755
--- a/backend/src/ocl_stdlib.tmpl.h
+++ b/backend/src/ocl_stdlib.tmpl.h
@@ -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
diff --git a/src/cl_command_queue_gen7.c b/src/cl_command_queue_gen7.c
index 348211c..891d6f1 100644
--- a/src/cl_command_queue_gen7.c
+++ b/src/cl_command_queue_gen7.c
@@ -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
*/
--
1.8.3.2
More information about the Beignet
mailing list