backend/gen_reg_allocation.cpp
backend/gen_reg_allocation.hpp
backend/gen_context.cpp
- backend/gen_context.hpp
+ backend/gen_context.cpp
+ backend/gen75_context.hpp
+ backend/gen75_context.cpp
backend/gen_program.cpp
backend/gen_program.hpp
backend/gen_program.h
backend/gen_defs.hpp
backend/gen_insn_compact.cpp
backend/gen_encoder.hpp
- backend/gen_encoder.cpp)
+ backend/gen_encoder.cpp
+ backend/gen75_encoder.hpp
+ backend/gen75_encoder.cpp
+ )
endif (GBE_USE_BLOB)
--- /dev/null
+/*
+ * 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 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 gen75_context.cpp
+ */
+
+#include "backend/gen75_context.hpp"
+#include "backend/gen75_encoder.hpp"
+
+namespace gbe
+{
+
+}
--- /dev/null
+/*
+ * 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 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 gen75_context.hpp
+ */
+#ifndef __GBE_GEN75_CONTEXT_HPP__
+#define __GBE_GEN75_CONTEXT_HPP__
+
+#include "backend/gen_context.hpp"
+#include "backend/gen75_encoder.hpp"
+
+namespace gbe
+{
+ /* This class is used to implement the HSW
+ specific logic for context. */
+ class Gen75Context : public GenContext
+ {
+ public:
+ Gen75Context(const ir::Unit &unit, const std::string &name, uint32_t deviceID, bool relaxMath = false)
+ : GenContext(unit, name, deviceID, relaxMath) {
+ };
+
+ protected:
+ virtual GenEncoder* generateEncoder(void) {
+ return GBE_NEW(Gen75Encoder, this->simdWidth, 75, deviceID);
+ }
+
+ };
+}
+#endif /* __GBE_GEN75_CONTEXT_HPP__ */
--- /dev/null
+/*
+ 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/gen75_encoder.hpp"
+
+namespace gbe
+{
+
+} /* End of the name space. */
--- /dev/null
+/*
+ * 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 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 gen75_context.hpp
+ */
+#ifndef __GBE_GEN75_ENCODER_HPP__
+#define __GBE_GEN75_ENCODER_HPP__
+
+#include "backend/gen_encoder.hpp"
+
+namespace gbe
+{
+ /* This class is used to implement the HSW
+ specific logic for encoder. */
+ class Gen75Encoder : public GenEncoder
+ {
+ public:
+ Gen75Encoder(uint32_t simdWidth, uint32_t gen, uint32_t deviceID)
+ : GenEncoder(simdWidth, gen, deviceID, 8) { };
+ };
+}
+#endif /* __GBE_GEN75_ENCODER_HPP__ */
///////////////////////////////////////////////////////////////////////////
// GenContext implementation
///////////////////////////////////////////////////////////////////////////
- GenContext::GenContext(const ir::Unit &unit,
- const std::string &name,
- uint32_t deviceID,
- bool relaxMath) :
+ GenContext::GenContext(const ir::Unit &unit, const std::string &name, uint32_t deviceID,
+ bool relaxMath) :
Context(unit, name), deviceID(deviceID), relaxMath(relaxMath)
{
this->p = NULL;
GBE_SAFE_DELETE(ra);
GBE_SAFE_DELETE(sel);
GBE_SAFE_DELETE(p);
- this->p = GBE_NEW(GenEncoder, this->simdWidth, 7, deviceID); // XXX handle more than Gen7
+ this->p = generateEncoder();
this->sel = GBE_NEW(Selection, *this);
this->ra = GBE_NEW(GenRegAllocator, *this);
this->branchPos2.clear();
#define __GBE_GEN_CONTEXT_HPP__
#include "backend/context.hpp"
+#include "backend/gen_encoder.hpp"
#include "backend/program.h"
#include "backend/gen_register.hpp"
#include "ir/function.hpp"
/*! Create a new context. name is the name of the function we want to
* compile
*/
- GenContext(const ir::Unit &unit, const std::string &name, uint32_t deviceID, bool relaxMath = false);
+ GenContext(const ir::Unit &unit, const std::string &name, uint32_t deviceID,
+ bool relaxMath = false);
/*! Release everything needed */
~GenContext(void);
/*! Start new code generation with specific parameters */
const bool getIFENDIFFix(void) const { return ifEndifFix; }
void setIFENDIFFix(bool fix) { ifEndifFix = fix; }
const CompileErrorCode getErrCode() { return errCode; }
+
+ protected:
+ virtual GenEncoder* generateEncoder(void) {
+ return GBE_NEW(GenEncoder, this->simdWidth, 7, deviceID);
+ }
+
private:
CompileErrorCode errCode;
bool ifEndifFix;
//////////////////////////////////////////////////////////////////////////
// Gen Emitter encoding class
//////////////////////////////////////////////////////////////////////////
- GenEncoder::GenEncoder(uint32_t simdWidth, uint32_t gen, uint32_t deviceID) :
- stateNum(0), gen(gen), deviceID(deviceID)
+ GenEncoder::GenEncoder(uint32_t simdWidth, uint32_t gen, uint32_t deviceID, int jump_width) :
+ stateNum(0), gen(gen), deviceID(deviceID), jump_width(jump_width)
{
this->curr.execWidth = simdWidth;
this->curr.quarterControl = GEN_COMPRESSION_Q1;
{
public:
/*! simdWidth is the default width for the instructions */
- GenEncoder(uint32_t simdWidth, uint32_t gen, uint32_t deviceID);
+ GenEncoder(uint32_t simdWidth, uint32_t gen, uint32_t deviceID, int jump_width = 1);
/*! Size of the stack (should be large enough) */
enum { MAX_STATE_NUM = 16 };
/*! Push the current instruction state */
uint32_t gen;
/*! Device ID */
uint32_t deviceID;
-
+ /*! The constant for jump. */
+ const int jump_width;
////////////////////////////////////////////////////////////////////////
// Encoding functions
////////////////////////////////////////////////////////////////////////
#include "backend/gen_program.h"
#include "backend/gen_program.hpp"
#include "backend/gen_context.hpp"
+#include "backend/gen75_context.hpp"
#include "backend/gen_defs.hpp"
#include "backend/gen/gen_mesa_disasm.h"
#include "backend/gen_reg_allocation.hpp"
const ir::Function *fn = unit.getFunction(name);
uint32_t codeGenNum = sizeof(codeGenStrategy) / sizeof(codeGenStrategy[0]);
uint32_t codeGen = 0;
+ GenContext *ctx = NULL;
if (fn->getSimdWidth() == 8) {
codeGen = 2;
} else if (fn->getSimdWidth() == 16) {
Kernel *kernel = NULL;
// Stop when compilation is successful
- GenContext *ctx = GBE_NEW(GenContext, unit, name, deviceID, relaxMath);
+ if (IS_IVYBRIDGE(deviceID)) {
+ ctx = GBE_NEW(GenContext, unit, name, deviceID, relaxMath);
+ } else if (IS_HASWELL(deviceID)) {
+ ctx = GBE_NEW(Gen75Context, unit, name, deviceID, relaxMath);
+ }
+ GBE_ASSERTM(ctx != NULL, "Fail to create the gen context\n");
+
for (; codeGen < codeGenNum; ++codeGen) {
const uint32_t simdWidth = codeGenStrategy[codeGen].simdWidth;
const bool limitRegisterPressure = codeGenStrategy[codeGen].limitRegisterPressure;
{
// FIXME, we need to find a graceful way to generate internal binaries for difference
// devices.
- gbe_program opaque = gbe_program_new_from_source(0, code, 0, build_opt.c_str(), NULL, NULL);
+ gbe_program opaque = gbe_program_new_from_source(0x0152, code, 0, build_opt.c_str(), NULL, NULL);
if (!opaque)
throw FILE_BUILD_FAILED;