|
Mila 0.13.48
Deep Neural Network Library
|
Vulkan-specific traits for abstract tensor data types. More...
Public Types | |
| template<TensorDataType TDataType> | |
| using | native_type = decltype(get_native_type<TDataType>()) |
| Type alias for the native Vulkan type corresponding to a TensorDataType. | |
Static Public Member Functions | |
| static constexpr std::string_view | device_type_name () |
| Gets the Vulkan device type string for debugging. | |
| template<TensorDataType TDataType> | |
| static consteval bool | is_device_only () |
| Checks if the specified data type requires device-only access. | |
| template<TensorDataType TDataType, typename T> | |
| static constexpr auto | make_native_value (const T &value) |
| Creates a native type value from a compatible input value. | |
| template<TensorDataType TDataType> | |
| static consteval std::string_view | preferred_allocation_strategy () |
| Gets the preferred memory allocation strategy for the data type. | |
| template<TensorDataType TDataType> | |
| static consteval std::string_view | required_extension () |
| Gets the required Vulkan extension name for the data type. | |
| template<TensorDataType TDataType> | |
| static consteval bool | requires_extensions () |
| Checks if the data type requires specific Vulkan device extensions. | |
| template<TensorDataType TDataType> | |
| static consteval uint32_t | spirv_bit_width () |
| Gets the SPIR-V OpTypeFloat/OpTypeInt bit width for the data type. | |
| template<TensorDataType TDataType> | |
| static consteval bool | supports () |
| Validates Vulkan support for abstract tensor data types. | |
| template<TensorDataType TDataType> | |
| static constexpr float | to_float (const native_type< TDataType > &value) |
| Converts native Vulkan type values to float for host operations. | |
Static Private Member Functions | |
| template<TensorDataType TDataType> | |
| static consteval auto | get_native_type () |
| Helper function for compile-time native type deduction. | |
Vulkan-specific traits for abstract tensor data types.
Provides device-specific characteristics and native type mappings for Vulkan-supported tensor data types, enabling type-safe value initialization and explicit graphics/compute operations with fine-grained synchronization control across different GPU architectures.
Vulkan's explicit design requires careful consideration of:
| using Mila::Dnn::VulkanTensorTraits::native_type = decltype(get_native_type<TDataType>()) |
Type alias for the native Vulkan type corresponding to a TensorDataType.
Provides compile-time mapping from abstract TensorDataType enumeration to concrete C++ types compatible with Vulkan's SPIR-V shader requirements and memory layout specifications.
|
inlinestaticconstexpr |
Gets the Vulkan device type string for debugging.
|
inlinestaticconstevalprivate |
Helper function for compile-time native type deduction.
Maps abstract tensor data types to Vulkan-compatible native types, using standard C++ types that align with SPIR-V and Vulkan shader data type requirements. Handles both available and unavailable Vulkan configurations with appropriate fallback types.
|
inlinestaticconsteval |
Checks if the specified data type requires device-only access.
Determines whether a tensor data type can only be accessed from Vulkan compute shaders and cannot be directly manipulated from host code without explicit staging buffer transfers.
| TDataType | Abstract tensor data type to check |

|
inlinestaticconstexpr |
Creates a native type value from a compatible input value.
Provides safe conversion from input values to the appropriate native Vulkan-compatible type, handling cross-platform type conversions and ensuring compatibility with SPIR-V data type requirements.
| TDataType | Target abstract tensor data type |
| T | Input value type |
| value | Input value to convert |
|
inlinestaticconsteval |
Gets the preferred memory allocation strategy for the data type.
Returns the optimal Vulkan memory allocation strategy based on data type characteristics, device capabilities, and expected usage patterns.
| TDataType | Abstract tensor data type |

|
inlinestaticconsteval |
Gets the required Vulkan extension name for the data type.
Returns the Vulkan extension string required for the specified data type, enabling proper device capability validation and extension enablement.
| TDataType | Abstract tensor data type requiring extensions |
|
inlinestaticconsteval |
Checks if the data type requires specific Vulkan device extensions.
Determines whether a tensor data type requires explicit Vulkan device extensions to be enabled, affecting device selection and capability validation.
| TDataType | Abstract tensor data type to check |
|
inlinestaticconsteval |
Gets the SPIR-V OpTypeFloat/OpTypeInt bit width for the data type.
Returns the bit width used in SPIR-V instruction generation for the specified data type, essential for compute shader compilation and validation.
| TDataType | Abstract tensor data type |
|
inlinestaticconsteval |
Validates Vulkan support for abstract tensor data types.
Determines whether Vulkan devices and memory resources support the specified abstract tensor data type, considering Vulkan's explicit memory model and compute pipeline requirements across different GPU vendors and architectures.
| TDataType | Abstract tensor data type to validate |
|
inlinestaticconstexpr |
Converts native Vulkan type values to float for host operations.
Provides conversion from Vulkan native types back to float values for host-side processing, validation, and cross-platform compatibility. Handles special cases like half-precision and 64-bit types that require explicit device extension support.
| TDataType | Source abstract tensor data type |
| value | Native Vulkan type value to convert |