diff options
author | Yang Rong <rong.r.yang@intel.com> | 2017-05-15 14:07:46 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2017-05-15 18:55:05 +0800 |
commit | 28854bfd44ae5c2664fe7e09f8302d9dfc688f3b (patch) | |
tree | 1027ec064fbcc2da2b6f79df7522a59e72e4cfd8 | |
parent | 2c1af92a2e8d8c3f31f2643f573cdceeaedfc372 (diff) |
GLK: add geminilake backend support.
Geminilake's backend is same as bxt.
Signed-off-by: Yang Rong <rong.r.yang@intel.com>
Reviewed-by: Pan Xiuli <xiuli.pan@intel.com>
-rw-r--r-- | backend/src/backend/gen9_context.cpp | 4 | ||||
-rw-r--r-- | backend/src/backend/gen9_context.hpp | 14 | ||||
-rw-r--r-- | backend/src/backend/gen_insn_selection.cpp | 11 | ||||
-rw-r--r-- | backend/src/backend/gen_insn_selection.hpp | 7 | ||||
-rw-r--r-- | backend/src/backend/gen_program.cpp | 13 |
5 files changed, 47 insertions, 2 deletions
diff --git a/backend/src/backend/gen9_context.cpp b/backend/src/backend/gen9_context.cpp index 483b2c33..2ce53b68 100644 --- a/backend/src/backend/gen9_context.cpp +++ b/backend/src/backend/gen9_context.cpp @@ -236,4 +236,8 @@ namespace gbe this->sel = GBE_NEW(SelectionKbl, *this); } + void GlkContext::newSelection(void) { + this->sel = GBE_NEW(SelectionGlk, *this); + } + } diff --git a/backend/src/backend/gen9_context.hpp b/backend/src/backend/gen9_context.hpp index 9977e9a1..04766616 100644 --- a/backend/src/backend/gen9_context.hpp +++ b/backend/src/backend/gen9_context.hpp @@ -82,5 +82,19 @@ namespace gbe private: virtual void newSelection(void); }; + + /* This class is used to implement the geminilake + specific logic for context. */ + class GlkContext : public BxtContext + { + public: + virtual ~GlkContext(void) { }; + GlkContext(const ir::Unit &unit, const std::string &name, uint32_t deviceID, bool relaxMath = false) + : BxtContext(unit, name, deviceID, relaxMath) { + }; + + private: + virtual void newSelection(void); + }; } #endif /* __GBE_GEN9_CONTEXT_HPP__ */ diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp index 41ef7b85..1a883ead 100644 --- a/backend/src/backend/gen_insn_selection.cpp +++ b/backend/src/backend/gen_insn_selection.cpp @@ -2805,6 +2805,17 @@ extern bool OCL_DEBUGINFO; // first defined by calling BVAR in program.cpp opt_features = SIOF_LOGICAL_SRCMOD; } + SelectionGlk::SelectionGlk(GenContext &ctx) : Selection(ctx) { + this->opaque->setHas32X32Mul(true); + this->opaque->setHasLongType(true); + this->opaque->setLongRegRestrict(true); + this->opaque->setHasDoubleType(true); + this->opaque->setLdMsgOrder(LD_MSG_ORDER_SKL); + this->opaque->setSlowByteGather(false); + this->opaque->setHasHalfType(true); + opt_features = SIOF_LOGICAL_SRCMOD | SIOF_OP_MOV_LONG_REG_RESTRICT; + } + void Selection::Opaque::TYPED_WRITE(GenRegister *msgs, uint32_t msgNum, uint32_t bti, bool is3D) { uint32_t elemID = 0; diff --git a/backend/src/backend/gen_insn_selection.hpp b/backend/src/backend/gen_insn_selection.hpp index 0eeaa5d1..aa433883 100644 --- a/backend/src/backend/gen_insn_selection.hpp +++ b/backend/src/backend/gen_insn_selection.hpp @@ -375,6 +375,13 @@ namespace gbe SelectionKbl(GenContext &ctx); }; + class SelectionGlk: public Selection + { + public: + /*! Initialize internal structures used for the selection */ + SelectionGlk(GenContext &ctx); + }; + } /* namespace gbe */ #endif /* __GEN_INSN_SELECTION_HPP__ */ diff --git a/backend/src/backend/gen_program.cpp b/backend/src/backend/gen_program.cpp index c1827b11..383f2f27 100644 --- a/backend/src/backend/gen_program.cpp +++ b/backend/src/backend/gen_program.cpp @@ -186,6 +186,8 @@ namespace gbe { ctx = GBE_NEW(BxtContext, unit, name, deviceID, relaxMath); } else if (IS_KABYLAKE(deviceID)) { ctx = GBE_NEW(KblContext, unit, name, deviceID, relaxMath); + } else if (IS_GEMINILAKE(deviceID)) { + ctx = GBE_NEW(GlkContext, unit, name, deviceID, relaxMath); } GBE_ASSERTM(ctx != NULL, "Fail to create the gen context\n"); @@ -241,6 +243,7 @@ namespace gbe { GBHI_SKL = 5, GBHI_BXT = 6, GBHI_KBL = 7, + GBHI_GLK = 8, GBHI_MAX, }; #define GEN_BINARY_VERSION 1 @@ -252,7 +255,8 @@ namespace gbe { {GEN_BINARY_VERSION, 'G','E', 'N', 'C', 'B', 'D', 'W'}, {GEN_BINARY_VERSION, 'G','E', 'N', 'C', 'S', 'K', 'L'}, {GEN_BINARY_VERSION, 'G','E', 'N', 'C', 'B', 'X', 'T'}, - {GEN_BINARY_VERSION, 'G','E', 'N', 'C', 'K', 'B', 'T'} + {GEN_BINARY_VERSION, 'G','E', 'N', 'C', 'K', 'B', 'T'}, + {GEN_BINARY_VERSION, 'G','E', 'N', 'C', 'G', 'L', 'K'} }; #define FILL_GEN_HEADER(binary, index) do {int i = 0; do {*(binary+i) = gen_binary_header[index][i]; i++; }while(i < GEN_BINARY_HEADER_LENGTH);}while(0) @@ -264,6 +268,7 @@ namespace gbe { #define FILL_SKL_HEADER(binary) FILL_GEN_HEADER(binary, GBHI_SKL) #define FILL_BXT_HEADER(binary) FILL_GEN_HEADER(binary, GBHI_BXT) #define FILL_KBL_HEADER(binary) FILL_GEN_HEADER(binary, GBHI_KBL) +#define FILL_GLK_HEADER(binary) FILL_GEN_HEADER(binary, GBHI_GLK) static bool genHeaderCompare(const unsigned char *BufPtr, GEN_BINARY_HEADER_INDEX index) { @@ -289,6 +294,7 @@ namespace gbe { #define MATCH_SKL_HEADER(binary) genHeaderCompare(binary, GBHI_SKL) #define MATCH_BXT_HEADER(binary) genHeaderCompare(binary, GBHI_BXT) #define MATCH_KBL_HEADER(binary) genHeaderCompare(binary, GBHI_KBL) +#define MATCH_GLK_HEADER(binary) genHeaderCompare(binary, GBHI_GLK) #define MATCH_DEVICE(deviceID, binary) ((IS_IVYBRIDGE(deviceID) && MATCH_IVB_HEADER(binary)) || \ (IS_IVYBRIDGE(deviceID) && MATCH_IVB_HEADER(binary)) || \ @@ -298,7 +304,8 @@ namespace gbe { (IS_CHERRYVIEW(deviceID) && MATCH_CHV_HEADER(binary)) || \ (IS_SKYLAKE(deviceID) && MATCH_SKL_HEADER(binary)) || \ (IS_BROXTON(deviceID) && MATCH_BXT_HEADER(binary)) || \ - (IS_KABYLAKE(deviceID) && MATCH_KBL_HEADER(binary)) \ + (IS_KABYLAKE(deviceID) && MATCH_KBL_HEADER(binary)) || \ + (IS_GEMINILAKE(deviceID) && MATCH_GLK_HEADER(binary)) \ ) static gbe_program genProgramNewFromBinary(uint32_t deviceID, const char *binary, size_t size) { @@ -406,6 +413,8 @@ namespace gbe { FILL_BXT_HEADER(*binary); }else if(IS_KABYLAKE(prog->deviceID)){ FILL_KBL_HEADER(*binary); + }else if(IS_GEMINILAKE(prog->deviceID)){ + FILL_GLK_HEADER(*binary); }else { free(*binary); *binary = NULL; |