Skip to content

Commit

Permalink
Remove maybe_unused to actually used variables (#172)
Browse files Browse the repository at this point in the history
* Remove maybe_unused to actually used variables

* Remove a pair of brackets
  • Loading branch information
tpadioleau authored Oct 14, 2024
1 parent 647f235 commit 74705bb
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 22 deletions.
11 changes: 5 additions & 6 deletions common/src/KokkosFFT_Helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,18 @@ void roll(const ExecutionSpace& exec_space, ViewType& inout, axis_type<2> shift,
int n0 = inout.extent_int(0), n1 = inout.extent_int(1);

ViewType tmp("tmp", n0, n1);
[[maybe_unused]] int len0 = (n0 - 1) / 2 + 1;
[[maybe_unused]] int len1 = (n1 - 1) / 2 + 1;
int len0 = (n0 - 1) / 2 + 1;
int len1 = (n1 - 1) / 2 + 1;

using range_type = Kokkos::MDRangePolicy<
ExecutionSpace,
Kokkos::Rank<2, Kokkos::Iterate::Default, Kokkos::Iterate::Default>>;
using tile_type = typename range_type::tile_type;
using point_type = typename range_type::point_type;

range_type range(
exec_space, point_type{{0, 0}}, point_type{{len0, len1}},
tile_type{{4, 4}} // [TO DO] Choose optimal tile sizes for each device
);
// [TO DO] Choose optimal tile sizes for each device
range_type range(exec_space, point_type{0, 0}, point_type{len0, len1},
tile_type{4, 4});

axis_type<2> shift0 = {0}, shift1 = {0}, shift2 = {n0 / 2, n1 / 2};
for (int i = 0; static_cast<std::size_t>(i) < DIM1; i++) {
Expand Down
10 changes: 4 additions & 6 deletions common/src/KokkosFFT_layouts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ auto get_extents(const InViewType& in, const OutViewType& out,
"input axes are not valid for the view");

constexpr std::size_t rank = InViewType::rank;
[[maybe_unused]] int inner_most_axis =
std::is_same_v<array_layout_type, typename Kokkos::LayoutLeft>
? 0
: (rank - 1);
int inner_most_axis =
std::is_same_v<array_layout_type, Kokkos::LayoutLeft> ? 0 : (rank - 1);

// index map after transpose over axis
auto [map, map_inv] = KokkosFFT::Impl::get_map_axes(in, axes);
Expand Down Expand Up @@ -97,10 +95,10 @@ auto get_extents(const InViewType& in, const OutViewType& out,
1, std::multiplies<>());
int fft_size = std::accumulate(fft_extents.begin(), fft_extents.end(), 1,
std::multiplies<>());
[[maybe_unused]] int howmany = total_fft_size / fft_size;
int howmany = total_fft_size / fft_size;

return std::tuple<std::vector<int>, std::vector<int>, std::vector<int>, int>(
{in_extents, out_extents, fft_extents, howmany});
in_extents, out_extents, fft_extents, howmany);
}
} // namespace Impl
}; // namespace KokkosFFT
Expand Down
6 changes: 3 additions & 3 deletions common/src/KokkosFFT_normalization.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ auto get_coefficients(ViewType, Direction direction,
Normalization normalization, std::size_t fft_size) {
using value_type = KokkosFFT::Impl::base_floating_point_type<
typename ViewType::non_const_value_type>;
value_type coef = 1;
[[maybe_unused]] bool to_normalize = false;
value_type coef = 1;
bool to_normalize = false;

switch (normalization) {
case Normalization::forward:
Expand All @@ -56,7 +56,7 @@ auto get_coefficients(ViewType, Direction direction,
default: // No normalization
break;
};
return std::tuple<value_type, bool>({coef, to_normalize});
return std::tuple<value_type, bool>(coef, to_normalize);
}

template <typename ExecutionSpace, typename ViewType>
Expand Down
8 changes: 4 additions & 4 deletions common/src/KokkosFFT_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ template <typename ViewType>
auto convert_negative_shift(const ViewType& view, int _shift, int _axis) {
static_assert(Kokkos::is_view_v<ViewType>,
"convert_negative_shift: ViewType must be a Kokkos::View.");
int axis = convert_negative_axis(view, _axis);
int extent = view.extent(axis);
[[maybe_unused]] int shift0 = 0, shift1 = 0, shift2 = extent / 2;
int axis = convert_negative_axis(view, _axis);
int extent = view.extent(axis);
int shift0 = 0, shift1 = 0, shift2 = extent / 2;

if (_shift < 0) {
shift0 = -_shift + extent % 2; // add 1 for odd case
Expand All @@ -48,7 +48,7 @@ auto convert_negative_shift(const ViewType& view, int _shift, int _axis) {
shift2 = 0;
}

return std::tuple<int, int, int>({shift0, shift1, shift2});
return std::tuple<int, int, int>(shift0, shift1, shift2);
}

template <typename ContainerType, typename ValueType>
Expand Down
2 changes: 1 addition & 1 deletion fft/src/KokkosFFT_Host_plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ template <typename ExecutionSpace, typename PlanType, typename InViewType,
auto create_plan(const ExecutionSpace& exec_space,
std::unique_ptr<PlanType>& plan, const InViewType& in,
const OutViewType& out, BufferViewType&, InfoType&,
[[maybe_unused]] Direction direction, axis_type<fft_rank> axes,
Direction direction, axis_type<fft_rank> axes,
shape_type<fft_rank> s) {
static_assert(
KokkosFFT::Impl::are_operatable_views_v<ExecutionSpace, InViewType,
Expand Down
3 changes: 1 addition & 2 deletions fft/src/KokkosFFT_ROCM_plans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ namespace KokkosFFT {
namespace Impl {
// Helper to get input and output array type and direction from transform type
template <typename TransformType>
auto get_in_out_array_type(TransformType type,
[[maybe_unused]] Direction direction) {
auto get_in_out_array_type(TransformType type, Direction direction) {
rocfft_array_type in_array_type, out_array_type;
rocfft_transform_type fft_direction;

Expand Down

0 comments on commit 74705bb

Please sign in to comment.