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
faefeef9
Unverified
Commit
faefeef9
authored
May 25, 2022
by
Charlie Lin
Committed by
GitHub
May 25, 2022
Browse files
Merge branch 'develop' into dyn_shape_update
parents
97a40ac3
bf0a4713
Changes
94
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
264 additions
and
42 deletions
+264
-42
src/targets/gpu/sync_device.cpp
src/targets/gpu/sync_device.cpp
+4
-4
src/targets/gpu/target.cpp
src/targets/gpu/target.cpp
+3
-0
src/targets/gpu/write_literals.cpp
src/targets/gpu/write_literals.cpp
+7
-7
test/api/test_module_construct.cpp
test/api/test_module_construct.cpp
+5
-7
test/dead_code_elimination_test.cpp
test/dead_code_elimination_test.cpp
+34
-0
test/matcher.cpp
test/matcher.cpp
+12
-12
test/onnx/gen_onnx.py
test/onnx/gen_onnx.py
+14
-0
test/onnx/mean_integral_test.onnx
test/onnx/mean_integral_test.onnx
+67
-0
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+24
-0
test/onnx/verify_onnx.cpp
test/onnx/verify_onnx.cpp
+27
-0
test/py/test_module_construct.py
test/py/test_module_construct.py
+12
-10
test/py/test_numpy.py
test/py/test_numpy.py
+22
-0
test/reduce_dims.cpp
test/reduce_dims.cpp
+23
-0
tools/install_prereqs.sh
tools/install_prereqs.sh
+10
-2
No files found.
src/targets/gpu/sync_device.cpp
View file @
faefeef9
...
...
@@ -8,9 +8,9 @@ namespace migraphx {
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
void
sync_device
::
apply
(
module
&
p
)
const
void
sync_device
::
apply
(
module
&
m
)
const
{
auto
last
=
std
::
prev
(
p
.
end
());
auto
last
=
std
::
prev
(
m
.
end
());
if
(
last
->
name
()
==
"@return"
)
{
auto
inputs
=
last
->
inputs
();
...
...
@@ -18,10 +18,10 @@ void sync_device::apply(module& p) const
return
(
i
->
name
()
==
"hip::copy_from_gpu"
);
}))
{
auto
sync_in
=
p
.
insert_instruction
(
last
,
make_op
(
"hip::sync_stream"
),
inputs
);
auto
sync_in
=
m
.
insert_instruction
(
last
,
make_op
(
"hip::sync_stream"
),
inputs
);
if
(
not
inputs
.
empty
())
{
p
.
replace_instruction
(
inputs
.
front
(),
sync_in
);
m
.
replace_instruction
(
inputs
.
front
(),
sync_in
);
}
}
}
...
...
src/targets/gpu/target.cpp
View file @
faefeef9
...
...
@@ -31,6 +31,7 @@
#include <migraphx/gpu/context.hpp>
#include <migraphx/gpu/eliminate_workspace.hpp>
#include <migraphx/gpu/fuse_ops.hpp>
#include <migraphx/gpu/prefuse_ops.hpp>
#include <migraphx/gpu/lowering.hpp>
#include <migraphx/gpu/mlir_conv.hpp>
#include <migraphx/gpu/pack_int8_args.hpp>
...
...
@@ -96,6 +97,8 @@ std::vector<pass> target::get_passes(migraphx::context& gctx, const compile_opti
simplify_algebra
{},
simplify_reshapes
{},
simplify_algebra
{},
prefuse_ops
{},
dead_code_elimination
{},
auto_contiguous
{},
simplify_reshapes
{},
propagate_constant
{},
...
...
src/targets/gpu/write_literals.cpp
View file @
faefeef9
...
...
@@ -11,25 +11,25 @@ namespace gpu {
MIGRAPHX_DECLARE_ENV_VAR
(
MIGRAPHX_COPY_LITERALS
)
void
write_literals
::
apply
(
module
&
p
)
const
void
write_literals
::
apply
(
module
&
m
)
const
{
assert
(
ctx
!=
nullptr
);
std
::
size_t
n
=
0
;
for
(
auto
ins
:
iterator_for
(
p
))
for
(
auto
ins
:
iterator_for
(
m
))
{
if
(
ins
->
name
()
==
"@literal"
)
{
if
(
enabled
(
MIGRAPHX_COPY_LITERALS
{}))
{
literal
l
=
ins
->
get_literal
();
auto
pre
=
p
.
add_literal
(
l
);
auto
alloc
=
p
.
insert_instruction
(
std
::
next
(
pre
),
hip_allocate
{
l
.
get_shape
()});
p
.
replace_instruction
(
ins
,
hip_copy_to_gpu
{},
pre
,
alloc
);
auto
pre
=
m
.
add_literal
(
l
);
auto
alloc
=
m
.
insert_instruction
(
std
::
next
(
pre
),
hip_allocate
{
l
.
get_shape
()});
m
.
replace_instruction
(
ins
,
hip_copy_to_gpu
{},
pre
,
alloc
);
}
else
{
std
::
string
id
=
p
.
name
()
+
":@literal:"
+
std
::
to_string
(
n
);
p
.
replace_instruction
(
ins
,
hip_copy_literal
{
ins
->
get_literal
(),
id
});
std
::
string
id
=
m
.
name
()
+
":@literal:"
+
std
::
to_string
(
n
);
m
.
replace_instruction
(
ins
,
hip_copy_literal
{
ins
->
get_literal
(),
id
});
n
++
;
}
}
...
...
test/api/test_module_construct.cpp
View file @
faefeef9
...
...
@@ -3,23 +3,21 @@
#include <migraphx/migraphx.hpp>
#include "test.hpp"
TEST_CASE
(
add_
op
)
TEST_CASE
(
add_
literals
)
{
migraphx
::
program
p
;
migraphx
::
module
m
=
p
.
get_main_module
();
migraphx
::
shape
param_shape
{
migraphx_shape_float_type
,
{
3
,
3
}};
auto
x
=
m
.
add_parameter
(
"x"
,
param_shape
);
auto
y
=
m
.
add_parameter
(
"y"
,
param_shape
);
std
::
vector
<
float
>
x_values
(
9
,
1
);
auto
x
=
m
.
add_literal
(
param_shape
,
x_values
.
data
());
std
::
vector
<
float
>
y_values
(
9
,
-
1
);
auto
y
=
m
.
add_literal
(
param_shape
,
y_values
.
data
());
auto
add_op
=
migraphx
::
operation
(
"add"
);
auto
r
=
m
.
add_instruction
(
add_op
,
{
x
,
y
});
m
.
add_return
({
r
});
// run on ref target
p
.
compile
(
migraphx
::
target
(
"ref"
));
migraphx
::
program_parameters
pp
;
std
::
vector
<
float
>
x_data
(
9
,
1
);
std
::
vector
<
float
>
y_data
(
9
,
-
1
);
pp
.
add
(
"x"
,
migraphx
::
argument
(
param_shape
,
x_data
.
data
()));
pp
.
add
(
"y"
,
migraphx
::
argument
(
param_shape
,
y_data
.
data
()));
auto
outputs
=
p
.
eval
(
pp
);
auto
output
=
outputs
[
0
];
std
::
vector
<
float
>
expected
(
9
,
0
);
...
...
test/dead_code_elimination_test.cpp
View file @
faefeef9
...
...
@@ -180,6 +180,40 @@ TEST_CASE(duplicate_args3)
EXPECT
(
result
==
migraphx
::
literal
{
0
});
}
TEST_CASE
(
reused_twice
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
std
::
vector
<
size_t
>
dims
=
{
1
,
2
,
2
};
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
dims
});
auto
y
=
mm
->
add_parameter
(
"y"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
dims
});
auto
z
=
mm
->
add_parameter
(
"z"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
dims
});
auto
add1
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
x
,
y
);
auto
add2
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
add1
,
z
);
auto
epsilon
=
mm
->
add_literal
(
1e-12
f
);
auto
exponent
=
mm
->
add_literal
(
2.0
f
);
auto
mean
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reduce_mean"
,
{{
"axes"
,
{
2
}}}),
add2
);
auto
mean_mbcast
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
dims
}}),
mean
);
auto
sub
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"sub"
),
add2
,
mean_mbcast
);
auto
exponent_mbcast
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
dims
}}),
exponent
);
auto
pow
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"pow"
),
sub
,
exponent_mbcast
);
auto
var
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"reduce_mean"
,
{{
"axes"
,
{
2
}}}),
pow
);
auto
epsilon_mbcast
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
{
1
,
dims
.
at
(
1
),
1
}}}),
epsilon
);
auto
add_epsilon
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
var
,
epsilon_mbcast
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"sqrt"
),
add_epsilon
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
x
,
y
);
auto
count
=
std
::
distance
(
mm
->
begin
(),
mm
->
end
());
run_pass
(
p
);
p
.
debug_print
();
EXPECT
(
std
::
distance
(
mm
->
begin
(),
mm
->
end
())
!=
count
);
EXPECT
(
std
::
distance
(
mm
->
begin
(),
mm
->
end
())
==
4
);
}
TEST_CASE
(
unused_module
)
{
migraphx
::
program
p
;
...
...
test/matcher.cpp
View file @
faefeef9
...
...
@@ -332,7 +332,7 @@ TEST_CASE(match_either_args_any1)
match
::
name
(
"sum"
)(
match
::
either_arg
(
0
,
1
)(
match
::
any
().
bind
(
"x"
),
match
::
any
().
bind
(
"y"
)));
auto
r
=
find_match
(
mm
,
m
);
EXPECT
(
bool
{
r
.
result
==
sum1
});
EXPECT
(
bool
{
r
.
instructions
.
at
(
"x"
)
!=
r
.
instructions
.
at
(
"y"
)
});
EXPECT
(
bool
{
r
.
instructions
[
"x"
]
!=
r
.
instructions
[
"y"
]
});
}
TEST_CASE
(
match_either_args_any2
)
...
...
@@ -347,7 +347,7 @@ TEST_CASE(match_either_args_any2)
match
::
either_arg
(
0
,
1
)(
match
::
any
().
bind
(
"x"
),
match
::
name
(
"@literal"
).
bind
(
"y"
)));
auto
r
=
find_match
(
mm
,
m
);
EXPECT
(
bool
{
r
.
result
==
sum1
});
EXPECT
(
bool
{
r
.
instructions
.
at
(
"x"
)
!=
r
.
instructions
.
at
(
"y"
)
});
EXPECT
(
bool
{
r
.
instructions
[
"x"
]
!=
r
.
instructions
[
"y"
]
});
}
TEST_CASE
(
match_either_args_any3
)
...
...
@@ -362,7 +362,7 @@ TEST_CASE(match_either_args_any3)
match
::
either_arg
(
0
,
1
)(
match
::
name
(
"@literal"
).
bind
(
"x"
),
match
::
any
().
bind
(
"y"
)));
auto
r
=
find_match
(
mm
,
m
);
EXPECT
(
bool
{
r
.
result
==
sum1
});
EXPECT
(
bool
{
r
.
instructions
.
at
(
"x"
)
!=
r
.
instructions
.
at
(
"y"
)
});
EXPECT
(
bool
{
r
.
instructions
[
"x"
]
!=
r
.
instructions
[
"y"
]
});
}
TEST_CASE
(
match_either_args_any4
)
...
...
@@ -377,7 +377,7 @@ TEST_CASE(match_either_args_any4)
match
::
either_arg
(
0
,
1
)(
match
::
name
(
"sum"
).
bind
(
"x"
),
match
::
any
().
bind
(
"y"
)));
auto
r
=
find_match
(
mm
,
m
);
EXPECT
(
bool
{
r
.
result
==
sum2
});
EXPECT
(
bool
{
r
.
instructions
.
at
(
"x"
)
!=
r
.
instructions
.
at
(
"y"
)
});
EXPECT
(
bool
{
r
.
instructions
[
"x"
]
!=
r
.
instructions
[
"y"
]
});
}
TEST_CASE
(
match_either_args_any5
)
...
...
@@ -392,7 +392,7 @@ TEST_CASE(match_either_args_any5)
match
::
either_arg
(
0
,
1
)(
match
::
any
().
bind
(
"x"
),
match
::
name
(
"sum"
).
bind
(
"y"
)));
auto
r
=
find_match
(
mm
,
m
);
EXPECT
(
bool
{
r
.
result
==
sum2
});
EXPECT
(
bool
{
r
.
instructions
.
at
(
"x"
)
!=
r
.
instructions
.
at
(
"y"
)
});
EXPECT
(
bool
{
r
.
instructions
[
"x"
]
!=
r
.
instructions
[
"y"
]
});
}
TEST_CASE
(
match_all_of1
)
...
...
@@ -747,10 +747,10 @@ TEST_CASE(match_bind1)
match
::
standard_shape
())
.
bind
(
"pass"
);
auto
r
=
find_match
(
mm
,
m
);
EXPECT
(
bool
{
r
.
instructions
.
at
(
"one"
)
==
one
});
EXPECT
(
bool
{
r
.
instructions
.
at
(
"two"
)
==
two
});
EXPECT
(
bool
{
r
.
instructions
.
at
(
"sum"
)
==
sum
});
EXPECT
(
bool
{
r
.
instructions
.
at
(
"pass"
)
==
pass
});
EXPECT
(
bool
{
r
.
instructions
[
"one"
]
==
one
});
EXPECT
(
bool
{
r
.
instructions
[
"two"
]
==
two
});
EXPECT
(
bool
{
r
.
instructions
[
"sum"
]
==
sum
});
EXPECT
(
bool
{
r
.
instructions
[
"pass"
]
==
pass
});
EXPECT
(
bool
{
r
.
result
==
pass
});
}
...
...
@@ -795,9 +795,9 @@ TEST_CASE(match_bind_modules2)
match
::
standard_shape
())
.
bind
(
"pass"
);
auto
r
=
find_match
(
*
child
,
m
);
EXPECT
(
bool
{
r
.
instructions
.
at
(
"two"
)
==
two
});
EXPECT
(
bool
{
r
.
instructions
.
at
(
"sum"
)
==
sum
});
EXPECT
(
bool
{
r
.
instructions
.
at
(
"pass"
)
==
pass
});
EXPECT
(
bool
{
r
.
instructions
[
"two"
]
==
two
});
EXPECT
(
bool
{
r
.
instructions
[
"sum"
]
==
sum
});
EXPECT
(
bool
{
r
.
instructions
[
"pass"
]
==
pass
});
EXPECT
(
bool
{
r
.
result
==
pass
});
}
...
...
test/onnx/gen_onnx.py
View file @
faefeef9
...
...
@@ -3178,6 +3178,20 @@ def mean_test():
return
([
node
],
data
,
[
mean
])
@
onnx_test
def
mean_integral_test
():
data
=
[
helper
.
make_tensor_value_info
(
str
(
i
),
TensorProto
.
INT32
,
[
2
,
2
,
2
])
for
i
in
range
(
10
)
]
data_names
=
[
str
(
i
)
for
i
in
range
(
10
)]
mean
=
helper
.
make_tensor_value_info
(
'mean'
,
TensorProto
.
INT32
,
[
2
,
2
,
2
])
node
=
onnx
.
helper
.
make_node
(
"Mean"
,
inputs
=
data_names
,
outputs
=
[
"mean"
])
return
([
node
],
data
,
[
mean
])
@
onnx_test
def
min_test
():
a
=
helper
.
make_tensor_value_info
(
'0'
,
TensorProto
.
FLOAT
,
[
3
])
...
...
test/onnx/mean_integral_test.onnx
0 → 100644
View file @
faefeef9
mean_integral_test:Ö
*
0
1
2
3
4
5
6
7
8
9mean"Meanmean_integral_testZ
0
Z
1
Z
2
Z
3
Z
4
Z
5
Z
6
Z
7
Z
8
Z
9
b
mean
B
\ No newline at end of file
test/onnx/onnx_test.cpp
View file @
faefeef9
...
...
@@ -2890,6 +2890,30 @@ TEST_CASE(mean_test)
EXPECT
(
p
==
prog
);
}
TEST_CASE
(
mean_integral_test
)
{
const
std
::
size_t
num_data
=
10
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
int32_type
,
{
2
,
2
,
2
}};
auto
mean
=
mm
->
add_parameter
(
"0"
,
s
);
for
(
std
::
size_t
i
=
1
;
i
<
num_data
;
++
i
)
{
auto
data
=
mm
->
add_parameter
(
std
::
to_string
(
i
),
s
);
mean
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"add"
),
mean
,
data
);
}
auto
div_lit
=
mm
->
add_literal
(
migraphx
::
literal
{
migraphx
::
shape
{
s
.
type
()},
{
num_data
}});
auto
divisor
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"multibroadcast"
,
{{
"out_lens"
,
s
.
lens
()}}),
div_lit
);
mean
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"div"
),
mean
,
divisor
);
auto
prog
=
optimize_onnx
(
"mean_integral_test.onnx"
);
EXPECT
(
p
==
prog
);
}
TEST_CASE
(
min_test
)
{
migraphx
::
program
p
;
...
...
test/onnx/verify_onnx.cpp
View file @
faefeef9
...
...
@@ -581,6 +581,33 @@ TEST_CASE(mean_test)
EXPECT
(
migraphx
::
verify_range
(
result_vector
,
gold
));
}
TEST_CASE
(
mean_integral_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"mean_integral_test.onnx"
);
p
.
compile
(
migraphx
::
ref
::
target
{});
migraphx
::
shape
s
{
migraphx
::
shape
::
int32_type
,
{
2
,
2
,
2
}};
const
int
num_elms
=
8
;
const
int
num_data
=
10
;
const
std
::
vector
<
int
>
scalars
{
1
,
5
,
14
,
2
,
6
,
21
,
101
,
0
,
-
4
,
-
11
};
std
::
vector
<
std
::
vector
<
int
>>
data
;
std
::
transform
(
scalars
.
begin
(),
scalars
.
end
(),
std
::
back_inserter
(
data
),
[
&
](
const
auto
i
)
{
return
std
::
vector
<
int
>
(
num_elms
,
i
);
});
migraphx
::
parameter_map
pp
;
for
(
std
::
size_t
i
=
0
;
i
<
num_data
;
++
i
)
pp
[
std
::
to_string
(
i
)]
=
migraphx
::
argument
(
s
,
data
[
i
].
data
());
auto
result
=
p
.
eval
(
pp
).
back
();
std
::
vector
<
double
>
result_vector
;
result
.
visit
([
&
](
auto
output
)
{
result_vector
.
assign
(
output
.
begin
(),
output
.
end
());
});
const
auto
mean
=
std
::
accumulate
(
scalars
.
begin
(),
scalars
.
end
(),
0
)
/
num_data
;
std
::
vector
<
int
>
gold
(
num_elms
,
mean
);
EXPECT
(
migraphx
::
verify_range
(
result_vector
,
gold
));
}
TEST_CASE
(
nonzero_test
)
{
migraphx
::
program
p
=
migraphx
::
parse_onnx
(
"nonzero_dynamic_test.onnx"
);
...
...
test/py/test_module_construct.py
View file @
faefeef9
import
migraphx
import
migraphx
,
array
,
sys
def
create_buffer
(
t
,
data
,
shape
):
a
=
array
.
array
(
t
,
data
)
m
=
memoryview
(
a
.
tobytes
())
return
m
.
cast
(
t
,
shape
)
def
test_add_op
():
p
=
migraphx
.
program
()
mm
=
p
.
get_main_module
()
param_shape
=
migraphx
.
shape
(
lens
=
[
3
,
3
],
type
=
"float"
)
x
=
mm
.
add_parameter
(
"x"
,
param_shape
)
y
=
mm
.
add_parameter
(
"y"
,
param_shape
)
x
=
mm
.
add_literal
(
create_buffer
(
'f'
,
[
1.0
]
*
9
,
(
3
,
3
)))
y
=
mm
.
add_literal
(
create_buffer
(
'f'
,
[
2.0
]
*
9
,
(
3
,
3
)))
add_op
=
mm
.
add_instruction
(
migraphx
.
op
(
"add"
),
[
x
,
y
])
mm
.
add_return
([
add_op
])
p
.
compile
(
migraphx
.
get_target
(
"ref"
))
params
=
{}
params
[
"x"
]
=
migraphx
.
generate_argument
(
param_shape
)
params
[
"y"
]
=
migraphx
.
generate_argument
(
param_shape
)
output
=
p
.
run
(
params
)[
-
1
].
tolist
()
assert
output
==
[
a
+
b
for
a
,
b
in
zip
(
params
[
"x"
].
tolist
(),
params
[
"y"
].
tolist
())
]
assert
output
==
list
([
3.0
]
*
9
)
def
test_if_then_else
():
...
...
@@ -60,5 +61,6 @@ def test_if_then_else():
if
__name__
==
"__main__"
:
test_add_op
()
if
sys
.
version_info
>=
(
3
,
0
):
test_add_op
()
test_if_then_else
()
test/py/test_numpy.py
0 → 100644
View file @
faefeef9
import
migraphx
,
sys
try
:
import
numpy
as
np
except
:
sys
.
exit
()
def
test_add_op
():
p
=
migraphx
.
program
()
mm
=
p
.
get_main_module
()
x
=
mm
.
add_literal
(
np
.
ones
((
3
,
3
),
dtype
=
'float32'
))
y
=
mm
.
add_literal
(
2
*
np
.
ones
((
3
,
3
),
dtype
=
'float32'
))
add_op
=
mm
.
add_instruction
(
migraphx
.
op
(
"add"
),
[
x
,
y
])
mm
.
add_return
([
add_op
])
p
.
compile
(
migraphx
.
get_target
(
"ref"
))
params
=
{}
output
=
p
.
run
(
params
)[
-
1
].
tolist
()
assert
output
==
list
(
3
*
np
.
ones
((
9
),
dtype
=
'float32'
))
if
__name__
==
"__main__"
:
test_add_op
()
test/reduce_dims.cpp
View file @
faefeef9
...
...
@@ -109,6 +109,29 @@ TEST_CASE(transposed1)
EXPECT
(
eshapes
==
rshapes
);
}
TEST_CASE
(
non_packed_empty1
)
{
std
::
vector
<
migraphx
::
shape
>
ishapes
=
{
make_shape
({
1
,
12
},
{
589824
,
64
})};
std
::
vector
<
migraphx
::
shape
>
eshapes
=
{
make_shape
({
12
},
{
64
})};
auto
rshapes
=
migraphx
::
reduce_dims
(
ishapes
);
EXPECT
(
eshapes
==
rshapes
);
}
TEST_CASE
(
non_packed_empty2
)
{
std
::
vector
<
migraphx
::
shape
>
ishapes
=
{
make_shape
({
12
,
1
},
{
64
,
589824
})};
std
::
vector
<
migraphx
::
shape
>
eshapes
=
{
make_shape
({
12
},
{
64
})};
auto
rshapes
=
migraphx
::
reduce_dims
(
ishapes
);
EXPECT
(
eshapes
==
rshapes
);
}
TEST_CASE
(
single_dim
)
{
std
::
vector
<
migraphx
::
shape
>
ishapes
=
{
make_shape
({
1
},
{
1
})};
auto
rshapes
=
migraphx
::
reduce_dims
(
ishapes
);
EXPECT
(
ishapes
==
rshapes
);
}
TEST_CASE
(
empty
)
{
auto
rshapes
=
migraphx
::
reduce_dims
({});
...
...
tools/install_prereqs.sh
View file @
faefeef9
...
...
@@ -4,12 +4,20 @@
set
-e
#install pip3, rocm-cmake, rocblas and miopen
apt update
&&
apt
install
-y
python3-pip rocm-cmake rocblas miopen-hip openmp-extras
export
LC_ALL
=
C.UTF-8
export
LANG
=
C.UTF-8
# Need pip3 and Python headers to build dependencies
apt update
&&
apt
install
-y
python3-pip python3-dev cmake rocm-cmake rocblas miopen-hip openmp-extras
# Needed for cmake to build various pip packages
pip3
install
setuptools wheel
# install rbuild to build dependencies
pip3
install
https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz
PREFIX
=
/usr/local
REQ_FILE_DIR
=
""
if
[
"$#"
-ge
2
]
;
then
...
...
Prev
1
2
3
4
5
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