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
9d3fb0b5
Unverified
Commit
9d3fb0b5
authored
Aug 05, 2023
by
Ted Themistokleous
Committed by
GitHub
Aug 05, 2023
Browse files
Merge branch 'develop' into enable_navi_32_ci
parents
9c91c08d
aeb9f78c
Changes
278
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
48 additions
and
41 deletions
+48
-41
src/include/migraphx/cpp_generator.hpp
src/include/migraphx/cpp_generator.hpp
+2
-2
src/include/migraphx/dead_code_elimination.hpp
src/include/migraphx/dead_code_elimination.hpp
+1
-1
src/include/migraphx/dom_info.hpp
src/include/migraphx/dom_info.hpp
+3
-3
src/include/migraphx/dynamic_loader.hpp
src/include/migraphx/dynamic_loader.hpp
+5
-1
src/include/migraphx/eliminate_allocation.hpp
src/include/migraphx/eliminate_allocation.hpp
+1
-1
src/include/migraphx/eliminate_common_subexpression.hpp
src/include/migraphx/eliminate_common_subexpression.hpp
+1
-1
src/include/migraphx/eliminate_concat.hpp
src/include/migraphx/eliminate_concat.hpp
+1
-1
src/include/migraphx/eliminate_contiguous.hpp
src/include/migraphx/eliminate_contiguous.hpp
+1
-1
src/include/migraphx/eliminate_data_type.hpp
src/include/migraphx/eliminate_data_type.hpp
+1
-1
src/include/migraphx/eliminate_identity.hpp
src/include/migraphx/eliminate_identity.hpp
+1
-1
src/include/migraphx/eliminate_pad.hpp
src/include/migraphx/eliminate_pad.hpp
+1
-1
src/include/migraphx/env.hpp
src/include/migraphx/env.hpp
+5
-5
src/include/migraphx/file_buffer.hpp
src/include/migraphx/file_buffer.hpp
+6
-4
src/include/migraphx/fuse_pointwise.hpp
src/include/migraphx/fuse_pointwise.hpp
+1
-1
src/include/migraphx/fuse_reduce.hpp
src/include/migraphx/fuse_reduce.hpp
+1
-1
src/include/migraphx/generate.hpp
src/include/migraphx/generate.hpp
+5
-5
src/include/migraphx/inline_module.hpp
src/include/migraphx/inline_module.hpp
+1
-1
src/include/migraphx/insert_pad.hpp
src/include/migraphx/insert_pad.hpp
+1
-1
src/include/migraphx/instruction.hpp
src/include/migraphx/instruction.hpp
+9
-8
src/include/migraphx/instruction_ref.hpp
src/include/migraphx/instruction_ref.hpp
+1
-1
No files found.
src/include/migraphx/cpp_generator.hpp
View file @
9d3fb0b5
...
@@ -40,7 +40,7 @@ struct shape;
...
@@ -40,7 +40,7 @@ struct shape;
struct
cpp_generator_impl
;
struct
cpp_generator_impl
;
struct
cpp_generator
struct
MIGRAPHX_EXPORT
cpp_generator
{
{
using
generate_module_callback
=
std
::
function
<
std
::
string
(
using
generate_module_callback
=
std
::
function
<
std
::
string
(
instruction_ref
,
const
std
::
unordered_map
<
instruction_ref
,
std
::
string
>&
)
>
;
instruction_ref
,
const
std
::
unordered_map
<
instruction_ref
,
std
::
string
>&
)
>
;
...
@@ -50,7 +50,7 @@ struct cpp_generator
...
@@ -50,7 +50,7 @@ struct cpp_generator
std
::
string
type
;
std
::
string
type
;
};
};
struct
function
struct
MIGRAPHX_EXPORT
function
{
{
std
::
vector
<
param
>
params
=
{};
std
::
vector
<
param
>
params
=
{};
std
::
string
body
=
""
;
std
::
string
body
=
""
;
...
...
src/include/migraphx/dead_code_elimination.hpp
View file @
9d3fb0b5
...
@@ -37,7 +37,7 @@ struct program;
...
@@ -37,7 +37,7 @@ struct program;
/**
/**
* Remove instructions where the output is not used.
* Remove instructions where the output is not used.
*/
*/
struct
dead_code_elimination
struct
MIGRAPHX_EXPORT
dead_code_elimination
{
{
std
::
string
name
()
const
{
return
"dead_code_elimination"
;
}
std
::
string
name
()
const
{
return
"dead_code_elimination"
;
}
void
apply
(
module
&
m
)
const
;
void
apply
(
module
&
m
)
const
;
...
...
src/include/migraphx/dom_info.hpp
View file @
9d3fb0b5
...
@@ -34,15 +34,15 @@ inline namespace MIGRAPHX_INLINE_NS {
...
@@ -34,15 +34,15 @@ inline namespace MIGRAPHX_INLINE_NS {
struct
module
;
struct
module
;
struct
dominator_info
struct
MIGRAPHX_EXPORT
dominator_info
{
{
bool
strictly_dominate
(
instruction_ref
ins1
,
instruction_ref
ins2
);
bool
strictly_dominate
(
instruction_ref
ins1
,
instruction_ref
ins2
);
std
::
unordered_map
<
instruction_ref
,
instruction_ref
>
ins2idom
;
std
::
unordered_map
<
instruction_ref
,
instruction_ref
>
ins2idom
;
};
};
dominator_info
compute_dominator
(
module
&
m
);
MIGRAPHX_EXPORT
dominator_info
compute_dominator
(
module
&
m
);
// dominator_info compute_dominator_naive(const module& m);
//
MIGRAPHX_EXPORT
dominator_info compute_dominator_naive(const module& m);
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
...
...
src/include/migraphx/dynamic_loader.hpp
View file @
9d3fb0b5
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
#include <migraphx/filesystem.hpp>
#include <migraphx/filesystem.hpp>
#include <migraphx/optional.hpp>
#include <functional>
#include <functional>
#include <memory>
#include <memory>
#include <vector>
#include <vector>
...
@@ -35,7 +36,7 @@ inline namespace MIGRAPHX_INLINE_NS {
...
@@ -35,7 +36,7 @@ inline namespace MIGRAPHX_INLINE_NS {
struct
dynamic_loader_impl
;
struct
dynamic_loader_impl
;
struct
dynamic_loader
struct
MIGRAPHX_EXPORT
dynamic_loader
{
{
template
<
class
T
>
template
<
class
T
>
static
fs
::
path
path
(
T
*
address
)
static
fs
::
path
path
(
T
*
address
)
...
@@ -43,6 +44,9 @@ struct dynamic_loader
...
@@ -43,6 +44,9 @@ struct dynamic_loader
return
path
(
reinterpret_cast
<
void
*>
(
address
));
return
path
(
reinterpret_cast
<
void
*>
(
address
));
}
}
static
fs
::
path
path
(
void
*
address
);
static
fs
::
path
path
(
void
*
address
);
static
optional
<
dynamic_loader
>
try_load
(
const
fs
::
path
&
p
);
dynamic_loader
()
=
default
;
dynamic_loader
()
=
default
;
dynamic_loader
(
const
fs
::
path
&
p
);
dynamic_loader
(
const
fs
::
path
&
p
);
...
...
src/include/migraphx/eliminate_allocation.hpp
View file @
9d3fb0b5
...
@@ -37,7 +37,7 @@ struct module;
...
@@ -37,7 +37,7 @@ struct module;
* Remove memory allocations. This will create a parameter which is the max of all memory used in
* Remove memory allocations. This will create a parameter which is the max of all memory used in
* the program.
* the program.
*/
*/
struct
eliminate_allocation
struct
MIGRAPHX_EXPORT
eliminate_allocation
{
{
std
::
string
allocation_op
{};
std
::
string
allocation_op
{};
std
::
size_t
alignment
=
32
;
std
::
size_t
alignment
=
32
;
...
...
src/include/migraphx/eliminate_common_subexpression.hpp
View file @
9d3fb0b5
...
@@ -36,7 +36,7 @@ struct module;
...
@@ -36,7 +36,7 @@ struct module;
/**
/**
* Remove identical instructions.
* Remove identical instructions.
*/
*/
struct
eliminate_common_subexpression
struct
MIGRAPHX_EXPORT
eliminate_common_subexpression
{
{
std
::
string
name
()
const
{
return
"eliminate_common_subexpression"
;
}
std
::
string
name
()
const
{
return
"eliminate_common_subexpression"
;
}
void
apply
(
module
&
m
)
const
;
void
apply
(
module
&
m
)
const
;
...
...
src/include/migraphx/eliminate_concat.hpp
View file @
9d3fb0b5
...
@@ -37,7 +37,7 @@ struct module;
...
@@ -37,7 +37,7 @@ struct module;
/**
/**
* Remove concat operators by having each operator can write to different chunk of memory.
* Remove concat operators by having each operator can write to different chunk of memory.
*/
*/
struct
eliminate_concat
struct
MIGRAPHX_EXPORT
eliminate_concat
{
{
concat_optimization
concat_opt
;
concat_optimization
concat_opt
;
std
::
string
name
()
const
{
return
"eliminate_concat"
;
}
std
::
string
name
()
const
{
return
"eliminate_concat"
;
}
...
...
src/include/migraphx/eliminate_contiguous.hpp
View file @
9d3fb0b5
...
@@ -36,7 +36,7 @@ struct module;
...
@@ -36,7 +36,7 @@ struct module;
/**
/**
* Remove contiguous instructions by checking if the operator can use non-standard shapes.
* Remove contiguous instructions by checking if the operator can use non-standard shapes.
*/
*/
struct
eliminate_contiguous
struct
MIGRAPHX_EXPORT
eliminate_contiguous
{
{
std
::
string
op_name
;
std
::
string
op_name
;
std
::
string
name
()
const
{
return
"eliminate_contiguous"
;
}
std
::
string
name
()
const
{
return
"eliminate_contiguous"
;
}
...
...
src/include/migraphx/eliminate_data_type.hpp
View file @
9d3fb0b5
...
@@ -38,7 +38,7 @@ struct module;
...
@@ -38,7 +38,7 @@ struct module;
* Remove data types. This will instert convert operators so the data type
* Remove data types. This will instert convert operators so the data type
* is not used by any operator.
* is not used by any operator.
*/
*/
struct
eliminate_data_type
struct
MIGRAPHX_EXPORT
eliminate_data_type
{
{
std
::
set
<
shape
::
type_t
>
types
;
std
::
set
<
shape
::
type_t
>
types
;
shape
::
type_t
target_type
;
shape
::
type_t
target_type
;
...
...
src/include/migraphx/eliminate_identity.hpp
View file @
9d3fb0b5
...
@@ -38,7 +38,7 @@ struct module;
...
@@ -38,7 +38,7 @@ struct module;
* preserve the semantics of previous program state, therefore dead code elimination
* preserve the semantics of previous program state, therefore dead code elimination
* should not be used afterwards.
* should not be used afterwards.
*/
*/
struct
eliminate_identity
struct
MIGRAPHX_EXPORT
eliminate_identity
{
{
std
::
string
name
()
const
{
return
"eliminate_identity"
;
}
std
::
string
name
()
const
{
return
"eliminate_identity"
;
}
void
apply
(
module
&
m
)
const
;
void
apply
(
module
&
m
)
const
;
...
...
src/include/migraphx/eliminate_pad.hpp
View file @
9d3fb0b5
...
@@ -39,7 +39,7 @@ struct module;
...
@@ -39,7 +39,7 @@ struct module;
* Remove pads if they can be written as an
* Remove pads if they can be written as an
* attribute to another op (im2col, convolution, pooling)
* attribute to another op (im2col, convolution, pooling)
*/
*/
struct
eliminate_pad
struct
MIGRAPHX_EXPORT
eliminate_pad
{
{
std
::
string
name
()
const
{
return
"eliminate_pad"
;
}
std
::
string
name
()
const
{
return
"eliminate_pad"
;
}
...
...
src/include/migraphx/env.hpp
View file @
9d3fb0b5
...
@@ -38,13 +38,13 @@ inline namespace MIGRAPHX_INLINE_NS {
...
@@ -38,13 +38,13 @@ inline namespace MIGRAPHX_INLINE_NS {
static const char* value() { return #x; } \
static const char* value() { return #x; } \
}; // NOLINT
}; // NOLINT
bool
enabled
(
const
char
*
name
);
MIGRAPHX_EXPORT
bool
enabled
(
const
char
*
name
);
bool
disabled
(
const
char
*
name
);
MIGRAPHX_EXPORT
bool
disabled
(
const
char
*
name
);
std
::
vector
<
std
::
string
>
env
(
const
char
*
name
);
MIGRAPHX_EXPORT
std
::
vector
<
std
::
string
>
env
(
const
char
*
name
);
std
::
size_t
value_of
(
const
char
*
name
,
std
::
size_t
fallback
=
0
);
MIGRAPHX_EXPORT
std
::
size_t
value_of
(
const
char
*
name
,
std
::
size_t
fallback
=
0
);
std
::
string
string_value_of
(
const
char
*
name
,
std
::
string
fallback
=
""
);
MIGRAPHX_EXPORT
std
::
string
string_value_of
(
const
char
*
name
,
std
::
string
fallback
=
""
);
template
<
class
T
>
template
<
class
T
>
bool
enabled
(
T
)
bool
enabled
(
T
)
...
...
src/include/migraphx/file_buffer.hpp
View file @
9d3fb0b5
...
@@ -31,11 +31,13 @@
...
@@ -31,11 +31,13 @@
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
std
::
vector
<
char
>
read_buffer
(
const
std
::
string
&
filename
,
size_t
offset
=
0
,
size_t
nbytes
=
0
);
MIGRAPHX_EXPORT
std
::
vector
<
char
>
std
::
string
read_string
(
const
std
::
string
&
filename
);
read_buffer
(
const
std
::
string
&
filename
,
size_t
offset
=
0
,
size_t
nbytes
=
0
);
MIGRAPHX_EXPORT
std
::
string
read_string
(
const
std
::
string
&
filename
);
void
write_buffer
(
const
std
::
string
&
filename
,
const
char
*
buffer
,
std
::
size_t
size
);
MIGRAPHX_EXPORT
void
void
write_buffer
(
const
std
::
string
&
filename
,
const
std
::
vector
<
char
>&
buffer
);
write_buffer
(
const
std
::
string
&
filename
,
const
char
*
buffer
,
std
::
size_t
size
);
MIGRAPHX_EXPORT
void
write_buffer
(
const
std
::
string
&
filename
,
const
std
::
vector
<
char
>&
buffer
);
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
...
...
src/include/migraphx/fuse_pointwise.hpp
View file @
9d3fb0b5
...
@@ -32,7 +32,7 @@ inline namespace MIGRAPHX_INLINE_NS {
...
@@ -32,7 +32,7 @@ inline namespace MIGRAPHX_INLINE_NS {
struct
module_pass_manager
;
struct
module_pass_manager
;
struct
fuse_pointwise
struct
MIGRAPHX_EXPORT
fuse_pointwise
{
{
std
::
string
name
()
const
{
return
"fuse_pointwise"
;
}
std
::
string
name
()
const
{
return
"fuse_pointwise"
;
}
void
apply
(
module_pass_manager
&
mpm
)
const
;
void
apply
(
module_pass_manager
&
mpm
)
const
;
...
...
src/include/migraphx/fuse_reduce.hpp
View file @
9d3fb0b5
...
@@ -32,7 +32,7 @@ inline namespace MIGRAPHX_INLINE_NS {
...
@@ -32,7 +32,7 @@ inline namespace MIGRAPHX_INLINE_NS {
struct
module_pass_manager
;
struct
module_pass_manager
;
struct
fuse_reduce
struct
MIGRAPHX_EXPORT
fuse_reduce
{
{
std
::
string
name
()
const
{
return
"fuse_reduce"
;
}
std
::
string
name
()
const
{
return
"fuse_reduce"
;
}
void
apply
(
module_pass_manager
&
mpm
)
const
;
void
apply
(
module_pass_manager
&
mpm
)
const
;
...
...
src/include/migraphx/generate.hpp
View file @
9d3fb0b5
...
@@ -117,20 +117,20 @@ auto generate_tensor_data(const migraphx::shape& s, unsigned long seed = 0)
...
@@ -117,20 +117,20 @@ auto generate_tensor_data(const migraphx::shape& s, unsigned long seed = 0)
}
}
template
<
class
T
>
template
<
class
T
>
auto
fill_tensor_data
(
const
migraphx
::
shape
&
s
,
unsigned
long
value
=
0
)
auto
fill_tensor_data
(
const
migraphx
::
shape
&
s
,
double
value
=
0
)
{
{
auto
result
=
make_shared_array
<
T
>
(
s
.
element_space
());
auto
result
=
make_shared_array
<
T
>
(
s
.
element_space
());
std
::
generate
(
result
.
get
(),
result
.
get
()
+
s
.
element_space
(),
[
=
]
{
return
value
;
});
std
::
generate
(
result
.
get
(),
result
.
get
()
+
s
.
element_space
(),
[
=
]
{
return
value
;
});
return
result
;
return
result
;
}
}
argument
fill_argument
(
shape
s
,
unsigned
long
value
=
0
);
MIGRAPHX_EXPORT
argument
fill_argument
(
shape
s
,
double
value
=
0
);
argument
generate_argument
(
shape
s
,
unsigned
long
seed
=
0
);
MIGRAPHX_EXPORT
argument
generate_argument
(
shape
s
,
unsigned
long
seed
=
0
);
literal
generate_literal
(
shape
s
,
unsigned
long
seed
=
0
);
MIGRAPHX_EXPORT
literal
generate_literal
(
shape
s
,
unsigned
long
seed
=
0
);
literal
abs
(
literal
l
);
MIGRAPHX_EXPORT
literal
abs
(
literal
l
);
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
...
...
src/include/migraphx/inline_module.hpp
View file @
9d3fb0b5
...
@@ -33,7 +33,7 @@ inline namespace MIGRAPHX_INLINE_NS {
...
@@ -33,7 +33,7 @@ inline namespace MIGRAPHX_INLINE_NS {
struct
module
;
struct
module
;
struct
inline_module
struct
MIGRAPHX_EXPORT
inline_module
{
{
std
::
string
name
()
const
{
return
"inline_module"
;
}
std
::
string
name
()
const
{
return
"inline_module"
;
}
void
apply
(
module
&
m
)
const
;
void
apply
(
module
&
m
)
const
;
...
...
src/include/migraphx/insert_pad.hpp
View file @
9d3fb0b5
...
@@ -38,7 +38,7 @@ struct module;
...
@@ -38,7 +38,7 @@ struct module;
/**
/**
* insert pads if attribute of padding is asymmetrical
* insert pads if attribute of padding is asymmetrical
*/
*/
struct
insert_pad
struct
MIGRAPHX_EXPORT
insert_pad
{
{
std
::
string
name
()
const
{
return
"insert_pad"
;
}
std
::
string
name
()
const
{
return
"insert_pad"
;
}
...
...
src/include/migraphx/instruction.hpp
View file @
9d3fb0b5
...
@@ -37,14 +37,15 @@
...
@@ -37,14 +37,15 @@
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
shape
compute_shape
(
const
operation
&
op
,
const
std
::
vector
<
instruction_ref
>&
args
);
MIGRAPHX_EXPORT
shape
compute_shape
(
const
operation
&
op
,
const
std
::
vector
<
instruction_ref
>&
args
);
shape
compute_shape
(
const
operation
&
op
,
MIGRAPHX_EXPORT
shape
compute_shape
(
const
operation
&
op
,
const
std
::
vector
<
instruction_ref
>&
args
,
const
std
::
vector
<
instruction_ref
>&
args
,
const
std
::
vector
<
module_ref
>&
mods
);
const
std
::
vector
<
module_ref
>&
mods
);
std
::
vector
<
shape
>
to_shapes
(
const
std
::
vector
<
instruction_ref
>&
args
);
MIGRAPHX_EXPORT
std
::
vector
<
shape
>
to_shapes
(
const
std
::
vector
<
instruction_ref
>&
args
);
std
::
vector
<
shape
>
try_compute_shape
(
const
operation
&
op
,
const
std
::
vector
<
shape
>&
inputs
);
MIGRAPHX_EXPORT
std
::
vector
<
shape
>
try_compute_shape
(
const
operation
&
op
,
const
std
::
vector
<
shape
>&
inputs
);
struct
instruction
struct
MIGRAPHX_EXPORT
instruction
{
{
instruction
()
{}
instruction
()
{}
...
...
src/include/migraphx/instruction_ref.hpp
View file @
9d3fb0b5
...
@@ -34,7 +34,7 @@ inline namespace MIGRAPHX_INLINE_NS {
...
@@ -34,7 +34,7 @@ inline namespace MIGRAPHX_INLINE_NS {
struct
instruction
;
struct
instruction
;
using
instruction_ref
=
std
::
list
<
instruction
>::
iterator
;
using
instruction_ref
=
std
::
list
<
instruction
>::
iterator
;
migraphx
::
instruction
*
as_address
(
const
instruction_ref
&
ins
)
noexcept
;
MIGRAPHX_EXPORT
migraphx
::
instruction
*
as_address
(
const
instruction_ref
&
ins
)
noexcept
;
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
...
...
Prev
1
2
3
4
5
6
7
…
14
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