Kompute
|
#include <Manager.hpp>
Public Member Functions | |
Manager () | |
Manager (uint32_t physicalDeviceIndex, const std::vector< uint32_t > &familyQueueIndices={}, const std::vector< std::string > &desiredExtensions={}) | |
Manager (std::shared_ptr< vk::Instance > instance, std::shared_ptr< vk::PhysicalDevice > physicalDevice, std::shared_ptr< vk::Device > device) | |
~Manager () | |
std::shared_ptr< Sequence > | sequence (uint32_t queueIndex=0, uint32_t totalTimestamps=0) |
template<typename T > | |
std::shared_ptr< TensorT< T > > | tensorT (const std::vector< T > &data, Tensor::TensorTypes tensorType=Tensor::TensorTypes::eDevice) |
std::shared_ptr< TensorT< float > > | tensor (const std::vector< float > &data, Tensor::TensorTypes tensorType=Tensor::TensorTypes::eDevice) |
std::shared_ptr< Tensor > | tensor (void *data, uint32_t elementTotalCount, uint32_t elementMemorySize, const Tensor::TensorDataTypes &dataType, Tensor::TensorTypes tensorType=Tensor::TensorTypes::eDevice) |
std::shared_ptr< Algorithm > | algorithm (const std::vector< std::shared_ptr< Tensor >> &tensors={}, const std::vector< uint32_t > &spirv={}, const Workgroup &workgroup={}, const std::vector< float > &specializationConstants={}, const std::vector< float > &pushConstants={}) |
template<typename S = float, typename P = float> | |
std::shared_ptr< Algorithm > | algorithm (const std::vector< std::shared_ptr< Tensor >> &tensors, const std::vector< uint32_t > &spirv, const Workgroup &workgroup, const std::vector< S > &specializationConstants, const std::vector< P > &pushConstants) |
void | destroy () |
void | clear () |
vk::PhysicalDeviceProperties | getDeviceProperties () const |
std::vector< vk::PhysicalDevice > | listDevices () const |
std::shared_ptr< vk::Instance > | getVkInstance () const |
Base orchestrator which creates and manages device and child components
kp::Manager::Manager | ( | ) |
Base constructor and default used which creates the base resources including choosing the device 0 by default.
kp::Manager::Manager | ( | uint32_t | physicalDeviceIndex, |
const std::vector< uint32_t > & | familyQueueIndices = {} , |
||
const std::vector< std::string > & | desiredExtensions = {} |
||
) |
Similar to base constructor but allows for further configuration to use when creating the Vulkan resources.
physicalDeviceIndex | The index of the physical device to use |
familyQueueIndices | (Optional) List of queue indices to add for explicit allocation |
desiredExtensions | The desired extensions to load from physicalDevice |
kp::Manager::Manager | ( | std::shared_ptr< vk::Instance > | instance, |
std::shared_ptr< vk::PhysicalDevice > | physicalDevice, | ||
std::shared_ptr< vk::Device > | device | ||
) |
Manager constructor which allows your own vulkan application to integrate with the kompute use.
instance | Vulkan compute instance to base this application |
physicalDevice | Vulkan physical device to use for application |
device | Vulkan logical device to use for all base resources |
physicalDeviceIndex | Index for vulkan physical device used |
kp::Manager::~Manager | ( | ) |
Manager destructor which would ensure all owned resources are destroyed unless explicitly stated that resources should not be destroyed or freed.
|
inline |
Create a managed algorithm that will be destroyed by this manager if it hasn't been destroyed by its reference count going to zero.
tensors | (optional) The tensors to initialise the algorithm with |
spirv | (optional) The SPIRV bytes for the algorithm to dispatch |
workgroup | (optional) kp::Workgroup for algorithm to use, and defaults to (tensor[0].size(), 1, 1) |
specializationConstants | (optional) templatable vector parameter to use for specialization constants, and defaults to an empty constant |
pushConstants | (optional) templatable vector parameter to use for push constants, and defaults to an empty constant |
|
inline |
Default non-template function that can be used to create algorithm objects which provides default types to the push and spec constants as floats.
tensors | (optional) The tensors to initialise the algorithm with |
spirv | (optional) The SPIRV bytes for the algorithm to dispatch |
workgroup | (optional) kp::Workgroup for algorithm to use, and defaults to (tensor[0].size(), 1, 1) |
specializationConstants | (optional) float vector to use for specialization constants, and defaults to an empty constant |
pushConstants | (optional) float vector to use for push constants, and defaults to an empty constant |
void kp::Manager::clear | ( | ) |
Run a pseudo-garbage collection to release all the managed resources that have been already freed due to these reaching to zero ref count.
void kp::Manager::destroy | ( | ) |
Destroy the GPU resources and all managed resources by manager.
vk::PhysicalDeviceProperties kp::Manager::getDeviceProperties | ( | ) | const |
Information about the current device.
std::shared_ptr<vk::Instance> kp::Manager::getVkInstance | ( | ) | const |
The current Vulkan instance.
std::vector<vk::PhysicalDevice> kp::Manager::listDevices | ( | ) | const |
List the devices available in the current vulkan instance.
std::shared_ptr<Sequence> kp::Manager::sequence | ( | uint32_t | queueIndex = 0 , |
uint32_t | totalTimestamps = 0 |
||
) |
Create a managed sequence that will be destroyed by this manager if it hasn't been destroyed by its reference count going to zero.
queueIndex | The queue to use from the available queues |
nrOfTimestamps | The maximum number of timestamps to allocate. If zero (default), disables latching of timestamps. |
|
inline |
Create a managed tensor that will be destroyed by this manager if it hasn't been destroyed by its reference count going to zero.
data | The data to initialize the tensor with |
tensorType | The type of tensor to initialize |