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
5c22dd0f
Commit
5c22dd0f
authored
Feb 02, 2022
by
Shucai Xiao
Browse files
Merge branch 'develop' of github.com:ROCmSoftwarePlatform/AMDMIGraphX into print_matmul_perf_flops
parents
4da0e5e6
b20e3d4d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
2 deletions
+79
-2
src/include/migraphx/iota_iterator.hpp
src/include/migraphx/iota_iterator.hpp
+7
-0
src/program.cpp
src/program.cpp
+72
-2
No files found.
src/include/migraphx/iota_iterator.hpp
View file @
5c22dd0f
...
@@ -89,6 +89,13 @@ inline std::ptrdiff_t operator-(basic_iota_iterator<F, Iterator> x,
...
@@ -89,6 +89,13 @@ inline std::ptrdiff_t operator-(basic_iota_iterator<F, Iterator> x,
return
x
.
index
-
y
.
index
;
return
x
.
index
-
y
.
index
;
}
}
template
<
class
F
,
class
Iterator
>
inline
basic_iota_iterator
<
F
,
Iterator
>
operator
-
(
basic_iota_iterator
<
F
,
Iterator
>
x
,
std
::
ptrdiff_t
y
)
{
return
x
-=
y
;
}
template
<
class
F
,
class
Iterator
>
template
<
class
F
,
class
Iterator
>
inline
bool
operator
==
(
basic_iota_iterator
<
F
,
Iterator
>
x
,
basic_iota_iterator
<
F
,
Iterator
>
y
)
inline
bool
operator
==
(
basic_iota_iterator
<
F
,
Iterator
>
x
,
basic_iota_iterator
<
F
,
Iterator
>
y
)
{
{
...
...
src/program.cpp
View file @
5c22dd0f
...
@@ -183,6 +183,63 @@ void program::finalize()
...
@@ -183,6 +183,63 @@ void program::finalize()
mm
->
finalize
(
this
->
impl
->
ctx
);
mm
->
finalize
(
this
->
impl
->
ctx
);
}
}
template
<
class
T
>
std
::
string
classify
(
T
x
)
{
switch
(
std
::
fpclassify
(
x
))
{
case
FP_INFINITE
:
return
"inf"
;
case
FP_NAN
:
return
"nan"
;
case
FP_NORMAL
:
return
"normal"
;
case
FP_SUBNORMAL
:
return
"subnormal"
;
case
FP_ZERO
:
return
"zero"
;
default:
return
"unknown"
;
}
}
std
::
unordered_set
<
std
::
string
>
classify_argument
(
const
argument
&
a
)
{
std
::
unordered_set
<
std
::
string
>
result
;
a
.
visit
(
[
&
](
auto
t
)
{
for
(
const
auto
&
x
:
t
)
result
.
insert
(
classify
(
x
));
},
[
&
](
const
auto
&
xs
)
{
for
(
const
auto
&
x
:
xs
)
{
auto
r
=
classify_argument
(
x
);
result
.
insert
(
r
.
begin
(),
r
.
end
());
}
});
return
result
;
}
void
preview_argument
(
std
::
ostream
&
os
,
const
argument
&
a
)
{
a
.
visit
(
[
&
](
auto
t
)
{
if
(
t
.
size
()
<=
10
)
{
os
<<
t
;
}
else
{
os
<<
to_string_range
(
t
.
begin
(),
t
.
begin
()
+
5
);
os
<<
", ..., "
;
os
<<
to_string_range
(
t
.
end
()
-
5
,
t
.
end
());
}
},
[
&
](
const
auto
&
xs
)
{
for
(
const
auto
&
x
:
xs
)
{
os
<<
'{'
;
preview_argument
(
os
,
x
);
os
<<
'}'
;
}
});
}
template
<
class
F
>
template
<
class
F
>
std
::
vector
<
argument
>
generic_eval
(
const
module
*
mod
,
std
::
vector
<
argument
>
generic_eval
(
const
module
*
mod
,
context
&
ctx
,
context
&
ctx
,
...
@@ -315,8 +372,21 @@ std::vector<argument> program::eval(parameter_map params) const
...
@@ -315,8 +372,21 @@ std::vector<argument> program::eval(parameter_map params) const
if
(
trace_level
>
1
and
ins
->
name
().
front
()
!=
'@'
and
if
(
trace_level
>
1
and
ins
->
name
().
front
()
!=
'@'
and
ins
->
name
()
!=
"load"
and
not
result
.
empty
())
ins
->
name
()
!=
"load"
and
not
result
.
empty
())
{
{
target
tgt
=
make_target
(
this
->
impl
->
target_name
);
target
tgt
=
make_target
(
this
->
impl
->
target_name
);
std
::
cout
<<
"Output: "
<<
tgt
.
copy_from
(
result
)
<<
std
::
endl
;
auto
buffer
=
tgt
.
copy_from
(
result
);
if
(
trace_level
==
2
)
{
std
::
cout
<<
"Output has "
<<
to_string_range
(
classify_argument
(
buffer
))
<<
std
::
endl
;
std
::
cout
<<
"Output: "
;
preview_argument
(
std
::
cout
,
buffer
);
std
::
cout
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"Output: "
<<
buffer
<<
std
::
endl
;
}
}
}
return
result
;
return
result
;
}));
}));
...
...
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