From 647019acf99bd25329f5202a78f0c7c7bc2d9a31 Mon Sep 17 00:00:00 2001 From: Ted Themistokleous Date: Tue, 10 Oct 2023 18:06:09 +0000 Subject: [PATCH 1/9] Remove contiguous insertion from simplify_algebra pass --- src/simplify_algebra.cpp | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/simplify_algebra.cpp b/src/simplify_algebra.cpp index 301b1d9970f..10a8e1e921c 100644 --- a/src/simplify_algebra.cpp +++ b/src/simplify_algebra.cpp @@ -941,15 +941,6 @@ struct find_splits { auto split = i->inputs()[split_idx]; assert(split->name() == "slice"); - // Insert contiguous for reshapes - auto outputs = i->outputs(); - for(auto output : outputs) - { - if(output->name() != "reshape") - continue; - auto x = m.insert_instruction(output, make_op("contiguous"), i); - m.replace_instruction(output, output->get_operator(), x); - } m.replace_instruction(i, split->get_operator(), c); } @@ -1181,13 +1172,6 @@ struct find_conv_dot_horiz_fusion for(auto arg : range(start, last)) { auto outputs = arg->outputs(); - for(auto output : outputs) - { - if(output->name() != "reshape") - continue; - auto x = m.insert_instruction(output, make_op("contiguous"), arg); - m.replace_instruction(output, output->get_operator(), x); - } int64_t len = arg->get_shape().lens()[axis]; m.replace_instruction( @@ -1487,11 +1471,6 @@ struct find_split_reshape slc_axis_len; }); - // insert the reshape instruction and add contiguous if needed - if(not input->get_shape().standard()) - { - input = m.insert_instruction(std::next(input), make_op("contiguous"), input); - } auto rsp_ins = m.insert_instruction( std::next(input), make_op("reshape", {{"dims", rsp_out_lens}}), input); From 10d9f8b4b60bd378442cc5594f085a52fa7edcfe Mon Sep 17 00:00:00 2001 From: Ted Themistokleous Date: Tue, 10 Oct 2023 21:12:53 +0000 Subject: [PATCH 2/9] Fix dot_fusion_reshape test --- test/simplify_algebra_test.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/simplify_algebra_test.cpp b/test/simplify_algebra_test.cpp index f5c64d2260f..6c53e3a402e 100644 --- a/test/simplify_algebra_test.cpp +++ b/test/simplify_algebra_test.cpp @@ -3372,9 +3372,8 @@ TEST_CASE(dot_fusion_reshape) auto s1 = m2.add_instruction( migraphx::make_op("slice", {{"axes", {2}}, {"starts", {320}}, {"ends", {640}}}), d); - auto cont0 = m2.add_instruction(migraphx::make_op("contiguous"), s0); auto r0 = - m2.add_instruction(migraphx::make_op("reshape", {{"dims", {2, 4096, 8, 40}}}), cont0); + m2.add_instruction(migraphx::make_op("reshape", {{"dims", {2, 4096, 8, 40}}}), s0); m2.add_return({r0, s1}); }; From 4ccfb9bf11b7269ccd6f127a48bf39aaa61c0ba9 Mon Sep 17 00:00:00 2001 From: Ted Themistokleous Date: Wed, 11 Oct 2023 18:11:14 +0000 Subject: [PATCH 3/9] Fix reoder_reshape_slice tests remove the contiguous added when transpose input is used. --- test/simplify_algebra_test.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/simplify_algebra_test.cpp b/test/simplify_algebra_test.cpp index 6c53e3a402e..8b21f85b84c 100644 --- a/test/simplify_algebra_test.cpp +++ b/test/simplify_algebra_test.cpp @@ -2690,10 +2690,6 @@ void reorder_reshape_slice() } auto input = m2.add_parameter("input", s); auto rsp_input = input; - if(TransposeInput) - { - rsp_input = m2.add_instruction(migraphx::make_op("contiguous"), {input}); - } std::vector lens = {static_cast(BS), 128, 30, 64}; auto r = m2.add_instruction(migraphx::make_op("reshape", {{"dims", lens}}), rsp_input); From b902c030b9da25475d4a410e7bff52354715abc4 Mon Sep 17 00:00:00 2001 From: Ted Themistokleous Date: Wed, 11 Oct 2023 18:47:32 +0000 Subject: [PATCH 4/9] Fix simplify_dot_horiz_reshape remove contiguous that we expect since we don't insert contiguous anymore as part of the simplification in our simplify algebra pass --- test/simplify_algebra_test.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/simplify_algebra_test.cpp b/test/simplify_algebra_test.cpp index 8b21f85b84c..a375c90c987 100644 --- a/test/simplify_algebra_test.cpp +++ b/test/simplify_algebra_test.cpp @@ -2323,9 +2323,8 @@ TEST_CASE(simplify_dot_horiz_reshape) migraphx::make_op("slice", {{"axes", {2}}, {"starts", {0}}, {"ends", {4}}}), dot); auto y = m2.add_instruction( migraphx::make_op("slice", {{"axes", {2}}, {"starts", {4}}, {"ends", {8}}}), dot); - auto x_cont = m2.add_instruction(migraphx::make_op("contiguous"), x); auto x_rsp = - m2.add_instruction(migraphx::make_op("reshape", {{"dims", {3, 4, 2, 2}}}), x_cont); + m2.add_instruction(migraphx::make_op("reshape", {{"dims", {3, 4, 2, 2}}}), x); auto y_rsp = m2.add_instruction(migraphx::make_op("unsqueeze", {{"axes", {2}}, {"steps", {2}}}), y); auto sum = m2.add_instruction(migraphx::make_op("add"), {x_rsp, y_rsp}); From 68c1c5b34e3b6b63f69f36c7694c71f0f0dadbaf Mon Sep 17 00:00:00 2001 From: Ted Themistokleous Date: Wed, 11 Oct 2023 19:08:21 +0000 Subject: [PATCH 5/9] Fix reoder_reshape_slice_multi_rsp Remove the extra contiguous put into reshapes --- test/simplify_algebra_test.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/simplify_algebra_test.cpp b/test/simplify_algebra_test.cpp index a375c90c987..6077e70dc37 100644 --- a/test/simplify_algebra_test.cpp +++ b/test/simplify_algebra_test.cpp @@ -2971,9 +2971,8 @@ TEST_CASE(reorder_reshape_slice_multi_rsp) auto input = m2.add_parameter("input", s); auto t1 = m2.add_instruction( migraphx::make_op("transpose", {{"permutation", {2, 0, 3, 1, 4}}}), input); - auto c_t1 = m2.add_instruction(migraphx::make_op("contiguous"), t1); auto rsp1 = - m2.add_instruction(migraphx::make_op("reshape", {{"dims", {384, 128, 80}}}), c_t1); + m2.add_instruction(migraphx::make_op("reshape", {{"dims", {384, 128, 80}}}), t1); auto slc0 = m2.add_instruction( migraphx::make_op("slice", {{"axes", {0}}, {"starts", {256}}, {"ends", {384}}}), rsp1); auto slc1 = m2.add_instruction( @@ -2988,9 +2987,8 @@ TEST_CASE(reorder_reshape_slice_multi_rsp) auto dot = m2.add_instruction(migraphx::make_op("dot"), slc2, c_t_slc1); - auto c_t1_1 = m2.add_instruction(migraphx::make_op("contiguous"), t1); auto rsp2 = - m2.add_instruction(migraphx::make_op("reshape", {{"dims", {12, 32, 128, 80}}}), c_t1_1); + m2.add_instruction(migraphx::make_op("reshape", {{"dims", {12, 32, 128, 80}}}), t1); auto slc2_1 = m2.add_instruction( migraphx::make_op("slice", {{"axes", {0}}, {"starts", {4}}, {"ends", {8}}}), rsp2); From 492e202dff93c8dcb807e30927ca35a883041c05 Mon Sep 17 00:00:00 2001 From: Ted Themistokleous Date: Wed, 11 Oct 2023 22:14:13 +0000 Subject: [PATCH 6/9] Adjust output for simplify_split_add_relu_reshape Need to adjust the output of this for comparision. Since we're missing the contiguous we can't rely on find_split_reshape due to the lack of contiguous to gate off of --- test/simplify_algebra_test.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test/simplify_algebra_test.cpp b/test/simplify_algebra_test.cpp index 6077e70dc37..73c2cebb450 100644 --- a/test/simplify_algebra_test.cpp +++ b/test/simplify_algebra_test.cpp @@ -1897,12 +1897,17 @@ TEST_CASE(simplify_split_add_relu_reshape) auto concatb = m2.add_instruction(b, concat); auto sum = m2.add_instruction(migraphx::make_op("add"), input, concatb); auto relu = m2.add_instruction(migraphx::make_op("relu"), sum); - auto rsp = m2.add_instruction(migraphx::make_op("reshape", {{"dims", {3, 8}}}), relu); auto slc1 = m2.add_instruction( - migraphx::make_op("slice", {{"axes", {1}}, {"starts", {0}}, {"ends", {4}}}), rsp); + migraphx::make_op("slice", {{"axes", {1}}, {"starts", {0}}, {"ends", {1}}}), relu); + + auto rsp1 = m2.add_instruction(migraphx::make_op("reshape", {{"dims", {3, 4}}}), slc1); + auto slc2 = m2.add_instruction( - migraphx::make_op("slice", {{"axes", {1}}, {"starts", {4}}, {"ends", {8}}}), rsp); - auto add = m2.add_instruction(migraphx::make_op("add"), slc1, slc2); + migraphx::make_op("slice", {{"axes", {1}}, {"starts", {1}}, {"ends", {2}}}), relu); + + auto rsp2 = m2.add_instruction(migraphx::make_op("reshape", {{"dims", {3, 4}}}), slc2); + + auto add = m2.add_instruction(migraphx::make_op("add"), rsp1, rsp2); m2.add_instruction(pass_op{}, add); } EXPECT(m1.sort() == m2.sort()); From af3e36c0ab99d1489b65ca5a5d36e98645bda802 Mon Sep 17 00:00:00 2001 From: Ted Themistokleous Date: Sat, 11 Nov 2023 17:37:49 +0000 Subject: [PATCH 7/9] Remove additional contiguous around reshape from fuse_pointwise and simplify_reshapes. Update tests to reflect change accordingly --- src/fuse_pointwise.cpp | 3 +-- src/simplify_reshapes.cpp | 8 ++------ test/fuse_pointwise.cpp | 15 +++++---------- test/simplify_reshapes_test.cpp | 12 ++++-------- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/fuse_pointwise.cpp b/src/fuse_pointwise.cpp index 54f362c57fa..491f68a146e 100644 --- a/src/fuse_pointwise.cpp +++ b/src/fuse_pointwise.cpp @@ -219,9 +219,8 @@ struct find_pointwise_reshape_pointwise auto reshape_input = [&](const auto& ins_to_insert) { return [&](auto input) { - auto c = m.insert_instruction(ins_to_insert, make_op("contiguous"), input); return m.insert_instruction( - ins_to_insert, make_op("reshape", {{"dims", cd.dims}}), c); + ins_to_insert, make_op("reshape", {{"dims", cd.dims}}), input); }; }; auto x_inputs = x_ins->inputs(); diff --git a/src/simplify_reshapes.cpp b/src/simplify_reshapes.cpp index 9528b0fe2e0..0dc093026a3 100644 --- a/src/simplify_reshapes.cpp +++ b/src/simplify_reshapes.cpp @@ -103,8 +103,6 @@ struct find_reshaper auto input = mr.instructions["x"]; auto dims = ins->get_shape().lens(); - if(not input->get_shape().standard()) - input = m.insert_instruction(ins, make_op("contiguous"), input); m.replace_instruction(ins, make_op("reshape", {{"dims", dims}}), input); } }; @@ -475,9 +473,8 @@ struct find_resize ins_rsp, migraphx::make_op("reshape", {{"dims", in_dims}}), in_rsp); auto mb_rsp = m.insert_instruction( ins_rsp, migraphx::make_op("multibroadcast", {{"out_lens", out_dims}}), rsp_data); - auto std_mb = m.insert_instruction(ins, migraphx::make_op("contiguous"), mb_rsp); std::vector rsp_dims(out_lens.begin(), out_lens.end()); - m.replace_instruction(ins, migraphx::make_op("reshape", {{"dims", rsp_dims}}), std_mb); + m.replace_instruction(ins, migraphx::make_op("reshape", {{"dims", rsp_dims}}), mb_rsp); } }; @@ -626,9 +623,8 @@ struct find_transpose_contiguous_reshaper_unary auto cont_ins = r.instructions["cont_ins"]; auto unary_op_name = ins->get_operator().name(); auto unary_ins = m.insert_instruction(cont_ins, make_op(unary_op_name), trans_ins); - auto new_cont_ins = m.insert_instruction(cont_ins, make_op("contiguous"), unary_ins); // older cont and reshape are removed by deadcode elimination - m.replace_instruction(ins, reshaper_ins->get_operator(), new_cont_ins); + m.replace_instruction(ins, reshaper_ins->get_operator(), unary_ins); } }; diff --git a/test/fuse_pointwise.cpp b/test/fuse_pointwise.cpp index 39827eb2507..80a79b673f0 100644 --- a/test/fuse_pointwise.cpp +++ b/test/fuse_pointwise.cpp @@ -414,8 +414,7 @@ TEST_CASE(add_reshape_add_nonstandard) auto y = mm->add_parameter("y", s1); auto z = mm->add_parameter("z", s2); auto add1 = mm->add_instruction(migraphx::make_op("add"), x, y); - auto c = mm->add_instruction(migraphx::make_op("contiguous"), add1); - auto reshape = mm->add_instruction(migraphx::make_op("reshape", {{"dims", s2.lens()}}), c); + auto reshape = mm->add_instruction(migraphx::make_op("reshape", {{"dims", s2.lens()}}), add1); auto add2 = mm->add_instruction(migraphx::make_op("add"), reshape, z); mm->add_return({add2}); } @@ -426,10 +425,8 @@ TEST_CASE(add_reshape_add_nonstandard) auto x = mm->add_parameter("x", s1); auto y = mm->add_parameter("y", s1); auto z = mm->add_parameter("z", s2); - auto cx = mm->add_instruction(migraphx::make_op("contiguous"), x); - auto cy = mm->add_instruction(migraphx::make_op("contiguous"), y); - auto x2 = mm->add_instruction(migraphx::make_op("reshape", {{"dims", s3.lens()}}), cx); - auto y2 = mm->add_instruction(migraphx::make_op("reshape", {{"dims", s3.lens()}}), cy); + auto x2 = mm->add_instruction(migraphx::make_op("reshape", {{"dims", s3.lens()}}), x); + auto y2 = mm->add_instruction(migraphx::make_op("reshape", {{"dims", s3.lens()}}), y); auto z2 = mm->add_instruction(migraphx::make_op("reshape", {{"dims", s3.lens()}}), z); auto fadd = add_pointwise(p2, "main:pointwise0", {x2, y2, z2}, [=](auto* pm, const auto& inputs) { @@ -466,10 +463,8 @@ TEST_CASE(add_unsqueeze_add_nonstandard) auto x = mm->add_parameter("x", s1); auto y = mm->add_parameter("y", s1); auto z = mm->add_parameter("z", s2); - auto cx = mm->add_instruction(migraphx::make_op("contiguous"), x); - auto cy = mm->add_instruction(migraphx::make_op("contiguous"), y); - auto x2 = mm->add_instruction(migraphx::make_op("reshape", {{"dims", s2.lens()}}), cx); - auto y2 = mm->add_instruction(migraphx::make_op("reshape", {{"dims", s2.lens()}}), cy); + auto x2 = mm->add_instruction(migraphx::make_op("reshape", {{"dims", s2.lens()}}), x); + auto y2 = mm->add_instruction(migraphx::make_op("reshape", {{"dims", s2.lens()}}), y); auto fadd = add_pointwise(p2, "main:pointwise0", {x2, y2, z}, [=](auto* pm, const auto& inputs) { auto add1 = pm->add_instruction(migraphx::make_op("add"), inputs[0], inputs[1]); diff --git a/test/simplify_reshapes_test.cpp b/test/simplify_reshapes_test.cpp index 2429b93ed85..abfd97d334b 100644 --- a/test/simplify_reshapes_test.cpp +++ b/test/simplify_reshapes_test.cpp @@ -888,9 +888,8 @@ TEST_CASE(optimize_resize) std::vector mb_dims = {1, 2, 2, 2, 2, 3}; auto mbx = m.add_instruction(migraphx::make_op("multibroadcast", {{"out_lens", mb_dims}}), rspx); - auto std_mb = m.add_instruction(migraphx::make_op("contiguous"), mbx); std::vector orig_dims = {1, 2, 4, 6}; - auto rmb = m.add_instruction(migraphx::make_op("reshape", {{"dims", orig_dims}}), std_mb); + auto rmb = m.add_instruction(migraphx::make_op("reshape", {{"dims", orig_dims}}), mbx); auto r = m.add_instruction(migraphx::make_op("softmax", {{"axis", 1}}), rmb); m.add_return({r}); @@ -1301,9 +1300,8 @@ TEST_CASE(transpose_contiguous_reshape_unary) auto transpose_ins = m2.add_instruction( migraphx::make_op("transpose", {{"permutation", {0, 3, 4, 1, 5, 2}}}), reshape_ins1); auto relu = m2.add_instruction(migraphx::make_op("relu"), transpose_ins); - auto cont_ins = m2.add_instruction(migraphx::make_op("contiguous"), relu); auto reshape_ins2 = - m2.add_instruction(migraphx::make_op("reshape", {{"dims", {2, 2, 10, 10}}}), cont_ins); + m2.add_instruction(migraphx::make_op("reshape", {{"dims", {2, 2, 10, 10}}}), relu); m2.add_instruction(pass_op{}, reshape_ins2); } EXPECT(m1 == m2); @@ -1328,8 +1326,7 @@ TEST_CASE(transpose_contiguous_squeeze_unary) auto transpose_ins = m2.add_instruction(migraphx::make_op("transpose", {{"permutation", {0, 2, 3, 1}}}), x); auto rsqrt = m2.add_instruction(migraphx::make_op("rsqrt"), transpose_ins); - auto cont_ins = m2.add_instruction(migraphx::make_op("contiguous"), rsqrt); - auto sq_ins = m2.add_instruction(migraphx::make_op("squeeze", {{"axes", {1}}}), cont_ins); + auto sq_ins = m2.add_instruction(migraphx::make_op("squeeze", {{"axes", {1}}}), rsqrt); m2.add_instruction(pass_op{}, sq_ins); } EXPECT(m1 == m2); @@ -1355,9 +1352,8 @@ TEST_CASE(transpose_contiguous_unsqueeze_unary) auto transpose_ins = m2.add_instruction(migraphx::make_op("transpose", {{"permutation", {0, 2, 3, 1}}}), x); auto round = m2.add_instruction(migraphx::make_op("nearbyint"), transpose_ins); - auto cont_ins = m2.add_instruction(migraphx::make_op("contiguous"), round); auto unsq_ins = - m2.add_instruction(migraphx::make_op("unsqueeze", {{"axes", {2}}}), cont_ins); + m2.add_instruction(migraphx::make_op("unsqueeze", {{"axes", {2}}}), round); m2.add_instruction(pass_op{}, unsq_ins); } EXPECT(m1 == m2); From 28126c4caa4ae11913bf2b1fd1ae4cb6b0b9ab75 Mon Sep 17 00:00:00 2001 From: Ted Themistokleous Date: Tue, 14 Nov 2023 15:22:10 +0000 Subject: [PATCH 8/9] Update format --- test/fuse_pointwise.cpp | 3 ++- test/simplify_algebra_test.cpp | 11 +++++------ test/simplify_reshapes_test.cpp | 5 ++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/test/fuse_pointwise.cpp b/test/fuse_pointwise.cpp index 80a79b673f0..cfe64f5a783 100644 --- a/test/fuse_pointwise.cpp +++ b/test/fuse_pointwise.cpp @@ -414,7 +414,8 @@ TEST_CASE(add_reshape_add_nonstandard) auto y = mm->add_parameter("y", s1); auto z = mm->add_parameter("z", s2); auto add1 = mm->add_instruction(migraphx::make_op("add"), x, y); - auto reshape = mm->add_instruction(migraphx::make_op("reshape", {{"dims", s2.lens()}}), add1); + auto reshape = + mm->add_instruction(migraphx::make_op("reshape", {{"dims", s2.lens()}}), add1); auto add2 = mm->add_instruction(migraphx::make_op("add"), reshape, z); mm->add_return({add2}); } diff --git a/test/simplify_algebra_test.cpp b/test/simplify_algebra_test.cpp index 73c2cebb450..4f48fcfb865 100644 --- a/test/simplify_algebra_test.cpp +++ b/test/simplify_algebra_test.cpp @@ -1900,12 +1900,12 @@ TEST_CASE(simplify_split_add_relu_reshape) auto slc1 = m2.add_instruction( migraphx::make_op("slice", {{"axes", {1}}, {"starts", {0}}, {"ends", {1}}}), relu); - auto rsp1 = m2.add_instruction(migraphx::make_op("reshape", {{"dims", {3, 4}}}), slc1); + auto rsp1 = m2.add_instruction(migraphx::make_op("reshape", {{"dims", {3, 4}}}), slc1); auto slc2 = m2.add_instruction( migraphx::make_op("slice", {{"axes", {1}}, {"starts", {1}}, {"ends", {2}}}), relu); - auto rsp2 = m2.add_instruction(migraphx::make_op("reshape", {{"dims", {3, 4}}}), slc2); + auto rsp2 = m2.add_instruction(migraphx::make_op("reshape", {{"dims", {3, 4}}}), slc2); auto add = m2.add_instruction(migraphx::make_op("add"), rsp1, rsp2); m2.add_instruction(pass_op{}, add); @@ -2328,8 +2328,7 @@ TEST_CASE(simplify_dot_horiz_reshape) migraphx::make_op("slice", {{"axes", {2}}, {"starts", {0}}, {"ends", {4}}}), dot); auto y = m2.add_instruction( migraphx::make_op("slice", {{"axes", {2}}, {"starts", {4}}, {"ends", {8}}}), dot); - auto x_rsp = - m2.add_instruction(migraphx::make_op("reshape", {{"dims", {3, 4, 2, 2}}}), x); + auto x_rsp = m2.add_instruction(migraphx::make_op("reshape", {{"dims", {3, 4, 2, 2}}}), x); auto y_rsp = m2.add_instruction(migraphx::make_op("unsqueeze", {{"axes", {2}}, {"steps", {2}}}), y); auto sum = m2.add_instruction(migraphx::make_op("add"), {x_rsp, y_rsp}); @@ -2692,8 +2691,8 @@ void reorder_reshape_slice() { s = migraphx::shape{migraphx::shape::float_type, {BS, 128, 1920}, {165120, 1, 128}}; } - auto input = m2.add_parameter("input", s); - auto rsp_input = input; + auto input = m2.add_parameter("input", s); + auto rsp_input = input; std::vector lens = {static_cast(BS), 128, 30, 64}; auto r = m2.add_instruction(migraphx::make_op("reshape", {{"dims", lens}}), rsp_input); diff --git a/test/simplify_reshapes_test.cpp b/test/simplify_reshapes_test.cpp index abfd97d334b..7e8bb74619d 100644 --- a/test/simplify_reshapes_test.cpp +++ b/test/simplify_reshapes_test.cpp @@ -1299,7 +1299,7 @@ TEST_CASE(transpose_contiguous_reshape_unary) m2.add_instruction(migraphx::make_op("reshape", {{"dims", {2, 2, 2, 2, 5, 5}}}), x); auto transpose_ins = m2.add_instruction( migraphx::make_op("transpose", {{"permutation", {0, 3, 4, 1, 5, 2}}}), reshape_ins1); - auto relu = m2.add_instruction(migraphx::make_op("relu"), transpose_ins); + auto relu = m2.add_instruction(migraphx::make_op("relu"), transpose_ins); auto reshape_ins2 = m2.add_instruction(migraphx::make_op("reshape", {{"dims", {2, 2, 10, 10}}}), relu); m2.add_instruction(pass_op{}, reshape_ins2); @@ -1352,8 +1352,7 @@ TEST_CASE(transpose_contiguous_unsqueeze_unary) auto transpose_ins = m2.add_instruction(migraphx::make_op("transpose", {{"permutation", {0, 2, 3, 1}}}), x); auto round = m2.add_instruction(migraphx::make_op("nearbyint"), transpose_ins); - auto unsq_ins = - m2.add_instruction(migraphx::make_op("unsqueeze", {{"axes", {2}}}), round); + auto unsq_ins = m2.add_instruction(migraphx::make_op("unsqueeze", {{"axes", {2}}}), round); m2.add_instruction(pass_op{}, unsq_ins); } EXPECT(m1 == m2); From fef5bd9df552e60bc298bccdf2ebde52efc90795 Mon Sep 17 00:00:00 2001 From: Ted Themistokleous Date: Tue, 14 Nov 2023 15:49:56 +0000 Subject: [PATCH 9/9] Format 2 --- test/fuse_pointwise.cpp | 2 +- test/simplify_algebra_test.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/fuse_pointwise.cpp b/test/fuse_pointwise.cpp index cfe64f5a783..cfab0597482 100644 --- a/test/fuse_pointwise.cpp +++ b/test/fuse_pointwise.cpp @@ -414,7 +414,7 @@ TEST_CASE(add_reshape_add_nonstandard) auto y = mm->add_parameter("y", s1); auto z = mm->add_parameter("z", s2); auto add1 = mm->add_instruction(migraphx::make_op("add"), x, y); - auto reshape = + auto reshape = mm->add_instruction(migraphx::make_op("reshape", {{"dims", s2.lens()}}), add1); auto add2 = mm->add_instruction(migraphx::make_op("add"), reshape, z); mm->add_return({add2}); diff --git a/test/simplify_algebra_test.cpp b/test/simplify_algebra_test.cpp index 4f48fcfb865..16fa1c0224e 100644 --- a/test/simplify_algebra_test.cpp +++ b/test/simplify_algebra_test.cpp @@ -2691,7 +2691,7 @@ void reorder_reshape_slice() { s = migraphx::shape{migraphx::shape::float_type, {BS, 128, 1920}, {165120, 1, 128}}; } - auto input = m2.add_parameter("input", s); + auto input = m2.add_parameter("input", s); auto rsp_input = input; std::vector lens = {static_cast(BS), 128, 30, 64}; auto r = m2.add_instruction(migraphx::make_op("reshape", {{"dims", lens}}), rsp_input);