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
aeacd4e3
Commit
aeacd4e3
authored
Jul 20, 2019
by
nmostafa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style-apply
parent
33ec9a8b
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
19 deletions
+16
-19
compiler.cpp
src/contrib/mlir/compiler.cpp
+12
-13
compiler.hpp
src/contrib/mlir/compiler.hpp
+1
-1
ops.cpp
src/contrib/mlir/dialect/ops.cpp
+0
-0
lowerer.cpp
src/contrib/mlir/lowerer.cpp
+3
-4
mlir_subgraph_extraction.cpp
src/contrib/mlir/pass/mlir_subgraph_extraction.cpp
+0
-1
No files found.
src/contrib/mlir/compiler.cpp
View file @
aeacd4e3
...
...
@@ -360,7 +360,8 @@ namespace ngraph
auto
*
idx_red
=
static_cast
<
const
ngraph
::
op
::
util
::
IndexReduction
*>
(
ng_node
);
mlir
::
Value
*
result
=
compiler
.
create_generic_op
<
mlir
::
NGArgMaxRedOp
>
(
ng_node
);
mlir
::
Operation
*
op
=
result
->
getDefiningOp
();
mlir
::
ArrayAttr
red_axes_attr
=
compiler
.
m_builder
->
getI64ArrayAttr
({(
int64_t
)
idx_red
->
get_reduction_axis
()});
mlir
::
ArrayAttr
red_axes_attr
=
compiler
.
m_builder
->
getI64ArrayAttr
({(
int64_t
)
idx_red
->
get_reduction_axis
()});
op
->
setAttr
(
"axes"
,
red_axes_attr
);
return
result
;
}
...
...
@@ -371,7 +372,8 @@ namespace ngraph
auto
*
idx_red
=
static_cast
<
const
ngraph
::
op
::
util
::
IndexReduction
*>
(
ng_node
);
mlir
::
Value
*
result
=
compiler
.
create_generic_op
<
mlir
::
NGArgMinRedOp
>
(
ng_node
);
mlir
::
Operation
*
op
=
result
->
getDefiningOp
();
mlir
::
ArrayAttr
red_axes_attr
=
compiler
.
m_builder
->
getI64ArrayAttr
({(
int64_t
)
idx_red
->
get_reduction_axis
()});
mlir
::
ArrayAttr
red_axes_attr
=
compiler
.
m_builder
->
getI64ArrayAttr
({(
int64_t
)
idx_red
->
get_reduction_axis
()});
op
->
setAttr
(
"axes"
,
red_axes_attr
);
return
result
;
}
...
...
@@ -382,7 +384,9 @@ namespace ngraph
auto
ng_node_concat
=
static_cast
<
const
ngraph
::
op
::
Concat
*>
(
ng_node
);
mlir
::
Value
*
result
=
compiler
.
create_generic_op
<
mlir
::
NGConcatOp
>
(
ng_node
);
mlir
::
Operation
*
op
=
result
->
getDefiningOp
();
op
->
setAttr
(
"concatenation_axis"
,
compiler
.
m_builder
->
getI64IntegerAttr
(
ng_node_concat
->
get_concatenation_axis
()));
op
->
setAttr
(
"concatenation_axis"
,
compiler
.
m_builder
->
getI64IntegerAttr
(
ng_node_concat
->
get_concatenation_axis
()));
return
result
;
}
...
...
@@ -392,9 +396,9 @@ namespace ngraph
auto
ng_node_gather
=
static_cast
<
const
ngraph
::
op
::
Gather
*>
(
ng_node
);
mlir
::
Value
*
result
=
compiler
.
create_generic_op
<
mlir
::
NGGatherOp
>
(
ng_node
);
mlir
::
Operation
*
op
=
result
->
getDefiningOp
();
op
->
setAttr
(
"axis"
,
compiler
.
m_builder
->
getI64IntegerAttr
(
ng_node_gather
->
get_axis
()));
op
->
setAttr
(
"axis"
,
compiler
.
m_builder
->
getI64IntegerAttr
(
ng_node_gather
->
get_axis
()));
return
result
;
}
}
}
...
...
@@ -418,16 +422,11 @@ mlir::Value* MLIRCompiler::create_generic_op(const ngraph::Node* ng_node)
}
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 */
}).
getResult
();
->
create
<
Op
,
ArrayRef
<
mlir
::
Type
>
,
ArrayRef
<
mlir
::
Value
*>
,
ArrayRef
<
mlir
::
NamedAttribute
>>
(
mlir
::
UnknownLoc
::
get
(
&
m_context
),
res_types
,
arg_values
,
{
/* no attrs */
})
.
getResult
();
}
const
MLIRCompiler
::
MLIRCompOpMap
MLIRCompiler
::
op_dispatcher
{
#define MLIR_OP(OP) {TI(ngraph::op::OP), &MLIRCompiler::create_op<ngraph::op::OP>},
#include "ops_supported.inc"
...
...
src/contrib/mlir/compiler.hpp
View file @
aeacd4e3
...
...
@@ -98,7 +98,7 @@ namespace ngraph
void
build_ng_dialect
();
template
<
typename
Op
>
template
<
typename
Op
>
static
mlir
::
Value
*
create_op
(
MLIRCompiler
&
compiler
,
const
ngraph
::
Node
*
ng_node
)
{
throw
std
::
runtime_error
(
"Unimplemented op '"
+
ng_node
->
description
()
+
...
...
src/contrib/mlir/dialect/ops.cpp
View file @
aeacd4e3
src/contrib/mlir/lowerer.cpp
View file @
aeacd4e3
...
...
@@ -681,13 +681,12 @@ namespace
paramsUbs
.
push_back
(
IndexHandle
(
vParams
.
ub
(
i
)));
paramsSteps
.
push_back
(
vParams
.
step
(
i
));
}
NGRAPH_CHECK
(
paramsLbs
.
size
()
==
vParams
.
rank
()
-
1
&&
NGRAPH_CHECK
(
paramsLbs
.
size
()
==
vParams
.
rank
()
-
1
&&
paramsUbs
.
size
()
==
paramsLbs
.
size
()
&&
paramsSteps
.
size
()
==
paramsLbs
.
size
(),
"Incorrect loop nest bounds size for gather params"
);
paramsIVs
=
IndexHandle
::
makeIndexHandles
(
vParams
.
rank
()
-
1
);
paramsIVs
=
IndexHandle
::
makeIndexHandles
(
vParams
.
rank
()
-
1
);
paramsIVPtrs
=
IndexHandle
::
makeIndexHandlePointers
(
paramsIVs
);
auto
indicesLbs
=
vIndices
.
getLbs
();
...
...
@@ -772,7 +771,7 @@ namespace
}
#undef REWRITER
/// End of pattern matchers
/// End of pattern matchers
template
<
typename
OP
>
void
lower_binary_elementwise
(
Operation
*
op
,
ArrayRef
<
Value
*>
operands
,
...
...
src/contrib/mlir/pass/mlir_subgraph_extraction.cpp
View file @
aeacd4e3
...
...
@@ -39,7 +39,6 @@ using namespace ngraph::descriptor;
using
namespace
ngraph
::
op
;
using
namespace
ngraph
::
pass
;
#define TI(x) std::type_index(typeid(x))
int
MLIRSubgraphExtractionPass
::
MLIRSubgraph
::
m_curr_graph_id
=
0
;
...
...
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