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
c4658e53
Commit
c4658e53
authored
Sep 17, 2022
by
Paul
Browse files
Use module_pass_manager
parent
c055fda8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
10 deletions
+11
-10
src/include/migraphx/layout_nhwc.hpp
src/include/migraphx/layout_nhwc.hpp
+2
-2
src/layout_nhwc.cpp
src/layout_nhwc.cpp
+9
-8
No files found.
src/include/migraphx/layout_nhwc.hpp
View file @
c4658e53
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
struct
module
;
struct
module
_pass_manager
;
/**
/**
* Transform convolutions to nhwc
* Transform convolutions to nhwc
...
@@ -16,7 +16,7 @@ struct module;
...
@@ -16,7 +16,7 @@ struct module;
struct
layout_nhwc
struct
layout_nhwc
{
{
std
::
string
name
()
const
{
return
"layout_nhwc"
;
}
std
::
string
name
()
const
{
return
"layout_nhwc"
;
}
void
apply
(
module
&
m
)
const
;
void
apply
(
module
_pass_manager
&
m
)
const
;
};
};
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
...
...
src/layout_nhwc.cpp
View file @
c4658e53
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/eliminate_contiguous.hpp>
#include <migraphx/eliminate_contiguous.hpp>
#include <migraphx/dead_code_elimination.hpp>
#include <migraphx/dead_code_elimination.hpp>
#include <migraphx/pass_manager.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
...
@@ -78,15 +79,15 @@ void remove_layout(module& m, const std::unordered_set<instruction_ref>& output_
...
@@ -78,15 +79,15 @@ void remove_layout(module& m, const std::unordered_set<instruction_ref>& output_
}
}
}
}
void
layout_nhwc
::
apply
(
module
&
m
)
const
void
layout_nhwc
::
apply
(
module
_pass_manager
&
mp
m
)
const
{
{
std
::
unordered_set
<
instruction_ref
>
output_layouts
=
preserve_output_layout
(
m
);
std
::
unordered_set
<
instruction_ref
>
output_layouts
=
preserve_output_layout
(
m
pm
.
get_module
()
);
transform_convolutions
(
m
);
transform_convolutions
(
m
pm
.
get_module
()
);
dead_code_elimination
{}
.
apply
(
m
);
mpm
.
run_pass
(
dead_code_elimination
{});
eliminate_contiguous
{
"contiguous"
}
.
apply
(
m
);
mpm
.
run_pass
(
eliminate_contiguous
{
"contiguous"
});
dead_code_elimination
{}
.
apply
(
m
);
mpm
.
run_pass
(
dead_code_elimination
{});
remove_layout
(
m
,
output_layouts
);
remove_layout
(
m
pm
.
get_module
()
,
output_layouts
);
dead_code_elimination
{}
.
apply
(
m
);
mpm
.
run_pass
(
dead_code_elimination
{});
}
}
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
...
...
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