summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunyan He <junyan.he@linux.intel.com>2015-11-17 07:40:19 +0800
committerYang Rong <rong.r.yang@intel.com>2015-11-17 16:23:57 +0800
commit1af4dc9c5e78ced35365c53c5bb42381e5aa9363 (patch)
tree9b703266af6b2915ed33929b0cf94027f2c5806e
parentcdb69637bda480c809a2ccd1d9eaba4322043b21 (diff)
Backend: Add ADD_ and SUB_ timestamps help functions.
The timestamps are calculated by Long type. Before BDW, there is no Long type support and we use i32 operations to implement them. Signed-off-by: Junyan He <junyan.he@linux.intel.com> Reviewed-by: Yang Rong <rong.r.yang@intel.com>
-rw-r--r--backend/src/backend/gen8_context.cpp21
-rw-r--r--backend/src/backend/gen8_context.hpp2
-rw-r--r--backend/src/backend/gen_context.cpp49
-rw-r--r--backend/src/backend/gen_context.hpp2
4 files changed, 67 insertions, 7 deletions
diff --git a/backend/src/backend/gen8_context.cpp b/backend/src/backend/gen8_context.cpp
index 5b1529d6..71d900f3 100644
--- a/backend/src/backend/gen8_context.cpp
+++ b/backend/src/backend/gen8_context.cpp
@@ -1151,6 +1151,27 @@ namespace gbe
p->pop();
}
+ void Gen8Context::subTimestamps(GenRegister& t0, GenRegister& t1, GenRegister& tmp)
+ {
+ p->push(); {
+ p->curr.execWidth = 1;
+ p->curr.predicate = GEN_PREDICATE_NONE;
+ p->curr.noMask = 1;
+ p->ADD(GenRegister::retype(t0, GEN_TYPE_UL), GenRegister::retype(t0, GEN_TYPE_UL),
+ GenRegister::negate(GenRegister::retype(t1, GEN_TYPE_UL)));
+ } p->pop();
+ }
+
+ void Gen8Context::addTimestamps(GenRegister& t0, GenRegister& t1, GenRegister& tmp) {
+ p->push(); {
+ p->curr.execWidth = 1;
+ p->curr.predicate = GEN_PREDICATE_NONE;
+ p->curr.noMask = 1;
+ p->ADD(GenRegister::retype(t0, GEN_TYPE_UL), GenRegister::retype(t0, GEN_TYPE_UL),
+ GenRegister::retype(t1, GEN_TYPE_UL));
+ } p->pop();
+ }
+
void ChvContext::newSelection(void) {
this->sel = GBE_NEW(SelectionChv, *this);
}
diff --git a/backend/src/backend/gen8_context.hpp b/backend/src/backend/gen8_context.hpp
index 386f7f30..537aef57 100644
--- a/backend/src/backend/gen8_context.hpp
+++ b/backend/src/backend/gen8_context.hpp
@@ -78,6 +78,8 @@ namespace gbe
protected:
virtual void setA0Content(uint16_t new_a0[16], uint16_t max_offset = 0, int sz = 0);
+ virtual void subTimestamps(GenRegister& t0, GenRegister& t1, GenRegister& tmp);
+ virtual void addTimestamps(GenRegister& t0, GenRegister& t1, GenRegister& tmp);
virtual GenEncoder* generateEncoder(void) {
return GBE_NEW(Gen8Encoder, this->simdWidth, 8, deviceID);
}
diff --git a/backend/src/backend/gen_context.cpp b/backend/src/backend/gen_context.cpp
index 6627d147..422e52f7 100644
--- a/backend/src/backend/gen_context.cpp
+++ b/backend/src/backend/gen_context.cpp
@@ -2474,13 +2474,7 @@ namespace gbe
void GenContext::profilingProlog(void) {
// record the prolog, globalXYZ and lasttimestamp at the very beginning.
GenRegister profilingReg2, profilingReg3, profilingReg4;
- GenRegister tmArf = GenRegister(GEN_ARCHITECTURE_REGISTER_FILE,
- 0xc0,
- 0,
- GEN_TYPE_UW,
- GEN_VERTICAL_STRIDE_4,
- GEN_WIDTH_4,
- GEN_HORIZONTAL_STRIDE_1);
+ GenRegister tmArf = GenRegister::tm0();
if (this->simdWidth == 16) {
profilingReg2 = ra->genReg(GenRegister::ud16grf(ir::ocl::profilingts1));
profilingReg3 = GenRegister::offset(profilingReg2, 1);
@@ -2527,6 +2521,47 @@ namespace gbe
return;
}
+ void GenContext::subTimestamps(GenRegister& t0, GenRegister& t1, GenRegister& tmp)
+ {
+ p->push(); {
+ p->curr.execWidth = 1;
+ p->curr.predicate = GEN_PREDICATE_NONE;
+ p->curr.noMask = 1;
+ p->SUBB(GenRegister::retype(t0, GEN_TYPE_UD),
+ GenRegister::retype(t0, GEN_TYPE_UD), GenRegister::retype(t1, GEN_TYPE_UD));
+ /* FIXME We can not get the acc register's value correctly by set simd = 1. */
+ p->curr.execWidth = 8;
+ p->MOV(tmp, GenRegister::retype(GenRegister::acc(), GEN_TYPE_UD));
+ p->curr.execWidth = 1;
+ p->ADD(GenRegister::retype(GenRegister::offset(t0, 0, sizeof(uint32_t)), GEN_TYPE_UD),
+ GenRegister::retype(GenRegister::offset(t0, 0, sizeof(uint32_t)), GEN_TYPE_UD),
+ GenRegister::negate(GenRegister::toUniform(tmp, GEN_TYPE_UD)));
+ p->ADD(GenRegister::retype(GenRegister::offset(t0, 0, sizeof(uint32_t)), GEN_TYPE_UD),
+ GenRegister::retype(GenRegister::offset(t0, 0, sizeof(uint32_t)), GEN_TYPE_UD),
+ GenRegister::negate(GenRegister::retype(GenRegister::offset(t1, 0, sizeof(uint32_t)), GEN_TYPE_UD)));
+ } p->pop();
+ }
+
+ void GenContext::addTimestamps(GenRegister& t0, GenRegister& t1, GenRegister& tmp)
+ {
+ p->push(); {
+ p->curr.execWidth = 1;
+ p->curr.predicate = GEN_PREDICATE_NONE;
+ p->curr.noMask = 1;
+ p->ADDC(GenRegister::retype(t0, GEN_TYPE_UD),
+ GenRegister::retype(t0, GEN_TYPE_UD), GenRegister::retype(t1, GEN_TYPE_UD));
+ p->curr.execWidth = 8;
+ p->MOV(tmp, GenRegister::retype(GenRegister::acc(), GEN_TYPE_UD));
+ p->curr.execWidth = 1;
+ p->ADD(GenRegister::retype(GenRegister::offset(t0, 0, sizeof(uint32_t)), GEN_TYPE_UD),
+ GenRegister::retype(GenRegister::offset(t0, 0, sizeof(uint32_t)), GEN_TYPE_UD),
+ GenRegister::offset(GenRegister::toUniform(tmp, GEN_TYPE_UD), 0, 6*sizeof(uint32_t)));
+ p->ADD(GenRegister::retype(GenRegister::offset(t0, 0, sizeof(uint32_t)), GEN_TYPE_UD),
+ GenRegister::retype(GenRegister::offset(t0, 0, sizeof(uint32_t)), GEN_TYPE_UD),
+ GenRegister::retype(GenRegister::offset(t1, 0, sizeof(uint32_t)), GEN_TYPE_UD));
+ } p->pop();
+ }
+
void GenContext::emitCalcTimestampInstruction(const SelectionInstruction &insn) {
}
diff --git a/backend/src/backend/gen_context.hpp b/backend/src/backend/gen_context.hpp
index 087e1862..af252ed5 100644
--- a/backend/src/backend/gen_context.hpp
+++ b/backend/src/backend/gen_context.hpp
@@ -225,6 +225,8 @@ namespace gbe
virtual void setA0Content(uint16_t new_a0[16], uint16_t max_offset = 0, int sz = 0);
void calcGlobalXYZRange(GenRegister& reg, GenRegister& tmp, int flag, int subFlag);
+ virtual void subTimestamps(GenRegister& t0, GenRegister& t1, GenRegister& tmp);
+ virtual void addTimestamps(GenRegister& t0, GenRegister& t1, GenRegister& tmp);
private:
CompileErrorCode errCode;