Commit a4157051 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Avoiding nvcc warnings in NDArray internals

parent 8253355f
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -224,7 +224,7 @@ struct ParallelExecutor< Permutation, Device, IndexTag< 3 > >
      void operator()( Index i2, Index i1, Index i0, Func f )
      {
         call_with_unpermuted_arguments< Permutation >( f, i0, i1, i2 );
      };
      }
   };

   // dummy specialization to avoid a shitpile of nvcc warnings
@@ -236,7 +236,7 @@ struct ParallelExecutor< Permutation, Device, IndexTag< 3 > >
      void operator()( Index i2, Index i1, Index i0, Func f )
      {
         call_with_unpermuted_arguments< Permutation >( f, i0, i1, i2 );
      };
      }
   };
};

@@ -275,7 +275,7 @@ struct ParallelExecutor< Permutation, Device, IndexTag< 2 > >
      void operator()( Index i1, Index i0, Func f )
      {
         call_with_unpermuted_arguments< Permutation >( f, i0, i1 );
      };
      }
   };

   // dummy specialization to avoid a shitpile of nvcc warnings
@@ -287,7 +287,7 @@ struct ParallelExecutor< Permutation, Device, IndexTag< 2 > >
      void operator()( Index i1, Index i0, Func f )
      {
         call_with_unpermuted_arguments< Permutation >( f, i0, i1 );
      };
      }
   };
};

+8 −24
Original line number Diff line number Diff line
@@ -15,8 +15,6 @@
#include <utility>
#include <initializer_list>

#include <TNL/Devices/CudaCallable.h>

namespace TNL {
namespace Containers {
namespace __ndarray_impl {
@@ -170,8 +168,7 @@ struct CallPermutationHelper< Permutation, std::index_sequence< N... > >
{
   template< typename Func,
             typename... Args >
   __cuda_callable__
   static auto apply( Func&& f, Args&&... args ) -> decltype(auto)
   static constexpr auto apply( Func&& f, Args&&... args ) -> decltype(auto)
   {
      return std::forward< Func >( f )( get_from_pack<
                  get< N >( Permutation{} )
@@ -184,17 +181,11 @@ struct CallPermutationHelper< Permutation, std::index_sequence< N... > >
template< typename Permutation,
          typename Func,
          typename... Args >
__cuda_callable__
// FIXME: does not compile with nvcc 10.0
//auto call_with_permuted_arguments( Func&& f, Args&&... args ) -> decltype(auto)
//{
//   return CallPermutationHelper< Permutation, std::make_index_sequence< sizeof...( Args ) > >
//          ::apply( std::forward< Func >( f ), std::forward< Args >( args )... );
//}
auto call_with_permuted_arguments( Func f, Args&&... args ) -> decltype(auto)
constexpr auto
call_with_permuted_arguments( Func&& f, Args&&... args ) -> decltype(auto)
{
   return CallPermutationHelper< Permutation, std::make_index_sequence< sizeof...( Args ) > >
          ::apply( f, std::forward< Args >( args )... );
          ::apply( std::forward< Func >( f ), std::forward< Args >( args )... );
}


@@ -209,8 +200,7 @@ struct CallInversePermutationHelper< Permutation, std::index_sequence< N... > >
{
   template< typename Func,
             typename... Args >
   __cuda_callable__
   static auto apply( Func&& f, Args&&... args ) -> decltype(auto)
   static constexpr auto apply( Func&& f, Args&&... args ) -> decltype(auto)
   {
      return std::forward< Func >( f )( get_from_pack<
                  index_in_sequence( N, Permutation{} )
@@ -223,17 +213,11 @@ struct CallInversePermutationHelper< Permutation, std::index_sequence< N... > >
template< typename Permutation,
          typename Func,
          typename... Args >
__cuda_callable__
// FIXME: does not compile with nvcc 10.0
//auto call_with_unpermuted_arguments( Func&& f, Args&&... args ) -> decltype(auto)
//{
//   return CallInversePermutationHelper< Permutation, std::make_index_sequence< sizeof...( Args ) > >
//          ::apply( std::forward< Func >( f ), std::forward< Args >( args )... );
//}
auto call_with_unpermuted_arguments( Func f, Args&&... args ) -> decltype(auto)
constexpr auto
call_with_unpermuted_arguments( Func&& f, Args&&... args ) -> decltype(auto)
{
   return CallInversePermutationHelper< Permutation, std::make_index_sequence< sizeof...( Args ) > >
          ::apply( f, std::forward< Args >( args )... );
          ::apply( std::forward< Func >( f ), std::forward< Args >( args )... );
}


+1 −1
Original line number Diff line number Diff line
@@ -350,7 +350,7 @@ struct LocalBeginsHolder : public SizesHolder
      if( SizesHolder::template getStaticSize< level >() == 0 )
         SizesHolder::template setSize< level >( newSize );
      else
         TNL_ASSERT_EQ( newSize, ConstValue, "Dynamic size for a static dimension must be equal to the specified ConstValue." );
         TNL_ASSERT_EQ( newSize, (typename SizesHolder::IndexType) ConstValue, "Dynamic size for a static dimension must be equal to the specified ConstValue." );
   }
};