Kabylake is almost same as skylake, derived it from GEN9. Signed-off-by: Yang Rong <rong.r.y...@intel.com> --- backend/src/CMakeLists.txt | 4 +++ backend/src/backend/gen10_context.cpp | 31 +++++++++++++++++++ backend/src/backend/gen10_context.hpp | 49 ++++++++++++++++++++++++++++++ backend/src/backend/gen10_encoder.cpp | 33 ++++++++++++++++++++ backend/src/backend/gen10_encoder.hpp | 40 ++++++++++++++++++++++++ backend/src/backend/gen_insn_selection.cpp | 10 ++++++ backend/src/backend/gen_insn_selection.hpp | 7 +++++ backend/src/backend/gen_program.cpp | 15 +++++++-- 8 files changed, 186 insertions(+), 3 deletions(-) create mode 100644 backend/src/backend/gen10_context.cpp create mode 100644 backend/src/backend/gen10_context.hpp create mode 100644 backend/src/backend/gen10_encoder.cpp create mode 100644 backend/src/backend/gen10_encoder.hpp
diff --git a/backend/src/CMakeLists.txt b/backend/src/CMakeLists.txt index 41eb5ec..f368ae1 100644 --- a/backend/src/CMakeLists.txt +++ b/backend/src/CMakeLists.txt @@ -116,6 +116,8 @@ set (GBE_SRC backend/gen8_context.cpp backend/gen9_context.hpp backend/gen9_context.cpp + backend/gen10_context.hpp + backend/gen10_context.cpp backend/gen_program.cpp backend/gen_program.hpp backend/gen_program.h @@ -133,6 +135,8 @@ set (GBE_SRC backend/gen8_encoder.cpp backend/gen9_encoder.hpp backend/gen9_encoder.cpp + backend/gen10_encoder.hpp + backend/gen10_encoder.cpp ) set (GBE_LINK_LIBRARIES diff --git a/backend/src/backend/gen10_context.cpp b/backend/src/backend/gen10_context.cpp new file mode 100644 index 0000000..a8dc316 --- /dev/null +++ b/backend/src/backend/gen10_context.cpp @@ -0,0 +1,31 @@ +/* + * Copyright © 2012 Intel Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/** + * \file gen9_context.cpp + */ + +#include "backend/gen10_context.hpp" +#include "backend/gen_insn_selection.hpp" + +namespace gbe +{ + void Gen10Context::newSelection(void) { + this->sel = GBE_NEW(Selection10, *this); + } +} diff --git a/backend/src/backend/gen10_context.hpp b/backend/src/backend/gen10_context.hpp new file mode 100644 index 0000000..87dbffc --- /dev/null +++ b/backend/src/backend/gen10_context.hpp @@ -0,0 +1,49 @@ +/* + * Copyright © 2012 Intel Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/** + * \file gen10_context.hpp + */ +#ifndef __GBE_gen10_CONTEXT_HPP__ +#define __GBE_gen10_CONTEXT_HPP__ + +#include "backend/gen9_context.hpp" +#include "backend/gen10_encoder.hpp" + +namespace gbe +{ + /* This class is used to implement the HSW + specific logic for context. */ + class Gen10Context : public Gen9Context + { + public: + virtual ~Gen10Context(void) { }; + Gen10Context(const ir::Unit &unit, const std::string &name, uint32_t deviceID, bool relaxMath = false) + : Gen9Context(unit, name, deviceID, relaxMath) { + }; + + protected: + virtual GenEncoder* generateEncoder(void) { + return GBE_NEW(Gen10Encoder, this->simdWidth, 10, deviceID); + } + + private: + virtual void newSelection(void); + }; +} +#endif /* __GBE_GEN10_CONTEXT_HPP__ */ diff --git a/backend/src/backend/gen10_encoder.cpp b/backend/src/backend/gen10_encoder.cpp new file mode 100644 index 0000000..0550e9f --- /dev/null +++ b/backend/src/backend/gen10_encoder.cpp @@ -0,0 +1,33 @@ +/* + Copyright (C) Intel Corp. 2006. All Rights Reserved. + Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to + develop this 3D driver. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice (including the + next paragraph) shall be included in all copies or substantial + portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + **********************************************************************/ + +#include "backend/gen10_encoder.hpp" + +namespace gbe +{ + +} /* End of the name space. */ diff --git a/backend/src/backend/gen10_encoder.hpp b/backend/src/backend/gen10_encoder.hpp new file mode 100644 index 0000000..5e1265e --- /dev/null +++ b/backend/src/backend/gen10_encoder.hpp @@ -0,0 +1,40 @@ +/* + * Copyright © 2012 Intel Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/** + * \file gen10_context.hpp + */ +#ifndef __GBE_GEN10_ENCODER_HPP__ +#define __GBE_GEN10_ENCODER_HPP__ + +#include "backend/gen9_encoder.hpp" + +namespace gbe +{ + /* This class is used to implement the SKL + specific logic for encoder. */ + class Gen10Encoder : public Gen9Encoder + { + public: + virtual ~Gen10Encoder(void) { } + + Gen10Encoder(uint32_t simdWidth, uint32_t gen, uint32_t deviceID) + : Gen9Encoder(simdWidth, gen, deviceID) { } + }; +} +#endif /* __GBE_GEN10_ENCODER_HPP__ */ diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp index e342161..69959e9 100644 --- a/backend/src/backend/gen_insn_selection.cpp +++ b/backend/src/backend/gen_insn_selection.cpp @@ -2523,6 +2523,16 @@ extern bool OCL_DEBUGINFO; // first defined by calling BVAR in program.cpp opt_features = SIOF_LOGICAL_SRCMOD | SIOF_OP_MOV_LONG_REG_RESTRICT; } + Selection10::Selection10(GenContext &ctx) : Selection(ctx) { + this->opaque->setHas32X32Mul(true); + this->opaque->setHasLongType(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; + } + 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 b481de8..4a43eb6 100644 --- a/backend/src/backend/gen_insn_selection.hpp +++ b/backend/src/backend/gen_insn_selection.hpp @@ -355,6 +355,13 @@ namespace gbe SelectionBxt(GenContext &ctx); }; + class Selection10 : public Selection + { + public: + /*! Initialize internal structures used for the selection */ + Selection10(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 ade0157..6bd6c2b 100644 --- a/backend/src/backend/gen_program.cpp +++ b/backend/src/backend/gen_program.cpp @@ -50,6 +50,7 @@ #include "backend/gen75_context.hpp" #include "backend/gen8_context.hpp" #include "backend/gen9_context.hpp" +#include "backend/gen10_context.hpp" #include "backend/gen_defs.hpp" #include "backend/gen/gen_mesa_disasm.h" #include "backend/gen_reg_allocation.hpp" @@ -100,7 +101,7 @@ namespace gbe { uint32_t insn_version = 0; if (IS_GEN7(deviceID) || IS_GEN75(deviceID)) insn_version = 7; - else if (IS_GEN8(deviceID) || IS_GEN9(deviceID)) + else if (IS_GEN8(deviceID) || IS_GEN9(deviceID) || IS_GEN10(deviceID)) insn_version = 8; for (uint32_t i = 0; i < insnNum;) { @@ -186,6 +187,8 @@ namespace gbe { ctx = GBE_NEW(Gen9Context, unit, name, deviceID, relaxMath); } else if (IS_BROXTON(deviceID)) { ctx = GBE_NEW(BxtContext, unit, name, deviceID, relaxMath); + } else if (IS_KABYLAKE(deviceID)) { + ctx = GBE_NEW(Gen10Context, unit, name, deviceID, relaxMath); } GBE_ASSERTM(ctx != NULL, "Fail to create the gen context\n"); @@ -239,6 +242,7 @@ namespace gbe { GBHI_BDW = 4, GBHI_SKL = 5, GBHI_BXT = 6, + GBHI_KBL = 7, GBHI_MAX, }; #define GEN_BINARY_VERSION 1 @@ -249,7 +253,8 @@ namespace gbe { {GEN_BINARY_VERSION, 'G','E', 'N', 'C', 'C', 'H', 'V'}, {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', 'B', 'X', 'T'}, + {GEN_BINARY_VERSION, 'G','E', 'N', 'C', 'K', 'B', 'T'} }; #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) @@ -284,6 +289,7 @@ namespace gbe { #define MATCH_BDW_HEADER(binary) genHeaderCompare(binary, GBHI_BDW) #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_DEVICE(deviceID, binary) ((IS_IVYBRIDGE(deviceID) && MATCH_IVB_HEADER(binary)) || \ (IS_IVYBRIDGE(deviceID) && MATCH_IVB_HEADER(binary)) || \ @@ -292,7 +298,8 @@ namespace gbe { (IS_BROADWELL(deviceID) && MATCH_BDW_HEADER(binary)) || \ (IS_CHERRYVIEW(deviceID) && MATCH_CHV_HEADER(binary)) || \ (IS_SKYLAKE(deviceID) && MATCH_SKL_HEADER(binary)) || \ - (IS_BROXTON(deviceID) && MATCH_BXT_HEADER(binary)) \ + (IS_BROXTON(deviceID) && MATCH_BXT_HEADER(binary)) || \ + (IS_KABYLAKE(deviceID) && MATCH_KBL_HEADER(binary)) \ ) static gbe_program genProgramNewFromBinary(uint32_t deviceID, const char *binary, size_t size) { @@ -392,6 +399,8 @@ namespace gbe { FILL_SKL_HEADER(*binary); }else if(IS_BROXTON(prog->deviceID)){ FILL_BXT_HEADER(*binary); + }else if(IS_KABYLAKE(prog->deviceID)){ + FILL_SKL_HEADER(*binary); }else { free(*binary); *binary = NULL; -- 2.1.4 _______________________________________________ Beignet mailing list Beignet@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/beignet