Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
8e832756
Commit
8e832756
authored
May 31, 2022
by
Paul
Browse files
Rename var
parent
a7a4cd04
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
src/eliminate_contiguous.cpp
src/eliminate_contiguous.cpp
+7
-7
No files found.
src/eliminate_contiguous.cpp
View file @
8e832756
...
@@ -74,7 +74,7 @@ template <class F>
...
@@ -74,7 +74,7 @@ template <class F>
static
void
remove_contiguous
(
const
std
::
string
&
op_name
,
module
&
m
,
F
f
)
static
void
remove_contiguous
(
const
std
::
string
&
op_name
,
module
&
m
,
F
f
)
{
{
auto
last
=
std
::
prev
(
m
.
end
());
auto
last
=
std
::
prev
(
m
.
end
());
std
::
vector
<
instruction_ref
>
const_instruction
;
std
::
vector
<
instruction_ref
>
const_instruction
s
;
for
(
auto
ins
:
iterator_for
(
m
))
for
(
auto
ins
:
iterator_for
(
m
))
{
{
...
@@ -112,24 +112,24 @@ static void remove_contiguous(const std::string& op_name, module& m, F f)
...
@@ -112,24 +112,24 @@ static void remove_contiguous(const std::string& op_name, module& m, F f)
}
}
else
if
(
prev
->
can_eval
())
else
if
(
prev
->
can_eval
())
{
{
const_instruction
.
push_back
(
arg
);
const_instruction
s
.
push_back
(
arg
);
}
}
}
}
}
}
}
}
// Perform evaluations in parallel
// Perform evaluations in parallel
std
::
vector
<
argument
>
literals
(
const_instruction
.
size
());
std
::
vector
<
argument
>
literals
(
const_instruction
s
.
size
());
par_for
(
const_instruction
.
size
(),
1
,
[
&
](
const
auto
i
)
{
par_for
(
const_instruction
s
.
size
(),
1
,
[
&
](
const
auto
i
)
{
auto
c
=
op
::
contiguous
{};
auto
c
=
op
::
contiguous
{};
auto
prev
=
const_instruction
[
i
]
->
inputs
().
front
();
auto
prev
=
const_instruction
s
[
i
]
->
inputs
().
front
();
literals
[
i
]
=
c
.
compute
(
c
.
compute_shape
({
prev
->
get_shape
()}),
{
prev
->
eval
()});
literals
[
i
]
=
c
.
compute
(
c
.
compute_shape
({
prev
->
get_shape
()}),
{
prev
->
eval
()});
});
});
for
(
size_t
i
=
0
;
i
<
const_instruction
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
const_instruction
s
.
size
();
i
++
)
{
{
auto
l
=
m
.
add_literal
(
literals
[
i
].
get_shape
(),
literals
[
i
].
data
());
auto
l
=
m
.
add_literal
(
literals
[
i
].
get_shape
(),
literals
[
i
].
data
());
m
.
replace_instruction
(
const_instruction
[
i
],
l
);
m
.
replace_instruction
(
const_instruction
s
[
i
],
l
);
}
}
}
}
...
...
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