Skip to content

Commit

Permalink
Remove list initialization for prefix_scan_sum (#2828)
Browse files Browse the repository at this point in the history
  • Loading branch information
TedThemistokleous authored Mar 7, 2024
1 parent 6396493 commit 81a558d
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/include/migraphx/builtin.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -98,7 +98,7 @@ struct returns
else if(arg.size() == 1)
return arg[0];
else
return arg;
return shape(arg);
}

argument compute(context&, const shape&, const std::vector<argument>&) const
Expand Down
4 changes: 2 additions & 2 deletions src/include/migraphx/op/if_op.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -57,7 +57,7 @@ struct if_op
MIGRAPHX_THROW("IF: output shapes of submodules must be the same.");
}

return {out_shapes0};
return shape(out_shapes0);
}

argument compute(const shape&,
Expand Down
4 changes: 2 additions & 2 deletions src/include/migraphx/op/loop.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -76,7 +76,7 @@ struct loop
ins_out_shapes.push_back({out_s.type(), lens});
}

return {ins_out_shapes};
return shape(ins_out_shapes);
}

struct ref_loop
Expand Down
4 changes: 2 additions & 2 deletions src/include/migraphx/op/run_on_target.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -62,7 +62,7 @@ struct run_on_target
MIGRAPHX_THROW("RUN_ON_TARGET: Mismatched number of input parameters");
}
auto mod_out_shapes = mod_input->get_output_shapes();
return mod_out_shapes;
return shape(mod_out_shapes);
}

migraphx::argument
Expand Down
4 changes: 2 additions & 2 deletions src/include/migraphx/op/topk.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -69,7 +69,7 @@ struct topk
shape s_val{type, lens};
shape s_ind{shape::int64_type, lens};

return {{s_val, s_ind}};
return shape({s_val, s_ind});
}

template <class T, class Compare>
Expand Down
4 changes: 2 additions & 2 deletions src/include/migraphx/op/unique.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -239,7 +239,7 @@ struct unique
// The three outputted Indices are just 1-D:
shape sh_idx{shape::int64_type, {d_out[0]}};

return {{sh_y, sh_idx, sh_idx, sh_idx}};
return shape({sh_y, sh_idx, sh_idx, sh_idx});
}

argument compute(const dyn_output& dyn_out, std::vector<argument> args) const
Expand Down
2 changes: 1 addition & 1 deletion src/include/migraphx/shape.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ struct MIGRAPHX_EXPORT shape
{
}

shape(const std::vector<shape>& subs);
explicit shape(const std::vector<shape>& subs);

/**
* Creates an output shape with dimensions equal to the input lengths and strides determined
Expand Down
2 changes: 1 addition & 1 deletion src/include/migraphx/type_traits.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions src/shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ shape shape::to_dynamic() const
sub_shapes().cend(),
std::back_inserter(subs),
[](auto s) { return s.to_dynamic(); });
return {subs};
return shape(subs);
}
if(this->dynamic())
{
Expand All @@ -548,7 +548,7 @@ shape shape::to_static(std::size_t x) const
sub_shapes().cend(),
std::back_inserter(subs),
[&](auto s) { return s.to_static(x); });
return {subs};
return shape(subs);
}
if(not this->dynamic())
{
Expand Down
4 changes: 2 additions & 2 deletions src/targets/fpga/vitis_ai_adapter.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -37,7 +37,7 @@ x_model create_xmodel(migraphx::const_module_ref mod)
{
std::cout << "Calling an external function: create_xmodel!\n";
x_model xmodel;
xmodel.set_shape(mod->get_output_shapes());
xmodel.set_shape(migraphx::shape(mod->get_output_shapes()));
return xmodel;
}

Expand Down
2 changes: 1 addition & 1 deletion src/targets/gpu/include/migraphx/gpu/prefix_scan_sum.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions test/include/basic_ops.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -208,7 +208,7 @@ struct tuple_op
std::string name() const { return "tuple_op"; }
migraphx::shape compute_shape(const std::vector<migraphx::shape>& inputs) const
{
return {inputs};
return migraphx::shape(inputs);
}
migraphx::argument compute(migraphx::context&,
const migraphx::shape&,
Expand Down
5 changes: 3 additions & 2 deletions test/op_shape_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4525,7 +4525,8 @@ TEST_CASE(test_unique_axis_negative)
{migraphx::shape::int64_type, idx_dims},
{migraphx::shape::int64_type, idx_dims}};

expect_shape(y_dyn_shape, migraphx::make_op("unique", {{"axis", -3}}), x_shape);
expect_shape(
migraphx::shape(y_dyn_shape), migraphx::make_op("unique", {{"axis", -3}}), x_shape);
}

TEST_CASE(test_unique_axis_none)
Expand All @@ -4539,7 +4540,7 @@ TEST_CASE(test_unique_axis_none)
{migraphx::shape::int64_type, idx_dims},
{migraphx::shape::int64_type, idx_dims}};

expect_shape(y_dyn_shape, migraphx::make_op("unique"), x_shape);
expect_shape(migraphx::shape(y_dyn_shape), migraphx::make_op("unique"), x_shape);
}

TEST_CASE(test_unsqueeze)
Expand Down
4 changes: 2 additions & 2 deletions test/run_loop_test.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -98,7 +98,7 @@ struct test_loop_op
ins_out_shapes.push_back({out_s.type(), lens});
}

return {ins_out_shapes};
return migraphx::shape(ins_out_shapes);
}

struct test_loop : public migraphx::op::loop::ref_loop
Expand Down

0 comments on commit 81a558d

Please sign in to comment.