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
7702c20d
Commit
7702c20d
authored
Aug 19, 2022
by
Paul
Browse files
Merge
parents
c362e7fa
9afce86d
Changes
248
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
296 additions
and
117 deletions
+296
-117
src/driver/command.hpp
src/driver/command.hpp
+9
-3
src/driver/main.cpp
src/driver/main.cpp
+51
-11
src/eliminate_contiguous.cpp
src/eliminate_contiguous.cpp
+36
-18
src/include/migraphx/algorithm.hpp
src/include/migraphx/algorithm.hpp
+16
-0
src/include/migraphx/assignment_options.hpp
src/include/migraphx/assignment_options.hpp
+40
-0
src/include/migraphx/check_shapes.hpp
src/include/migraphx/check_shapes.hpp
+96
-9
src/include/migraphx/literal.hpp
src/include/migraphx/literal.hpp
+5
-0
src/include/migraphx/matcher.hpp
src/include/migraphx/matcher.hpp
+13
-11
src/include/migraphx/module.hpp
src/include/migraphx/module.hpp
+8
-2
src/include/migraphx/module_ref.hpp
src/include/migraphx/module_ref.hpp
+2
-1
src/include/migraphx/onnx.hpp
src/include/migraphx/onnx.hpp
+12
-2
src/include/migraphx/op/abs.hpp
src/include/migraphx/op/abs.hpp
+1
-8
src/include/migraphx/op/acos.hpp
src/include/migraphx/op/acos.hpp
+1
-8
src/include/migraphx/op/add.hpp
src/include/migraphx/op/add.hpp
+1
-9
src/include/migraphx/op/allocate.hpp
src/include/migraphx/op/allocate.hpp
+1
-7
src/include/migraphx/op/argmax.hpp
src/include/migraphx/op/argmax.hpp
+0
-2
src/include/migraphx/op/argmin.hpp
src/include/migraphx/op/argmin.hpp
+0
-2
src/include/migraphx/op/as_shape.hpp
src/include/migraphx/op/as_shape.hpp
+2
-8
src/include/migraphx/op/asin.hpp
src/include/migraphx/op/asin.hpp
+1
-8
src/include/migraphx/op/atan.hpp
src/include/migraphx/op/atan.hpp
+1
-8
No files found.
src/driver/command.hpp
View file @
7702c20d
...
@@ -41,7 +41,10 @@ inline namespace MIGRAPHX_INLINE_NS {
...
@@ -41,7 +41,10 @@ inline namespace MIGRAPHX_INLINE_NS {
inline
auto
&
get_commands
()
inline
auto
&
get_commands
()
{
{
// NOLINTNEXTLINE
// NOLINTNEXTLINE
static
std
::
unordered_map
<
std
::
string
,
std
::
function
<
void
(
std
::
vector
<
std
::
string
>
args
)
>>
m
;
static
std
::
unordered_map
<
std
::
string
,
std
::
function
<
void
(
const
std
::
string
&
exe_name
,
std
::
vector
<
std
::
string
>
args
)
>>
m
;
return
m
;
return
m
;
}
}
...
@@ -65,10 +68,11 @@ const std::string& command_name()
...
@@ -65,10 +68,11 @@ const std::string& command_name()
}
}
template
<
class
T
>
template
<
class
T
>
void
run_command
(
std
::
vector
<
std
::
string
>
args
,
bool
add_help
=
false
)
void
run_command
(
const
std
::
string
&
exe_name
,
std
::
vector
<
std
::
string
>
args
,
bool
add_help
=
false
)
{
{
T
x
;
T
x
;
argument_parser
ap
;
argument_parser
ap
;
ap
.
set_exe_name
(
exe_name
+
" "
+
command_name
<
T
>
());
if
(
add_help
)
if
(
add_help
)
ap
(
nullptr
,
{
"-h"
,
"--help"
},
ap
.
help
(
"Show help"
),
ap
.
show_help
());
ap
(
nullptr
,
{
"-h"
,
"--help"
},
ap
.
help
(
"Show help"
),
ap
.
show_help
());
x
.
parse
(
ap
);
x
.
parse
(
ap
);
...
@@ -81,7 +85,9 @@ template <class T>
...
@@ -81,7 +85,9 @@ template <class T>
int
auto_register_command
()
int
auto_register_command
()
{
{
auto
&
m
=
get_commands
();
auto
&
m
=
get_commands
();
m
[
command_name
<
T
>
()]
=
[](
std
::
vector
<
std
::
string
>
args
)
{
run_command
<
T
>
(
args
,
true
);
};
m
[
command_name
<
T
>
()]
=
[](
const
std
::
string
&
exe_name
,
std
::
vector
<
std
::
string
>
args
)
{
run_command
<
T
>
(
exe_name
,
args
,
true
);
};
return
0
;
return
0
;
}
}
...
...
src/driver/main.cpp
View file @
7702c20d
...
@@ -73,8 +73,12 @@ struct loader
...
@@ -73,8 +73,12 @@ struct loader
void
parse
(
argument_parser
&
ap
)
void
parse
(
argument_parser
&
ap
)
{
{
ap
(
file
,
{},
ap
.
metavar
(
"<input file>"
));
ap
(
file
,
{},
ap
.
metavar
(
"<input file>"
),
ap
.
file_exist
(),
ap
.
required
(),
ap
.
group
(
"input"
));
ap
(
model
,
{
"--model"
},
ap
.
help
(
"Load model"
),
ap
.
type
(
"resnet50|inceptionv3|alexnet"
));
ap
(
model
,
{
"--model"
},
ap
.
help
(
"Load model"
),
ap
.
type
(
"resnet50|inceptionv3|alexnet"
),
ap
.
group
(
"input"
));
ap
(
file_type
,
{
"--onnx"
},
ap
.
help
(
"Load as onnx"
),
ap
.
set_value
(
"onnx"
));
ap
(
file_type
,
{
"--onnx"
},
ap
.
help
(
"Load as onnx"
),
ap
.
set_value
(
"onnx"
));
ap
(
file_type
,
{
"--tf"
},
ap
.
help
(
"Load as tensorflow"
),
ap
.
set_value
(
"tf"
));
ap
(
file_type
,
{
"--tf"
},
ap
.
help
(
"Load as tensorflow"
),
ap
.
set_value
(
"tf"
));
ap
(
file_type
,
{
"--migraphx"
},
ap
.
help
(
"Load as MIGraphX"
),
ap
.
set_value
(
"migraphx"
));
ap
(
file_type
,
{
"--migraphx"
},
ap
.
help
(
"Load as MIGraphX"
),
ap
.
set_value
(
"migraphx"
));
...
@@ -578,26 +582,62 @@ struct onnx : command<onnx>
...
@@ -578,26 +582,62 @@ struct onnx : command<onnx>
struct
main_command
struct
main_command
{
{
static
std
::
string
get_command_help
()
static
std
::
string
get_command_help
(
const
std
::
string
&
title
=
colorize
(
color
::
fg_yellow
,
"COMMANDS:"
))
{
{
std
::
string
result
=
"Commands:
\n
"
;
std
::
string
result
=
title
+
"
\n
"
;
return
std
::
accumulate
(
get_commands
().
begin
(),
std
::
vector
<
std
::
string
>
commands
(
get_commands
().
size
());
get_commands
().
end
(),
std
::
transform
(
get_commands
().
begin
(),
result
,
get_commands
().
end
(),
[](
auto
r
,
auto
&&
p
)
{
return
r
+
" "
+
p
.
first
+
"
\n
"
;
});
commands
.
begin
(),
[](
const
auto
&
p
)
{
return
colorize
(
color
::
fg_green
,
p
.
first
);
});
std
::
sort
(
commands
.
begin
(),
commands
.
end
());
return
std
::
accumulate
(
commands
.
begin
(),
commands
.
end
(),
result
,
[](
auto
r
,
auto
&&
s
)
{
return
r
+
" "
+
s
+
"
\n
"
;
});
}
}
void
parse
(
argument_parser
&
ap
)
void
parse
(
argument_parser
&
ap
)
{
{
std
::
string
version_str
=
"MIGraphX Version: "
+
std
::
to_string
(
MIGRAPHX_VERSION_MAJOR
)
+
std
::
string
version_str
=
"MIGraphX Version: "
+
std
::
to_string
(
MIGRAPHX_VERSION_MAJOR
)
+
"."
+
std
::
to_string
(
MIGRAPHX_VERSION_MINOR
);
"."
+
std
::
to_string
(
MIGRAPHX_VERSION_MINOR
);
ap
(
wrong_commands
,
{},
ap
.
metavar
(
"<command>"
),
ap
.
append
());
ap
(
nullptr
,
{
"-h"
,
"--help"
},
ap
.
help
(
"Show help"
),
ap
.
show_help
(
get_command_help
()));
ap
(
nullptr
,
{
"-h"
,
"--help"
},
ap
.
help
(
"Show help"
),
ap
.
show_help
(
get_command_help
()));
ap
(
nullptr
,
ap
(
nullptr
,
{
"-v"
,
"--version"
},
{
"-v"
,
"--version"
},
ap
.
help
(
"Show MIGraphX version"
),
ap
.
help
(
"Show MIGraphX version"
),
ap
.
show_help
(
version_str
));
ap
.
show_help
(
version_str
));
// Trim command off of exe name
ap
.
set_exe_name
(
ap
.
get_exe_name
().
substr
(
0
,
ap
.
get_exe_name
().
size
()
-
5
));
ap
.
set_exe_name_to
(
exe_name
);
}
}
void
run
()
{}
std
::
vector
<
std
::
string
>
wrong_commands
{};
std
::
string
exe_name
=
"<exe>"
;
void
run
()
{
std
::
cout
<<
color
::
fg_red
<<
color
::
bold
<<
"error: "
<<
color
::
reset
;
auto
it
=
std
::
find_if
(
wrong_commands
.
begin
(),
wrong_commands
.
end
(),
[](
const
auto
&
c
)
{
return
get_commands
().
count
(
c
)
>
0
;
});
if
(
it
==
wrong_commands
.
end
())
{
std
::
cout
<<
"'"
<<
color
::
fg_yellow
<<
wrong_commands
.
front
()
<<
color
::
reset
<<
"' is not a valid command."
<<
std
::
endl
;
std
::
cout
<<
get_command_help
(
"Available commands:"
)
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"command '"
<<
color
::
fg_yellow
<<
*
it
<<
color
::
reset
<<
"' must be first argument"
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
color
::
fg_yellow
<<
"USAGE:"
<<
color
::
reset
<<
std
::
endl
;
std
::
cout
<<
" "
<<
exe_name
<<
" "
<<
*
it
<<
" <options>"
<<
std
::
endl
;
}
std
::
cout
<<
std
::
endl
;
}
};
};
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
...
@@ -619,11 +659,11 @@ int main(int argc, const char* argv[])
...
@@ -619,11 +659,11 @@ int main(int argc, const char* argv[])
auto
cmd
=
args
.
front
();
auto
cmd
=
args
.
front
();
if
(
m
.
count
(
cmd
)
>
0
)
if
(
m
.
count
(
cmd
)
>
0
)
{
{
m
.
at
(
cmd
)({
args
.
begin
()
+
1
,
args
.
end
()});
m
.
at
(
cmd
)(
argv
[
0
],
{
args
.
begin
()
+
1
,
args
.
end
()});
}
}
else
else
{
{
run_command
<
main_command
>
(
args
);
run_command
<
main_command
>
(
argv
[
0
],
args
);
}
}
return
0
;
return
0
;
...
...
src/eliminate_contiguous.cpp
View file @
7702c20d
...
@@ -93,9 +93,11 @@ static bool try_compute_shape(instruction_ref ins,
...
@@ -93,9 +93,11 @@ static bool try_compute_shape(instruction_ref ins,
return
try_compute_shape
(
ins
,
inputs
,
mods
);
return
try_compute_shape
(
ins
,
inputs
,
mods
);
}
}
void
eliminate_contiguous
::
apply
(
module
&
m
)
const
template
<
class
F
>
static
void
remove_contiguous
(
const
std
::
string
&
op_name
,
module
&
m
,
F
f
)
{
{
std
::
vector
<
instruction_ref
>
const_instruction
;
auto
last
=
std
::
prev
(
m
.
end
());
std
::
vector
<
instruction_ref
>
const_instructions
;
for
(
auto
ins
:
iterator_for
(
m
))
for
(
auto
ins
:
iterator_for
(
m
))
{
{
...
@@ -103,6 +105,12 @@ void eliminate_contiguous::apply(module& m) const
...
@@ -103,6 +105,12 @@ void eliminate_contiguous::apply(module& m) const
if
(
ins
->
name
()
==
"@return"
)
if
(
ins
->
name
()
==
"@return"
)
continue
;
continue
;
if
(
ins
!=
last
and
ins
->
outputs
().
empty
())
continue
;
if
(
not
f
(
ins
))
continue
;
// Make a copy so we can modify it while we iterate
// Make a copy so we can modify it while we iterate
auto
args
=
ins
->
inputs
();
auto
args
=
ins
->
inputs
();
auto
new_args
=
args
;
auto
new_args
=
args
;
...
@@ -110,36 +118,46 @@ void eliminate_contiguous::apply(module& m) const
...
@@ -110,36 +118,46 @@ void eliminate_contiguous::apply(module& m) const
for
(
auto
arg
:
ins
->
inputs
())
for
(
auto
arg
:
ins
->
inputs
())
{
{
if
(
arg
->
name
()
==
op_name
)
if
(
arg
->
name
()
!=
op_name
)
continue
;
auto
prev
=
arg
->
inputs
().
front
();
replace
(
new_args
,
arg
,
prev
);
if
(
try_compute_shape
(
ins
,
new_args
,
mod_args
))
{
instruction
::
replace_argument
(
ins
,
arg
,
prev
);
}
else
if
(
prev
->
can_eval
())
{
{
auto
prev
=
arg
->
inputs
().
front
();
const_instructions
.
push_back
(
arg
);
replace
(
new_args
,
arg
,
prev
);
if
(
try_compute_shape
(
ins
,
new_args
,
mod_args
))
{
instruction
::
replace_argument
(
ins
,
arg
,
prev
);
}
else
if
(
prev
->
can_eval
())
{
const_instruction
.
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
);
}
}
}
}
void
eliminate_contiguous
::
apply
(
module
&
m
)
const
{
// Skip contiguous from splits first
remove_contiguous
(
op_name
,
m
,
[](
auto
ins
)
{
if
(
ins
->
name
()
!=
"slice"
)
return
true
;
return
(
ins
->
inputs
().
front
()
->
outputs
().
size
()
==
1
);
});
remove_contiguous
(
op_name
,
m
,
[](
auto
)
{
return
true
;
});
}
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
src/include/migraphx/algorithm.hpp
View file @
7702c20d
...
@@ -74,6 +74,22 @@ void group_unique(Iterator start, Iterator last, Output out, Predicate pred)
...
@@ -74,6 +74,22 @@ void group_unique(Iterator start, Iterator last, Output out, Predicate pred)
}
}
}
}
template
<
class
Iterator1
,
class
Iterator2
>
std
::
ptrdiff_t
levenshtein_distance
(
Iterator1
first1
,
Iterator1
last1
,
Iterator2
first2
,
Iterator2
last2
)
{
if
(
first1
==
last1
)
return
std
::
distance
(
first2
,
last2
);
if
(
first2
==
last2
)
return
std
::
distance
(
first1
,
last1
);
if
(
*
first1
==
*
first2
)
return
levenshtein_distance
(
std
::
next
(
first1
),
last1
,
std
::
next
(
first2
),
last2
);
auto
x1
=
levenshtein_distance
(
std
::
next
(
first1
),
last1
,
std
::
next
(
first2
),
last2
);
auto
x2
=
levenshtein_distance
(
first1
,
last1
,
std
::
next
(
first2
),
last2
);
auto
x3
=
levenshtein_distance
(
std
::
next
(
first1
),
last1
,
first2
,
last2
);
return
std
::
ptrdiff_t
{
1
}
+
std
::
min
({
x1
,
x2
,
x3
});
}
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
...
...
src/include/migraphx/assignment_options.hpp
0 → 100644
View file @
7702c20d
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MIGRAPHX_GUARD_RTGLIB_ASSIGNMENT_OPTIONS_HPP
#define MIGRAPHX_GUARD_RTGLIB_ASSIGNMENT_OPTIONS_HPP
#include <migraphx/support_metric.hpp>
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
struct
assignment_options
{
support_metric
metric
=
support_metric
::
latency
;
};
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
#endif // MIGRAPHX_GUARD_RTGLIB_ASSIGNMENT_OPTIONS_HPP
src/include/migraphx/check_shapes.hpp
View file @
7702c20d
...
@@ -38,20 +38,34 @@ struct check_shapes
...
@@ -38,20 +38,34 @@ struct check_shapes
const
shape
*
begin
;
const
shape
*
begin
;
const
shape
*
end
;
const
shape
*
end
;
const
std
::
string
name
;
const
std
::
string
name
;
const
bool
dynamic_allowed
;
check_shapes
(
const
shape
*
b
,
const
shape
*
e
,
const
std
::
string
&
n
)
:
begin
(
b
),
end
(
e
),
name
(
n
)
check_shapes
(
const
shape
*
b
,
const
shape
*
e
,
const
std
::
string
&
n
,
const
bool
d
=
false
)
:
begin
(
b
),
end
(
e
),
name
(
n
),
dynamic_allowed
(
d
)
{
{
check_dynamic
();
}
}
template
<
class
Op
>
template
<
class
Op
>
check_shapes
(
const
shape
*
b
,
const
shape
*
e
,
const
Op
&
op
)
:
begin
(
b
),
end
(
e
),
name
(
op
.
name
())
check_shapes
(
const
shape
*
b
,
const
shape
*
e
,
const
Op
&
op
,
const
bool
d
=
false
)
:
begin
(
b
),
end
(
e
),
name
(
op
.
name
()),
dynamic_allowed
(
d
)
{
{
check_dynamic
();
}
}
template
<
class
Op
>
template
<
class
Op
>
check_shapes
(
const
std
::
vector
<
shape
>&
s
,
const
Op
&
op
)
check_shapes
(
const
std
::
vector
<
shape
>&
s
,
const
Op
&
op
,
const
bool
d
=
false
)
:
begin
(
s
.
data
()),
end
(
s
.
data
()
+
s
.
size
()),
name
(
op
.
name
())
:
begin
(
s
.
data
()),
end
(
s
.
data
()
+
s
.
size
()),
name
(
op
.
name
())
,
dynamic_allowed
(
d
)
{
{
check_dynamic
();
}
void
check_dynamic
()
const
{
if
(
not
dynamic_allowed
and
this
->
any_of
([
&
](
const
shape
&
s
)
{
return
s
.
dynamic
();
}))
{
MIGRAPHX_THROW
(
prefix
()
+
"Dynamic shapes not supported"
);
}
}
}
std
::
string
prefix
()
const
std
::
string
prefix
()
const
...
@@ -71,6 +85,11 @@ struct check_shapes
...
@@ -71,6 +85,11 @@ struct check_shapes
return
end
-
begin
;
return
end
-
begin
;
}
}
/*!
* Check if the number of shape objects is equal to atleast one of the
* given sizes.
* \param ns template parameter pack of sizes to check against
*/
template
<
class
...
Ts
>
template
<
class
...
Ts
>
const
check_shapes
&
has
(
Ts
...
ns
)
const
const
check_shapes
&
has
(
Ts
...
ns
)
const
{
{
...
@@ -87,44 +106,62 @@ struct check_shapes
...
@@ -87,44 +106,62 @@ struct check_shapes
return
*
this
;
return
*
this
;
}
}
/*!
* Check that the first shape has exactly n dimensions.
* Do nothing if the container is empty.
* \param n number of dimensions
*/
const
check_shapes
&
only_dims
(
std
::
size_t
n
)
const
const
check_shapes
&
only_dims
(
std
::
size_t
n
)
const
{
{
assert
(
begin
!=
nullptr
);
assert
(
begin
!=
nullptr
);
assert
(
end
!=
nullptr
);
assert
(
end
!=
nullptr
);
if
(
begin
!=
end
)
if
(
begin
!=
end
)
{
{
if
(
begin
->
lens
().
size
()
!=
n
)
if
(
begin
->
max_
lens
().
size
()
!=
n
)
MIGRAPHX_THROW
(
prefix
()
+
"Only "
+
std
::
to_string
(
n
)
+
"d supported"
);
MIGRAPHX_THROW
(
prefix
()
+
"Only "
+
std
::
to_string
(
n
)
+
"d supported"
);
}
}
return
*
this
;
return
*
this
;
}
}
/*!
* Check that the first shape has a maximum of n dimensions.
* Do nothing if the container is empty.
* \param n number of dimensions
*/
const
check_shapes
&
max_ndims
(
std
::
size_t
n
)
const
const
check_shapes
&
max_ndims
(
std
::
size_t
n
)
const
{
{
assert
(
begin
!=
nullptr
);
assert
(
begin
!=
nullptr
);
assert
(
end
!=
nullptr
);
assert
(
end
!=
nullptr
);
if
(
begin
!=
end
)
if
(
begin
!=
end
)
{
{
if
(
begin
->
lens
().
size
()
>
n
)
if
(
begin
->
max_
lens
().
size
()
>
n
)
MIGRAPHX_THROW
(
prefix
()
+
"Shape must have at most "
+
std
::
to_string
(
n
)
+
MIGRAPHX_THROW
(
prefix
()
+
"Shape must have at most "
+
std
::
to_string
(
n
)
+
" dimensions"
);
" dimensions"
);
}
}
return
*
this
;
return
*
this
;
}
}
/*!
* Check that the first shape has a minimum of n dimensions.
* Do nothing if the container is empty.
* \param n number of dimensions
*/
const
check_shapes
&
min_ndims
(
std
::
size_t
n
)
const
const
check_shapes
&
min_ndims
(
std
::
size_t
n
)
const
{
{
assert
(
begin
!=
nullptr
);
assert
(
begin
!=
nullptr
);
assert
(
end
!=
nullptr
);
assert
(
end
!=
nullptr
);
if
(
begin
!=
end
)
if
(
begin
!=
end
)
{
{
if
(
begin
->
lens
().
size
()
<
n
)
if
(
begin
->
max_
lens
().
size
()
<
n
)
MIGRAPHX_THROW
(
prefix
()
+
"Shape must have at least "
+
std
::
to_string
(
n
)
+
MIGRAPHX_THROW
(
prefix
()
+
"Shape must have at least "
+
std
::
to_string
(
n
)
+
" dimensions"
);
" dimensions"
);
}
}
return
*
this
;
return
*
this
;
}
}
/*!
* Check all shapes have the same shape.
*/
const
check_shapes
&
same_shape
()
const
const
check_shapes
&
same_shape
()
const
{
{
if
(
!
this
->
same
([](
const
shape
&
s
)
{
return
s
;
}))
if
(
!
this
->
same
([](
const
shape
&
s
)
{
return
s
;
}))
...
@@ -132,6 +169,9 @@ struct check_shapes
...
@@ -132,6 +169,9 @@ struct check_shapes
return
*
this
;
return
*
this
;
}
}
/*!
* Check all shapes have the same type.
*/
const
check_shapes
&
same_type
()
const
const
check_shapes
&
same_type
()
const
{
{
if
(
!
this
->
same
([](
const
shape
&
s
)
{
return
s
.
type
();
}))
if
(
!
this
->
same
([](
const
shape
&
s
)
{
return
s
.
type
();
}))
...
@@ -139,20 +179,32 @@ struct check_shapes
...
@@ -139,20 +179,32 @@ struct check_shapes
return
*
this
;
return
*
this
;
}
}
/*!
* Check all shapes have the same lens.
*/
const
check_shapes
&
same_dims
()
const
const
check_shapes
&
same_dims
()
const
{
{
if
(
!
this
->
same
([](
const
shape
&
s
)
{
return
s
.
lens
();
}))
if
(
!
this
->
same
([](
const
shape
&
s
)
{
return
s
.
max_
lens
();
}))
MIGRAPHX_THROW
(
prefix
()
+
"Dimensions do not match"
);
MIGRAPHX_THROW
(
prefix
()
+
"Dimensions do not match"
);
if
(
this
->
any_of
([
&
](
const
shape
&
s
)
{
return
s
.
dynamic
();
}))
if
(
!
this
->
same
([](
const
shape
&
s
)
{
return
s
.
min_lens
();
}))
MIGRAPHX_THROW
(
prefix
()
+
"Min dynamic dimensions do not match"
);
return
*
this
;
return
*
this
;
}
}
/*!
* Check all shapes have the same number of dimensions.
*/
const
check_shapes
&
same_ndims
()
const
const
check_shapes
&
same_ndims
()
const
{
{
if
(
!
this
->
same
([](
const
shape
&
s
)
{
return
s
.
lens
().
size
();
}))
if
(
!
this
->
same
([](
const
shape
&
s
)
{
return
s
.
max_
lens
().
size
();
}))
MIGRAPHX_THROW
(
prefix
()
+
"Number of dimensions do not match"
);
MIGRAPHX_THROW
(
prefix
()
+
"Number of dimensions do not match"
);
return
*
this
;
return
*
this
;
}
}
/*!
* Check all shapes are standard.
*/
const
check_shapes
&
standard
()
const
const
check_shapes
&
standard
()
const
{
{
if
(
!
this
->
all_of
([](
const
shape
&
s
)
{
return
s
.
standard
();
}))
if
(
!
this
->
all_of
([](
const
shape
&
s
)
{
return
s
.
standard
();
}))
...
@@ -160,6 +212,9 @@ struct check_shapes
...
@@ -160,6 +212,9 @@ struct check_shapes
return
*
this
;
return
*
this
;
}
}
/*!
* Check all shapes are standard or scalar.
*/
const
check_shapes
&
standard_or_scalar
()
const
const
check_shapes
&
standard_or_scalar
()
const
{
{
if
(
!
this
->
all_of
([](
const
shape
&
s
)
{
return
s
.
standard
()
or
s
.
scalar
();
}))
if
(
!
this
->
all_of
([](
const
shape
&
s
)
{
return
s
.
standard
()
or
s
.
scalar
();
}))
...
@@ -167,6 +222,9 @@ struct check_shapes
...
@@ -167,6 +222,9 @@ struct check_shapes
return
*
this
;
return
*
this
;
}
}
/*!
* Check all shapes are packed.
*/
const
check_shapes
&
packed
()
const
const
check_shapes
&
packed
()
const
{
{
if
(
!
this
->
all_of
([](
const
shape
&
s
)
{
return
s
.
packed
();
}))
if
(
!
this
->
all_of
([](
const
shape
&
s
)
{
return
s
.
packed
();
}))
...
@@ -174,6 +232,9 @@ struct check_shapes
...
@@ -174,6 +232,9 @@ struct check_shapes
return
*
this
;
return
*
this
;
}
}
/*!
* Check all shapes are packed or broadcasted.
*/
const
check_shapes
&
packed_or_broadcasted
()
const
const
check_shapes
&
packed_or_broadcasted
()
const
{
{
if
(
!
this
->
all_of
([](
const
shape
&
s
)
{
return
s
.
packed
()
or
s
.
broadcasted
();
}))
if
(
!
this
->
all_of
([](
const
shape
&
s
)
{
return
s
.
packed
()
or
s
.
broadcasted
();
}))
...
@@ -181,6 +242,9 @@ struct check_shapes
...
@@ -181,6 +242,9 @@ struct check_shapes
return
*
this
;
return
*
this
;
}
}
/*!
* Check all shapes are tuples.
*/
const
check_shapes
&
tuple_type
()
const
const
check_shapes
&
tuple_type
()
const
{
{
if
(
!
this
->
all_of
([](
const
shape
&
s
)
{
return
s
.
type
()
==
shape
::
tuple_type
;
}))
if
(
!
this
->
all_of
([](
const
shape
&
s
)
{
return
s
.
type
()
==
shape
::
tuple_type
;
}))
...
@@ -188,6 +252,9 @@ struct check_shapes
...
@@ -188,6 +252,9 @@ struct check_shapes
return
*
this
;
return
*
this
;
}
}
/*!
* Check all shapes are not transposed.
*/
const
check_shapes
&
not_transposed
()
const
const
check_shapes
&
not_transposed
()
const
{
{
if
(
!
this
->
all_of
([](
const
shape
&
s
)
{
return
not
s
.
transposed
();
}))
if
(
!
this
->
all_of
([](
const
shape
&
s
)
{
return
not
s
.
transposed
();
}))
...
@@ -195,6 +262,9 @@ struct check_shapes
...
@@ -195,6 +262,9 @@ struct check_shapes
return
*
this
;
return
*
this
;
}
}
/*!
* Check all shapes are not broadcasted.
*/
const
check_shapes
&
not_broadcasted
()
const
const
check_shapes
&
not_broadcasted
()
const
{
{
if
(
!
this
->
all_of
([](
const
shape
&
s
)
{
return
not
s
.
broadcasted
();
}))
if
(
!
this
->
all_of
([](
const
shape
&
s
)
{
return
not
s
.
broadcasted
();
}))
...
@@ -202,6 +272,10 @@ struct check_shapes
...
@@ -202,6 +272,10 @@ struct check_shapes
return
*
this
;
return
*
this
;
}
}
/*!
* Check all shapes have the same n elements.
* \param n number of elements
*/
const
check_shapes
&
elements
(
std
::
size_t
n
)
const
const
check_shapes
&
elements
(
std
::
size_t
n
)
const
{
{
if
(
!
this
->
all_of
([
&
](
const
shape
&
s
)
{
return
s
.
elements
()
==
n
;
}))
if
(
!
this
->
all_of
([
&
](
const
shape
&
s
)
{
return
s
.
elements
()
==
n
;
}))
...
@@ -209,6 +283,9 @@ struct check_shapes
...
@@ -209,6 +283,9 @@ struct check_shapes
return
*
this
;
return
*
this
;
}
}
/*!
* Check the batches of all the shapes do not have transposed strides.
*/
const
check_shapes
&
batch_not_transposed
()
const
const
check_shapes
&
batch_not_transposed
()
const
{
{
if
(
!
this
->
all_of
([
&
](
const
shape
&
s
)
{
return
batch_not_transposed_strides
(
s
.
strides
());
}))
if
(
!
this
->
all_of
([
&
](
const
shape
&
s
)
{
return
batch_not_transposed_strides
(
s
.
strides
());
}))
...
@@ -237,6 +314,16 @@ struct check_shapes
...
@@ -237,6 +314,16 @@ struct check_shapes
return
std
::
all_of
(
begin
,
end
,
p
);
return
std
::
all_of
(
begin
,
end
,
p
);
}
}
template
<
class
Predicate
>
bool
any_of
(
Predicate
p
)
const
{
if
(
begin
==
end
)
return
false
;
assert
(
begin
!=
nullptr
);
assert
(
end
!=
nullptr
);
return
std
::
any_of
(
begin
,
end
,
p
);
}
const
shape
*
get
(
long
i
)
const
const
shape
*
get
(
long
i
)
const
{
{
if
(
i
>=
size
())
if
(
i
>=
size
())
...
...
src/include/migraphx/literal.hpp
View file @
7702c20d
...
@@ -45,6 +45,11 @@ struct literal : raw_data<literal>
...
@@ -45,6 +45,11 @@ struct literal : raw_data<literal>
{
{
literal
()
{}
literal
()
{}
/*!
* Empty literal with a specific shape type
*/
explicit
literal
(
shape
::
type_t
shape_type
)
:
m_shape
(
shape_type
,
{})
{}
template
<
class
U
,
class
T
=
deduce
<
U
>,
shape
::
type_t
ShapeType
=
shape
::
get_type
<
T
>
{}
>
template
<
class
U
,
class
T
=
deduce
<
U
>,
shape
::
type_t
ShapeType
=
shape
::
get_type
<
T
>
{}
>
literal
(
U
x
)
:
buffer
(
make_shared_array
<
char
>
(
sizeof
(
T
))),
m_shape
(
ShapeType
)
literal
(
U
x
)
:
buffer
(
make_shared_array
<
char
>
(
sizeof
(
T
))),
m_shape
(
ShapeType
)
{
{
...
...
src/include/migraphx/matcher.hpp
View file @
7702c20d
...
@@ -349,25 +349,27 @@ match::matcher_result find_match(module& modl, M&& m)
...
@@ -349,25 +349,27 @@ match::matcher_result find_match(module& modl, M&& m)
MIGRAPHX_DECLARE_ENV_VAR
(
MIGRAPHX_TRACE_MATCHES
)
MIGRAPHX_DECLARE_ENV_VAR
(
MIGRAPHX_TRACE_MATCHES
)
/// Find matches for an instruction in the module
/// Find matches for an instruction in the module
template
<
class
...
Ms
>
template
<
class
Mod
,
class
...
Ms
>
void
find_matches
(
m
od
ule
&
mod
,
instruction_ref
ins
,
Ms
&&
...
ms
)
void
find_matches
(
M
od
&
mod
,
instruction_ref
ins
,
Ms
&&
...
ms
)
{
{
#if !defined(__GNUC__) || defined(__clang__) || __GNUC__ > 5
#if !defined(__GNUC__) || defined(__clang__) || __GNUC__ > 5
const
const
#endif
#endif
bool
trace
=
enabled
(
MIGRAPHX_TRACE_MATCHES
{});
int
trace
=
value_of
(
MIGRAPHX_TRACE_MATCHES
{});
bool
match
=
false
;
bool
match
=
false
;
each_args
(
each_args
(
[
&
](
auto
&&
m
)
{
[
&
](
auto
&&
m
)
{
if
(
match
)
if
(
match
)
return
;
return
;
auto
r
=
match_instruction
(
mod
,
ins
,
m
.
matcher
());
if
(
trace
>
1
)
if
(
r
.
result
==
mod
.
end
())
std
::
cout
<<
"Match: "
<<
get_type_name
(
m
)
<<
std
::
endl
;
auto
r
=
match_instruction
(
get_module
(
mod
),
ins
,
m
.
matcher
());
if
(
r
.
result
==
get_module
(
mod
).
end
())
return
;
return
;
if
(
trace
)
if
(
trace
>
0
)
{
{
std
::
cout
<<
"Matched by "
<<
get_type_name
(
m
)
<<
std
::
endl
;
std
::
cout
<<
"Matched by "
<<
get_type_name
(
m
)
<<
std
::
endl
;
mod
.
debug_print
(
ins
);
get_module
(
mod
)
.
debug_print
(
ins
);
}
}
m
.
apply
(
mod
,
r
);
m
.
apply
(
mod
,
r
);
match
=
true
;
match
=
true
;
...
@@ -376,10 +378,10 @@ void find_matches(module& mod, instruction_ref ins, Ms&&... ms)
...
@@ -376,10 +378,10 @@ void find_matches(module& mod, instruction_ref ins, Ms&&... ms)
}
}
/// Find matches in a module
/// Find matches in a module
template
<
class
...
Ms
>
template
<
class
Mod
,
class
...
Ms
>
void
find_matches
(
m
od
ule
&
mod
,
Ms
&&
...
ms
)
void
find_matches
(
M
od
&
mod
,
Ms
&&
...
ms
)
{
{
for
(
auto
ins
:
iterator_for
(
mod
))
for
(
auto
ins
:
iterator_for
(
get_module
(
mod
)
))
{
{
find_matches
(
mod
,
ins
,
ms
...);
find_matches
(
mod
,
ins
,
ms
...);
}
}
...
...
src/include/migraphx/module.hpp
View file @
7702c20d
...
@@ -124,7 +124,7 @@ struct module
...
@@ -124,7 +124,7 @@ struct module
std
::
unordered_map
<
instruction_ref
,
instruction_ref
>
map_ins
=
{});
std
::
unordered_map
<
instruction_ref
,
instruction_ref
>
map_ins
=
{});
std
::
vector
<
instruction_ref
>
std
::
vector
<
instruction_ref
>
add_instructions
(
module_ref
m
,
add_instructions
(
const_
module_ref
m
,
std
::
unordered_map
<
instruction_ref
,
instruction_ref
>
map_ins
=
{});
std
::
unordered_map
<
instruction_ref
,
instruction_ref
>
map_ins
=
{});
std
::
vector
<
instruction_ref
>
std
::
vector
<
instruction_ref
>
...
@@ -139,7 +139,7 @@ struct module
...
@@ -139,7 +139,7 @@ struct module
std
::
vector
<
instruction_ref
>
std
::
vector
<
instruction_ref
>
insert_instructions
(
instruction_ref
ins
,
insert_instructions
(
instruction_ref
ins
,
module_ref
m
,
const_
module_ref
m
,
std
::
unordered_map
<
instruction_ref
,
instruction_ref
>
map_ins
=
{});
std
::
unordered_map
<
instruction_ref
,
instruction_ref
>
map_ins
=
{});
std
::
vector
<
instruction_ref
>
std
::
vector
<
instruction_ref
>
...
@@ -164,6 +164,10 @@ struct module
...
@@ -164,6 +164,10 @@ struct module
instruction_ref
replace_return
(
std
::
vector
<
instruction_ref
>
args
);
instruction_ref
replace_return
(
std
::
vector
<
instruction_ref
>
args
);
instruction_ref
insert_literal
(
instruction_ref
ins
,
literal
l
);
instruction_ref
insert_parameter
(
instruction_ref
ins
,
std
::
string
name
,
shape
s
);
std
::
vector
<
std
::
string
>
get_parameter_names
()
const
;
std
::
vector
<
std
::
string
>
get_parameter_names
()
const
;
shape
get_parameter_shape
(
std
::
string
name
)
const
;
shape
get_parameter_shape
(
std
::
string
name
)
const
;
...
@@ -227,6 +231,8 @@ struct module
...
@@ -227,6 +231,8 @@ struct module
std
::
unique_ptr
<
module_impl
>
impl
;
std
::
unique_ptr
<
module_impl
>
impl
;
};
};
inline
module
&
get_module
(
module
&
m
)
{
return
m
;
}
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
...
...
src/include/migraphx/module_ref.hpp
View file @
7702c20d
...
@@ -32,7 +32,8 @@ namespace migraphx {
...
@@ -32,7 +32,8 @@ namespace migraphx {
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
struct
module
;
struct
module
;
using
module_ref
=
module
*
;
using
module_ref
=
module
*
;
using
const_module_ref
=
const
module
*
;
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
...
...
src/include/migraphx/onnx.hpp
View file @
7702c20d
...
@@ -33,10 +33,20 @@ inline namespace MIGRAPHX_INLINE_NS {
...
@@ -33,10 +33,20 @@ inline namespace MIGRAPHX_INLINE_NS {
/// struct to pass in onnx options to parser
/// struct to pass in onnx options to parser
struct
onnx_options
struct
onnx_options
{
{
/// default batch size to use (if not specified in onnx file)
/// Old way to set default fixed dimension size
std
::
size_t
default_dim_value
=
1
;
std
::
size_t
default_dim_value
=
0
;
/*!
* Default dynamic dimension size (if both default_dim_value and default_dyn_dim_value
* set parser throws)
*/
shape
::
dynamic_dimension
default_dyn_dim_value
=
{
1
,
1
,
0
};
/// Explicitly specify the dims of an input
/// Explicitly specify the dims of an input
std
::
unordered_map
<
std
::
string
,
std
::
vector
<
std
::
size_t
>>
map_input_dims
=
{};
std
::
unordered_map
<
std
::
string
,
std
::
vector
<
std
::
size_t
>>
map_input_dims
=
{};
/*!
* Explicitly specify dynamic dims of an input (if both map_input_dims and
* map_dyn_input_dims set parser throws)
*/
std
::
unordered_map
<
std
::
string
,
std
::
vector
<
shape
::
dynamic_dimension
>>
map_dyn_input_dims
=
{};
/// Continue parsing onnx file if an unknown operator is found
/// Continue parsing onnx file if an unknown operator is found
bool
skip_unknown_operators
=
false
;
bool
skip_unknown_operators
=
false
;
/// Print program if an error occurs
/// Print program if an error occurs
...
...
src/include/migraphx/op/abs.hpp
View file @
7702c20d
...
@@ -24,17 +24,10 @@
...
@@ -24,17 +24,10 @@
#ifndef MIGRAPHX_GUARD_OPERATORS_ABS_HPP
#ifndef MIGRAPHX_GUARD_OPERATORS_ABS_HPP
#define MIGRAPHX_GUARD_OPERATORS_ABS_HPP
#define MIGRAPHX_GUARD_OPERATORS_ABS_HPP
#include <array>
#include <migraphx/op/unary.hpp>
#include <migraphx/check_shapes.hpp>
#include <migraphx/stringutils.hpp>
#include <migraphx/streamutils.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/shape_for_each.hpp>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
#include <migraphx/op/unary.hpp>
#include <migraphx/make_signed.hpp>
#include <migraphx/make_signed.hpp>
#include <cmath>
#include <cmath>
#include <utility>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
...
...
src/include/migraphx/op/acos.hpp
View file @
7702c20d
...
@@ -24,16 +24,9 @@
...
@@ -24,16 +24,9 @@
#ifndef MIGRAPHX_GUARD_OPERATORS_ACOS_HPP
#ifndef MIGRAPHX_GUARD_OPERATORS_ACOS_HPP
#define MIGRAPHX_GUARD_OPERATORS_ACOS_HPP
#define MIGRAPHX_GUARD_OPERATORS_ACOS_HPP
#include <array>
#include <migraphx/op/unary.hpp>
#include <migraphx/check_shapes.hpp>
#include <migraphx/stringutils.hpp>
#include <migraphx/streamutils.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/shape_for_each.hpp>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
#include <migraphx/op/unary.hpp>
#include <cmath>
#include <cmath>
#include <utility>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
...
...
src/include/migraphx/op/add.hpp
View file @
7702c20d
...
@@ -24,16 +24,8 @@
...
@@ -24,16 +24,8 @@
#ifndef MIGRAPHX_GUARD_OPERATORS_ADD_HPP
#ifndef MIGRAPHX_GUARD_OPERATORS_ADD_HPP
#define MIGRAPHX_GUARD_OPERATORS_ADD_HPP
#define MIGRAPHX_GUARD_OPERATORS_ADD_HPP
#include <array>
#include <migraphx/op/binary.hpp>
#include <migraphx/check_shapes.hpp>
#include <migraphx/stringutils.hpp>
#include <migraphx/streamutils.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/shape_for_each.hpp>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
#include <cmath>
#include <migraphx/op/binary.hpp>
#include <utility>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
...
...
src/include/migraphx/op/allocate.hpp
View file @
7702c20d
...
@@ -24,16 +24,10 @@
...
@@ -24,16 +24,10 @@
#ifndef MIGRAPHX_GUARD_OPERATORS_ALLOCATE_HPP
#ifndef MIGRAPHX_GUARD_OPERATORS_ALLOCATE_HPP
#define MIGRAPHX_GUARD_OPERATORS_ALLOCATE_HPP
#define MIGRAPHX_GUARD_OPERATORS_ALLOCATE_HPP
#include <array>
#include <migraphx/check_shapes.hpp>
#include <migraphx/check_shapes.hpp>
#include <migraphx/stringutils.hpp>
#include <migraphx/streamutils.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/shape_for_each.hpp>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
#include <cmath>
#include <utility>
#include <migraphx/shape.hpp>
#include <migraphx/shape.hpp>
#include <migraphx/argument.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
...
...
src/include/migraphx/op/argmax.hpp
View file @
7702c20d
...
@@ -26,12 +26,10 @@
...
@@ -26,12 +26,10 @@
#include <migraphx/check_shapes.hpp>
#include <migraphx/check_shapes.hpp>
#include <migraphx/argument.hpp>
#include <migraphx/argument.hpp>
#include <migraphx/functional.hpp>
#include <migraphx/par_for.hpp>
#include <migraphx/par_for.hpp>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
#include <migraphx/value.hpp>
#include <migraphx/value.hpp>
#include <migraphx/op/normalize_attribute.hpp>
#include <migraphx/op/normalize_attribute.hpp>
#include <migraphx/tune_axis.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
...
...
src/include/migraphx/op/argmin.hpp
View file @
7702c20d
...
@@ -26,12 +26,10 @@
...
@@ -26,12 +26,10 @@
#include <migraphx/check_shapes.hpp>
#include <migraphx/check_shapes.hpp>
#include <migraphx/argument.hpp>
#include <migraphx/argument.hpp>
#include <migraphx/functional.hpp>
#include <migraphx/par_for.hpp>
#include <migraphx/par_for.hpp>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
#include <migraphx/value.hpp>
#include <migraphx/value.hpp>
#include <migraphx/op/normalize_attribute.hpp>
#include <migraphx/op/normalize_attribute.hpp>
#include <migraphx/tune_axis.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
...
...
src/include/migraphx/op/as_shape.hpp
View file @
7702c20d
...
@@ -24,16 +24,10 @@
...
@@ -24,16 +24,10 @@
#ifndef MIGRAPHX_GUARD_OPERATORS_AS_SHAPE_HPP
#ifndef MIGRAPHX_GUARD_OPERATORS_AS_SHAPE_HPP
#define MIGRAPHX_GUARD_OPERATORS_AS_SHAPE_HPP
#define MIGRAPHX_GUARD_OPERATORS_AS_SHAPE_HPP
#include <array>
#include <migraphx/check_shapes.hpp>
#include <migraphx/check_shapes.hpp>
#include <migraphx/stringutils.hpp>
#include <migraphx/streamutils.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/shape_for_each.hpp>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
#include <migraphx/lifetime.hpp>
#include <migraphx/argument.hpp>
#include <cmath>
#include <migraphx/shape.hpp>
#include <utility>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
...
...
src/include/migraphx/op/asin.hpp
View file @
7702c20d
...
@@ -24,16 +24,9 @@
...
@@ -24,16 +24,9 @@
#ifndef MIGRAPHX_GUARD_OPERATORS_ASIN_HPP
#ifndef MIGRAPHX_GUARD_OPERATORS_ASIN_HPP
#define MIGRAPHX_GUARD_OPERATORS_ASIN_HPP
#define MIGRAPHX_GUARD_OPERATORS_ASIN_HPP
#include <array>
#include <migraphx/op/unary.hpp>
#include <migraphx/check_shapes.hpp>
#include <migraphx/stringutils.hpp>
#include <migraphx/streamutils.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/shape_for_each.hpp>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
#include <migraphx/op/unary.hpp>
#include <cmath>
#include <cmath>
#include <utility>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
...
...
src/include/migraphx/op/atan.hpp
View file @
7702c20d
...
@@ -24,16 +24,9 @@
...
@@ -24,16 +24,9 @@
#ifndef MIGRAPHX_GUARD_OPERATORS_ATAN_HPP
#ifndef MIGRAPHX_GUARD_OPERATORS_ATAN_HPP
#define MIGRAPHX_GUARD_OPERATORS_ATAN_HPP
#define MIGRAPHX_GUARD_OPERATORS_ATAN_HPP
#include <array>
#include <migraphx/op/unary.hpp>
#include <migraphx/check_shapes.hpp>
#include <migraphx/stringutils.hpp>
#include <migraphx/streamutils.hpp>
#include <migraphx/literal.hpp>
#include <migraphx/shape_for_each.hpp>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
#include <migraphx/op/unary.hpp>
#include <cmath>
#include <cmath>
#include <utility>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
...
...
Prev
1
2
3
4
5
6
…
13
Next
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