[Beignet] [PATCH] Change the oreder of the code
Song, Ruiling
ruiling.song at intel.com
Fri Feb 21 00:11:46 PST 2014
Good finding, thanks for the fix. And please refine it according to zhigang's comments.
Thanks!
Ruiling
-----Original Message-----
From: beignet-bounces at lists.freedesktop.org [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Xiuli Pan
Sent: Friday, February 21, 2014 4:00 PM
To: beignet at lists.freedesktop.org
Cc: Pan, Xiuli; pxli168 at 163.com
Subject: [Beignet] [PATCH] Change the oreder of the code
From: xiuli pan <xiuli.pan at intel.com>
---
backend/src/llvm/llvm_gen_backend.cpp | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp
index 2d4fb0a..e20f810 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -1394,16 +1394,7 @@ namespace gbe
ir::AddressSpace addrSpace = addressSpaceLLVMToGen(v.getType()->getAddressSpace());
if(addrSpace == ir::MEM_LOCAL) {
- ir::Function &f = ctx.getFunction();
- f.setUseSLM(true);
- const Constant *c = v.getInitializer();
- Type *ty = c->getType();
- uint32_t oldSlm = f.getSLMSize();
- uint32_t align = 8 * getAlignmentByte(unit, ty);
- uint32_t padding = getPadding(oldSlm*8, align);
-
- f.setSLMSize(oldSlm + padding/8 + getTypeByteSize(unit, ty));
- const Value * val = cast<Value>(&v);
+ const Value * val = cast<Value>(&v);
// local variable can only be used in one kernel function. so, don't need to check its all uses.
// loop through the Constant to find the instruction that use the global variable
// FIXME need to find a more grace way to find the function which use this local data.
@@ -1419,6 +1410,16 @@ namespace gbe
const BasicBlock * bb = insn->getParent();
const Function * func = bb->getParent();
if(func != &F) continue;
+
+ ir::Function &f = ctx.getFunction();
+ f.setUseSLM(true);
+ const Constant *c = v.getInitializer();
+ Type *ty = c->getType();
+ uint32_t oldSlm = f.getSLMSize();
+ uint32_t align = 8 * getAlignmentByte(unit, ty);
+ uint32_t padding = getPadding(oldSlm*8, align);
+
+ f.setSLMSize(oldSlm + padding/8 + getTypeByteSize(unit, ty));
this->newRegister(const_cast<GlobalVariable*>(&v));
ir::Register reg = regTranslator.getScalar(const_cast<GlobalVariable*>(&v), 0);
--
1.7.9.5
_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list