Mila
Deep Neural Network Library
Loading...
Searching...
No Matches
Mila::Dnn::Compute::OperationTraits< TOp, TDeviceType, TPrecision, TPolicy > Struct Template Referenceexport

Primary traits template for unified compile-time operation dispatch. More...

Detailed Description

template<OperationType TOp, DeviceType TDeviceType, TensorDataType TPrecision, typename TPolicy = void>
struct Mila::Dnn::Compute::OperationTraits< TOp, TDeviceType, TPrecision, TPolicy >

Primary traits template for unified compile-time operation dispatch.

Each specialization provides either a nested type alias naming the concrete operation class, or (for functor-templated ops such as ElementwiseActivationOp) a nested op_for<Functor> alias, for the given (OperationType, DeviceType, precision, policy) combination.

The primary template is intentionally left undefined. An unsupported tuple therefore names an incomplete type, and the compiler reports a single-line "use of undefined type OperationTraits<Op, Device, Precision, Policy>" naming the exact tuple – a readable diagnostic, not a multi-hundred-line constraint cascade. (A kernel that only supports FP32 must not advertise a BF16 row: the honest failure is a missing specialization here, not a poisoned row whose op fails a float || half kernel constraint deep in dispatch.)

To branch on availability at compile time – e.g. a multi-precision typed test skipping the precisions an op does not implement – use the SFINAE-safe OperationSupported<...> predicate below rather than instantiating this template. The primary must stay undefined for that predicate to work: a static_assert in the primary body would fire during the predicate's own probe, turning the detectable "false" back into a hard error.

Template Parameters
TOpOperation identifier from the OperationType enum.
TDeviceTypeTarget device (Cpu, Cuda, ...).
TPrecisionCompute and activation precision.
TPolicyOptional policy type. Defaults to void for policy-free ops.

The documentation for this struct was generated from the following file: