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
e45e0216
Commit
e45e0216
authored
Apr 06, 2022
by
umangyadav
Browse files
formatting
parent
aff10174
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
14 deletions
+20
-14
src/include/migraphx/program.hpp
src/include/migraphx/program.hpp
+3
-1
src/include/migraphx/tracer.hpp
src/include/migraphx/tracer.hpp
+11
-8
src/pass_manager.cpp
src/pass_manager.cpp
+4
-3
src/program.cpp
src/program.cpp
+1
-1
test/verify/run_verify.cpp
test/verify/run_verify.cpp
+1
-1
No files found.
src/include/migraphx/program.hpp
View file @
e45e0216
...
@@ -61,7 +61,9 @@ struct program
...
@@ -61,7 +61,9 @@ struct program
instruction_ref
validate
()
const
;
instruction_ref
validate
()
const
;
void
compile
(
const
target
&
t
,
compile_options
options
=
compile_options
{},
std
::
string
ir_dump_path
=
"passes"
);
void
compile
(
const
target
&
t
,
compile_options
options
=
compile_options
{},
std
::
string
ir_dump_path
=
"passes"
);
bool
is_compiled
()
const
;
bool
is_compiled
()
const
;
...
...
src/include/migraphx/tracer.hpp
View file @
e45e0216
...
@@ -19,24 +19,27 @@ struct tracer
...
@@ -19,24 +19,27 @@ struct tracer
template
<
class
...
Ts
>
template
<
class
...
Ts
>
void
operator
()(
const
std
::
string
&
program_name
,
const
Ts
&
...
xs
)
void
operator
()(
const
std
::
string
&
program_name
,
const
Ts
&
...
xs
)
{
{
if
(
this
->
enabled
())
{
if
(
this
->
enabled
())
{
fs
::
path
dir_path
=
fs
::
current_path
()
/
this
->
dump_dir
;
fs
::
path
dir_path
=
fs
::
current_path
()
/
this
->
dump_dir
;
if
(
not
fs
::
exists
(
dir_path
))
{
if
(
not
fs
::
exists
(
dir_path
))
{
fs
::
create_directories
(
dir_path
);
fs
::
create_directories
(
dir_path
);
}
}
fs
::
path
ir_file_path
=
dir_path
/
(
std
::
to_string
(
this
->
counter
++
)
+
"_"
+
program_name
+
".mxr"
);
fs
::
path
ir_file_path
=
dir_path
/
(
std
::
to_string
(
this
->
counter
++
)
+
"_"
+
program_name
+
".mxr"
);
std
::
ofstream
ofs
(
ir_file_path
);
std
::
ofstream
ofs
(
ir_file_path
);
swallow
{
ofs
<<
xs
...};
swallow
{
ofs
<<
xs
...};
ofs
<<
std
::
endl
;
ofs
<<
std
::
endl
;
ofs
.
close
();
ofs
.
close
();
}
}
}
}
std
::
string
dump_dir
;
std
::
string
dump_dir
;
private:
private:
uint
counter
;
uint
counter
;
};
};
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
...
...
src/pass_manager.cpp
100755 → 100644
View file @
e45e0216
...
@@ -83,7 +83,7 @@ module& get_module(module_pass_manager& mpm) { return mpm.get_module(); }
...
@@ -83,7 +83,7 @@ module& get_module(module_pass_manager& mpm) { return mpm.get_module(); }
void
run_passes
(
module
&
mod
,
const
std
::
vector
<
pass
>&
passes
,
tracer
trace
)
void
run_passes
(
module
&
mod
,
const
std
::
vector
<
pass
>&
passes
,
tracer
trace
)
{
{
if
(
enabled
(
MIGRAPHX_TRACE_PASSES
{}))
if
(
enabled
(
MIGRAPHX_TRACE_PASSES
{}))
trace
=
tracer
{
mod
.
name
()
+
"_passes"
};
trace
=
tracer
{
mod
.
name
()
+
"_passes"
};
for
(
const
auto
&
p
:
passes
)
for
(
const
auto
&
p
:
passes
)
{
{
module_pm
{
&
mod
,
nullptr
,
&
trace
}.
run_pass
(
p
);
module_pm
{
&
mod
,
nullptr
,
&
trace
}.
run_pass
(
p
);
...
@@ -101,9 +101,10 @@ void run_passes(program& prog, const std::vector<pass>& passes, tracer trace)
...
@@ -101,9 +101,10 @@ void run_passes(program& prog, const std::vector<pass>& passes, tracer trace)
auto
mods
=
prog
.
get_modules
();
auto
mods
=
prog
.
get_modules
();
for
(
const
auto
&
mod
:
reverse
(
mods
))
for
(
const
auto
&
mod
:
reverse
(
mods
))
{
{
if
(
!
module_tracer_map
.
count
(
mod
->
name
()))
{
if
(
!
module_tracer_map
.
count
(
mod
->
name
()))
{
module_tracer_map
[
mod
->
name
()]
=
module_trace
;
module_tracer_map
[
mod
->
name
()]
=
module_trace
;
module_tracer_map
[
mod
->
name
()].
dump_dir
+=
"/"
+
mod
->
name
();
module_tracer_map
[
mod
->
name
()].
dump_dir
+=
"/"
+
mod
->
name
();
}
}
if
(
mod
->
bypass
())
if
(
mod
->
bypass
())
continue
;
continue
;
...
...
src/program.cpp
View file @
e45e0216
...
@@ -144,7 +144,7 @@ void program::compile(const target& t, compile_options options, std::string ir_d
...
@@ -144,7 +144,7 @@ void program::compile(const target& t, compile_options options, std::string ir_d
this
->
impl
->
target_name
=
t
.
name
();
this
->
impl
->
target_name
=
t
.
name
();
this
->
impl
->
ctx
=
t
.
get_context
();
this
->
impl
->
ctx
=
t
.
get_context
();
if
(
enabled
(
MIGRAPHX_TRACE_COMPILE
{}))
if
(
enabled
(
MIGRAPHX_TRACE_COMPILE
{}))
options
.
trace
=
tracer
{
t
.
name
()
+
"_"
+
ir_dump_path
};
options
.
trace
=
tracer
{
t
.
name
()
+
"_"
+
ir_dump_path
};
options
.
trace
(
"input_program"
,
*
this
);
options
.
trace
(
"input_program"
,
*
this
);
...
...
test/verify/run_verify.cpp
View file @
e45e0216
...
@@ -41,7 +41,7 @@ inline void compile_check(migraphx::program& p, const migraphx::target& t, bool
...
@@ -41,7 +41,7 @@ inline void compile_check(migraphx::program& p, const migraphx::target& t, bool
std
::
stringstream
ss
;
std
::
stringstream
ss
;
migraphx
::
compile_options
options
;
migraphx
::
compile_options
options
;
if
(
show_trace
)
if
(
show_trace
)
options
.
trace
=
migraphx
::
tracer
{
t
.
name
()
+
"_passes"
};
options
.
trace
=
migraphx
::
tracer
{
t
.
name
()
+
"_passes"
};
p
.
compile
(
t
,
options
);
p
.
compile
(
t
,
options
);
if
(
shapes
.
size
()
!=
p
.
get_output_shapes
().
size
())
if
(
shapes
.
size
()
!=
p
.
get_output_shapes
().
size
())
{
{
...
...
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