Lluvia
|
Class that contains all the state required to run compute operations on a compute device. More...
#include <Session.h>
Public Member Functions | |
Session (const Session &session)=delete | |
Session (Session &&session)=delete | |
~Session () | |
Session & | operator= (const Session &session)=delete |
Session & | operator= (Session &&session)=delete |
std::shared_ptr< ll::Memory > | getHostMemory () const noexcept |
Returns a pointer to ll::Memory object that is HOST_LOCAL and HOST_COHERENT. More... | |
std::shared_ptr< ll::Memory > | getDeviceMemory () const noexcept |
Returns a pointer to ll::Memory object that is DEVICE_LOCAL. More... | |
vk::PhysicalDeviceMemoryProperties | getPhysicalDeviceMemoryProperties () const |
Gets the Lua interpreter. More... | |
std::vector< ll::MemoryPropertyFlags > | getSupportedMemoryFlags () const |
Gets the supported memory flags. More... | |
const ll::DeviceDescriptor & | getDeviceDescriptor () const noexcept |
Gets the device descriptor associated to this session. More... | |
bool | isImageDescriptorSupported (const ll::ImageDescriptor &descriptor) const noexcept |
Determines if parameters in image descriptor are supported for image creation. More... | |
std::shared_ptr< ll::Memory > | createMemory (const ll::MemoryPropertyFlags &flags, const uint64_t pageSize, bool exactFlagsMatch=false) |
Creates a memory. More... | |
std::unique_ptr< ll::CommandBuffer > | createCommandBuffer () const |
Creates a command buffer. More... | |
std::unique_ptr< ll::Duration > | createDuration () const |
Creates a Duration object. More... | |
std::shared_ptr< ll::Program > | createProgram (const std::string &spirvPath) const |
Creates a program object reading a file at a given path. More... | |
std::shared_ptr< ll::Program > | createProgram (const std::vector< uint8_t > &spirv) const |
Creates a program providing the SPIR-V code directly. More... | |
void | setProgram (const std::string &name, const std::shared_ptr< ll::Program > &program) |
Sets a program with a given name into the registry. More... | |
std::shared_ptr< ll::Program > | getProgram (const std::string &name) const |
Gets a program given its name in the registry. More... | |
std::vector< ll::NodeBuilderDescriptor > | getNodeBuilderDescriptors () const |
Gets the node builder descriptors currently registered. More... | |
std::shared_ptr< ll::ComputeNode > | createComputeNode (const ll::ComputeNodeDescriptor &descriptor) |
Creates a compute node. More... | |
std::shared_ptr< ll::ComputeNode > | createComputeNode (const std::string &builderName) |
Creates a compute node given its builder name. More... | |
ll::ComputeNodeDescriptor | createComputeNodeDescriptor (const std::string &builderName) const |
Creates a compute node descriptor given its builder name. More... | |
std::shared_ptr< ll::ContainerNode > | createContainerNode (const ll::ContainerNodeDescriptor &descriptor) |
std::shared_ptr< ll::ContainerNode > | createContainerNode (const std::string &builderName) |
ll::ContainerNodeDescriptor | createContainerNodeDescriptor (const std::string &builderName) const |
void | run (const ll::CommandBuffer &cmdBuffer) |
Runs a ll::CommandBuffer. More... | |
void | run (const ll::ComputeNode &node) |
Runs a ll::ComputeNode. More... | |
void | run (const ll::ContainerNode &node) |
Runs a ll::ContainerNode. More... | |
void | script (const std::string &code) |
Runs Lua script code into the session's internal interpreter. More... | |
void | scriptFile (const std::string &filename) |
Runs a Lua script file into the the session's internal interpreter. More... | |
void | loadLibrary (const std::string &filename) |
Loads a library made of SPIR-V shader code and Lua scripts. More... | |
ll::vec3ui | getGoodComputeLocalShape (ll::ComputeDimension dimensions) const noexcept |
Returns the suggested local grid shape for compute nodes given the number of dimensions. More... | |
std::string | help (const std::string &builderName) const |
Returns the help string of a given node builder. More... | |
bool | hasReceivedVulkanWarningMessages () const noexcept |
Tells whether or not this session has triggered Vulkan warning messages. More... | |
Static Public Member Functions | |
static std::vector< ll::DeviceDescriptor > | getAvailableDevices () |
Gets the available devices. More... | |
static std::vector< vk::LayerProperties > | getVulkanInstanceLayerProperties () |
Gets the Vulkan instance layer properties available to this machine. More... | |
static std::vector< vk::ExtensionProperties > | getVulkanExtensionProperties () |
Gets the Vulkan extension properties available to this machine. More... | |
static std::shared_ptr< ll::Session > | create () |
Creates a new ll::Session object. More... | |
static std::shared_ptr< ll::Session > | create (const ll::SessionDescriptor &descriptor) |
Creates a new ll::Session object. More... | |
Class that contains all the state required to run compute operations on a compute device.
|
delete |
|
delete |
ll::Session::~Session | ( | ) |
|
static |
Creates a new ll::Session object.
std::system_error | with error code ll::ErrorCode::PhysicalDevicesNotFound if not physical devices are available. |
|
static |
Creates a new ll::Session object.
[in] | descriptor | for this session. |
std::system_error | with error code ll::ErrorCode::PhysicalDevicesNotFound if not physical devices are available. |
std::unique_ptr<ll::CommandBuffer> ll::Session::createCommandBuffer | ( | ) | const |
Creates a command buffer.
std::shared_ptr<ll::ComputeNode> ll::Session::createComputeNode | ( | const ll::ComputeNodeDescriptor & | descriptor | ) |
Creates a compute node.
[in] | descriptor | The node's descriptor |
std::shared_ptr<ll::ComputeNode> ll::Session::createComputeNode | ( | const std::string & | builderName | ) |
Creates a compute node given its builder name.
Builders can be registered by running Lua scripts using ll::Session::script method.
[in] | builderName | The builder name. |
ll::ComputeNodeDescriptor ll::Session::createComputeNodeDescriptor | ( | const std::string & | builderName | ) | const |
Creates a compute node descriptor given its builder name.
Builders can be registered by running Lua scripts using ll::Session::script method.
[in] | builderName | The builder name. |
std::shared_ptr<ll::ContainerNode> ll::Session::createContainerNode | ( | const ll::ContainerNodeDescriptor & | descriptor | ) |
std::shared_ptr<ll::ContainerNode> ll::Session::createContainerNode | ( | const std::string & | builderName | ) |
ll::ContainerNodeDescriptor ll::Session::createContainerNodeDescriptor | ( | const std::string & | builderName | ) | const |
std::unique_ptr<ll::Duration> ll::Session::createDuration | ( | ) | const |
Creates a Duration object.
std::shared_ptr<ll::Memory> ll::Session::createMemory | ( | const ll::MemoryPropertyFlags & | flags, |
const uint64_t | pageSize, | ||
bool | exactFlagsMatch = false |
||
) |
Creates a memory.
TODO Exceptions
[in] | flags | The flags. It should be one of the values returned by ll::Session::getSupportedMemoryFlags(). |
[in] | pageSize | The page size. The size in bytes of each page the new memory object will allocate when there is no space for creating new objects. |
[in] | exactFlagsMatch | The exact flags match. Tells whether or not flags should match exactly one of the values in ll::Session::getSupportedMemoryFlags() or if it is enough that it contains at least the flags bits. |
std::system_error | With error code ll::ErrorCode::MemoryCreationError if no memory was found that matched the requested flags. |
std::shared_ptr<ll::Program> ll::Session::createProgram | ( | const std::string & | spirvPath | ) | const |
Creates a program object reading a file at a given path.
TODO Exceptions
[in] | spirvPath | The path to the SPIR-V file containing the program code. |
std::ios_base::failure | if there is a problem reading the file at spirvPath. |
std::shared_ptr<ll::Program> ll::Session::createProgram | ( | const std::vector< uint8_t > & | spirv | ) | const |
Creates a program providing the SPIR-V code directly.
TODO Exceptions
[in] | spirv | The SPIR-V code. |
std::system_error | With error code ll::ErrorCode::ProgramCompilationError if the supplied spirv code is empty. |
|
static |
Gets the available devices.
|
noexcept |
Gets the device descriptor associated to this session.
|
noexcept |
Returns a pointer to ll::Memory object that is DEVICE_LOCAL.
This memory can be used to create images and buffers that will be used in shaders. The page size is set to 0 in order to create independent memories for each object.
|
noexcept |
Returns the suggested local grid shape for compute nodes given the number of dimensions.
The local shape depends on the underlying device.
|
noexcept |
Returns a pointer to ll::Memory object that is HOST_LOCAL and HOST_COHERENT.
This memory can be used to create uniform buffers to pass to shaders. The page size is set to 0 in order to create independent memories for each object allocated in this memory. This allows for each object to be mapped and stay mapped indefinitely, thus saving map/unmap operations.
std::vector<ll::NodeBuilderDescriptor> ll::Session::getNodeBuilderDescriptors | ( | ) | const |
Gets the node builder descriptors currently registered.
vk::PhysicalDeviceMemoryProperties ll::Session::getPhysicalDeviceMemoryProperties | ( | ) | const |
Gets the Lua interpreter.
Gets the physical device memory properties for this session.
std::shared_ptr<ll::Program> ll::Session::getProgram | ( | const std::string & | name | ) | const |
Gets a program given its name in the registry.
[in] | name | The name. |
std::vector<ll::MemoryPropertyFlags> ll::Session::getSupportedMemoryFlags | ( | ) | const |
Gets the supported memory flags.
The length of the returned vector equals the number of Vulkan memory types available for the physical device this session was created from.
|
static |
Gets the Vulkan extension properties available to this machine.
|
static |
Gets the Vulkan instance layer properties available to this machine.
|
noexcept |
Tells whether or not this session has triggered Vulkan warning messages.
For this method to return a correct value, the session must be created enabling debug.
std::string ll::Session::help | ( | const std::string & | builderName | ) | const |
Returns the help string of a given node builder.
[in] | builderName | The builder name. |
|
noexcept |
Determines if parameters in image descriptor are supported for image creation.
This method tests whether or not the combination of image shape, tiling and usage flags is supported by the physical device.
[in] | descriptor | The descriptor |
void ll::Session::loadLibrary | ( | const std::string & | filename | ) |
Loads a library made of SPIR-V shader code and Lua scripts.
[in] | filename | The path of the library file. It must be a valid zip archive. |
std::system_error | With error code ll::ErrorCode::IOError if there is some problem reading the library archive. |
void ll::Session::run | ( | const ll::CommandBuffer & | cmdBuffer | ) |
Runs a ll::CommandBuffer.
This is a blocking call. The host thread will wait until execution of this command buffer is completed.
[in] | cmdBuffer | The command buffer. |
void ll::Session::run | ( | const ll::ComputeNode & | node | ) |
Runs a ll::ComputeNode.
Internally, this function creates a ll::CommandBuffer using ll::Session::createCommandBuffer, records the execution of the compute node and submits to the device.
Calling this function is equivalent to:
[in] | node | The node |
void ll::Session::run | ( | const ll::ContainerNode & | node | ) |
Runs a ll::ContainerNode.
Internally, this function creates a ll::CommandBuffer using ll::Session::createCommandBuffer, records the execution of the container node and submits to the device.
Calling this function is equivalent to:
[in] | node | The node |
void ll::Session::script | ( | const std::string & | code | ) |
Runs Lua script code into the session's internal interpreter.
[in] | code | The Lua code |
void ll::Session::scriptFile | ( | const std::string & | filename | ) |
Runs a Lua script file into the the session's internal interpreter.
[in] | filename | The filename. |
void ll::Session::setProgram | ( | const std::string & | name, |
const std::shared_ptr< ll::Program > & | program | ||
) |
Sets a program with a given name into the registry.
[in] | name | The name |
[in] | program | The program |