From 04c180e62b582997429c78aa6b63cd6dff0bc6c0 Mon Sep 17 00:00:00 2001 From: yasahi-hpc <57478230+yasahi-hpc@users.noreply.github.com> Date: Fri, 5 Jul 2024 10:27:58 +0200 Subject: [PATCH] Cleaning up some warnings and enabling -Werror on Intel GPU CI tests (#112) * suppress unused arguments * Add -Werror option in icpx CI * suppress unused arguments and variables in plan create * Allow some warning for intel GPU CI * fix: missing & in _destroy_info for SYCL * remove unused variable from SYCL plan --------- Co-authored-by: Yuuichi Asahi --- .github/workflows/build_test.yaml | 2 +- fft/src/KokkosFFT_Cuda_plans.hpp | 24 ++++++++--------------- fft/src/KokkosFFT_Cuda_transform.hpp | 17 ++++++---------- fft/src/KokkosFFT_HIP_plans.hpp | 24 ++++++++--------------- fft/src/KokkosFFT_HIP_transform.hpp | 18 ++++++----------- fft/src/KokkosFFT_OpenMP_plans.hpp | 8 +++----- fft/src/KokkosFFT_OpenMP_transform.hpp | 12 ++++++------ fft/src/KokkosFFT_ROCM_plans.hpp | 2 +- fft/src/KokkosFFT_ROCM_transform.hpp | 12 ++++++------ fft/src/KokkosFFT_SYCL_plans.hpp | 27 ++++++++------------------ 10 files changed, 53 insertions(+), 93 deletions(-) diff --git a/.github/workflows/build_test.yaml b/.github/workflows/build_test.yaml index ed252965..086690e4 100644 --- a/.github/workflows/build_test.yaml +++ b/.github/workflows/build_test.yaml @@ -123,7 +123,7 @@ jobs: # building for Intel PVC was unsuccessful without the proper # device, so for now, we simply generate generic Intel GPU code kokkos: -DKokkos_ENABLE_SYCL=ON -DKokkos_ARCH_INTEL_GEN=ON - kokkos_fft: "" + kokkos_fft: -DCMAKE_CXX_FLAGS="-Wall -Wextra" target: - name: native cmake_flags: "" diff --git a/fft/src/KokkosFFT_Cuda_plans.hpp b/fft/src/KokkosFFT_Cuda_plans.hpp index 816c797e..6ea457f4 100644 --- a/fft/src/KokkosFFT_Cuda_plans.hpp +++ b/fft/src/KokkosFFT_Cuda_plans.hpp @@ -18,10 +18,8 @@ template , std::nullptr_t> = nullptr> auto _create(const ExecutionSpace& exec_space, std::unique_ptr& plan, - const InViewType& in, const OutViewType& out, - [[maybe_unused]] BufferViewType& buffer, - [[maybe_unused]] InfoType& execution_info, - [[maybe_unused]] Direction direction, axis_type<1> axes, + const InViewType& in, const OutViewType& out, BufferViewType&, + InfoType&, Direction /*direction*/, axis_type<1> axes, shape_type<1> s) { static_assert(Kokkos::is_view::value, "KokkosFFT::_create: InViewType is not a Kokkos::View."); @@ -57,10 +55,8 @@ template , std::nullptr_t> = nullptr> auto _create(const ExecutionSpace& exec_space, std::unique_ptr& plan, - const InViewType& in, const OutViewType& out, - [[maybe_unused]] BufferViewType& buffer, - [[maybe_unused]] InfoType& execution_info, - [[maybe_unused]] Direction direction, axis_type<2> axes, + const InViewType& in, const OutViewType& out, BufferViewType&, + InfoType&, Direction /*direction*/, axis_type<2> axes, shape_type<2> s) { static_assert(Kokkos::is_view::value, "KokkosFFT::_create: InViewType is not a Kokkos::View."); @@ -96,10 +92,8 @@ template , std::nullptr_t> = nullptr> auto _create(const ExecutionSpace& exec_space, std::unique_ptr& plan, - const InViewType& in, const OutViewType& out, - [[maybe_unused]] BufferViewType& buffer, - [[maybe_unused]] InfoType& execution_info, - [[maybe_unused]] Direction direction, axis_type<3> axes, + const InViewType& in, const OutViewType& out, BufferViewType&, + InfoType&, Direction /*direction*/, axis_type<3> axes, shape_type<3> s) { static_assert(Kokkos::is_view::value, "KokkosFFT::_create: InViewType is not a Kokkos::View."); @@ -137,10 +131,8 @@ template , std::nullptr_t> = nullptr> auto _create(const ExecutionSpace& exec_space, std::unique_ptr& plan, - const InViewType& in, const OutViewType& out, - [[maybe_unused]] BufferViewType& buffer, - [[maybe_unused]] InfoType& execution_info, - [[maybe_unused]] Direction direction, axis_type axes, + const InViewType& in, const OutViewType& out, BufferViewType&, + InfoType&, Direction /*direction*/, axis_type axes, shape_type s) { static_assert(Kokkos::is_view::value, "KokkosFFT::_create: InViewType is not a Kokkos::View."); diff --git a/fft/src/KokkosFFT_Cuda_transform.hpp b/fft/src/KokkosFFT_Cuda_transform.hpp index aee7f22e..2072fd72 100644 --- a/fft/src/KokkosFFT_Cuda_transform.hpp +++ b/fft/src/KokkosFFT_Cuda_transform.hpp @@ -11,8 +11,7 @@ namespace KokkosFFT { namespace Impl { template inline void _exec(cufftHandle& plan, cufftReal* idata, cufftComplex* odata, - [[maybe_unused]] int direction, - [[maybe_unused]] Args... args) { + int /*direction*/, Args...) { cufftResult cufft_rt = cufftExecR2C(plan, idata, odata); if (cufft_rt != CUFFT_SUCCESS) throw std::runtime_error("cufftExecR2C failed"); @@ -20,8 +19,7 @@ inline void _exec(cufftHandle& plan, cufftReal* idata, cufftComplex* odata, template inline void _exec(cufftHandle& plan, cufftDoubleReal* idata, - cufftDoubleComplex* odata, [[maybe_unused]] int direction, - [[maybe_unused]] Args... args) { + cufftDoubleComplex* odata, int /*direction*/, Args...) { cufftResult cufft_rt = cufftExecD2Z(plan, idata, odata); if (cufft_rt != CUFFT_SUCCESS) throw std::runtime_error("cufftExecD2Z failed"); @@ -29,8 +27,7 @@ inline void _exec(cufftHandle& plan, cufftDoubleReal* idata, template inline void _exec(cufftHandle& plan, cufftComplex* idata, cufftReal* odata, - [[maybe_unused]] int direction, - [[maybe_unused]] Args... args) { + int /*direction*/, Args...) { cufftResult cufft_rt = cufftExecC2R(plan, idata, odata); if (cufft_rt != CUFFT_SUCCESS) throw std::runtime_error("cufftExecC2R failed"); @@ -38,8 +35,7 @@ inline void _exec(cufftHandle& plan, cufftComplex* idata, cufftReal* odata, template inline void _exec(cufftHandle& plan, cufftDoubleComplex* idata, - cufftDoubleReal* odata, [[maybe_unused]] int direction, - [[maybe_unused]] Args... args) { + cufftDoubleReal* odata, int /*direction*/, Args...) { cufftResult cufft_rt = cufftExecZ2D(plan, idata, odata); if (cufft_rt != CUFFT_SUCCESS) throw std::runtime_error("cufftExecZ2D failed"); @@ -47,7 +43,7 @@ inline void _exec(cufftHandle& plan, cufftDoubleComplex* idata, template inline void _exec(cufftHandle& plan, cufftComplex* idata, cufftComplex* odata, - int direction, [[maybe_unused]] Args... args) { + int direction, Args...) { cufftResult cufft_rt = cufftExecC2C(plan, idata, odata, direction); if (cufft_rt != CUFFT_SUCCESS) throw std::runtime_error("cufftExecC2C failed"); @@ -55,8 +51,7 @@ inline void _exec(cufftHandle& plan, cufftComplex* idata, cufftComplex* odata, template inline void _exec(cufftHandle& plan, cufftDoubleComplex* idata, - cufftDoubleComplex* odata, int direction, - [[maybe_unused]] Args... args) { + cufftDoubleComplex* odata, int direction, Args...) { cufftResult cufft_rt = cufftExecZ2Z(plan, idata, odata, direction); if (cufft_rt != CUFFT_SUCCESS) throw std::runtime_error("cufftExecZ2Z failed"); diff --git a/fft/src/KokkosFFT_HIP_plans.hpp b/fft/src/KokkosFFT_HIP_plans.hpp index c20bcba7..5247e9fa 100644 --- a/fft/src/KokkosFFT_HIP_plans.hpp +++ b/fft/src/KokkosFFT_HIP_plans.hpp @@ -18,10 +18,8 @@ template , std::nullptr_t> = nullptr> auto _create(const ExecutionSpace& exec_space, std::unique_ptr& plan, - const InViewType& in, const OutViewType& out, - [[maybe_unused]] BufferViewType& buffer, - [[maybe_unused]] InfoType& execution_info, - [[maybe_unused]] Direction direction, axis_type<1> axes, + const InViewType& in, const OutViewType& out, BufferViewType&, + InfoType&, Direction /*direction*/, axis_type<1> axes, shape_type<1> s) { static_assert(Kokkos::is_view::value, "KokkosFFT::_create: InViewType is not a Kokkos::View."); @@ -59,10 +57,8 @@ template , std::nullptr_t> = nullptr> auto _create(const ExecutionSpace& exec_space, std::unique_ptr& plan, - const InViewType& in, const OutViewType& out, - [[maybe_unused]] BufferViewType& buffer, - [[maybe_unused]] InfoType& execution_info, - [[maybe_unused]] Direction direction, axis_type<2> axes, + const InViewType& in, const OutViewType& out, BufferViewType&, + InfoType&, Direction /*direction*/, axis_type<2> axes, shape_type<2> s) { static_assert(Kokkos::is_view::value, "KokkosFFT::_create: InViewType is not a Kokkos::View."); @@ -100,10 +96,8 @@ template , std::nullptr_t> = nullptr> auto _create(const ExecutionSpace& exec_space, std::unique_ptr& plan, - const InViewType& in, const OutViewType& out, - [[maybe_unused]] BufferViewType& buffer, - [[maybe_unused]] InfoType& execution_info, - [[maybe_unused]] Direction direction, axis_type<3> axes, + const InViewType& in, const OutViewType& out, BufferViewType&, + InfoType&, Direction /*direction*/, axis_type<3> axes, shape_type<3> s) { static_assert(Kokkos::is_view::value, "KokkosFFT::_create: InViewType is not a Kokkos::View."); @@ -143,10 +137,8 @@ template , std::nullptr_t> = nullptr> auto _create(const ExecutionSpace& exec_space, std::unique_ptr& plan, - const InViewType& in, const OutViewType& out, - [[maybe_unused]] BufferViewType& buffer, - [[maybe_unused]] InfoType& execution_info, - [[maybe_unused]] Direction direction, axis_type axes, + const InViewType& in, const OutViewType& out, BufferViewType&, + InfoType&, Direction /*direction*/, axis_type axes, shape_type s) { static_assert(Kokkos::is_view::value, "KokkosFFT::_create: InViewType is not a Kokkos::View."); diff --git a/fft/src/KokkosFFT_HIP_transform.hpp b/fft/src/KokkosFFT_HIP_transform.hpp index 6528c337..62ab520d 100644 --- a/fft/src/KokkosFFT_HIP_transform.hpp +++ b/fft/src/KokkosFFT_HIP_transform.hpp @@ -11,8 +11,7 @@ namespace KokkosFFT { namespace Impl { template inline void _exec(hipfftHandle& plan, hipfftReal* idata, hipfftComplex* odata, - [[maybe_unused]] int direction, - [[maybe_unused]] Args... args) { + int /*direction*/, Args...) { hipfftResult hipfft_rt = hipfftExecR2C(plan, idata, odata); if (hipfft_rt != HIPFFT_SUCCESS) throw std::runtime_error("hipfftExecR2C failed"); @@ -20,8 +19,7 @@ inline void _exec(hipfftHandle& plan, hipfftReal* idata, hipfftComplex* odata, template inline void _exec(hipfftHandle& plan, hipfftDoubleReal* idata, - hipfftDoubleComplex* odata, [[maybe_unused]] int direction, - [[maybe_unused]] Args... args) { + hipfftDoubleComplex* odata, int /*direction*/, Args...) { hipfftResult hipfft_rt = hipfftExecD2Z(plan, idata, odata); if (hipfft_rt != HIPFFT_SUCCESS) throw std::runtime_error("hipfftExecD2Z failed"); @@ -29,8 +27,7 @@ inline void _exec(hipfftHandle& plan, hipfftDoubleReal* idata, template inline void _exec(hipfftHandle& plan, hipfftComplex* idata, hipfftReal* odata, - [[maybe_unused]] int direction, - [[maybe_unused]] Args... args) { + int /*direction*/, Args...) { hipfftResult hipfft_rt = hipfftExecC2R(plan, idata, odata); if (hipfft_rt != HIPFFT_SUCCESS) throw std::runtime_error("hipfftExecC2R failed"); @@ -38,8 +35,7 @@ inline void _exec(hipfftHandle& plan, hipfftComplex* idata, hipfftReal* odata, template inline void _exec(hipfftHandle& plan, hipfftDoubleComplex* idata, - hipfftDoubleReal* odata, [[maybe_unused]] int direction, - [[maybe_unused]] Args... args) { + hipfftDoubleReal* odata, int /*direction*/, Args...) { hipfftResult hipfft_rt = hipfftExecZ2D(plan, idata, odata); if (hipfft_rt != HIPFFT_SUCCESS) throw std::runtime_error("hipfftExecZ2D failed"); @@ -47,8 +43,7 @@ inline void _exec(hipfftHandle& plan, hipfftDoubleComplex* idata, template inline void _exec(hipfftHandle& plan, hipfftComplex* idata, - hipfftComplex* odata, int direction, - [[maybe_unused]] Args... args) { + hipfftComplex* odata, int direction, Args...) { hipfftResult hipfft_rt = hipfftExecC2C(plan, idata, odata, direction); if (hipfft_rt != HIPFFT_SUCCESS) throw std::runtime_error("hipfftExecC2C failed"); @@ -56,8 +51,7 @@ inline void _exec(hipfftHandle& plan, hipfftComplex* idata, template inline void _exec(hipfftHandle& plan, hipfftDoubleComplex* idata, - hipfftDoubleComplex* odata, int direction, - [[maybe_unused]] Args... args) { + hipfftDoubleComplex* odata, int direction, Args...) { hipfftResult hipfft_rt = hipfftExecZ2Z(plan, idata, odata, direction); if (hipfft_rt != HIPFFT_SUCCESS) throw std::runtime_error("hipfftExecZ2Z failed"); diff --git a/fft/src/KokkosFFT_OpenMP_plans.hpp b/fft/src/KokkosFFT_OpenMP_plans.hpp index 0b3f9883..2e5cc7db 100644 --- a/fft/src/KokkosFFT_OpenMP_plans.hpp +++ b/fft/src/KokkosFFT_OpenMP_plans.hpp @@ -34,11 +34,9 @@ template , std::nullptr_t> = nullptr> auto _create(const ExecutionSpace& exec_space, std::unique_ptr& plan, - const InViewType& in, const OutViewType& out, - [[maybe_unused]] BufferViewType& buffer, - [[maybe_unused]] InfoType& execution_info, - [[maybe_unused]] Direction direction, axis_type axes, - shape_type s) { + const InViewType& in, const OutViewType& out, BufferViewType&, + InfoType&, [[maybe_unused]] Direction direction, + axis_type axes, shape_type s) { static_assert(Kokkos::is_view::value, "KokkosFFT::_create: InViewType is not a Kokkos::View."); static_assert(Kokkos::is_view::value, diff --git a/fft/src/KokkosFFT_OpenMP_transform.hpp b/fft/src/KokkosFFT_OpenMP_transform.hpp index ea64437c..f8ccaf56 100644 --- a/fft/src/KokkosFFT_OpenMP_transform.hpp +++ b/fft/src/KokkosFFT_OpenMP_transform.hpp @@ -11,37 +11,37 @@ namespace KokkosFFT { namespace Impl { template void _exec(PlanType& plan, float* idata, fftwf_complex* odata, - [[maybe_unused]] int direction, [[maybe_unused]] Args... args) { + int /*direction*/, Args...) { fftwf_execute_dft_r2c(plan, idata, odata); } template void _exec(PlanType& plan, double* idata, fftw_complex* odata, - [[maybe_unused]] int direction, [[maybe_unused]] Args... args) { + int /*direction*/, Args...) { fftw_execute_dft_r2c(plan, idata, odata); } template void _exec(PlanType& plan, fftwf_complex* idata, float* odata, - [[maybe_unused]] int direction, [[maybe_unused]] Args... args) { + int /*direction*/, Args...) { fftwf_execute_dft_c2r(plan, idata, odata); } template void _exec(PlanType& plan, fftw_complex* idata, double* odata, - [[maybe_unused]] int direction, [[maybe_unused]] Args... args) { + int /*direction*/, Args...) { fftw_execute_dft_c2r(plan, idata, odata); } template void _exec(PlanType& plan, fftwf_complex* idata, fftwf_complex* odata, - [[maybe_unused]] int direction, [[maybe_unused]] Args... args) { + int /*direction*/, Args...) { fftwf_execute_dft(plan, idata, odata); } template void _exec(PlanType plan, fftw_complex* idata, fftw_complex* odata, - [[maybe_unused]] int direction, [[maybe_unused]] Args... args) { + int /*direction*/, Args...) { fftw_execute_dft(plan, idata, odata); } } // namespace Impl diff --git a/fft/src/KokkosFFT_ROCM_plans.hpp b/fft/src/KokkosFFT_ROCM_plans.hpp index c2a2b64f..a8103fbb 100644 --- a/fft/src/KokkosFFT_ROCM_plans.hpp +++ b/fft/src/KokkosFFT_ROCM_plans.hpp @@ -88,7 +88,7 @@ template & plan, const InViewType& in, const OutViewType& out, BufferViewType& buffer, InfoType& execution_info, - [[maybe_unused]] Direction direction, axis_type axes, + Direction direction, axis_type axes, shape_type s) { static_assert(Kokkos::is_view::value, "KokkosFFT::_create: InViewType is not a Kokkos::View."); diff --git a/fft/src/KokkosFFT_ROCM_transform.hpp b/fft/src/KokkosFFT_ROCM_transform.hpp index 1b157b91..4dfbc75f 100644 --- a/fft/src/KokkosFFT_ROCM_transform.hpp +++ b/fft/src/KokkosFFT_ROCM_transform.hpp @@ -11,7 +11,7 @@ namespace KokkosFFT { namespace Impl { inline void _exec(rocfft_plan& plan, float* idata, std::complex* odata, - [[maybe_unused]] int direction, + int /*direction*/, const rocfft_execution_info& execution_info) { rocfft_status status = rocfft_execute(plan, (void**)&idata, (void**)&odata, execution_info); @@ -20,7 +20,7 @@ inline void _exec(rocfft_plan& plan, float* idata, std::complex* odata, } inline void _exec(rocfft_plan& plan, double* idata, std::complex* odata, - [[maybe_unused]] int direction, + int /*direction*/, const rocfft_execution_info& execution_info) { rocfft_status status = rocfft_execute(plan, (void**)&idata, (void**)&odata, execution_info); @@ -29,7 +29,7 @@ inline void _exec(rocfft_plan& plan, double* idata, std::complex* odata, } inline void _exec(rocfft_plan& plan, std::complex* idata, float* odata, - [[maybe_unused]] int direction, + int /*direction*/, const rocfft_execution_info& execution_info) { rocfft_status status = rocfft_execute(plan, (void**)&idata, (void**)&odata, execution_info); @@ -38,7 +38,7 @@ inline void _exec(rocfft_plan& plan, std::complex* idata, float* odata, } inline void _exec(rocfft_plan& plan, std::complex* idata, double* odata, - [[maybe_unused]] int direction, + int /*direction*/, const rocfft_execution_info& execution_info) { rocfft_status status = rocfft_execute(plan, (void**)&idata, (void**)&odata, execution_info); @@ -47,7 +47,7 @@ inline void _exec(rocfft_plan& plan, std::complex* idata, double* odata, } inline void _exec(rocfft_plan& plan, std::complex* idata, - std::complex* odata, [[maybe_unused]] int direction, + std::complex* odata, int /*direction*/, const rocfft_execution_info& execution_info) { rocfft_status status = rocfft_execute(plan, (void**)&idata, (void**)&odata, execution_info); @@ -56,7 +56,7 @@ inline void _exec(rocfft_plan& plan, std::complex* idata, } inline void _exec(rocfft_plan& plan, std::complex* idata, - std::complex* odata, [[maybe_unused]] int direction, + std::complex* odata, int /*direction*/, const rocfft_execution_info& execution_info) { rocfft_status status = rocfft_execute(plan, (void**)&idata, (void**)&odata, execution_info); diff --git a/fft/src/KokkosFFT_SYCL_plans.hpp b/fft/src/KokkosFFT_SYCL_plans.hpp index 005bcb04..f4c0ec40 100644 --- a/fft/src/KokkosFFT_SYCL_plans.hpp +++ b/fft/src/KokkosFFT_SYCL_plans.hpp @@ -49,10 +49,8 @@ template < std::enable_if_t, std::nullptr_t> = nullptr> auto _create(const ExecutionSpace& exec_space, std::unique_ptr& plan, - const InViewType& in, const OutViewType& out, - [[maybe_unused]] BufferViewType& buffer, - [[maybe_unused]] InfoType& execution_info, - [[maybe_unused]] Direction direction, axis_type axes, + const InViewType& in, const OutViewType& out, BufferViewType&, + InfoType&, Direction /*direction*/, axis_type axes, shape_type s) { static_assert(Kokkos::is_view::value, "KokkosFFT::_create: InViewType is not a Kokkos::View."); @@ -64,11 +62,7 @@ auto _create(const ExecutionSpace& exec_space, std::unique_ptr& plan, static_assert( InViewType::rank() >= fft_rank, "KokkosFFT::_create: Rank of View must be larger than Rank of FFT."); - const int rank = fft_rank; - constexpr auto type = - KokkosFFT::Impl::transform_type::type(); auto [in_extents, out_extents, fft_extents, howmany] = KokkosFFT::Impl::get_extents(in, out, axes, s); int idist = std::accumulate(in_extents.begin(), in_extents.end(), 1, @@ -78,14 +72,6 @@ auto _create(const ExecutionSpace& exec_space, std::unique_ptr& plan, int fft_size = std::accumulate(fft_extents.begin(), fft_extents.end(), 1, std::multiplies<>()); - auto* idata = reinterpret_cast::type*>(in.data()); - auto* odata = reinterpret_cast::type*>(out.data()); - - // For the moment, considering the contiguous layout only - auto sign = KokkosFFT::Impl::direction_type(direction); - // Create plan auto in_strides = compute_strides(in_extents); auto out_strides = compute_strides(out_extents); @@ -118,18 +104,21 @@ auto _create(const ExecutionSpace& exec_space, std::unique_ptr& plan, return fft_size; } -// In oneMKL, plans are destroybed by destructor template < typename ExecutionSpace, typename PlanType, std::enable_if_t, std::nullptr_t> = nullptr> -void _destroy_plan(std::unique_ptr& plan) {} +void _destroy_plan(std::unique_ptr&) { + // In oneMKL, plans are destroybed by destructor +} template < typename ExecutionSpace, typename InfoType, std::enable_if_t, std::nullptr_t> = nullptr> -void _destroy_info(InfoType& plan) {} +void _destroy_info(InfoType&) { + // not used, no finalization is required +} } // namespace Impl } // namespace KokkosFFT