[Beignet] [PATCH] GBE: don't allocate any register for image argument.

Zhigang Gong zhigang.gong at intel.com
Wed Dec 17 23:40:32 PST 2014


As all the image indexes are analyzed at compile time, we don't
need the host side to pass any real data to kernel at runtime.
Just simply ignore the image argument when allocate payload for
input argument. This could save one or two DW register space for
some kernels.

Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
 backend/src/backend/gen_context.cpp   | 6 +++---
 backend/src/llvm/llvm_gen_backend.cpp | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/backend/src/backend/gen_context.cpp b/backend/src/backend/gen_context.cpp
index a473451..df129b9 100644
--- a/backend/src/backend/gen_context.cpp
+++ b/backend/src/backend/gen_context.cpp
@@ -1828,9 +1828,9 @@ namespace gbe
         this->insertCurbeReg(arg.reg, this->newCurbeEntry(GBE_CURBE_KERNEL_ARGUMENT, argID, ptrSize, ptrSize));
       if (arg.type == ir::FunctionArgument::VALUE ||
           arg.type == ir::FunctionArgument::STRUCTURE ||
-          arg.type == ir::FunctionArgument::IMAGE ||
-          arg.type == ir::FunctionArgument::SAMPLER)
-        this->insertCurbeReg(arg.reg, this->newCurbeEntry(GBE_CURBE_KERNEL_ARGUMENT, argID, arg.size, arg.size));
+          arg.type == ir::FunctionArgument::SAMPLER) {
+          this->insertCurbeReg(arg.reg, this->newCurbeEntry(GBE_CURBE_KERNEL_ARGUMENT, argID, arg.size, arg.size));
+      }
     }
 
     // Go over all the instructions and find the special register we need
diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp
index b5da147..f89bea4 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -1567,7 +1567,7 @@ error:
                     "vector type in the function argument is not supported yet");
         const ir::Register reg = getRegister(I);
         if (llvmInfo.isImageType()) {
-          ctx.input(argName, ir::FunctionArgument::IMAGE, reg, llvmInfo, 4, 4, 0);
+          ctx.input(argName, ir::FunctionArgument::IMAGE, reg, llvmInfo, 0, 0, 0);
           ctx.getFunction().getImageSet()->append(reg, &ctx, incBtiBase());
           continue;
         }
-- 
1.8.3.2



More information about the Beignet mailing list