Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
e78fc77f
Commit
e78fc77f
authored
Jul 31, 2018
by
Paul
Browse files
Add check_context pass
parent
a48f046e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
16 deletions
+35
-16
src/include/migraph/check_context.hpp
src/include/migraph/check_context.hpp
+33
-0
src/include/migraph/operators.hpp
src/include/migraph/operators.hpp
+0
-14
src/targets/gpu/lowering.cpp
src/targets/gpu/lowering.cpp
+0
-1
src/targets/gpu/target.cpp
src/targets/gpu/target.cpp
+2
-1
No files found.
src/include/migraph/check_context.hpp
0 → 100644
View file @
e78fc77f
#ifndef MIGRAPH_GUARD_RTGLIB_CHECK_CONTEXT_HPP
#define MIGRAPH_GUARD_RTGLIB_CHECK_CONTEXT_HPP
#include <migraph/program.hpp>
namespace
migraph
{
template
<
class
T
>
struct
check_context
{
struct
op
{
std
::
string
name
()
const
{
return
"check_context"
;
}
shape
compute_shape
(
std
::
vector
<
shape
>
)
const
{
return
{};
}
argument
compute
(
context
&
ctx
,
shape
,
std
::
vector
<
argument
>
)
const
{
T
*
x
=
any_cast
<
T
>
(
&
ctx
);
if
(
x
==
nullptr
)
MIGRAPH_THROW
(
std
::
string
(
"Unexpected context type: "
)
+
ctx
.
type_id
().
name
());
return
{};
}
};
std
::
string
name
()
const
{
return
"check_context"
;
}
void
apply
(
program
&
p
)
const
{
p
.
insert_instruction
(
p
.
begin
(),
op
{});
}
};
}
// namespace migraph
#endif
src/include/migraph/operators.hpp
View file @
e78fc77f
...
@@ -491,20 +491,6 @@ struct outline
...
@@ -491,20 +491,6 @@ struct outline
argument
compute
(
context
&
,
shape
,
std
::
vector
<
argument
>
)
const
{
return
{
s
,
nullptr
};
}
argument
compute
(
context
&
,
shape
,
std
::
vector
<
argument
>
)
const
{
return
{
s
,
nullptr
};
}
};
};
template
<
class
T
>
struct
check_context
{
std
::
string
name
()
const
{
return
"check_context"
;
}
shape
compute_shape
(
std
::
vector
<
shape
>
)
const
{
return
{};
}
argument
compute
(
context
&
ctx
,
shape
,
std
::
vector
<
argument
>
)
const
{
T
*
x
=
any_cast
<
T
>
(
&
ctx
);
if
(
x
==
nullptr
)
MIGRAPH_THROW
(
std
::
string
(
"Unexpected context type: "
)
+
ctx
.
type_id
().
name
());
return
{};
}
};
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/gpu/lowering.cpp
View file @
e78fc77f
...
@@ -249,7 +249,6 @@ struct miopen_apply
...
@@ -249,7 +249,6 @@ struct miopen_apply
void
apply
()
void
apply
()
{
{
prog
->
insert_instruction
(
prog
->
begin
(),
check_context
<
context
>
{});
for
(
auto
it
=
prog
->
begin
();
it
!=
prog
->
end
();
it
++
)
for
(
auto
it
=
prog
->
begin
();
it
!=
prog
->
end
();
it
++
)
{
{
if
(
it
->
op
.
name
()
==
"convolution"
)
if
(
it
->
op
.
name
()
==
"convolution"
)
...
...
src/targets/gpu/target.cpp
View file @
e78fc77f
...
@@ -2,13 +2,14 @@
...
@@ -2,13 +2,14 @@
#include <migraph/gpu/lowering.hpp>
#include <migraph/gpu/lowering.hpp>
#include <migraph/gpu/write_literals.hpp>
#include <migraph/gpu/write_literals.hpp>
#include <migraph/gpu/context.hpp>
#include <migraph/gpu/context.hpp>
#include <migraph/check_context.hpp>
namespace
migraph
{
namespace
migraph
{
namespace
gpu
{
namespace
gpu
{
std
::
vector
<
pass
>
target
::
get_passes
(
migraph
::
context
&
)
const
std
::
vector
<
pass
>
target
::
get_passes
(
migraph
::
context
&
)
const
{
{
return
{
lowering
{},
write_literals
{}};
return
{
lowering
{},
write_literals
{}
,
check_context
<
context
>
{}
};
}
}
std
::
string
target
::
name
()
const
{
return
"miopen"
;
}
std
::
string
target
::
name
()
const
{
return
"miopen"
;
}
...
...
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