Skip to content

Commit

Permalink
Make argument constructor explicit (#2346)
Browse files Browse the repository at this point in the history
  • Loading branch information
pfultz2 authored Oct 19, 2023
1 parent 581b1b5 commit 07848b2
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/include/migraphx/argument.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct MIGRAPHX_EXPORT argument : raw_data<argument>
{
argument() = default;

argument(const shape& s);
explicit argument(const shape& s);

template <class F, MIGRAPHX_REQUIRES(std::is_pointer<decltype(std::declval<F>()())>{})>
argument(shape s, F d)
Expand Down
4 changes: 2 additions & 2 deletions src/include/migraphx/op/allocate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ struct allocate
{
if(args.empty())
{
return {output_shape};
return argument{output_shape};
}
else
{
std::vector<std::size_t> output_dims(output_shape.ndim());
args.at(0).visit([&](auto a) { output_dims.assign(a.begin(), a.end()); });
return {shape{buf_type, output_dims}};
return argument{shape{buf_type, output_dims}};
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/include/migraphx/op/pooling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ struct pooling
// for dynamic GlobalPooling, there's no padding
kernel_dims.insert(kernel_dims.end(), input_lens.begin() + 2, input_lens.end());
output_shape = dyn_out.computed_shape;
result = dyn_out.computed_shape;
result = argument{dyn_out.computed_shape};
}
else if((padding_mode != op::padding_mode_t::default_))
{
Expand Down Expand Up @@ -439,7 +439,7 @@ struct pooling
{
kernel_dims = this->lengths;
output_shape = dyn_out.computed_shape;
result = dyn_out.computed_shape;
result = argument{dyn_out.computed_shape};
}

// Perform the computation and populate result
Expand Down
6 changes: 3 additions & 3 deletions src/targets/gpu/include/migraphx/gpu/convolution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ struct miopen_convolution
// MIOpen has APIs to pass pre-allocated buffers starting from rocm-5.6
preallocate = true;
#endif
auto x = preallocate ? to_gpu(generate_argument(x_shape)) : inputs[0];
auto w = preallocate ? to_gpu(generate_argument(w_shape)) : inputs[1];
auto y = preallocate ? allocate_gpu(output_shape) : inputs[2];
auto x = preallocate ? to_gpu(generate_argument(x_shape)) : argument{inputs[0]};
auto w = preallocate ? to_gpu(generate_argument(w_shape)) : argument{inputs[1]};
auto y = preallocate ? allocate_gpu(output_shape) : argument{inputs[2]};
auto workspace =
preallocate ? allocate_gpu(workspace_shape) : migraphx::argument(workspace_shape);

Expand Down
2 changes: 1 addition & 1 deletion test/eliminate_allocation_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct allocate
const migraphx::shape& output_shape,
const std::vector<migraphx::argument>&) const
{
return {output_shape};
return migraphx::argument{output_shape};
}
};

Expand Down
4 changes: 2 additions & 2 deletions test/eliminate_concat_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct concat
const migraphx::shape& output_shape,
const std::vector<migraphx::argument>&) const
{
return {output_shape};
return migraphx::argument{output_shape};
}
};

Expand Down Expand Up @@ -104,7 +104,7 @@ struct allocate
const migraphx::shape& output_shape,
const std::vector<migraphx::argument>&) const
{
return {output_shape};
return migraphx::argument{output_shape};
}
};

Expand Down
2 changes: 1 addition & 1 deletion test/memory_coloring_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct allocate
const migraphx::shape& output_shape,
const std::vector<migraphx::argument>&) const
{
return {output_shape};
return migraphx::argument{output_shape};
}
};

Expand Down
2 changes: 1 addition & 1 deletion test/normalize_ops_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct normalize_test_op
const migraphx::shape& output_shape,
const std::vector<migraphx::argument>&) const
{
return {output_shape};
return migraphx::argument{output_shape};
}
};

Expand Down
4 changes: 2 additions & 2 deletions test/replace_allocate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct allocate_no_out : migraphx::auto_register_op<allocate_no_out>
const migraphx::shape& output_shape,
const std::vector<migraphx::argument>&) const
{
return {output_shape};
return migraphx::argument{output_shape};
}
};

Expand All @@ -78,7 +78,7 @@ struct allocate_with_out : migraphx::auto_register_op<allocate_with_out>
const migraphx::shape& output_shape,
const std::vector<migraphx::argument>&) const
{
return {output_shape};
return migraphx::argument{output_shape};
}
};

Expand Down

0 comments on commit 07848b2

Please sign in to comment.