122 template<
typename T_FnSpec,
typename... Args>
124 =
requires(T_FnSpec fnSpec, Args&&... args) { alpakaFnDispatch(fnSpec, std::forward<Args>(args)...); };
132 template<
typename T_FnSpec>
133 concept FnRegistered =
requires(T_FnSpec fnSpec) { alpakaFnRegister(fnSpec); };
167 template<alpaka::concepts::Api T_Api, alpaka::concepts::DeviceKind T_DeviceKind>
171 return typename T_FnClass::template Spec<T_Api, T_DeviceKind>{};
218 constexpr bool isFallbackAllowed = T_fallbackPolicy !=
Fallback::none;
219 constexpr bool hasAlpakaFallback
222 constexpr bool hasGenericFallback
225 || (isFallbackAllowed && (hasAlpakaFallback || hasGenericFallback));
231 constexpr decltype(
auto)
operator()(T_Any&& any, Args&&... args)
const
235 "Function dispatch for the given function symbol, API and device kind is not registered.");
236 return alpakaFnDispatch(
spec(any), std::forward<T_Any>(any), std::forward<Args>(args)...);
249 constexpr decltype(
auto)
operator()(T_Any&& any, Args&&... args)
const
254 "Function for the given function group, device kind the api fn::api::alpaka is not registered.");
255 return alpakaFnDispatch(
257 std::forward<T_Any>(any),
258 std::forward<Args>(args)...);
273 constexpr decltype(
auto)
operator()(T_Any&& any, Args&&... args)
const
277 "Function dispatch for the given function symbol, is not registered.");
278 return alpakaFnDispatch(T_FnClass{}, std::forward<T_Any>(any), std::forward<Args>(args)...);
289 std::is_trivially_constructible_v<T_FnClass>,
290 "Function class must be trivially constructible to use call().");
319#define ALPAKA_FN_SYMBOL(fnName, ...) \
320 struct fnName : alpaka::fn::Fn<fnName __VA_OPT__(, __VA_ARGS__)> \
328 template<alpaka::concepts::Api T_Api, alpaka::concepts::DeviceKind T_DeviceKind> \
#define ALPAKA_TYPEOF(...)
Get the type of instance.
#define ALPAKA_FORWARD(instance)
Perfectly forward an instance as argument.
Concept to check for APIs.
Concept to check that a device specification with an API and device kind can be extracted.
Concept to check if a function symbol can be called.
Concept to check if a function symbol is registered.
alpaka'S function interface
Fallback
Fallback policy for function calls.
@ none
No fallback is performed in case no overload is fitting.
@ toAlpaka
The alpaka implementation is called if no other overload fits.
@ toGeneric
The generic implementation is called if no other overload fits.
Registration
Policy to control if a function symbol must be registered.
@ none
The isRegistered() function is not available and no registration of the vendor function overloads is ...
@ enforced
It is required to define alpakaFnRegister() for a function symbol.
@ alwaysTrue
The isRegistered() function will always return true.
constexpr decltype(auto) getDeviceKind(auto &&any)
Get the device type of an object.
constexpr decltype(auto) getApi(auto &&any)
Get the API an object depends on.
Base class for function symbols.
static constexpr bool hasRegisteredFallback(alpaka::concepts::DeviceSpec auto const &any)
Checks if the function overload fallback is registered.
static constexpr bool isRegistered(alpaka::concepts::DeviceSpec auto const &any)
Checks if a function overload is registered for the given device specification.
static constexpr auto spec(alpaka::concepts::DeviceSpec auto const &any)
Get the function specification.
static constexpr decltype(auto) call(alpaka::concepts::DeviceSpec auto &&any, auto &&... args)
Call the function overload for the given device specification.
static constexpr auto spec(T_Api api, T_DeviceKind deviceKind)
Get the function specification.
static std::string getName()