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
96358e41
Commit
96358e41
authored
Nov 14, 2018
by
Paul
Browse files
Rename to migraphx
parent
80203608
Changes
190
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
160 additions
and
160 deletions
+160
-160
src/onnx/CMakeLists.txt
src/onnx/CMakeLists.txt
+11
-11
src/onnx/cifar10.cpp
src/onnx/cifar10.cpp
+15
-15
src/onnx/mnist.cpp
src/onnx/mnist.cpp
+11
-11
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+16
-16
src/onnx/perf_onnx.cpp
src/onnx/perf_onnx.cpp
+11
-11
src/onnx/read_onnx.cpp
src/onnx/read_onnx.cpp
+2
-2
src/onnx/verify_onnx.cpp
src/onnx/verify_onnx.cpp
+26
-26
src/opt/common_header.hpp
src/opt/common_header.hpp
+9
-9
src/opt/memory_coloring.cpp
src/opt/memory_coloring.cpp
+3
-3
src/opt/memory_coloring_impl.cpp
src/opt/memory_coloring_impl.cpp
+2
-2
src/opt/memory_coloring_impl.hpp
src/opt/memory_coloring_impl.hpp
+3
-3
src/program.cpp
src/program.cpp
+9
-9
src/shape.cpp
src/shape.cpp
+4
-4
src/simplify_algebra.cpp
src/simplify_algebra.cpp
+7
-7
src/simplify_reshapes.cpp
src/simplify_reshapes.cpp
+8
-8
src/targets/cpu/CMakeLists.txt
src/targets/cpu/CMakeLists.txt
+7
-7
src/targets/cpu/gemm.cpp
src/targets/cpu/gemm.cpp
+5
-5
src/targets/cpu/include/migraphx/cpu/context.hpp
src/targets/cpu/include/migraphx/cpu/context.hpp
+3
-3
src/targets/cpu/include/migraphx/cpu/gemm.hpp
src/targets/cpu/include/migraphx/cpu/gemm.hpp
+4
-4
src/targets/cpu/include/migraphx/cpu/lowering.hpp
src/targets/cpu/include/migraphx/cpu/lowering.hpp
+4
-4
No files found.
src/onnx/CMakeLists.txt
View file @
96358e41
...
...
@@ -7,35 +7,35 @@ target_compile_options(onnx-proto PRIVATE -w)
target_link_libraries
(
onnx-proto PRIVATE
${
PROTOBUF_LIBRARY
}
)
set_target_properties
(
onnx-proto PROPERTIES POSITION_INDEPENDENT_CODE On
)
add_library
(
migraph_onnx onnx.cpp
)
set_target_properties
(
migraph_onnx PROPERTIES EXPORT_NAME onnx
)
rocm_clang_tidy_check
(
migraph_onnx
)
target_link_libraries
(
migraph_onnx PRIVATE onnx-proto
)
target_link_libraries
(
migraph_onnx PUBLIC migraph
)
add_library
(
migraph
x
_onnx onnx.cpp
)
set_target_properties
(
migraph
x
_onnx PROPERTIES EXPORT_NAME onnx
)
rocm_clang_tidy_check
(
migraph
x
_onnx
)
target_link_libraries
(
migraph
x
_onnx PRIVATE onnx-proto
)
target_link_libraries
(
migraph
x
_onnx PUBLIC migraph
x
)
rocm_install_targets
(
TARGETS migraph_onnx
TARGETS migraph
x
_onnx
)
add_executable
(
read_onnx read_onnx.cpp
)
rocm_clang_tidy_check
(
read_onnx
)
target_link_libraries
(
read_onnx migraph_onnx
)
target_link_libraries
(
read_onnx migraph
x
_onnx
)
if
(
MIGRAPH_ENABLE_GPU
)
add_executable
(
mnist mnist.cpp
)
rocm_clang_tidy_check
(
mnist
)
target_link_libraries
(
mnist migraph_cpu migraph_gpu migraph_onnx
)
target_link_libraries
(
mnist migraph
x
_cpu migraph
x
_gpu migraph
x
_onnx
)
add_executable
(
cifar10 cifar10.cpp
)
rocm_clang_tidy_check
(
cifar10
)
target_link_libraries
(
cifar10 migraph_cpu migraph_gpu migraph_onnx
)
target_link_libraries
(
cifar10 migraph
x
_cpu migraph
x
_gpu migraph
x
_onnx
)
add_executable
(
verify_onnx verify_onnx.cpp
)
rocm_clang_tidy_check
(
verify_onnx
)
target_link_libraries
(
verify_onnx migraph_onnx migraph_cpu migraph_gpu
)
target_link_libraries
(
verify_onnx migraph
x
_onnx migraph
x
_cpu migraph
x
_gpu
)
add_executable
(
perf_onnx perf_onnx.cpp
)
rocm_clang_tidy_check
(
perf_onnx
)
target_link_libraries
(
perf_onnx migraph_onnx migraph_cpu migraph_gpu
)
target_link_libraries
(
perf_onnx migraph
x
_onnx migraph
x
_cpu migraph
x
_gpu
)
endif
()
src/onnx/cifar10.cpp
View file @
96358e41
...
...
@@ -4,12 +4,12 @@
#include <numeric>
#include <stdexcept>
#include <migraph/onnx.hpp>
#include <migraph
x
/onnx.hpp>
#include <migraph/cpu/target.hpp>
#include <migraph/gpu/target.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/generate.hpp>
#include <migraph
x
/cpu/target.hpp>
#include <migraph
x
/gpu/target.hpp>
#include <migraph
x
/gpu/hip.hpp>
#include <migraph
x
/generate.hpp>
#include "softmax.hpp"
...
...
@@ -53,19 +53,19 @@ int main(int argc, char const* argv[])
std
::
string
gpu_cpu
=
argv
[
1
];
std
::
string
file
=
argv
[
2
];
std
::
string
datafile
=
argv
[
3
];
auto
prog
=
migraph
::
parse_onnx
(
file
);
auto
prog
=
migraph
x
::
parse_onnx
(
file
);
std
::
cout
<<
prog
<<
std
::
endl
;
auto
imageset
=
read_cifar10_images
(
datafile
);
if
(
gpu_cpu
==
"gpu"
)
{
// GPU target
prog
.
compile
(
migraph
::
gpu
::
target
{});
migraph
::
program
::
parameter_map
m
;
auto
s
=
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
1
,
3
,
32
,
32
}};
prog
.
compile
(
migraph
x
::
gpu
::
target
{});
migraph
x
::
program
::
parameter_map
m
;
auto
s
=
migraph
x
::
shape
{
migraph
x
::
shape
::
float_type
,
{
1
,
3
,
32
,
32
}};
for
(
auto
&&
x
:
prog
.
get_parameter_shapes
())
{
m
[
x
.
first
]
=
migraph
::
gpu
::
to_gpu
(
migraph
::
generate_argument
(
x
.
second
));
m
[
x
.
first
]
=
migraph
x
::
gpu
::
to_gpu
(
migraph
x
::
generate_argument
(
x
.
second
));
}
auto
labels
=
imageset
.
first
;
auto
input
=
imageset
.
second
;
...
...
@@ -73,8 +73,8 @@ int main(int argc, char const* argv[])
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
std
::
cout
<<
"label: "
<<
static_cast
<
uint32_t
>
(
labels
[
i
])
<<
" ----> "
;
m
[
"0"
]
=
migraph
::
gpu
::
to_gpu
(
migraph
::
argument
{
s
,
&
ptr
[
3072
*
i
]});
auto
result
=
migraph
::
gpu
::
from_gpu
(
prog
.
eval
(
m
));
m
[
"0"
]
=
migraph
x
::
gpu
::
to_gpu
(
migraph
x
::
argument
{
s
,
&
ptr
[
3072
*
i
]});
auto
result
=
migraph
x
::
gpu
::
from_gpu
(
prog
.
eval
(
m
));
std
::
vector
<
float
>
logits
;
result
.
visit
([
&
](
auto
output
)
{
logits
.
assign
(
output
.
begin
(),
output
.
end
());
});
std
::
vector
<
float
>
probs
=
softmax
<
float
>
(
logits
);
...
...
@@ -86,15 +86,15 @@ int main(int argc, char const* argv[])
else
{
// CPU target
prog
.
compile
(
migraph
::
cpu
::
target
{});
auto
s
=
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
1
,
3
,
32
,
32
}};
prog
.
compile
(
migraph
x
::
cpu
::
target
{});
auto
s
=
migraph
x
::
shape
{
migraph
x
::
shape
::
float_type
,
{
1
,
3
,
32
,
32
}};
auto
labels
=
imageset
.
first
;
auto
input
=
imageset
.
second
;
auto
ptr
=
input
.
data
();
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
std
::
cout
<<
"label: "
<<
static_cast
<
uint32_t
>
(
labels
[
i
])
<<
" ----> "
;
auto
input3
=
migraph
::
argument
{
s
,
&
ptr
[
3072
*
i
]};
auto
input3
=
migraph
x
::
argument
{
s
,
&
ptr
[
3072
*
i
]};
auto
result
=
prog
.
eval
({{
"0"
,
input3
}});
std
::
vector
<
float
>
logits
;
result
.
visit
([
&
](
auto
output
)
{
logits
.
assign
(
output
.
begin
(),
output
.
end
());
});
...
...
src/onnx/mnist.cpp
View file @
96358e41
...
...
@@ -4,11 +4,11 @@
#include <numeric>
#include <stdexcept>
#include <migraph/onnx.hpp>
#include <migraph
x
/onnx.hpp>
#include <migraph/gpu/target.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/generate.hpp>
#include <migraph
x
/gpu/target.hpp>
#include <migraph
x
/gpu/hip.hpp>
#include <migraph
x
/generate.hpp>
#include "softmax.hpp"
...
...
@@ -113,20 +113,20 @@ int main(int argc, char const* argv[])
std
::
vector
<
int32_t
>
labels
=
read_mnist_labels
(
labelfile
,
nlabels
);
std
::
string
file
=
argv
[
1
];
auto
prog
=
migraph
::
parse_onnx
(
file
);
auto
prog
=
migraph
x
::
parse_onnx
(
file
);
std
::
cout
<<
prog
<<
std
::
endl
<<
std
::
endl
;
prog
.
compile
(
migraph
::
gpu
::
target
{});
auto
s
=
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
1
,
1
,
28
,
28
}};
prog
.
compile
(
migraph
x
::
gpu
::
target
{});
auto
s
=
migraph
x
::
shape
{
migraph
x
::
shape
::
float_type
,
{
1
,
1
,
28
,
28
}};
std
::
cout
<<
s
<<
std
::
endl
;
auto
ptr
=
input
.
data
();
migraph
::
program
::
parameter_map
m
;
migraph
x
::
program
::
parameter_map
m
;
m
[
"output"
]
=
migraph
::
gpu
::
to_gpu
(
migraph
::
generate_argument
(
prog
.
get_parameter_shape
(
"output"
)));
migraph
x
::
gpu
::
to_gpu
(
migraph
x
::
generate_argument
(
prog
.
get_parameter_shape
(
"output"
)));
for
(
int
i
=
0
;
i
<
20
;
i
++
)
{
std
::
cout
<<
"label: "
<<
labels
[
i
]
<<
" ----> "
;
m
[
"0"
]
=
migraph
::
gpu
::
to_gpu
(
migraph
::
argument
{
s
,
&
ptr
[
784
*
i
]});
auto
result
=
migraph
::
gpu
::
from_gpu
(
prog
.
eval
(
m
));
m
[
"0"
]
=
migraph
x
::
gpu
::
to_gpu
(
migraph
x
::
argument
{
s
,
&
ptr
[
784
*
i
]});
auto
result
=
migraph
x
::
gpu
::
from_gpu
(
prog
.
eval
(
m
));
std
::
vector
<
float
>
logits
;
result
.
visit
([
&
](
auto
output
)
{
logits
.
assign
(
output
.
begin
(),
output
.
end
());
});
std
::
vector
<
float
>
probs
=
softmax
(
logits
);
...
...
src/onnx/onnx.cpp
View file @
96358e41
...
...
@@ -9,14 +9,14 @@
#include <utility>
#include <vector>
#include <migraph/fallthrough.hpp>
#include <migraph/program.hpp>
#include <migraph/operators.hpp>
#include <migraph/ranges.hpp>
#include <migraph/instruction.hpp>
#include <migraph/config.hpp>
namespace
migraph
{
#include <migraph
x
/fallthrough.hpp>
#include <migraph
x
/program.hpp>
#include <migraph
x
/operators.hpp>
#include <migraph
x
/ranges.hpp>
#include <migraph
x
/instruction.hpp>
#include <migraph
x
/config.hpp>
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
struct
unknown
{
...
...
@@ -406,12 +406,12 @@ struct onnx_parser
auto
scale_val
=
prog
.
add_literal
(
scale
);
auto
bias_vals
=
prog
.
add_literal
(
migraph
::
literal
{
migraph
::
shape
{
migraph
::
shape
::
float_type
,
{
bias
.
size
()}},
bias
});
migraph
x
::
literal
{
migraph
x
::
shape
{
migraph
x
::
shape
::
float_type
,
{
bias
.
size
()}},
bias
});
auto
scale_tensor
=
prog
.
add_instruction
(
migraph
::
op
::
scalar
{
input_shape
},
scale_val
);
auto
img_scaled
=
prog
.
add_instruction
(
migraph
::
op
::
mul
{},
args
.
front
(),
scale_tensor
);
auto
bias_bcast
=
prog
.
add_instruction
(
migraph
::
op
::
broadcast
{
1
,
input_shape
},
bias_vals
);
return
prog
.
add_instruction
(
migraph
::
op
::
add
{},
img_scaled
,
bias_bcast
);
auto
scale_tensor
=
prog
.
add_instruction
(
migraph
x
::
op
::
scalar
{
input_shape
},
scale_val
);
auto
img_scaled
=
prog
.
add_instruction
(
migraph
x
::
op
::
mul
{},
args
.
front
(),
scale_tensor
);
auto
bias_bcast
=
prog
.
add_instruction
(
migraph
x
::
op
::
broadcast
{
1
,
input_shape
},
bias_vals
);
return
prog
.
add_instruction
(
migraph
x
::
op
::
add
{},
img_scaled
,
bias_bcast
);
}
instruction_ref
...
...
@@ -423,7 +423,7 @@ struct onnx_parser
auto
&&
perm_vals
=
attributes
[
"perm"
].
ints
();
perm
=
std
::
vector
<
int64_t
>
(
perm_vals
.
begin
(),
perm_vals
.
end
());
}
return
prog
.
add_instruction
(
migraph
::
op
::
transpose
{
perm
},
args
.
front
());
return
prog
.
add_instruction
(
migraph
x
::
op
::
transpose
{
perm
},
args
.
front
());
}
void
parse_from
(
std
::
istream
&
is
)
...
...
@@ -519,7 +519,7 @@ struct onnx_parser
{
if
(
node
.
name
().
empty
())
{
std
::
string
generated
=
"migraph_unnamed_node"
;
std
::
string
generated
=
"migraph
x
_unnamed_node"
;
return
std
::
accumulate
(
node
.
output
().
begin
(),
node
.
output
().
end
(),
generated
,
...
...
@@ -694,4 +694,4 @@ program parse_onnx(const std::string& name)
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
src/onnx/perf_onnx.cpp
View file @
96358e41
#include <migraph/onnx.hpp>
#include <migraph
x
/onnx.hpp>
#include <migraph/gpu/target.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/generate.hpp>
#include <migraph/verify.hpp>
#include <migraph
x
/gpu/target.hpp>
#include <migraph
x
/gpu/hip.hpp>
#include <migraph
x
/generate.hpp>
#include <migraph
x
/verify.hpp>
migraph
::
program
::
parameter_map
create_param_map
(
const
migraph
::
program
&
p
,
bool
gpu
=
true
)
migraph
x
::
program
::
parameter_map
create_param_map
(
const
migraph
x
::
program
&
p
,
bool
gpu
=
true
)
{
migraph
::
program
::
parameter_map
m
;
migraph
x
::
program
::
parameter_map
m
;
for
(
auto
&&
x
:
p
.
get_parameter_shapes
())
{
if
(
gpu
)
m
[
x
.
first
]
=
migraph
::
gpu
::
to_gpu
(
migraph
::
generate_argument
(
x
.
second
));
m
[
x
.
first
]
=
migraph
x
::
gpu
::
to_gpu
(
migraph
x
::
generate_argument
(
x
.
second
));
else
m
[
x
.
first
]
=
migraph
::
generate_argument
(
x
.
second
);
m
[
x
.
first
]
=
migraph
x
::
generate_argument
(
x
.
second
);
}
return
m
;
}
...
...
@@ -25,9 +25,9 @@ int main(int argc, char const* argv[])
{
std
::
string
file
=
argv
[
1
];
std
::
size_t
n
=
argc
>
2
?
std
::
stoul
(
argv
[
2
])
:
50
;
auto
p
=
migraph
::
parse_onnx
(
file
);
auto
p
=
migraph
x
::
parse_onnx
(
file
);
std
::
cout
<<
"Compiling ... "
<<
std
::
endl
;
p
.
compile
(
migraph
::
gpu
::
target
{});
p
.
compile
(
migraph
x
::
gpu
::
target
{});
std
::
cout
<<
"Allocating params ... "
<<
std
::
endl
;
auto
m
=
create_param_map
(
p
);
std
::
cout
<<
"Running performance report ... "
<<
std
::
endl
;
...
...
src/onnx/read_onnx.cpp
View file @
96358e41
#include <migraph/onnx.hpp>
#include <migraph
x
/onnx.hpp>
int
main
(
int
argc
,
char
const
*
argv
[])
{
if
(
argc
>
1
)
{
std
::
string
file
=
argv
[
1
];
auto
prog
=
migraph
::
parse_onnx
(
file
);
auto
prog
=
migraph
x
::
parse_onnx
(
file
);
std
::
cout
<<
prog
<<
std
::
endl
;
}
}
src/onnx/verify_onnx.cpp
View file @
96358e41
#include <migraph/onnx.hpp>
#include <migraph
x
/onnx.hpp>
#include <migraph/cpu/target.hpp>
#include <migraph/gpu/target.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/generate.hpp>
#include <migraph/verify_args.hpp>
#include <migraph/instruction.hpp>
#include <migraph
x
/cpu/target.hpp>
#include <migraph
x
/gpu/target.hpp>
#include <migraph
x
/gpu/hip.hpp>
#include <migraph
x
/generate.hpp>
#include <migraph
x
/verify_args.hpp>
#include <migraph
x
/instruction.hpp>
template
<
class
T
>
auto
get_hash
(
const
T
&
x
)
...
...
@@ -15,14 +15,14 @@ auto get_hash(const T& x)
}
template
<
class
F
>
migraph
::
argument
run_cpu
(
F
f
)
migraph
x
::
argument
run_cpu
(
F
f
)
{
auto
p
=
f
();
p
.
compile
(
migraph
::
cpu
::
target
{});
migraph
::
program
::
parameter_map
m
;
p
.
compile
(
migraph
x
::
cpu
::
target
{});
migraph
x
::
program
::
parameter_map
m
;
for
(
auto
&&
x
:
p
.
get_parameter_shapes
())
{
m
[
x
.
first
]
=
migraph
::
generate_argument
(
x
.
second
,
get_hash
(
x
.
first
));
m
[
x
.
first
]
=
migraph
x
::
generate_argument
(
x
.
second
,
get_hash
(
x
.
first
));
}
auto
out
=
p
.
eval
(
m
);
std
::
cout
<<
p
<<
std
::
endl
;
...
...
@@ -30,19 +30,19 @@ migraph::argument run_cpu(F f)
}
template
<
class
F
>
migraph
::
argument
run_gpu
(
F
f
)
migraph
x
::
argument
run_gpu
(
F
f
)
{
auto
p
=
f
();
p
.
compile
(
migraph
::
gpu
::
target
{});
p
.
compile
(
migraph
x
::
gpu
::
target
{});
migraph
::
program
::
parameter_map
m
;
migraph
x
::
program
::
parameter_map
m
;
for
(
auto
&&
x
:
p
.
get_parameter_shapes
())
{
m
[
x
.
first
]
=
migraph
::
gpu
::
to_gpu
(
migraph
::
generate_argument
(
x
.
second
,
get_hash
(
x
.
first
)));
m
[
x
.
first
]
=
migraph
x
::
gpu
::
to_gpu
(
migraph
x
::
generate_argument
(
x
.
second
,
get_hash
(
x
.
first
)));
}
auto
out
=
migraph
::
gpu
::
from_gpu
(
p
.
eval
(
m
));
auto
out
=
migraph
x
::
gpu
::
from_gpu
(
p
.
eval
(
m
));
std
::
cout
<<
p
<<
std
::
endl
;
return
migraph
::
gpu
::
from_gpu
(
out
);
return
migraph
x
::
gpu
::
from_gpu
(
out
);
}
template
<
class
F
>
...
...
@@ -50,12 +50,12 @@ void verify_program(const std::string& name, F f, double tolerance = 100)
{
auto
x
=
run_cpu
(
f
);
auto
y
=
run_gpu
(
f
);
migraph
::
verify_args
(
name
,
x
,
y
,
tolerance
);
migraph
x
::
verify_args
(
name
,
x
,
y
,
tolerance
);
// std::cout << "cpu: " << x << std::endl;
// std::cout << "gpu: " << y << std::endl;
}
void
verify_instructions
(
const
migraph
::
program
&
prog
,
double
tolerance
=
80
)
void
verify_instructions
(
const
migraph
x
::
program
&
prog
,
double
tolerance
=
80
)
{
for
(
auto
&&
ins
:
prog
)
{
...
...
@@ -68,8 +68,8 @@ void verify_instructions(const migraph::program& prog, double tolerance = 80)
if
(
ins
.
name
()
==
"reshape"
)
continue
;
auto
create_program
=
[
&
]
{
migraph
::
program
p
;
std
::
vector
<
migraph
::
instruction_ref
>
inputs
;
migraph
x
::
program
p
;
std
::
vector
<
migraph
x
::
instruction_ref
>
inputs
;
for
(
auto
&&
arg
:
ins
.
inputs
())
{
if
(
arg
->
name
()
==
"@literal"
)
...
...
@@ -100,7 +100,7 @@ void verify_reduced(F f, int n, double tolerance = 80)
{
auto
create_program
=
[
&
]
{
migraph
::
program
p
=
f
();
migraph
x
::
program
p
=
f
();
auto
last
=
std
::
prev
(
p
.
end
(),
n
+
1
);
p
.
remove_instructions
(
last
,
p
.
end
());
return
p
;
...
...
@@ -113,7 +113,7 @@ void verify_reduced(F f, int n, double tolerance = 80)
template
<
class
F
>
void
verify_reduced_program
(
F
f
,
double
tolerance
=
80
)
{
migraph
::
program
p
=
f
();
migraph
x
::
program
p
=
f
();
auto
n
=
std
::
distance
(
p
.
begin
(),
p
.
end
());
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
...
...
@@ -127,7 +127,7 @@ int main(int argc, char const* argv[])
if
(
not
args
.
empty
())
{
std
::
string
file
=
args
.
front
();
auto
p
=
migraph
::
parse_onnx
(
file
);
auto
p
=
migraph
x
::
parse_onnx
(
file
);
std
::
cout
<<
p
<<
std
::
endl
;
if
(
std
::
any_of
(
args
.
begin
(),
args
.
end
(),
[](
const
auto
&
s
)
{
return
s
==
"-i"
;
}))
...
...
@@ -136,11 +136,11 @@ int main(int argc, char const* argv[])
}
else
if
(
std
::
any_of
(
args
.
begin
(),
args
.
end
(),
[](
const
auto
&
s
)
{
return
s
==
"-r"
;
}))
{
verify_reduced_program
([
&
]
{
return
migraph
::
parse_onnx
(
file
);
});
verify_reduced_program
([
&
]
{
return
migraph
x
::
parse_onnx
(
file
);
});
}
else
{
verify_program
(
file
,
[
&
]
{
return
migraph
::
parse_onnx
(
file
);
});
verify_program
(
file
,
[
&
]
{
return
migraph
x
::
parse_onnx
(
file
);
});
}
}
}
src/opt/common_header.hpp
View file @
96358e41
#ifndef MIGRAPH_GUARD_RTGLIB_COMMON_HEADER_HPP
#define MIGRAPH_GUARD_RTGLIB_COMMON_HEADER_HPP
#include <migraph/program.hpp>
#include <migraph/stringutils.hpp>
#include <migraph/instruction.hpp>
#include <migraph/operators.hpp>
#include <migraph/iterator_for.hpp>
#include <migraph/pass_config.hpp>
#include <migraph/config.hpp>
#include <migraph
x
/program.hpp>
#include <migraph
x
/stringutils.hpp>
#include <migraph
x
/instruction.hpp>
#include <migraph
x
/operators.hpp>
#include <migraph
x
/iterator_for.hpp>
#include <migraph
x
/pass_config.hpp>
#include <migraph
x
/config.hpp>
#include <set>
#include <list>
#include <vector>
#include <queue>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
//#define MIGRAPH_DEBUG_OPT
...
...
@@ -25,6 +25,6 @@ inline namespace MIGRAPH_INLINE_NS {
#endif // MIGRAPH_DEBUG_OPT
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
#endif // MIGRAPH_GUARD_RTGLIB_COMMON_HEADER_HPP
src/opt/memory_coloring.cpp
View file @
96358e41
#include <migraph/memory_coloring.hpp>
#include <migraph
x
/memory_coloring.hpp>
#include "memory_coloring_impl.hpp"
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
void
memory_coloring
::
apply
(
program
&
p
)
const
...
...
@@ -14,4 +14,4 @@ void memory_coloring::apply(program& p) const
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
src/opt/memory_coloring_impl.cpp
View file @
96358e41
#include "memory_coloring_impl.hpp"
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
void
memory_coloring_impl
::
run
()
...
...
@@ -335,4 +335,4 @@ void live_interval::dump()
#endif
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
src/opt/memory_coloring_impl.hpp
View file @
96358e41
#ifndef MIGRAPH_GUARD_RTGLIB_MEMORY_COLORING_IMPL_HPP
#define MIGRAPH_GUARD_RTGLIB_MEMORY_COLORING_IMPL_HPP
#include "common_header.hpp"
#include <migraph/config.hpp>
#include <migraph
x
/config.hpp>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
static
const
int
invalid_offset
=
-
1
;
...
...
@@ -155,5 +155,5 @@ struct memory_coloring_impl
};
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
#endif
src/program.cpp
View file @
96358e41
#include <migraph/program.hpp>
#include <migraph/stringutils.hpp>
#include <migraph/instruction.hpp>
#include <migraph/env.hpp>
#include <migraph/ranges.hpp>
#include <migraph/time.hpp>
#include <migraph/iterator_for.hpp>
#include <migraph
x
/program.hpp>
#include <migraph
x
/stringutils.hpp>
#include <migraph
x
/instruction.hpp>
#include <migraph
x
/env.hpp>
#include <migraph
x
/ranges.hpp>
#include <migraph
x
/time.hpp>
#include <migraph
x
/iterator_for.hpp>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <utility>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
MIGRAPH_DECLARE_ENV_VAR
(
MIGRAPH_TRACE_COMPILE
)
...
...
@@ -502,4 +502,4 @@ std::ostream& operator<<(std::ostream& os, const program& p)
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
src/shape.cpp
View file @
96358e41
#include <migraph/shape.hpp>
#include <migraph/stringutils.hpp>
#include <migraph
x
/shape.hpp>
#include <migraph
x
/stringutils.hpp>
#include <numeric>
#include <algorithm>
#include <functional>
#include <iostream>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
struct
shape_impl
...
...
@@ -192,4 +192,4 @@ std::ostream& operator<<(std::ostream& os, const shape& x)
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
src/simplify_algebra.cpp
View file @
96358e41
#include <migraph/simplify_algebra.hpp>
#include <migraph/program.hpp>
#include <migraph/operators.hpp>
#include <migraph/matcher.hpp>
#include <migraph/literal.hpp>
#include <migraph
x
/simplify_algebra.hpp>
#include <migraph
x
/program.hpp>
#include <migraph
x
/operators.hpp>
#include <migraph
x
/matcher.hpp>
#include <migraph
x
/literal.hpp>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
struct
find_add_lit_broadcast
...
...
@@ -62,4 +62,4 @@ struct find_add_lit_broadcast
void
simplify_algebra
::
apply
(
program
&
p
)
const
{
match
::
find_matches
(
p
,
find_add_lit_broadcast
{});
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
src/simplify_reshapes.cpp
View file @
96358e41
#include <migraph/simplify_reshapes.hpp>
#include <migraph/program.hpp>
#include <migraph/instruction.hpp>
#include <migraph/operators.hpp>
#include <migraph/iterator_for.hpp>
#include <migraph/ranges.hpp>
#include <migraph
x
/simplify_reshapes.hpp>
#include <migraph
x
/program.hpp>
#include <migraph
x
/instruction.hpp>
#include <migraph
x
/operators.hpp>
#include <migraph
x
/iterator_for.hpp>
#include <migraph
x
/ranges.hpp>
#include <unordered_set>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
bool
is_reshaper
(
const
std
::
string
&
name
)
...
...
@@ -61,4 +61,4 @@ void simplify_reshapes::apply(program& p) const
}
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
src/targets/cpu/CMakeLists.txt
View file @
96358e41
add_library
(
migraph_cpu
add_library
(
migraph
x
_cpu
target.cpp
lowering.cpp
gemm.cpp
)
set_target_properties
(
migraph_cpu PROPERTIES EXPORT_NAME cpu
)
set_target_properties
(
migraph
x
_cpu PROPERTIES EXPORT_NAME cpu
)
find_path
(
BLAZE_INCLUDE blaze/Blaze.h
)
find_package
(
Threads
)
rocm_clang_tidy_check
(
migraph_cpu
)
target_link_libraries
(
migraph_cpu migraph Threads::Threads
)
target_include_directories
(
migraph_cpu PRIVATE
${
BLAZE_INCLUDE
}
)
target_compile_definitions
(
migraph_cpu PRIVATE -DBLAZE_USE_CPP_THREADS
)
rocm_clang_tidy_check
(
migraph
x
_cpu
)
target_link_libraries
(
migraph
x
_cpu migraph
x
Threads::Threads
)
target_include_directories
(
migraph
x
_cpu PRIVATE
${
BLAZE_INCLUDE
}
)
target_compile_definitions
(
migraph
x
_cpu PRIVATE -DBLAZE_USE_CPP_THREADS
)
rocm_install_targets
(
TARGETS migraph_cpu
TARGETS migraph
x
_cpu
INCLUDE
${
CMAKE_CURRENT_SOURCE_DIR
}
/include
)
...
...
src/targets/cpu/gemm.cpp
View file @
96358e41
#include <migraph/cpu/gemm.hpp>
#include <migraph/dfor.hpp>
#include <migraph/requires.hpp>
#include <migraph
x
/cpu/gemm.hpp>
#include <migraph
x
/dfor.hpp>
#include <migraph
x
/requires.hpp>
#include <blaze/math/CustomMatrix.h>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
cpu
{
...
...
@@ -95,4 +95,4 @@ void migemm(
}
// namespace cpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
src/targets/cpu/include/migraph/cpu/context.hpp
→
src/targets/cpu/include/migraph
x
/cpu/context.hpp
View file @
96358e41
#ifndef MIGRAPH_GUARD_RTGLIB_CONTEXT_HPP
#define MIGRAPH_GUARD_RTGLIB_CONTEXT_HPP
#include <migraph/config.hpp>
#include <migraph
x
/config.hpp>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
cpu
{
...
...
@@ -14,6 +14,6 @@ struct context
}
// namespace cpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
#endif
src/targets/cpu/include/migraph/cpu/gemm.hpp
→
src/targets/cpu/include/migraph
x
/cpu/gemm.hpp
View file @
96358e41
#ifndef MIGRAPH_GUARD_RTGLIB_CPU_GEMM_HPP
#define MIGRAPH_GUARD_RTGLIB_CPU_GEMM_HPP
#include <migraph/argument.hpp>
#include <migraph/config.hpp>
#include <migraph
x
/argument.hpp>
#include <migraph
x
/config.hpp>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
cpu
{
...
...
@@ -13,6 +13,6 @@ void migemm(
}
// namespace cpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
#endif
src/targets/cpu/include/migraph/cpu/lowering.hpp
→
src/targets/cpu/include/migraph
x
/cpu/lowering.hpp
View file @
96358e41
#ifndef MIGRAPH_GUARD_RTGLIB_CPU_LOWERING_HPP
#define MIGRAPH_GUARD_RTGLIB_CPU_LOWERING_HPP
#include <migraph/program.hpp>
#include <migraph/config.hpp>
#include <migraph
x
/program.hpp>
#include <migraph
x
/config.hpp>
namespace
migraph
{
namespace
migraph
x
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
cpu
{
...
...
@@ -16,6 +16,6 @@ struct lowering
}
// namespace cpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
x
#endif
Prev
1
2
3
4
5
6
7
8
9
10
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