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
67536ddf
Commit
67536ddf
authored
Jul 19, 2019
by
nmostafa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
graph node lowering
parent
3a9de1bb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
compiler.cpp
src/contrib/mlir/compiler.cpp
+6
-1
ops.cpp
src/contrib/mlir/dialect/ops.cpp
+3
-3
No files found.
src/contrib/mlir/compiler.cpp
View file @
67536ddf
...
...
@@ -389,7 +389,12 @@ namespace ngraph
template
<>
mlir
::
Value
*
MLIRCompiler
::
COMPILE_OP_DECL
(
ngraph
::
op
::
Gather
)
{
return
nullptr
;
//compiler.create_gather(ng_node);
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
()));
return
result
;
}
}
}
...
...
src/contrib/mlir/dialect/ops.cpp
View file @
67536ddf
...
...
@@ -174,11 +174,11 @@ mlir::LogicalResult verifyOp(NGGatherOp* op)
Type
ty
=
op
->
input
()
->
getType
();
NGTensorType
inputType
=
ty
.
cast
<
NGTensorType
>
();
ty
=
op
->
in
put
()
->
getType
();
ty
=
op
->
in
dices
()
->
getType
();
NGTensorType
indicesType
=
ty
.
cast
<
NGTensorType
>
();
// ensure axis < params rank
if
(
op
->
axis
().
getSExtValue
()
>=
inputType
.
getRank
())
;
if
(
op
->
axis
().
getSExtValue
()
>=
inputType
.
getRank
())
return
op
->
emitOpError
(
"Gather axis is larger than input rank"
);
ty
=
indicesType
.
getElementType
();
...
...
@@ -195,7 +195,7 @@ mlir::LogicalResult verifyOp(NGGatherOp* op)
NGTensorType
resType
=
r0
.
cast
<
NGTensorType
>
();
// ensure result is compatible with input
if
(
!
resType
.
isCompatible
(
inputType
)
)
if
(
!
resType
.
getRank
()
==
inputType
.
getRank
()
+
indicesType
.
getRank
()
-
1
)
return
op
->
emitOpError
(
"Incompatible result shape and/or type"
);
return
mlir
::
success
();
...
...
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