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
75bb9a6f
Commit
75bb9a6f
authored
Jul 10, 2023
by
Khalique Ahmed
Browse files
formatting
parent
eb0c5099
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
18 deletions
+18
-18
src/auto_contiguous.cpp
src/auto_contiguous.cpp
+2
-1
src/eliminate_layout.cpp
src/eliminate_layout.cpp
+11
-11
src/layout_nhwc.cpp
src/layout_nhwc.cpp
+3
-4
src/targets/gpu/kernels/include/migraphx/kernels/math.hpp
src/targets/gpu/kernels/include/migraphx/kernels/math.hpp
+2
-2
No files found.
src/auto_contiguous.cpp
View file @
75bb9a6f
...
...
@@ -65,7 +65,8 @@ void auto_contiguous::apply(module& m) const
if
(
ins
->
outputs
().
empty
()
and
ins
!=
last
)
continue
;
shape
s
=
ins
->
get_shape
();
if
((
ins
->
name
()
==
"pooling"
or
ins
->
name
()
==
"dot"
)
and
not
s
.
dynamic
()
and
not
s
.
standard
()
and
s
.
elements
()
!=
0
)
if
((
ins
->
name
()
==
"pooling"
or
ins
->
name
()
==
"dot"
)
and
not
s
.
dynamic
()
and
not
s
.
standard
()
and
s
.
elements
()
!=
0
)
{
auto
c
=
m
.
insert_instruction
(
std
::
next
(
ins
),
make_op
(
"contiguous"
),
ins
);
m
.
replace_instruction
(
ins
,
c
);
...
...
src/eliminate_layout.cpp
View file @
75bb9a6f
...
...
@@ -129,9 +129,9 @@ void remove_layout(module& m)
// m.debug_print(convs[i]->outputs().front());
// m.debug_print(convs[i]->outputs().front()->outputs().front());
// m.replace_instruction(convs[i]->outputs().front(),
convs[i]->outputs().front()->outputs().front());
// std::cout << "HERE" <<
std::endl;
// m.debug_print(convs[i]->outputs().front());
// m.replace_instruction(convs[i]->outputs().front(),
//
convs[i]->outputs().front()->outputs().front());
std::cout << "HERE" <<
//
std::endl;
m.debug_print(convs[i]->outputs().front());
// // m.debug_print(convs[i]->outputs().front());
// // m.debug_print(convs[i]->outputs().front()->outputs().front());
...
...
@@ -148,8 +148,8 @@ void remove_layout(module& m)
// std::cout << "HERE2" << std::endl;
// continue;
// }
// m.replace_instruction(convs[i + 1]->inputs()[j], convs[i +
1]->inputs()[j]->inputs().front());
// m.debug_print(convs[i+1]);
// m.replace_instruction(convs[i + 1]->inputs()[j], convs[i +
//
1]->inputs()[j]->inputs().front());
m.debug_print(convs[i+1]);
// }
// break;
// }
...
...
@@ -159,7 +159,6 @@ void remove_layout(module& m)
// }
// }
// void remove_layout(module& m, const std::unordered_set<instruction_ref>& output_layouts)
// {
// for(auto ins : iterator_for(m))
...
...
@@ -178,8 +177,8 @@ void remove_layout(module& m)
// m.debug_print(ins);
// if(ins->get_shape() != ins->inputs().front()->get_shape())
// {
// std::cout << ins->get_shape() << " " << ins->inputs().front()->get_shape() <<
std::endl;
// continue;
// std::cout << ins->get_shape() << " " << ins->inputs().front()->get_shape() <<
//
std::endl;
continue;
// }
// if(contains(output_layouts, ins))
// continue;
...
...
@@ -190,8 +189,9 @@ void remove_layout(module& m)
void
eliminate_layout
::
apply
(
module_pass_manager
&
mpm
)
const
{
// std::unordered_set<instruction_ref> output_layouts = preserve_output_layout(mpm.get_module());
// remove_layout(mpm.get_module(), find_convs(mpm.get_module()));
// std::unordered_set<instruction_ref> output_layouts =
// preserve_output_layout(mpm.get_module()); remove_layout(mpm.get_module(),
// find_convs(mpm.get_module()));
remove_layout
(
mpm
.
get_module
());
mpm
.
run_pass
(
dead_code_elimination
{});
}
...
...
src/layout_nhwc.cpp
View file @
75bb9a6f
...
...
@@ -99,9 +99,8 @@ void transform_convolutions(module& m, bool skip_elim_contiguous)
auto
conv
=
m
.
insert_instruction
(
ins
,
ins
->
get_operator
(),
args
);
// m.debug_print(conv);
// auto c = conv;
// auto nchw = m.insert_instruction(ins, make_op("layout", {{"permutation", {0, 1, 2, 3}}}), conv);
// m.debug_print();
// if(not skip_elim_contiguous)
// auto nchw = m.insert_instruction(ins, make_op("layout", {{"permutation", {0, 1, 2, 3}}}),
// conv); m.debug_print(); if(not skip_elim_contiguous)
// c = m.insert_instruction(ins, make_op("contiguous"), conv);
m
.
replace_instruction
(
ins
,
conv
);
}
...
...
src/targets/gpu/kernels/include/migraphx/kernels/math.hpp
View file @
75bb9a6f
...
...
@@ -188,8 +188,8 @@ MIGRAPHX_DEVICE_MATH_BINARY_FOR(float, max, ::max)
MIGRAPHX_DEVICE_MATH_BINARY_FOR
(
float
,
min
,
::
min
)
MIGRAPHX_DEVICE_MATH_BINARY_FOR
(
double
,
max
,
::
max
)
MIGRAPHX_DEVICE_MATH_BINARY_FOR
(
double
,
min
,
::
min
)
MIGRAPHX_DEVICE_MATH_BINARY_FOR
(
migraphx
::
half
,
max
,
::
f
max
f
)
MIGRAPHX_DEVICE_MATH_BINARY_FOR
(
migraphx
::
half
,
min
,
::
f
min
f
)
MIGRAPHX_DEVICE_MATH_BINARY_FOR
(
migraphx
::
half
,
max
,
::
__h
max
)
MIGRAPHX_DEVICE_MATH_BINARY_FOR
(
migraphx
::
half
,
min
,
::
__h
min
)
template
<
class
T
,
MIGRAPHX_REQUIRES
(
not
is_any_vec
<
T
>())
>
constexpr
auto
max
(
const
T
&
a
,
const
T
&
b
)
...
...
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