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
05ca1e02
Commit
05ca1e02
authored
Jul 23, 2019
by
nmostafa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style-apply
parent
2243df56
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
compiler.cpp
src/contrib/mlir/compiler.cpp
+10
-7
compiler.hpp
src/contrib/mlir/compiler.hpp
+2
-1
No files found.
src/contrib/mlir/compiler.cpp
View file @
05ca1e02
...
...
@@ -286,7 +286,7 @@ void MLIRCompiler::build_ng_dialect()
}
mlir
::
Operation
*
op
=
it
->
second
(
*
this
,
np
.
get
());
// This assumes simple 1:1 mapping between output edges and generated MLIR op results
// If the mapping is more complex, the create_op helper can return null operation
// If the mapping is more complex, the create_op helper can return null operation
// and handles populating the value map itself
if
(
op
)
{
...
...
@@ -381,8 +381,8 @@ namespace ngraph
auto
ng_node_concat
=
static_cast
<
const
ngraph
::
op
::
Concat
*>
(
ng_node
);
auto
op
=
compiler
.
create_generic_op
<
mlir
::
NGConcatOp
>
(
ng_node
);
op
->
setAttr
(
"concatenation_axis"
,
compiler
.
m_builder
->
getI64IntegerAttr
(
ng_node_concat
->
get_concatenation_axis
()));
compiler
.
m_builder
->
getI64IntegerAttr
(
ng_node_concat
->
get_concatenation_axis
()));
return
op
;
}
...
...
@@ -392,7 +392,7 @@ namespace ngraph
auto
ng_node_gather
=
static_cast
<
const
ngraph
::
op
::
Gather
*>
(
ng_node
);
auto
op
=
compiler
.
create_generic_op
<
mlir
::
NGGatherOp
>
(
ng_node
);
op
->
setAttr
(
"axis"
,
compiler
.
m_builder
->
getI64IntegerAttr
(
ng_node_gather
->
get_axis
()));
compiler
.
m_builder
->
getI64IntegerAttr
(
ng_node_gather
->
get_axis
()));
return
op
;
}
}
...
...
@@ -416,9 +416,12 @@ mlir::Operation* MLIRCompiler::create_generic_op(const ngraph::Node* ng_node)
res_types
.
push_back
(
get_mlir_type
(
output
.
get_tensor_ptr
().
get
()));
}
return
(
m_builder
->
create
<
Op
,
ArrayRef
<
mlir
::
Type
>
,
ArrayRef
<
mlir
::
Value
*>
,
ArrayRef
<
mlir
::
NamedAttribute
>>
(
mlir
::
UnknownLoc
::
get
(
&
m_context
),
res_types
,
arg_values
,
{
/* no attrs */
})).
getOperation
();
return
(
m_builder
->
create
<
Op
,
ArrayRef
<
mlir
::
Type
>
,
ArrayRef
<
mlir
::
Value
*>
,
ArrayRef
<
mlir
::
NamedAttribute
>>
(
mlir
::
UnknownLoc
::
get
(
&
m_context
),
res_types
,
arg_values
,
{
/* no attrs */
}))
.
getOperation
();
}
const
MLIRCompiler
::
MLIRCompOpMap
MLIRCompiler
::
op_dispatcher
{
...
...
src/contrib/mlir/compiler.hpp
View file @
05ca1e02
...
...
@@ -99,7 +99,8 @@ namespace ngraph
void
build_ng_dialect
();
template
<
typename
Op
>
static
mlir
::
Operation
*
create_op
(
MLIRCompiler
&
compiler
,
const
ngraph
::
Node
*
ng_node
)
static
mlir
::
Operation
*
create_op
(
MLIRCompiler
&
compiler
,
const
ngraph
::
Node
*
ng_node
)
{
throw
std
::
runtime_error
(
"Unimplemented op '"
+
ng_node
->
description
()
+
"' in MLIR Compiler"
);
...
...
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