Commit 187888bb authored by charlie's avatar charlie
Browse files

Merge branch 'develop' of github.com:ROCmSoftwarePlatform/AMDMIGraphX into...

Merge branch 'develop' of github.com:ROCmSoftwarePlatform/AMDMIGraphX into split_multiple_same_dyn_dim
parents bab722b3 57f734a5
...@@ -190,7 +190,6 @@ def disabled_tests_onnx_1_7_0(backend_test): ...@@ -190,7 +190,6 @@ def disabled_tests_onnx_1_7_0(backend_test):
backend_test.exclude( backend_test.exclude(
r'test_negative_log_likelihood_loss_input_shape_is_NCd1d2d3d4d5_none_no_weight_cpu' r'test_negative_log_likelihood_loss_input_shape_is_NCd1d2d3d4d5_none_no_weight_cpu'
) )
backend_test.exclude(r'test_qlinearconv_cpu')
backend_test.exclude(r'test_qlinearmatmul_2D_cpu') backend_test.exclude(r'test_qlinearmatmul_2D_cpu')
backend_test.exclude(r'test_qlinearmatmul_3D_cpu') backend_test.exclude(r'test_qlinearmatmul_3D_cpu')
backend_test.exclude(r'test_range_float_type_positive_delta_expanded_cpu') backend_test.exclude(r'test_range_float_type_positive_delta_expanded_cpu')
...@@ -576,6 +575,8 @@ def disabled_tests_onnx_1_9_0(backend_test): ...@@ -576,6 +575,8 @@ def disabled_tests_onnx_1_9_0(backend_test):
backend_test.exclude(r'test_gru_batchwise_cpu') backend_test.exclude(r'test_gru_batchwise_cpu')
backend_test.exclude(r'test_simple_rnn_batchwise_cpu') backend_test.exclude(r'test_simple_rnn_batchwise_cpu')
# from OnnxBackendPyTorchConvertedModelTest # from OnnxBackendPyTorchConvertedModelTest
# MaxPool dialtion is partially supported on GPU by a workaround
# But these tests require too large allocations to work properly
backend_test.exclude(r'test_MaxPool1d_stride_padding_dilation_cpu') backend_test.exclude(r'test_MaxPool1d_stride_padding_dilation_cpu')
backend_test.exclude(r'test_MaxPool2d_stride_padding_dilation_cpu') backend_test.exclude(r'test_MaxPool2d_stride_padding_dilation_cpu')
......
This diff is collapsed.
This diff is collapsed.
...@@ -155,29 +155,187 @@ TEST_CASE(after_split_dyn_broadcast_match) ...@@ -155,29 +155,187 @@ TEST_CASE(after_split_dyn_broadcast_match)
EXPECT(p0 == p1); EXPECT(p0 == p1);
} }
TEST_CASE(const_slice_3input) TEST_CASE(const_slice_2input_ends_axes)
{ {
migraphx::module m0; migraphx::module m0;
{ {
migraphx::shape s{migraphx::shape::float_type, {6, 4, 4}}; migraphx::shape s{migraphx::shape::float_type, {6, 4, 4}};
auto input = m0.add_parameter("data", s); auto input = m0.add_parameter("data", s);
auto slice_ins = m0.add_instruction( migraphx::shape s1{migraphx::shape::int32_type, {1}};
auto input_starts = m0.add_literal(migraphx::literal{s1, {0}});
auto slice_ins = m0.add_instruction(
migraphx::make_op("slice", {{"ends", {3}}, {"axes", {0}}}), input, input_starts);
m0.add_return({slice_ins});
}
run_pass(m0);
migraphx::module m1;
{
migraphx::shape s{migraphx::shape::float_type, {6, 4, 4}};
auto input = m1.add_parameter("data", s);
auto slice_ins = m1.add_instruction(
migraphx::make_op("slice", {{"starts", {0}}, {"ends", {3}}, {"axes", {0}}}), input); migraphx::make_op("slice", {{"starts", {0}}, {"ends", {3}}, {"axes", {0}}}), input);
m1.add_return({slice_ins});
}
EXPECT(m0 == m1);
}
TEST_CASE(const_slice_2input_starts_axes)
{
migraphx::module m0;
{
migraphx::shape s{migraphx::shape::float_type, {6, 4, 4}};
auto input = m0.add_parameter("data", s);
migraphx::shape s1{migraphx::shape::int32_type, {1}};
auto input_ends = m0.add_literal(migraphx::literal{s1, {3}});
auto slice_ins = m0.add_instruction(
migraphx::make_op("slice", {{"starts", {0}}, {"axes", {0}}}), input, input_ends);
m0.add_return({slice_ins}); m0.add_return({slice_ins});
} }
run_pass(m0);
migraphx::module m1; migraphx::module m1;
{ {
migraphx::shape s{migraphx::shape::float_type, {6, 4, 4}}; migraphx::shape s{migraphx::shape::float_type, {6, 4, 4}};
auto input = m1.add_parameter("data", s); auto input = m1.add_parameter("data", s);
auto slice_ins = m1.add_instruction(
migraphx::make_op("slice", {{"starts", {0}}, {"ends", {3}}, {"axes", {0}}}), input);
m1.add_return({slice_ins});
}
EXPECT(m0 == m1);
}
TEST_CASE(const_slice_2input_starts_ends)
{
migraphx::module m0;
{
migraphx::shape s{migraphx::shape::float_type, {6, 4, 4}};
auto input = m0.add_parameter("data", s);
migraphx::shape s1{migraphx::shape::int32_type, {1}}; migraphx::shape s1{migraphx::shape::int32_type, {1}};
auto input_starts = m1.add_literal(migraphx::literal{s1, {0}}); auto input_axes = m0.add_literal(migraphx::literal{s1, {0}});
auto input_ends = m1.add_literal(migraphx::literal{s1, {3}}); auto slice_ins = m0.add_instruction(
auto slice_ins = m1.add_instruction( migraphx::make_op("slice", {{"starts", {0}}, {"ends", {3}}}), input, input_axes);
m0.add_return({slice_ins});
}
run_pass(m0);
migraphx::module m1;
{
migraphx::shape s{migraphx::shape::float_type, {6, 4, 4}};
auto input = m1.add_parameter("data", s);
auto slice_ins = m1.add_instruction(
migraphx::make_op("slice", {{"starts", {0}}, {"ends", {3}}, {"axes", {0}}}), input);
m1.add_return({slice_ins});
}
EXPECT(m0 == m1);
}
TEST_CASE(const_slice_3input_axes_only)
{
migraphx::module m0;
{
migraphx::shape s{migraphx::shape::float_type, {6, 4, 4}};
auto input = m0.add_parameter("data", s);
migraphx::shape s1{migraphx::shape::int32_type, {1}};
auto input_starts = m0.add_literal(migraphx::literal{s1, {0}});
auto input_ends = m0.add_literal(migraphx::literal{s1, {3}});
auto slice_ins = m0.add_instruction(
migraphx::make_op("slice", {{"axes", {0}}}), input, input_starts, input_ends); migraphx::make_op("slice", {{"axes", {0}}}), input, input_starts, input_ends);
m0.add_return({slice_ins});
}
run_pass(m0);
migraphx::module m1;
{
migraphx::shape s{migraphx::shape::float_type, {6, 4, 4}};
auto input = m1.add_parameter("data", s);
auto slice_ins = m1.add_instruction(
migraphx::make_op("slice", {{"starts", {0}}, {"ends", {3}}, {"axes", {0}}}), input);
m1.add_return({slice_ins});
}
EXPECT(m0 == m1);
}
TEST_CASE(const_slice_3input_ends_only)
{
migraphx::module m0;
{
migraphx::shape s{migraphx::shape::float_type, {6, 4, 4}};
auto input = m0.add_parameter("data", s);
migraphx::shape s1{migraphx::shape::int32_type, {1}};
auto input_starts = m0.add_literal(migraphx::literal{s1, {0}});
auto input_axes = m0.add_literal(migraphx::literal{s1, {0}});
auto slice_ins = m0.add_instruction(
migraphx::make_op("slice", {{"ends", {3}}}), input, input_starts, input_axes);
m0.add_return({slice_ins});
}
run_pass(m0);
migraphx::module m1;
{
migraphx::shape s{migraphx::shape::float_type, {6, 4, 4}};
auto input = m1.add_parameter("data", s);
auto slice_ins = m1.add_instruction(
migraphx::make_op("slice", {{"starts", {0}}, {"ends", {3}}, {"axes", {0}}}), input);
m1.add_return({slice_ins});
}
EXPECT(m0 == m1);
}
TEST_CASE(const_slice_3inputs_starts_only)
{
migraphx::module m0;
{
migraphx::shape s{migraphx::shape::float_type, {6, 4, 4}};
auto input = m0.add_parameter("data", s);
migraphx::shape s1{migraphx::shape::int32_type, {1}};
auto input_ends = m0.add_literal(migraphx::literal{s1, {3}});
auto input_axes = m0.add_literal(migraphx::literal{s1, {0}});
auto slice_ins = m0.add_instruction(
migraphx::make_op("slice", {{"starts", {0}}}), input, input_ends, input_axes);
m0.add_return({slice_ins});
}
run_pass(m0);
migraphx::module m1;
{
migraphx::shape s{migraphx::shape::float_type, {6, 4, 4}};
auto input = m1.add_parameter("data", s);
auto slice_ins = m1.add_instruction(
migraphx::make_op("slice", {{"starts", {0}}, {"ends", {3}}, {"axes", {0}}}), input);
m1.add_return({slice_ins});
}
EXPECT(m0 == m1);
}
TEST_CASE(const_slice_2input_ends_axes_dyn)
{
migraphx::module m0;
{
migraphx::shape s{migraphx::shape::float_type, {{6, 6}, {2, 4, {2, 4}}, {2, 4, {2, 4}}}};
auto input = m0.add_parameter("data", s);
migraphx::shape s1{migraphx::shape::int32_type, {1}};
auto input_starts = m0.add_literal(migraphx::literal{s1, {0}});
auto slice_ins = m0.add_instruction(
migraphx::make_op("slice", {{"ends", {3}}, {"axes", {0}}}), input, input_starts);
m0.add_return({slice_ins});
}
run_pass(m0);
migraphx::module m1;
{
migraphx::shape s{migraphx::shape::float_type, {{6, 6}, {2, 4, {2, 4}}, {2, 4, {2, 4}}}};
auto input = m1.add_parameter("data", s);
auto slice_ins = m1.add_instruction(
migraphx::make_op("slice", {{"starts", {0}}, {"ends", {3}}, {"axes", {0}}}), input);
m1.add_return({slice_ins}); m1.add_return({slice_ins});
} }
run_pass(m1);
EXPECT(m0 == m1); EXPECT(m0 == m1);
} }
...@@ -386,4 +544,31 @@ TEST_CASE(static_dimensions_of_to_constant_alloc_reshape) ...@@ -386,4 +544,31 @@ TEST_CASE(static_dimensions_of_to_constant_alloc_reshape)
EXPECT(m0 == m1); EXPECT(m0 == m1);
} }
TEST_CASE(const_alloc_fill)
{
migraphx::module m0;
{
migraphx::shape val_shape{migraphx::shape::int64_type, {1}, {0}};
std::vector<int64_t> lit_data = {3};
auto value_lit = m0.add_literal(migraphx::literal{val_shape, lit_data});
migraphx::shape lit_s{migraphx::shape::int64_type, {3}};
auto output_dim_lit = m0.add_literal(migraphx::literal{lit_s, {3, 4, 4}});
auto alloc_ins = m0.add_instruction(
migraphx::make_op("allocate", {{"buf_type", migraphx::shape::int64_type}}),
output_dim_lit);
auto ret = m0.add_instruction(migraphx::make_op("fill"), value_lit, alloc_ins);
m0.add_return({ret});
}
run_pass(m0);
migraphx::module m1;
{
migraphx::shape lit_shape{migraphx::shape::int64_type, {3, 4, 4}};
std::vector<int64_t> lit_data(3 * 4 * 4, 3);
auto ret = m1.add_literal(migraphx::literal{lit_shape, lit_data});
m1.add_return({ret});
}
EXPECT(m0 == m1);
}
int main(int argc, const char* argv[]) { test::run(argc, argv); } int main(int argc, const char* argv[]) { test::run(argc, argv); }
...@@ -788,6 +788,7 @@ TEST_CASE(conv_pooling_dot) ...@@ -788,6 +788,7 @@ TEST_CASE(conv_pooling_dot)
{"padding", {0, 0, 0, 0}}, {"padding", {0, 0, 0, 0}},
{"stride", {1, 1}}, {"stride", {1, 1}},
{"lengths", {7, 7}}, {"lengths", {7, 7}},
{"dilations", {1, 1}},
{"ceil_mode", 0}}), {"ceil_mode", 0}}),
a1); a1);
auto fl = m1.add_instruction(migraphx::make_op("flatten", {{"axis", 1}}), ap); auto fl = m1.add_instruction(migraphx::make_op("flatten", {{"axis", 1}}), ap);
...@@ -835,6 +836,7 @@ TEST_CASE(conv_pooling_dot) ...@@ -835,6 +836,7 @@ TEST_CASE(conv_pooling_dot)
{"padding", {0, 0, 0, 0}}, {"padding", {0, 0, 0, 0}},
{"stride", {1, 1}}, {"stride", {1, 1}},
{"lengths", {7, 7}}, {"lengths", {7, 7}},
{"dilations", {1, 1}},
{"ceil_mode", 0}}), {"ceil_mode", 0}}),
a1); a1);
auto fl = m2.add_instruction(migraphx::make_op("flatten", {{"axis", 1}}), ap); auto fl = m2.add_instruction(migraphx::make_op("flatten", {{"axis", 1}}), ap);
...@@ -896,6 +898,7 @@ TEST_CASE(mobilenet_snippet) ...@@ -896,6 +898,7 @@ TEST_CASE(mobilenet_snippet)
{"padding", {0, 0, 0, 0}}, {"padding", {0, 0, 0, 0}},
{"stride", {1, 1}}, {"stride", {1, 1}},
{"lengths", {7, 7}}, {"lengths", {7, 7}},
{"dilations", {1, 1}},
{"ceil_mode", 0}}), {"ceil_mode", 0}}),
d6); d6);
auto q3 = add_quantize_op(mm, "quantizelinear", ap, scale, zero); auto q3 = add_quantize_op(mm, "quantizelinear", ap, scale, zero);
......
...@@ -35,7 +35,7 @@ struct test_avg_pooling_1d : verify_program<test_avg_pooling_1d> ...@@ -35,7 +35,7 @@ struct test_avg_pooling_1d : verify_program<test_avg_pooling_1d>
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
auto input = auto input =
mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {1, 3, 5}}); mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {1, 3, 5}});
auto op = migraphx::op::pooling{migraphx::op::pooling_mode::average, {0}, {1}, {3}}; auto op = migraphx::op::pooling{migraphx::op::pooling_mode::average, {0}, {1}, {3}, {1}};
mm->add_instruction(op, input); mm->add_instruction(op, input);
return p; return p;
} }
......
...@@ -36,7 +36,7 @@ struct test_avg_pooling_3d : verify_program<test_avg_pooling_3d> ...@@ -36,7 +36,7 @@ struct test_avg_pooling_3d : verify_program<test_avg_pooling_3d>
auto input = auto input =
mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {1, 3, 5, 5, 5}}); mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {1, 3, 5, 5, 5}});
auto op = migraphx::op::pooling{ auto op = migraphx::op::pooling{
migraphx::op::pooling_mode::average, {1, 1, 1}, {3, 3, 3}, {3, 3, 3}}; migraphx::op::pooling_mode::average, {1, 1, 1}, {3, 3, 3}, {3, 3, 3}, {1, 1, 1}};
mm->add_instruction(op, input); mm->add_instruction(op, input);
return p; return p;
} }
......
...@@ -36,7 +36,7 @@ struct test_avg_pooling_3d_opt : verify_program<test_avg_pooling_3d_opt> ...@@ -36,7 +36,7 @@ struct test_avg_pooling_3d_opt : verify_program<test_avg_pooling_3d_opt>
auto input = auto input =
mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {4, 2, 3, 3, 3}}); mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {4, 2, 3, 3, 3}});
auto op = migraphx::op::pooling{ auto op = migraphx::op::pooling{
migraphx::op::pooling_mode::average, {0, 0, 0}, {1, 1, 1}, {3, 3, 3}}; migraphx::op::pooling_mode::average, {0, 0, 0}, {1, 1, 1}, {3, 3, 3}, {1, 1, 1}};
mm->add_instruction(op, input); mm->add_instruction(op, input);
return p; return p;
} }
......
...@@ -37,7 +37,7 @@ struct test_avg_pooling_ceil_3d : verify_program<test_avg_pooling_ceil_3d> ...@@ -37,7 +37,7 @@ struct test_avg_pooling_ceil_3d : verify_program<test_avg_pooling_ceil_3d>
auto input = auto input =
mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {1, 3, 5, 5, 5}}); mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {1, 3, 5, 5, 5}});
auto op = migraphx::op::pooling{ auto op = migraphx::op::pooling{
migraphx::op::pooling_mode::average, {1, 1, 1}, {3, 3, 3}, {3, 3, 3}, true}; migraphx::op::pooling_mode::average, {1, 1, 1}, {3, 3, 3}, {3, 3, 3}, {1, 1, 1}, true};
mm->add_instruction(op, input); mm->add_instruction(op, input);
return p; return p;
} }
......
...@@ -36,7 +36,7 @@ struct test_avg_pooling_pad : verify_program<test_avg_pooling_pad> ...@@ -36,7 +36,7 @@ struct test_avg_pooling_pad : verify_program<test_avg_pooling_pad>
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
auto input = auto input =
mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {1, 3, 7}}); mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {1, 3, 7}});
auto op = migraphx::op::pooling{migraphx::op::pooling_mode::average, {2}, {1}, {3}}; auto op = migraphx::op::pooling{migraphx::op::pooling_mode::average, {2}, {1}, {3}, {1}};
mm->add_instruction(op, input); mm->add_instruction(op, input);
return p; return p;
} }
......
...@@ -47,7 +47,8 @@ struct test_concat_pooling : verify_program<test_concat_pooling> ...@@ -47,7 +47,8 @@ struct test_concat_pooling : verify_program<test_concat_pooling>
{{"mode", migraphx::op::pooling_mode::average}, {{"mode", migraphx::op::pooling_mode::average},
{"padding", {0, 0}}, {"padding", {0, 0}},
{"stride", {1, 1}}, {"stride", {1, 1}},
{"lengths", {8, 8}}}), {"lengths", {8, 8}},
{"dilations", {1, 1}}}),
concat_t); concat_t);
mm->add_instruction(migraphx::make_op("relu"), pooling); mm->add_instruction(migraphx::make_op("relu"), pooling);
return p; return p;
......
...@@ -76,7 +76,8 @@ struct test_conv_bn_relu_pooling : verify_program<test_conv_bn_relu_pooling> ...@@ -76,7 +76,8 @@ struct test_conv_bn_relu_pooling : verify_program<test_conv_bn_relu_pooling>
{{"mode", migraphx::op::pooling_mode::average}, {{"mode", migraphx::op::pooling_mode::average},
{"padding", {1, 1}}, {"padding", {1, 1}},
{"stride", {2, 2}}, {"stride", {2, 2}},
{"lengths", {3, 3}}}), {"lengths", {3, 3}},
{"dilations", {1, 1}}}),
relu); relu);
return p; return p;
} }
......
...@@ -92,7 +92,8 @@ struct test_conv_bn_relu_pooling2 : verify_program<test_conv_bn_relu_pooling2> ...@@ -92,7 +92,8 @@ struct test_conv_bn_relu_pooling2 : verify_program<test_conv_bn_relu_pooling2>
{{"mode", migraphx::op::pooling_mode::average}, {{"mode", migraphx::op::pooling_mode::average},
{"padding", {1, 1}}, {"padding", {1, 1}},
{"stride", {2, 2}}, {"stride", {2, 2}},
{"lengths", {3, 3}}}), {"lengths", {3, 3}},
{"dilations", {1, 1}}}),
relu); relu);
return p; return p;
} }
......
...@@ -36,7 +36,7 @@ struct test_max_pooling_ceil_3d : verify_program<test_max_pooling_ceil_3d> ...@@ -36,7 +36,7 @@ struct test_max_pooling_ceil_3d : verify_program<test_max_pooling_ceil_3d>
auto input = auto input =
mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {1, 3, 5, 5, 5}}); mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {1, 3, 5, 5, 5}});
auto op = migraphx::op::pooling{ auto op = migraphx::op::pooling{
migraphx::op::pooling_mode::max, {1, 1, 1}, {3, 3, 3}, {3, 3, 3}, true}; migraphx::op::pooling_mode::max, {1, 1, 1}, {3, 3, 3}, {3, 3, 3}, {1, 1, 1}, true};
mm->add_instruction(op, input); mm->add_instruction(op, input);
return p; return p;
} }
......
...@@ -53,7 +53,8 @@ else ...@@ -53,7 +53,8 @@ else
python3-pip \ python3-pip \
python3-venv \ python3-venv \
rocblas-dev \ rocblas-dev \
rocm-cmake rocm-cmake \
libtbb-dev
fi fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment