Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
2a438ff2
Commit
2a438ff2
authored
Feb 13, 2018
by
Jaikrishnan Menon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CPU: MKLDNN build WIP
parent
00fb503f
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
119 additions
and
0 deletions
+119
-0
CMakeLists.txt
src/ngraph/CMakeLists.txt
+1
-0
cpu_external_function.cpp
src/ngraph/runtime/cpu/cpu_external_function.cpp
+2
-0
cpu_external_function.hpp
src/ngraph/runtime/cpu/cpu_external_function.hpp
+12
-0
cpu_runtime_context.hpp
src/ngraph/runtime/cpu/cpu_runtime_context.hpp
+6
-0
mkldnn_emitter.hpp
src/ngraph/runtime/cpu/mkldnn_emitter.hpp
+45
-0
mkldnn_invoke.cpp
src/ngraph/runtime/cpu/mkldnn_invoke.cpp
+21
-0
mkldnn_invoke.hpp
src/ngraph/runtime/cpu/mkldnn_invoke.hpp
+32
-0
No files found.
src/ngraph/CMakeLists.txt
View file @
2a438ff2
...
...
@@ -171,6 +171,7 @@ if (NGRAPH_CPU_ENABLE AND LLVM_INCLUDE_DIR AND
runtime/cpu/cpu_external_function.cpp
runtime/cpu/cpu_tensor_view_wrapper.cpp
runtime/cpu/cpu_tracing.cpp
runtime/cpu/mkldnn_invoke.cpp
runtime/cpu/ops/matmul_bias.cpp
runtime/cpu/pass/cpu_fusion.cpp
)
...
...
src/ngraph/runtime/cpu/cpu_external_function.cpp
View file @
2a438ff2
...
...
@@ -226,6 +226,8 @@ void runtime::cpu::CPU_ExternalFunction::compile()
string
function_name
=
m_function
->
get_name
();
mkldnn_emitter
.
reset
(
new
MKLDNNEmitter
(
shared_from_this
()));
pass
::
Manager
pass_manager
;
// For now, just make everyone row-major.
pass_manager
.
register_pass
<
pass
::
CPUFusion
>
();
...
...
src/ngraph/runtime/cpu/cpu_external_function.hpp
View file @
2a438ff2
...
...
@@ -24,12 +24,15 @@
#include <unordered_map>
#include <vector>
#include <mkldnn.hpp>
#include "ngraph/codegen/code_writer.hpp"
#include "ngraph/codegen/compiler.hpp"
#include "ngraph/codegen/execution_engine.hpp"
#include "ngraph/function.hpp"
#include "ngraph/runtime/cpu/cpu_call_frame.hpp"
#include "ngraph/runtime/cpu/cpu_tensor_view_wrapper.hpp"
#include "ngraph/runtime/cpu/mkldnn_emitter.hpp"
#include "ngraph/runtime/external_function.hpp"
namespace
ngraph
...
...
@@ -41,6 +44,7 @@ namespace ngraph
class
CPU_ExternalFunction
;
class
CPU_Emitter
;
class
CPU_CallFrame
;
class
MKLDNNEmitter
;
using
OpFunction
=
std
::
function
<
void
(
codegen
::
CodeWriter
&
,
const
ngraph
::
Node
*
,
...
...
@@ -75,6 +79,11 @@ namespace ngraph
std
::
shared_ptr
<
ngraph
::
runtime
::
CallFrame
>
make_call_frame
();
const
std
::
vector
<
OpAttributes
>&
get_op_attrs
()
const
{
return
m_op_attrs
;
}
const
std
::
vector
<
mkldnn
::
primitive
>&
get_mkldnn_primitives
()
const
{
return
m_mkldnn_primitives
;
}
protected
:
void
compile
();
...
...
@@ -107,6 +116,9 @@ namespace ngraph
bool
m_use_tbb
;
std
::
unordered_map
<
std
::
string
,
std
::
string
>
m_variable_name_map
;
std
::
vector
<
OpAttributes
>
m_op_attrs
;
std
::
vector
<
mkldnn
::
primitive
>
m_mkldnn_primitives
;
std
::
unique_ptr
<
MKLDNNEmitter
>
mkldnn_emitter
;
};
}
}
...
...
src/ngraph/runtime/cpu/cpu_runtime_context.hpp
View file @
2a438ff2
...
...
@@ -17,6 +17,11 @@
#include <chrono>
#include <cstdint>
namespace
mkldnn
{
class
primitive
;
}
namespace
ngraph
{
namespace
runtime
...
...
@@ -31,6 +36,7 @@ namespace ngraph
struct
CPURuntimeContext
{
int64_t
*
op_durations
;
mkldnn
::
primitive
*
mkldnn_primitives
;
};
}
}
...
...
src/ngraph/runtime/cpu/mkldnn_emitter.hpp
0 → 100644
View file @
2a438ff2
// ----------------------------------------------------------------------------
// Copyright 2018 Nervana Systems Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#pragma once
#include <memory>
#include "ngraph/codegen/code_writer.hpp"
#include "ngraph/shape.hpp"
namespace
ngraph
{
namespace
runtime
{
namespace
cpu
{
class
CPU_ExternalFunction
;
class
MKLDNNEmitter
{
public
:
MKLDNNEmitter
(
std
::
shared_ptr
<
CPU_ExternalFunction
>
ef
)
:
external_function
(
ef
)
{
}
void
build_memory_descriptor
();
private
:
std
::
shared_ptr
<
CPU_ExternalFunction
>
external_function
;
};
}
}
}
src/ngraph/runtime/cpu/mkldnn_invoke.cpp
0 → 100644
View file @
2a438ff2
// ----------------------------------------------------------------------------
// Copyright 2018 Nervana Systems Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include "mkldnn_invoke.hpp"
extern
"C"
void
ngraph
::
runtime
::
cpu
::
mkldnn_utils
::
mkldnn_invoke_primitive
(
CPURuntimeContext
*
ctx
,
unsigned
int
primitive_index
)
{
}
src/ngraph/runtime/cpu/mkldnn_invoke.hpp
0 → 100644
View file @
2a438ff2
// ----------------------------------------------------------------------------
// Copyright 2018 Nervana Systems Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#pragma once
namespace
ngraph
{
namespace
runtime
{
namespace
cpu
{
struct
CPURuntimeContext
;
namespace
mkldnn_utils
{
extern
"C"
void
mkldnn_invoke_primitive
(
CPURuntimeContext
*
ctx
,
unsigned
int
primitive_index
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment