Unverified Commit efe4ba18 authored by Jai Menon's avatar Jai Menon Committed by GitHub

Merge pull request #249 from NervanaSystems/bob/simple_function_call

Bob/simple function call
parents 41f9ec92 14e2c9b8
...@@ -45,7 +45,7 @@ void CallFrame::tensor_call( ...@@ -45,7 +45,7 @@ void CallFrame::tensor_call(
} }
// Invoke compiled computation // Invoke compiled computation
m_compiled_function(inputs, outputs); m_compiled_function(inputs.data(), outputs.data());
} }
void CallFrame::operator()(const std::vector<std::shared_ptr<ngraph::runtime::Value>>& arguments, void CallFrame::operator()(const std::vector<std::shared_ptr<ngraph::runtime::Value>>& arguments,
......
...@@ -32,8 +32,7 @@ namespace ngraph ...@@ -32,8 +32,7 @@ namespace ngraph
{ {
class CallFrame; class CallFrame;
using EntryPoint_t = void(const std::vector<void*>& inputs, using EntryPoint_t = void(void** inputs, void** outputs);
const std::vector<void*>& outputs);
using EntryPoint = std::function<EntryPoint_t>; using EntryPoint = std::function<EntryPoint_t>;
......
...@@ -56,14 +56,12 @@ static std::string eigen_matrix_format(const ngraph::Shape& shape, const ngraph: ...@@ -56,14 +56,12 @@ static std::string eigen_matrix_format(const ngraph::Shape& shape, const ngraph:
} }
void Emitter::EmitNop(const ngraph::Node* n, void Emitter::EmitNop(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
} }
void Emitter::EmitAdd(const ngraph::Node* n, void Emitter::EmitAdd(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -78,7 +76,6 @@ void Emitter::EmitAdd(const ngraph::Node* n, ...@@ -78,7 +76,6 @@ void Emitter::EmitAdd(const ngraph::Node* n,
} }
void Emitter::EmitDot(const ngraph::Node* n, void Emitter::EmitDot(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -172,7 +169,6 @@ void Emitter::EmitDot(const ngraph::Node* n, ...@@ -172,7 +169,6 @@ void Emitter::EmitDot(const ngraph::Node* n,
} }
void Emitter::EmitMultiply(const ngraph::Node* n, void Emitter::EmitMultiply(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -191,7 +187,6 @@ void Emitter::EmitMultiply(const ngraph::Node* n, ...@@ -191,7 +187,6 @@ void Emitter::EmitMultiply(const ngraph::Node* n,
} }
void Emitter::EmitGetTupleElement(const ngraph::Node* n, void Emitter::EmitGetTupleElement(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -213,7 +208,6 @@ void Emitter::EmitGetTupleElement(const ngraph::Node* n, ...@@ -213,7 +208,6 @@ void Emitter::EmitGetTupleElement(const ngraph::Node* n,
} }
void Emitter::EmitTuple(const ngraph::Node* n, void Emitter::EmitTuple(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -239,7 +233,6 @@ void Emitter::EmitTuple(const ngraph::Node* n, ...@@ -239,7 +233,6 @@ void Emitter::EmitTuple(const ngraph::Node* n,
} }
void Emitter::EmitAbs(const ngraph::Node* n, void Emitter::EmitAbs(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -252,7 +245,6 @@ void Emitter::EmitAbs(const ngraph::Node* n, ...@@ -252,7 +245,6 @@ void Emitter::EmitAbs(const ngraph::Node* n,
} }
void Emitter::EmitConcat(const ngraph::Node* n, void Emitter::EmitConcat(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -306,7 +298,6 @@ void Emitter::EmitConcat(const ngraph::Node* n, ...@@ -306,7 +298,6 @@ void Emitter::EmitConcat(const ngraph::Node* n,
} }
void Emitter::EmitDivide(const ngraph::Node* n, void Emitter::EmitDivide(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -320,7 +311,6 @@ void Emitter::EmitDivide(const ngraph::Node* n, ...@@ -320,7 +311,6 @@ void Emitter::EmitDivide(const ngraph::Node* n,
} }
void Emitter::EmitEqual(const ngraph::Node* n, void Emitter::EmitEqual(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -334,7 +324,6 @@ void Emitter::EmitEqual(const ngraph::Node* n, ...@@ -334,7 +324,6 @@ void Emitter::EmitEqual(const ngraph::Node* n,
} }
void Emitter::EmitGreater(const ngraph::Node* n, void Emitter::EmitGreater(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -348,7 +337,6 @@ void Emitter::EmitGreater(const ngraph::Node* n, ...@@ -348,7 +337,6 @@ void Emitter::EmitGreater(const ngraph::Node* n,
} }
void Emitter::EmitGreaterEq(const ngraph::Node* n, void Emitter::EmitGreaterEq(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -362,7 +350,6 @@ void Emitter::EmitGreaterEq(const ngraph::Node* n, ...@@ -362,7 +350,6 @@ void Emitter::EmitGreaterEq(const ngraph::Node* n,
} }
void Emitter::EmitLess(const ngraph::Node* n, void Emitter::EmitLess(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -376,7 +363,6 @@ void Emitter::EmitLess(const ngraph::Node* n, ...@@ -376,7 +363,6 @@ void Emitter::EmitLess(const ngraph::Node* n,
} }
void Emitter::EmitLessEq(const ngraph::Node* n, void Emitter::EmitLessEq(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -390,7 +376,6 @@ void Emitter::EmitLessEq(const ngraph::Node* n, ...@@ -390,7 +376,6 @@ void Emitter::EmitLessEq(const ngraph::Node* n,
} }
void Emitter::EmitLog(const ngraph::Node* n, void Emitter::EmitLog(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -403,7 +388,6 @@ void Emitter::EmitLog(const ngraph::Node* n, ...@@ -403,7 +388,6 @@ void Emitter::EmitLog(const ngraph::Node* n,
} }
void Emitter::EmitMaximum(const ngraph::Node* n, void Emitter::EmitMaximum(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -417,7 +401,6 @@ void Emitter::EmitMaximum(const ngraph::Node* n, ...@@ -417,7 +401,6 @@ void Emitter::EmitMaximum(const ngraph::Node* n,
} }
void Emitter::EmitMinimum(const ngraph::Node* n, void Emitter::EmitMinimum(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -431,7 +414,6 @@ void Emitter::EmitMinimum(const ngraph::Node* n, ...@@ -431,7 +414,6 @@ void Emitter::EmitMinimum(const ngraph::Node* n,
} }
void Emitter::EmitNegative(const ngraph::Node* n, void Emitter::EmitNegative(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -444,7 +426,6 @@ void Emitter::EmitNegative(const ngraph::Node* n, ...@@ -444,7 +426,6 @@ void Emitter::EmitNegative(const ngraph::Node* n,
} }
void Emitter::EmitNotEqual(const ngraph::Node* n, void Emitter::EmitNotEqual(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -458,7 +439,6 @@ void Emitter::EmitNotEqual(const ngraph::Node* n, ...@@ -458,7 +439,6 @@ void Emitter::EmitNotEqual(const ngraph::Node* n,
} }
void Emitter::EmitSelect(const ngraph::Node* n, void Emitter::EmitSelect(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -473,7 +453,6 @@ void Emitter::EmitSelect(const ngraph::Node* n, ...@@ -473,7 +453,6 @@ void Emitter::EmitSelect(const ngraph::Node* n,
} }
void Emitter::EmitSubtract(const ngraph::Node* n, void Emitter::EmitSubtract(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -487,7 +466,6 @@ void Emitter::EmitSubtract(const ngraph::Node* n, ...@@ -487,7 +466,6 @@ void Emitter::EmitSubtract(const ngraph::Node* n,
} }
void Emitter::EmitParameterizedConstantBool(const ngraph::Node* n, void Emitter::EmitParameterizedConstantBool(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -546,7 +524,6 @@ static string format_float_as_string(float value) ...@@ -546,7 +524,6 @@ static string format_float_as_string(float value)
} }
void Emitter::EmitParameterizedConstantFloat32(const ngraph::Node* n, void Emitter::EmitParameterizedConstantFloat32(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -583,7 +560,6 @@ void Emitter::EmitParameterizedConstantFloat32(const ngraph::Node* n, ...@@ -583,7 +560,6 @@ void Emitter::EmitParameterizedConstantFloat32(const ngraph::Node* n,
} }
void Emitter::EmitParameterizedConstantInt8(const ngraph::Node* n, void Emitter::EmitParameterizedConstantInt8(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -620,7 +596,6 @@ void Emitter::EmitParameterizedConstantInt8(const ngraph::Node* n, ...@@ -620,7 +596,6 @@ void Emitter::EmitParameterizedConstantInt8(const ngraph::Node* n,
} }
void Emitter::EmitParameterizedConstantInt32(const ngraph::Node* n, void Emitter::EmitParameterizedConstantInt32(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -657,7 +632,6 @@ void Emitter::EmitParameterizedConstantInt32(const ngraph::Node* n, ...@@ -657,7 +632,6 @@ void Emitter::EmitParameterizedConstantInt32(const ngraph::Node* n,
} }
void Emitter::EmitParameterizedConstantInt64(const ngraph::Node* n, void Emitter::EmitParameterizedConstantInt64(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -694,7 +668,6 @@ void Emitter::EmitParameterizedConstantInt64(const ngraph::Node* n, ...@@ -694,7 +668,6 @@ void Emitter::EmitParameterizedConstantInt64(const ngraph::Node* n,
} }
void Emitter::EmitParameterizedConstantUInt8(const ngraph::Node* n, void Emitter::EmitParameterizedConstantUInt8(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -731,7 +704,6 @@ void Emitter::EmitParameterizedConstantUInt8(const ngraph::Node* n, ...@@ -731,7 +704,6 @@ void Emitter::EmitParameterizedConstantUInt8(const ngraph::Node* n,
} }
void Emitter::EmitParameterizedConstantUInt32(const ngraph::Node* n, void Emitter::EmitParameterizedConstantUInt32(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -768,7 +740,6 @@ void Emitter::EmitParameterizedConstantUInt32(const ngraph::Node* n, ...@@ -768,7 +740,6 @@ void Emitter::EmitParameterizedConstantUInt32(const ngraph::Node* n,
} }
void Emitter::EmitParameterizedConstantUInt64(const ngraph::Node* n, void Emitter::EmitParameterizedConstantUInt64(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -805,7 +776,6 @@ void Emitter::EmitParameterizedConstantUInt64(const ngraph::Node* n, ...@@ -805,7 +776,6 @@ void Emitter::EmitParameterizedConstantUInt64(const ngraph::Node* n,
} }
void Emitter::EmitBroadcast(const ngraph::Node* n, void Emitter::EmitBroadcast(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -880,7 +850,6 @@ void Emitter::EmitBroadcast(const ngraph::Node* n, ...@@ -880,7 +850,6 @@ void Emitter::EmitBroadcast(const ngraph::Node* n,
} }
void Emitter::EmitConvert(const ngraph::Node* n, void Emitter::EmitConvert(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -904,7 +873,6 @@ void Emitter::EmitConvert(const ngraph::Node* n, ...@@ -904,7 +873,6 @@ void Emitter::EmitConvert(const ngraph::Node* n,
} }
void Emitter::EmitConstant(const ngraph::Node* n, void Emitter::EmitConstant(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -926,7 +894,6 @@ void Emitter::EmitConstant(const ngraph::Node* n, ...@@ -926,7 +894,6 @@ void Emitter::EmitConstant(const ngraph::Node* n,
} }
void Emitter::EmitReshape(const ngraph::Node* n, void Emitter::EmitReshape(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -1009,7 +976,6 @@ void Emitter::EmitReshape(const ngraph::Node* n, ...@@ -1009,7 +976,6 @@ void Emitter::EmitReshape(const ngraph::Node* n,
} }
void Emitter::EmitFunctionCall(const ngraph::Node* n, void Emitter::EmitFunctionCall(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -1030,7 +996,6 @@ void Emitter::EmitFunctionCall(const ngraph::Node* n, ...@@ -1030,7 +996,6 @@ void Emitter::EmitFunctionCall(const ngraph::Node* n,
// to what's seen there (for now atleast) // to what's seen there (for now atleast)
void Emitter::EmitReduce(const ngraph::Node* n, void Emitter::EmitReduce(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -1118,8 +1083,8 @@ void Emitter::EmitReduce(const ngraph::Node* n, ...@@ -1118,8 +1083,8 @@ void Emitter::EmitReduce(const ngraph::Node* n,
TU.indent++; TU.indent++;
TU << "\n"; TU << "\n";
TU << type << " result;\n"; TU << type << " result;\n";
TU << "std::vector<void*> inputs = {&x, &y};\n"; TU << "void* inputs[] = {&x, &y};\n";
TU << "std::vector<void*> outputs = {&result};\n"; TU << "void* outputs[] = {&result};\n";
TU << reduction_function->get_name() << "(inputs, outputs);\n"; TU << reduction_function->get_name() << "(inputs, outputs);\n";
TU << "return result;\n"; TU << "return result;\n";
TU.indent--; TU.indent--;
...@@ -1154,8 +1119,8 @@ void Emitter::EmitReduce(const ngraph::Node* n, ...@@ -1154,8 +1119,8 @@ void Emitter::EmitReduce(const ngraph::Node* n,
TU.indent++; TU.indent++;
TU << "\n"; TU << "\n";
TU << type << " result;\n"; TU << type << " result;\n";
TU << "std::vector<void*> inputs = {&x, &y};\n"; TU << "void* inputs[] = {&x, &y};\n";
TU << "std::vector<void*> outputs = {&result};\n"; TU << "void* outputs[] = {&result};\n";
TU << reduction_function->get_name() << "(inputs, outputs);\n"; TU << reduction_function->get_name() << "(inputs, outputs);\n";
TU << "return result;\n"; TU << "return result;\n";
TU.indent--; TU.indent--;
...@@ -1186,8 +1151,8 @@ void Emitter::EmitReduce(const ngraph::Node* n, ...@@ -1186,8 +1151,8 @@ void Emitter::EmitReduce(const ngraph::Node* n,
TU.indent++; TU.indent++;
TU << "\n"; TU << "\n";
TU << type << " result;\n"; TU << type << " result;\n";
TU << "std::vector<void*> inputs = {&x, &y};\n"; TU << "void* inputs[] = {&x, &y};\n";
TU << "std::vector<void*> outputs = {&result};\n"; TU << "void* outputs[] = {&result};\n";
TU << reduction_function->get_name() << "(inputs, outputs);\n"; TU << reduction_function->get_name() << "(inputs, outputs);\n";
TU << "return result;\n"; TU << "return result;\n";
TU.indent--; TU.indent--;
...@@ -1205,7 +1170,6 @@ void Emitter::EmitReduce(const ngraph::Node* n, ...@@ -1205,7 +1170,6 @@ void Emitter::EmitReduce(const ngraph::Node* n,
} }
void Emitter::EmitSign(const ngraph::Node* n, void Emitter::EmitSign(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -1218,7 +1182,6 @@ void Emitter::EmitSign(const ngraph::Node* n, ...@@ -1218,7 +1182,6 @@ void Emitter::EmitSign(const ngraph::Node* n,
} }
void Emitter::EmitSlice(const ngraph::Node* n, void Emitter::EmitSlice(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -1288,7 +1251,6 @@ void Emitter::EmitSlice(const ngraph::Node* n, ...@@ -1288,7 +1251,6 @@ void Emitter::EmitSlice(const ngraph::Node* n,
} }
void Emitter::EmitSum(const ngraph::Node* n, void Emitter::EmitSum(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -1359,7 +1321,6 @@ void Emitter::EmitSum(const ngraph::Node* n, ...@@ -1359,7 +1321,6 @@ void Emitter::EmitSum(const ngraph::Node* n,
} }
void Emitter::EmitExp(const ngraph::Node* n, void Emitter::EmitExp(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -1372,7 +1333,6 @@ void Emitter::EmitExp(const ngraph::Node* n, ...@@ -1372,7 +1333,6 @@ void Emitter::EmitExp(const ngraph::Node* n,
} }
void Emitter::EmitSin(const ngraph::Node* n, void Emitter::EmitSin(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -1385,7 +1345,6 @@ void Emitter::EmitSin(const ngraph::Node* n, ...@@ -1385,7 +1345,6 @@ void Emitter::EmitSin(const ngraph::Node* n,
} }
void Emitter::EmitSinh(const ngraph::Node* n, void Emitter::EmitSinh(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -1398,7 +1357,6 @@ void Emitter::EmitSinh(const ngraph::Node* n, ...@@ -1398,7 +1357,6 @@ void Emitter::EmitSinh(const ngraph::Node* n,
} }
void Emitter::EmitCos(const ngraph::Node* n, void Emitter::EmitCos(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -1411,7 +1369,6 @@ void Emitter::EmitCos(const ngraph::Node* n, ...@@ -1411,7 +1369,6 @@ void Emitter::EmitCos(const ngraph::Node* n,
} }
void Emitter::EmitCosh(const ngraph::Node* n, void Emitter::EmitCosh(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -1424,7 +1381,6 @@ void Emitter::EmitCosh(const ngraph::Node* n, ...@@ -1424,7 +1381,6 @@ void Emitter::EmitCosh(const ngraph::Node* n,
} }
void Emitter::EmitTan(const ngraph::Node* n, void Emitter::EmitTan(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -1437,7 +1393,6 @@ void Emitter::EmitTan(const ngraph::Node* n, ...@@ -1437,7 +1393,6 @@ void Emitter::EmitTan(const ngraph::Node* n,
} }
void Emitter::EmitTanh(const ngraph::Node* n, void Emitter::EmitTanh(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -1457,7 +1412,6 @@ void Emitter::EmitTanh(const ngraph::Node* n, ...@@ -1457,7 +1412,6 @@ void Emitter::EmitTanh(const ngraph::Node* n,
} }
void Emitter::EmitAsin(const ngraph::Node* n, void Emitter::EmitAsin(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -1470,7 +1424,6 @@ void Emitter::EmitAsin(const ngraph::Node* n, ...@@ -1470,7 +1424,6 @@ void Emitter::EmitAsin(const ngraph::Node* n,
} }
void Emitter::EmitAcos(const ngraph::Node* n, void Emitter::EmitAcos(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -1483,7 +1436,6 @@ void Emitter::EmitAcos(const ngraph::Node* n, ...@@ -1483,7 +1436,6 @@ void Emitter::EmitAcos(const ngraph::Node* n,
} }
void Emitter::EmitAtan(const ngraph::Node* n, void Emitter::EmitAtan(const ngraph::Node* n,
ExternalFunction* ef,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
{ {
...@@ -1516,13 +1468,13 @@ void Emitter::generate_call(const std::vector<TensorViewInfo>& inputs, ...@@ -1516,13 +1468,13 @@ void Emitter::generate_call(const std::vector<TensorViewInfo>& inputs,
output_names.push_back(output.get_tensor().get_name()); output_names.push_back(output.get_tensor().get_name());
} }
TU << "std::vector<void*> inputs =\n{"; TU << "void* inputs[] =\n{";
TU.indent++; TU.indent++;
TU << "\n" << join(input_names, ",\n"); TU << "\n" << join(input_names, ",\n");
TU.indent--; TU.indent--;
TU << "\n};\n"; TU << "\n};\n";
TU << "std::vector<void*> outputs =\n{"; TU << "void* outputs[] =\n{";
TU.indent++; TU.indent++;
TU << "\n" << join(output_names, ",\n"); TU << "\n" << join(output_names, ",\n");
TU.indent--; TU.indent--;
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#define EMITTER_DECL(E) \ #define EMITTER_DECL(E) \
E(const ngraph::Node* n, \ E(const ngraph::Node* n, \
ExternalFunction* ef, \
const std::vector<TensorViewInfo>& inputs, \ const std::vector<TensorViewInfo>& inputs, \
const std::vector<TensorViewInfo>& outputs) const std::vector<TensorViewInfo>& outputs)
......
...@@ -186,7 +186,6 @@ void ExternalFunction::compile() ...@@ -186,7 +186,6 @@ void ExternalFunction::compile()
TU += TU +=
R"(// Generated by the NGraph CPU backend R"(// Generated by the NGraph CPU backend
#include <cmath> #include <cmath>
#include <vector>
#include <Eigen/Dense> #include <Eigen/Dense>
...@@ -202,17 +201,14 @@ using namespace ngraph::runtime::cpu::eigen; ...@@ -202,17 +201,14 @@ using namespace ngraph::runtime::cpu::eigen;
TU << "// Declare all functions\n"; TU << "// Declare all functions\n";
for (shared_ptr<Function> f : pass_manager.get_state().get_functions()) for (shared_ptr<Function> f : pass_manager.get_state().get_functions())
{ {
TU << "extern \"C\" void " << f->get_name() << "(\n"; TU << "extern \"C\" void " << f->get_name() << "(void** inputs, void** outputs);\n";
TU << " const std::vector<void*>& inputs,\n";
TU << " const std::vector<void*>& outputs);\n";
} }
TU << "\n"; TU << "\n";
for (shared_ptr<Function> current_function : pass_manager.get_state().get_functions()) for (shared_ptr<Function> current_function : pass_manager.get_state().get_functions())
{ {
TU << "extern \"C\" void " << current_function->get_name() << "(\n"; TU << "extern \"C\" void " << current_function->get_name();
TU << " const std::vector<void*>& inputs,\n"; TU << "(void** inputs, void** outputs)\n";
TU << " const std::vector<void*>& outputs)\n";
TU << "{\n"; TU << "{\n";
TU.indent++; TU.indent++;
...@@ -297,7 +293,7 @@ using namespace ngraph::runtime::cpu::eigen; ...@@ -297,7 +293,7 @@ using namespace ngraph::runtime::cpu::eigen;
auto tv = output.get_tensor_view(); auto tv = output.get_tensor_view();
out.push_back({0, tv}); out.push_back({0, tv});
} }
handler->second(&emitter, node.get(), this, in, out); handler->second(&emitter, node.get(), in, out);
} }
TU.indent--; TU.indent--;
......
...@@ -41,7 +41,6 @@ namespace ngraph ...@@ -41,7 +41,6 @@ namespace ngraph
using OpFunction = std::function<void(Emitter*, using OpFunction = std::function<void(Emitter*,
const ngraph::Node*, const ngraph::Node*,
ExternalFunction*,
const std::vector<TensorViewInfo>& inputs, const std::vector<TensorViewInfo>& inputs,
const std::vector<TensorViewInfo>& outputs)>; const std::vector<TensorViewInfo>& outputs)>;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment