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
4e14ec8e
Commit
4e14ec8e
authored
Aug 10, 2018
by
Paul
Browse files
Formatting
parent
80ffc159
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
22 deletions
+15
-22
src/include/migraph/instruction.hpp
src/include/migraph/instruction.hpp
+1
-4
src/include/migraph/program.hpp
src/include/migraph/program.hpp
+2
-1
src/include/migraph/ranges.hpp
src/include/migraph/ranges.hpp
+4
-10
src/program.cpp
src/program.cpp
+4
-3
test/gpu/miopen.cpp
test/gpu/miopen.cpp
+4
-4
No files found.
src/include/migraph/instruction.hpp
View file @
4e14ec8e
...
@@ -44,10 +44,7 @@ struct instruction
...
@@ -44,10 +44,7 @@ struct instruction
}
}
}
}
void
recompute_shape
()
void
recompute_shape
()
{
replace
(
compute_shape
(
op
,
arguments
));
}
{
replace
(
compute_shape
(
op
,
arguments
));
}
void
replace
(
std
::
vector
<
instruction_ref
>
args
)
void
replace
(
std
::
vector
<
instruction_ref
>
args
)
{
{
...
...
src/include/migraph/program.hpp
View file @
4e14ec8e
...
@@ -52,7 +52,8 @@ struct program
...
@@ -52,7 +52,8 @@ struct program
instruction_ref
instruction_ref
replace_instruction
(
instruction_ref
ins
,
operation
op
,
std
::
vector
<
instruction_ref
>
args
);
replace_instruction
(
instruction_ref
ins
,
operation
op
,
std
::
vector
<
instruction_ref
>
args
);
instruction_ref
replace_instructions
(
instruction_ref
ins
,
instruction_ref
start
,
instruction_ref
last
);
instruction_ref
replace_instructions
(
instruction_ref
ins
,
instruction_ref
start
,
instruction_ref
last
);
instruction_ref
remove_instruction
(
instruction_ref
ins
);
instruction_ref
remove_instruction
(
instruction_ref
ins
);
instruction_ref
remove_instructions
(
instruction_ref
first
,
instruction_ref
last
);
instruction_ref
remove_instructions
(
instruction_ref
first
,
instruction_ref
last
);
...
...
src/include/migraph/ranges.hpp
View file @
4e14ec8e
...
@@ -17,24 +17,18 @@ void copy(Range&& r, Iterator it)
...
@@ -17,24 +17,18 @@ void copy(Range&& r, Iterator it)
std
::
copy
(
r
.
begin
(),
r
.
end
(),
it
);
std
::
copy
(
r
.
begin
(),
r
.
end
(),
it
);
}
}
template
<
class
Iterator
>
template
<
class
Iterator
>
struct
iterator_range
struct
iterator_range
{
{
Iterator
start
;
Iterator
start
;
Iterator
last
;
Iterator
last
;
Iterator
begin
()
const
Iterator
begin
()
const
{
return
start
;
}
{
return
start
;
}
Iterator
end
()
const
Iterator
end
()
const
{
return
last
;
}
{
return
last
;
}
};
};
template
<
class
Iterator
>
template
<
class
Iterator
>
iterator_range
<
Iterator
>
range
(
Iterator
start
,
Iterator
last
)
iterator_range
<
Iterator
>
range
(
Iterator
start
,
Iterator
last
)
{
{
return
{
start
,
last
};
return
{
start
,
last
};
...
...
src/program.cpp
View file @
4e14ec8e
...
@@ -55,10 +55,11 @@ program::replace_instruction(instruction_ref ins, operation op, std::vector<inst
...
@@ -55,10 +55,11 @@ program::replace_instruction(instruction_ref ins, operation op, std::vector<inst
return
ins
;
return
ins
;
}
}
instruction_ref
program
::
replace_instructions
(
instruction_ref
ins
,
instruction_ref
start
,
instruction_ref
last
)
instruction_ref
program
::
replace_instructions
(
instruction_ref
ins
,
instruction_ref
start
,
instruction_ref
last
)
{
{
auto
rep
=
std
::
prev
(
last
);
auto
rep
=
std
::
prev
(
last
);
for
(
auto
&&
out
:
ins
->
output
)
for
(
auto
&&
out
:
ins
->
output
)
{
{
if
(
std
::
find
(
start
,
last
,
out
)
==
last
)
if
(
std
::
find
(
start
,
last
,
out
)
==
last
)
...
@@ -67,7 +68,7 @@ instruction_ref program::replace_instructions(instruction_ref ins, instruction_r
...
@@ -67,7 +68,7 @@ instruction_ref program::replace_instructions(instruction_ref ins, instruction_r
backreference
(
out
);
backreference
(
out
);
}
}
}
}
if
(
ins
->
output
.
empty
())
if
(
ins
->
output
.
empty
())
return
remove_instruction
(
ins
);
return
remove_instruction
(
ins
);
return
ins
;
return
ins
;
}
}
...
...
test/gpu/miopen.cpp
View file @
4e14ec8e
...
@@ -26,16 +26,15 @@ struct auto_print
...
@@ -26,16 +26,15 @@ struct auto_print
int
index
;
int
index
;
auto_print
(
migraph
::
program
&
pp
,
int
i
)
:
p
(
pp
),
index
(
i
)
auto_print
(
migraph
::
program
&
pp
,
int
i
)
:
p
(
pp
),
index
(
i
)
{
{
handlers
()[
index
]
=
[
this
]{
std
::
cout
<<
p
<<
std
::
endl
;
};
handlers
()[
index
]
=
[
this
]
{
std
::
cout
<<
p
<<
std
::
endl
;
};
}
}
~
auto_print
()
~
auto_print
()
{
{
handlers
()[
index
]
=
[]{};
handlers
()[
index
]
=
[]
{};
}
}
};
};
template
<
class
V
>
template
<
class
V
>
migraph
::
argument
run_cpu
()
migraph
::
argument
run_cpu
()
{
{
...
@@ -80,7 +79,8 @@ void verify_program()
...
@@ -80,7 +79,8 @@ void verify_program()
{
{
std
::
cout
<<
"what(): "
<<
e
.
what
()
<<
std
::
endl
;
std
::
cout
<<
"what(): "
<<
e
.
what
()
<<
std
::
endl
;
}
}
for
(
auto
&&
handle
:
handlers
())
handle
();
for
(
auto
&&
handle
:
handlers
())
handle
();
});
});
auto
cpu_arg
=
run_cpu
<
V
>
();
auto
cpu_arg
=
run_cpu
<
V
>
();
auto
gpu_arg
=
run_gpu
<
V
>
();
auto
gpu_arg
=
run_gpu
<
V
>
();
...
...
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