Speclib  0.1.2
The library for writing better CUDA libraries
sp::TensorDescriptorSpecialiser Struct Reference

Convert a TensorDescriptor into a Tensor by finding the type/rank at runtime. More...

#include <TensorDescriptor.hpp>

Inheritance diagram for sp::TensorDescriptorSpecialiser:
[legend]

Static Public Member Functions

template<typename T >
static constexpr bool test ()
 
template<typename TargetType , typename... Ts>
constexpr static bool checkTensorRanks (sp::TypeList< Ts... > &&)
 Call validTensorRanks() on the functor type. More...
 
template<typename TargetType , typename... Ts>
constexpr static bool checkTensorTypes (sp::TypeList< Ts... > &&)
 Call validTensorTypes() on the functor type. More...
 
template<typename... O, typename TensorType , int TensorRank, typename Fn , typename... Stuff>
static auto createTensor (const TensorDescriptor< TensorType, TensorRank > &arg, Fn &fn, std::tuple< O &&... >, Stuff &&... stuff)
 Once the rank/type are known, create the Tensor and pass it to TensorSpecialiser to have its optimisation flags refined. More...
 
template<typename TensorType , int TDRank, typename... Stuff>
static auto selectRank (const TensorDescriptor< TensorType, TDRank > &arg, Stuff &&... stuff)
 
template<typename TDType , int TDRank, typename... Stuff>
static auto run (const sp::TensorDescriptor< TDType, TDRank > &arg, Stuff &&... stuff)
 
- Static Public Member Functions inherited from sp::Specialiser
template<typename T >
static constexpr bool test ()
 Return true iff the specialiser is able to specialise arguments of type T. More...
 
template<typename... O, typename ArgType , typename... Stuff>
static auto run (const ArgType &thisArg, Stuff &&... stuff)
 Specialise an argument. More...
 

Detailed Description

Convert a TensorDescriptor into a Tensor by finding the type/rank at runtime.

If the deduced rank/type combination is rejected by the target Specialisable, that branch of the specialisation tree throws sp::RejectedSpecialiationException.

Member Function Documentation

◆ checkTensorRanks()

template<typename TargetType , typename... Ts>
constexpr static bool sp::TensorDescriptorSpecialiser::checkTensorRanks ( sp::TypeList< Ts... > &&  )
staticconstexpr

Call validTensorRanks() on the functor type.

See also
Specialisable.hpp. Tensors is a TypeList.

◆ checkTensorTypes()

template<typename TargetType , typename... Ts>
constexpr static bool sp::TensorDescriptorSpecialiser::checkTensorTypes ( sp::TypeList< Ts... > &&  )
staticconstexpr

Call validTensorTypes() on the functor type.

See also
Specialisable.hpp. Tensors is a TypeList.

◆ createTensor()

template<typename... O, typename TensorType , int TensorRank, typename Fn , typename... Stuff>
static auto sp::TensorDescriptorSpecialiser::createTensor ( const TensorDescriptor< TensorType, TensorRank > &  arg,
Fn &  fn,
std::tuple< O &&... >  ,
Stuff &&...  stuff 
)
static

Once the rank/type are known, create the Tensor and pass it to TensorSpecialiser to have its optimisation flags refined.

If the functor type rejected this rank/type combination (by returning false from validTensorRanks(), validTensorTypes(), or similar functions defined in Specialisable.hpp), this function will instead call the corresponding error handling, which is guaranteed to throw.

That throw prevents the specialiser from continuing to explore this branch of the specialisation tree.