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
63387253
Commit
63387253
authored
Feb 17, 2023
by
charlie
Browse files
Merge branch 'develop' of github.com:ROCmSoftwarePlatform/AMDMIGraphX into select_module_op
parents
dd74a89a
962329f3
Changes
57
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
321 additions
and
7 deletions
+321
-7
src/targets/gpu/lowering.cpp
src/targets/gpu/lowering.cpp
+1
-2
src/targets/gpu/target.cpp
src/targets/gpu/target.cpp
+1
-0
test/api/test_gpu.cpp
test/api/test_gpu.cpp
+1
-0
test/onnx/gen_onnx.py
test/onnx/gen_onnx.py
+127
-1
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+38
-0
test/onnx/slice_dyn_test.onnx
test/onnx/slice_dyn_test.onnx
+0
-0
test/onnx/slice_reverse_dyn_test.onnx
test/onnx/slice_reverse_dyn_test.onnx
+0
-0
test/onnx/slice_step_dyn_test.onnx
test/onnx/slice_step_dyn_test.onnx
+0
-0
test/op_shape_test.cpp
test/op_shape_test.cpp
+64
-0
test/py/test_gpu.py
test/py/test_gpu.py
+2
-1
test/ref_ops_test.cpp
test/ref_ops_test.cpp
+63
-0
test/verify/test_reduce_op_large.cpp
test/verify/test_reduce_op_large.cpp
+13
-0
tools/api/api.cpp
tools/api/api.cpp
+5
-0
tools/build_and_test_onnxrt.sh
tools/build_and_test_onnxrt.sh
+1
-1
tools/include/context.hpp
tools/include/context.hpp
+2
-0
tools/install_prereqs.sh
tools/install_prereqs.sh
+1
-1
tools/te.py
tools/te.py
+2
-1
No files found.
src/targets/gpu/lowering.cpp
View file @
63387253
...
@@ -83,7 +83,6 @@ struct miopen_apply
...
@@ -83,7 +83,6 @@ struct miopen_apply
auto
&
ctx
=
get_context
();
auto
&
ctx
=
get_context
();
int8_x4_format
=
get_int8_x4_format
(
ctx
);
int8_x4_format
=
get_int8_x4_format
(
ctx
);
compute_fp32
=
get_compute_fp32_flag
();
compute_fp32
=
get_compute_fp32_flag
();
offload_copy
=
(
mod
->
name
()
==
"main"
)
?
pass
->
offload_copy
:
false
;
offload_copy
=
(
mod
->
name
()
==
"main"
)
?
pass
->
offload_copy
:
false
;
add_generic_op
(
"contiguous"
);
add_generic_op
(
"contiguous"
);
...
...
src/targets/gpu/target.cpp
View file @
63387253
...
@@ -91,6 +91,7 @@ pass enable_pass(bool enabled, pass p)
...
@@ -91,6 +91,7 @@ pass enable_pass(bool enabled, pass p)
std
::
vector
<
pass
>
target
::
get_passes
(
migraphx
::
context
&
gctx
,
const
compile_options
&
options
)
const
std
::
vector
<
pass
>
target
::
get_passes
(
migraphx
::
context
&
gctx
,
const
compile_options
&
options
)
const
{
{
auto
&
ctx
=
any_cast
<
context
>
(
gctx
);
auto
&
ctx
=
any_cast
<
context
>
(
gctx
);
ctx
.
set_exhaustive_tune_flag
(
options
.
exhaustive_tune
);
std
::
set
<
shape
::
type_t
>
unsupported_types
(
shape
::
types
().
begin
(),
shape
::
types
().
end
());
std
::
set
<
shape
::
type_t
>
unsupported_types
(
shape
::
types
().
begin
(),
shape
::
types
().
end
());
unsupported_types
.
erase
(
shape
::
type_t
::
float_type
);
unsupported_types
.
erase
(
shape
::
type_t
::
float_type
);
unsupported_types
.
erase
(
shape
::
type_t
::
half_type
);
unsupported_types
.
erase
(
shape
::
type_t
::
half_type
);
...
...
test/api/test_gpu.cpp
View file @
63387253
...
@@ -35,6 +35,7 @@ TEST_CASE(load_and_run)
...
@@ -35,6 +35,7 @@ TEST_CASE(load_and_run)
auto
shapes_before
=
p
.
get_output_shapes
();
auto
shapes_before
=
p
.
get_output_shapes
();
migraphx
::
compile_options
options
;
migraphx
::
compile_options
options
;
options
.
set_offload_copy
();
options
.
set_offload_copy
();
options
.
set_exhaustive_tune_flag
();
p
.
compile
(
migraphx
::
target
(
"gpu"
),
options
);
p
.
compile
(
migraphx
::
target
(
"gpu"
),
options
);
auto
shapes_after
=
p
.
get_output_shapes
();
auto
shapes_after
=
p
.
get_output_shapes
();
CHECK
(
shapes_before
.
size
()
==
1
);
CHECK
(
shapes_before
.
size
()
==
1
);
...
...
test/onnx/gen_onnx.py
View file @
63387253
#####################################################################################
#####################################################################################
# The MIT License (MIT)
# The MIT License (MIT)
#
#
# Copyright (c) 2015-202
2
Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2015-202
3
Advanced Micro Devices, Inc. All rights reserved.
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# of this software and associated documentation files (the "Software"), to deal
...
@@ -6184,6 +6184,132 @@ def slice_test():
...
@@ -6184,6 +6184,132 @@ def slice_test():
return
([
node
],
[
x
],
[
y
])
return
([
node
],
[
x
],
[
y
])
@
onnx_test
()
def
slice_dyn_test
():
x
=
helper
.
make_tensor_value_info
(
'0'
,
TensorProto
.
FLOAT
,
[
None
,
None
,
2
])
y
=
helper
.
make_tensor_value_info
(
'1'
,
TensorProto
.
FLOAT
,
[
None
,
None
,
2
])
node
=
onnx
.
helper
.
make_node
(
'Slice'
,
inputs
=
[
'0'
],
axes
=
[
0
],
starts
=
[
1
],
ends
=
[
2
],
outputs
=
[
'1'
])
return
([
node
],
[
x
],
[
y
])
@
onnx_test
def
slice_step_dyn_test
():
# A slice command with non - default steps will have a "Step"
# instruction added in parsing.
step
=
np
.
array
([
2
,
1
])
step_tensor
=
helper
.
make_tensor
(
name
=
"step"
,
data_type
=
TensorProto
.
INT32
,
dims
=
step
.
shape
,
vals
=
step
.
astype
(
int
))
arg_step
=
helper
.
make_node
(
"Constant"
,
inputs
=
[],
outputs
=
[
'arg_step'
],
value
=
step_tensor
)
axis
=
np
.
array
([
-
1
,
-
2
])
axis_tensor
=
helper
.
make_tensor
(
name
=
"axis"
,
data_type
=
TensorProto
.
INT32
,
dims
=
axis
.
shape
,
vals
=
axis
.
astype
(
int
))
arg_axis
=
helper
.
make_node
(
"Constant"
,
inputs
=
[],
outputs
=
[
'arg_axis'
],
value
=
axis_tensor
)
end
=
np
.
array
([
-
1
,
-
1
])
end_tensor
=
helper
.
make_tensor
(
name
=
"end"
,
data_type
=
TensorProto
.
INT32
,
dims
=
end
.
shape
,
vals
=
end
.
astype
(
int
))
arg_end
=
helper
.
make_node
(
"Constant"
,
inputs
=
[],
outputs
=
[
'arg_end'
],
value
=
end_tensor
)
start
=
np
.
array
([
-
5
,
-
3
])
start_tensor
=
helper
.
make_tensor
(
name
=
"start"
,
data_type
=
TensorProto
.
INT32
,
dims
=
start
.
shape
,
vals
=
start
.
astype
(
int
))
arg_start
=
helper
.
make_node
(
"Constant"
,
inputs
=
[],
outputs
=
[
'arg_start'
],
value
=
start_tensor
)
x
=
helper
.
make_tensor_value_info
(
'0'
,
TensorProto
.
FLOAT
,
[
None
,
5
])
y
=
helper
.
make_tensor_value_info
(
'1'
,
TensorProto
.
FLOAT
,
[
None
,
2
])
node
=
onnx
.
helper
.
make_node
(
'Slice'
,
inputs
=
[
'0'
,
'arg_start'
,
'arg_end'
,
'arg_axis'
,
'arg_step'
],
outputs
=
[
'1'
])
return
([
arg_step
,
arg_axis
,
arg_end
,
arg_start
,
node
],
[
x
],
[
y
])
@
onnx_test
def
slice_reverse_dyn_test
():
# A slice command with negative step on any axis will have
# a "Reverse" instruction added in parsing.
step
=
np
.
array
([
-
1
,
1
])
step_tensor
=
helper
.
make_tensor
(
name
=
"step"
,
data_type
=
TensorProto
.
INT32
,
dims
=
step
.
shape
,
vals
=
step
.
astype
(
int
))
arg_step
=
helper
.
make_node
(
"Constant"
,
inputs
=
[],
outputs
=
[
'arg_step'
],
value
=
step_tensor
)
axis
=
np
.
array
([
-
1
,
-
2
])
axis_tensor
=
helper
.
make_tensor
(
name
=
"axis"
,
data_type
=
TensorProto
.
INT32
,
dims
=
axis
.
shape
,
vals
=
axis
.
astype
(
int
))
arg_axis
=
helper
.
make_node
(
"Constant"
,
inputs
=
[],
outputs
=
[
'arg_axis'
],
value
=
axis_tensor
)
end
=
np
.
array
([
-
1
,
-
1
])
end_tensor
=
helper
.
make_tensor
(
name
=
"end"
,
data_type
=
TensorProto
.
INT32
,
dims
=
end
.
shape
,
vals
=
end
.
astype
(
int
))
arg_end
=
helper
.
make_node
(
"Constant"
,
inputs
=
[],
outputs
=
[
'arg_end'
],
value
=
end_tensor
)
start
=
np
.
array
([
-
5
,
-
3
])
start_tensor
=
helper
.
make_tensor
(
name
=
"start"
,
data_type
=
TensorProto
.
INT32
,
dims
=
start
.
shape
,
vals
=
start
.
astype
(
int
))
arg_start
=
helper
.
make_node
(
"Constant"
,
inputs
=
[],
outputs
=
[
'arg_start'
],
value
=
start_tensor
)
x
=
helper
.
make_tensor_value_info
(
'0'
,
TensorProto
.
FLOAT
,
[
None
,
5
])
y
=
helper
.
make_tensor_value_info
(
'1'
,
TensorProto
.
FLOAT
,
[
None
,
2
])
node
=
onnx
.
helper
.
make_node
(
'Slice'
,
inputs
=
[
'0'
,
'arg_start'
,
'arg_end'
,
'arg_axis'
,
'arg_step'
],
outputs
=
[
'1'
])
return
([
arg_step
,
arg_axis
,
arg_end
,
arg_start
,
node
],
[
x
],
[
y
])
@
onnx_test
()
@
onnx_test
()
def
slice_3arg_test
():
def
slice_3arg_test
():
x
=
helper
.
make_tensor_value_info
(
'0'
,
TensorProto
.
FLOAT
,
[
5
,
5
])
x
=
helper
.
make_tensor_value_info
(
'0'
,
TensorProto
.
FLOAT
,
[
5
,
5
])
...
...
test/onnx/onnx_test.cpp
View file @
63387253
...
@@ -6010,6 +6010,44 @@ TEST_CASE(slice_test)
...
@@ -6010,6 +6010,44 @@ TEST_CASE(slice_test)
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
}
}
TEST_CASE
(
slice_dyn_test
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
l0
=
mm
->
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{{
3
,
3
,
0
},
{
1
,
3
,
0
},
{
2
,
2
,
0
}}});
auto
ret
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
}},
{
"starts"
,
{
1
}},
{
"ends"
,
{
2
}}}),
l0
);
mm
->
add_return
({
ret
});
migraphx
::
onnx_options
options
;
// Parser converts the dynamic input shape to static unless there is at least one non-fixed
// dynamic dimension. Slicing is not allowed along the non-fixed axis 1.
options
.
map_dyn_input_dims
[
"0"
]
=
{{
3
,
3
,
0
},
{
1
,
3
,
0
},
{
2
,
2
,
0
}};
auto
prog
=
migraphx
::
parse_onnx
(
"slice_dyn_test.onnx"
,
options
);
EXPECT
(
p
==
prog
);
}
TEST_CASE
(
slice_step_dyn_test
)
{
// A slice command with non-default steps will have a "Step" instruction added in parsing.
// At the time of writing, Step doesn't support dynamic shape input.
migraphx
::
onnx_options
options
;
options
.
default_dyn_dim_value
=
{
1
,
4
,
0
};
EXPECT
(
test
::
throws
([
&
]
{
migraphx
::
parse_onnx
(
"slice_step_dyn_test.onnx"
,
options
);
}));
}
TEST_CASE
(
slice_reverse_dyn_test
)
{
// A slice command with negative step on any axis will have a "Reverse" instruction added in
// parsing. At the time of writing, Reverse doesn't support dynamic shape input.
migraphx
::
onnx_options
options
;
options
.
default_dyn_dim_value
=
{
1
,
4
,
0
};
EXPECT
(
test
::
throws
([
&
]
{
migraphx
::
parse_onnx
(
"slice_reverse_dyn_test.onnx"
,
options
);
}));
}
TEST_CASE
(
slice_3arg_test
)
TEST_CASE
(
slice_3arg_test
)
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
...
...
test/onnx/slice_dyn_test.onnx
0 → 100644
View file @
63387253
File added
test/onnx/slice_reverse_dyn_test.onnx
0 → 100644
View file @
63387253
File added
test/onnx/slice_step_dyn_test.onnx
0 → 100644
View file @
63387253
File added
test/op_shape_test.cpp
View file @
63387253
...
@@ -2386,6 +2386,70 @@ TEST_CASE(slice_shape)
...
@@ -2386,6 +2386,70 @@ TEST_CASE(slice_shape)
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
int32_type
,
{
2
,
2
,
1
},
{
6
,
3
,
1
}},
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
int32_type
,
{
2
,
2
,
1
},
{
6
,
3
,
1
}},
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
2
}},
{
"starts"
,
{
2
}},
{
"ends"
,
{
10
}}}),
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
2
}},
{
"starts"
,
{
2
}},
{
"ends"
,
{
10
}}}),
input
);
input
);
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
int32_type
,
{
2
,
2
,
1
},
{
6
,
3
,
1
}},
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
2
}},
{
"starts"
,
{
-
1
}},
{
"ends"
,
{
10
}}}),
input
);
}
TEST_CASE
(
slice_dyn_shape0
)
{
migraphx
::
shape
input
{
migraphx
::
shape
::
int32_type
,
{{
2
,
3
,
0
},
{
7
,
7
,
0
},
{
2
,
3
,
0
}}};
// Slice axis 1 to size 4-1=3
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
int32_type
,
{{
2
,
3
,
0
},
{
3
,
3
,
0
},
{
2
,
3
,
0
}}},
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
1
}},
{
"starts"
,
{
1
}},
{
"ends"
,
{
4
}}}),
input
);
}
TEST_CASE
(
slice_dyn_shape1
)
{
migraphx
::
shape
input
{
migraphx
::
shape
::
int32_type
,
{{
2
,
3
,
0
},
{
7
,
7
,
0
},
{
2
,
3
,
0
}}};
// Slice axis 1 with negative index
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
int32_type
,
{{
2
,
3
,
0
},
{
2
,
2
,
0
},
{
2
,
3
,
0
}}},
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
1
}},
{
"starts"
,
{
1
}},
{
"ends"
,
{
-
4
}}}),
input
);
}
TEST_CASE
(
slice_dyn_shape2
)
{
migraphx
::
shape
input
{
migraphx
::
shape
::
int32_type
,
{{
2
,
3
,
0
},
{
7
,
7
,
0
},
{
2
,
3
,
0
}}};
// Sliced range max bigger than dimension; is clipped
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
int32_type
,
{{
2
,
3
,
0
},
{
6
,
6
,
0
},
{
2
,
3
,
0
}}},
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
1
}},
{
"starts"
,
{
1
}},
{
"ends"
,
{
10
}}}),
input
);
}
TEST_CASE
(
slice_dyn_shape3
)
{
// TODO: When variable dimension slicing is allowed, Slice to a size smaller than min.
// Until then, this action is an error.
migraphx
::
shape
input
{
migraphx
::
shape
::
int32_type
,
{{
2
,
3
,
0
},
{
7
,
8
,
0
},
{
2
,
3
,
0
}}};
throws_shape
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
1
}},
{
"starts"
,
{
0
}},
{
"ends"
,
{
1
}}}),
input
);
// clang-format off
// expect_shape(migraphx::shape{migraphx::shape::int32_type, {{2, 3, 0}, {1, 1, 0}, {2, 3, 0}}},
// migraphx::make_op("slice", {{"axes", {1}}, {"starts", {0}}, {"ends", {1}}}),
// input);
// clang-format on
}
TEST_CASE
(
slice_dyn_shape4
)
{
migraphx
::
shape
input
{
migraphx
::
shape
::
int32_type
,
{{
2
,
2
,
0
},
{
7
,
7
,
0
},
{
2
,
3
,
0
}}};
// Slice multiple axes: axis 0 to size 2-1=1 and axis 1 to size 4-1=3
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
int32_type
,
{{
1
,
1
,
0
},
{
3
,
3
,
0
},
{
2
,
3
,
0
}}},
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
,
1
}},
{
"starts"
,
{
1
,
1
}},
{
"ends"
,
{
2
,
4
}}}),
input
);
}
TEST_CASE
(
slice_dyn_shape5
)
{
// Axis out of range.
migraphx
::
shape
input
{
migraphx
::
shape
::
int32_type
,
{{
2
,
2
,
0
},
{
7
,
7
,
0
},
{
2
,
3
,
0
}}};
throws_shape
(
migraphx
::
make_op
(
"slice"
,
{{
"axes"
,
{
0
,
20
}},
{
"starts"
,
{
1
,
1
}},
{
"ends"
,
{
2
,
4
}}}),
input
);
}
}
TEST_CASE
(
softmax
)
{
test_softmax_variations
<
migraphx
::
op
::
softmax
>
();
}
TEST_CASE
(
softmax
)
{
test_softmax_variations
<
migraphx
::
op
::
softmax
>
();
}
...
...
test/py/test_gpu.py
View file @
63387253
...
@@ -33,7 +33,8 @@ def test_conv_relu():
...
@@ -33,7 +33,8 @@ def test_conv_relu():
p
=
migraphx
.
parse_onnx
(
"conv_relu_maxpool_test.onnx"
)
p
=
migraphx
.
parse_onnx
(
"conv_relu_maxpool_test.onnx"
)
print
(
p
)
print
(
p
)
print
(
"Compiling ..."
)
print
(
"Compiling ..."
)
p
.
compile
(
migraphx
.
get_target
(
"gpu"
))
# set offload_copy, fast_match and exhaustive_tune to true
p
.
compile
(
migraphx
.
get_target
(
"gpu"
),
True
,
True
,
True
)
print
(
p
)
print
(
p
)
params
=
{}
params
=
{}
...
...
test/ref_ops_test.cpp
View file @
63387253
...
@@ -7659,6 +7659,69 @@ TEST_CASE(slice_test)
...
@@ -7659,6 +7659,69 @@ TEST_CASE(slice_test)
}
}
}
}
TEST_CASE(slice_dyn_test0)
{
// Slice a single dynamic dimension. ax1 slice limits are smaller than min; ax2 "ends" is too
// large
migraphx::program p;
auto* mm = p.get_main_module();
migraphx::shape s{migraphx::shape::int32_type, {{2, 3, 0}, {2, 2, 0}, {3, 3, 0}}};
auto x = mm->add_parameter("x", s);
mm->add_instruction(
migraphx::make_op("slice", {{"axes", {1, 2}}, {"starts", {0, 1}}, {"ends", {1, 6}}}), x);
migraphx::shape s2{migraphx::shape::int32_type, {{2, 3, 0}, {1, 1, 0}, {2, 2, 0}}};
EXPECT(p.get_output_shapes().back() == s2);
p.compile(migraphx::ref::target{});
// the strides of sresult are those of the original shape, not
// reduced to sliced size.
migraphx::shape sresult{migraphx::shape::int32_type, {2, 1, 2}, {6, 3, 1}};
migraphx::shape input_fixed_shape{migraphx::shape::int32_type, {2, 2, 3}};
migraphx::parameter_map params;
std::vector<int> data(2 * 2 * 3);
std::iota(data.begin(), data.end(), 0);
params["x"] = migraphx::argument(input_fixed_shape, data.data());
auto result = p.eval(params).back();
std::vector<int> gold = {1, 2, 7, 8};
std::vector<int> results_vector(2 * 1 * 2);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
EXPECT(migraphx::verify_range(results_vector, gold));
EXPECT(result.get_shape() == sresult);
}
TEST_CASE(slice_dyn_test1)
{
// Slice all three dynamic dimensions
migraphx::program p;
auto* mm = p.get_main_module();
migraphx::shape s{migraphx::shape::int32_type, {{2, 2, 0}, {2, 2, 0}, {3, 3, 0}}};
auto x = mm->add_parameter("x", s);
mm->add_instruction(
migraphx::make_op("slice",
{{"axes", {0, 1, 2}}, {"starts", {0, 0, 0}}, {"ends", {2, 2, 2}}}),
x);
migraphx::shape s2{migraphx::shape::int32_type, {{2, 2, 0}, {2, 2, 0}, {2, 2, 0}}};
EXPECT(p.get_output_shapes().back() == s2);
p.compile(migraphx::ref::target{});
migraphx::shape sresult{migraphx::shape::int32_type, {2, 2, 2}, {6, 3, 1}};
migraphx::shape input_fixed_shape{migraphx::shape::int32_type, {2, 2, 3}};
migraphx::parameter_map params;
std::vector<int> data(2 * 2 * 3);
std::iota(data.begin(), data.end(), 0);
params["x"] = migraphx::argument(input_fixed_shape, data.data());
auto result = p.eval(params).back();
std::vector<int> gold = {0, 1, 3, 4, 6, 7, 9, 10};
std::vector<int> results_vector(2 * 2 * 2);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
EXPECT(migraphx::verify_range(results_vector, gold));
EXPECT(result.get_shape() == sresult);
}
TEST_CASE(softmax_simple_test)
TEST_CASE(softmax_simple_test)
{
{
migraphx::program p;
migraphx::program p;
...
...
test/verify/test_reduce_op_large.cpp
View file @
63387253
...
@@ -76,3 +76,16 @@ struct test_reduce_mean_2 : verify_program<test_reduce_mean_2>
...
@@ -76,3 +76,16 @@ struct test_reduce_mean_2 : verify_program<test_reduce_mean_2>
return
p
;
return
p
;
};
};
};
};
struct
test_large_reduce_mean
:
verify_program
<
test_large_reduce_mean
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
2
,
256
*
256
*
16
}};
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
mm
->
add_instruction
(
migraphx
::
op
::
reduce_mean
{{
1
}},
x
);
return
p
;
};
};
tools/api/api.cpp
View file @
63387253
...
@@ -134,6 +134,11 @@ void set_offload_copy(compile_options& options, bool value) { options.offload_co
...
@@ -134,6 +134,11 @@ void set_offload_copy(compile_options& options, bool value) { options.offload_co
void
set_fast_math
(
compile_options
&
options
,
bool
value
)
{
options
.
fast_math
=
value
;
}
void
set_fast_math
(
compile_options
&
options
,
bool
value
)
{
options
.
fast_math
=
value
;
}
void
set_exhaustive_tune_flag
(
compile_options
&
options
,
bool
value
)
{
options
.
exhaustive_tune
=
value
;
}
void
set_file_format
(
file_options
&
options
,
const
char
*
format
)
{
options
.
format
=
format
;
}
void
set_file_format
(
file_options
&
options
,
const
char
*
format
)
{
options
.
format
=
format
;
}
void
set_default_dim_value
(
onnx_options
&
options
,
size_t
value
)
void
set_default_dim_value
(
onnx_options
&
options
,
size_t
value
)
...
...
tools/build_and_test_onnxrt.sh
View file @
63387253
...
@@ -25,7 +25,7 @@ cd /onnxruntime
...
@@ -25,7 +25,7 @@ cd /onnxruntime
pip3
install
-r
requirements-dev.txt
pip3
install
-r
requirements-dev.txt
# Add newer cmake to the path
# Add newer cmake to the path
export
PATH
=
"/opt/cmake/bin:
$PATH
"
export
PATH
=
"/opt/cmake/bin:
$PATH
"
export
CXXFLAGS
=
"-D__HIP_PLATFORM_
HCC
__=1 -w"
export
CXXFLAGS
=
"-D__HIP_PLATFORM_
AMD
__=1 -w"
./build.sh
--config
Release
--cmake_extra_defines
CMAKE_HIP_COMPILER
=
/opt/rocm/llvm/bin/clang++
--update
--build
--parallel
--cmake_extra_defines
ONNXRUNTIME_VERSION
=
$(
cat
./VERSION_NUMBER
)
--skip_tests
--rocm_home
/opt/rocm
--use_migraphx
--migraphx_home
/opt/rocm
--rocm_version
=
`
cat
/opt/rocm/.info/version-dev
`
./build.sh
--config
Release
--cmake_extra_defines
CMAKE_HIP_COMPILER
=
/opt/rocm/llvm/bin/clang++
--update
--build
--parallel
--cmake_extra_defines
ONNXRUNTIME_VERSION
=
$(
cat
./VERSION_NUMBER
)
--skip_tests
--rocm_home
/opt/rocm
--use_migraphx
--migraphx_home
/opt/rocm
--rocm_version
=
`
cat
/opt/rocm/.info/version-dev
`
cd
build/Linux/Release
cd
build/Linux/Release
...
...
tools/include/context.hpp
View file @
63387253
...
@@ -66,6 +66,7 @@ any_ptr get_queue_context(T&)
...
@@ -66,6 +66,7 @@ any_ptr get_queue_context(T&)
{
{
return
{};
return
{};
}
}
template
<
class
T
>
template
<
class
T
>
void
wait_for_context
(
T
&
,
any_ptr
)
void
wait_for_context
(
T
&
,
any_ptr
)
{
{
...
@@ -87,6 +88,7 @@ void finish_on_context(T&, any_ptr){}
...
@@ -87,6 +88,7 @@ void finish_on_context(T&, any_ptr){}
{
{
v
=
ctx
.
to_value
();
v
=
ctx
.
to_value
();
}
}
inline
void
migraphx_from_value
(
const
value
&
v
,
context
&
ctx
)
{
ctx
.
from_value
(
v
);
}
inline
void
migraphx_from_value
(
const
value
&
v
,
context
&
ctx
)
{
ctx
.
from_value
(
v
);
}
#endif
#endif
...
...
tools/install_prereqs.sh
View file @
63387253
...
@@ -57,7 +57,7 @@ echo "Dependencies are installed at $PREFIX"
...
@@ -57,7 +57,7 @@ echo "Dependencies are installed at $PREFIX"
rbuild prepare
-d
$PREFIX
-s
develop
rbuild prepare
-d
$PREFIX
-s
develop
# install onnx package for unit tests
# install onnx package for unit tests
pip3
install
onnx
==
1.10.
0
numpy
==
1.21.6
typing
==
3.7.4
pytest
==
6.0.1
packaging
==
16.8
pip3
install
onnx
==
1.10.
2
numpy
==
1.21.6
typing
==
3.7.4
pytest
==
6.0.1
packaging
==
23.0
# pin version of protobuf in Python for onnx runtime unit tests
# pin version of protobuf in Python for onnx runtime unit tests
pip3
install
protobuf
==
3.20.0
pip3
install
protobuf
==
3.20.0
tools/te.py
View file @
63387253
...
@@ -24,7 +24,8 @@
...
@@ -24,7 +24,8 @@
import
string
,
sys
,
re
import
string
,
sys
,
re
trivial
=
[
trivial
=
[
'std::size_t'
,
'instruction_ref'
,
'support_metric'
,
'const_module_ref'
'std::size_t'
,
'instruction_ref'
,
'support_metric'
,
'const_module_ref'
,
'bool'
,
'any_ptr'
]
]
headers
=
'''
headers
=
'''
...
...
Prev
1
2
3
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