Implements the TVM DeviceAPI interface. Owns the core Vulkan datastructures. Is responsible for initializing the Vulkan instance and devices, querying for possible extensions.
Thread-local state for the Vulkan runtime. Maintains a staging buffer (for copies), and a VulkanStream per device.
Responsible for launching computation kernels. Responsible for obtaining a VulkanPipeline instance (from the VulkanModuleNode), and launches the kernel (via immediate or deferred mode) on the active VulkanStream instance.
The natural model for TVM DeviceAPI implementation and runtime follows the CUDA
API model. That is, we launch "kernels" onto a (implicit or explicit) "stream"
(which execute asynchronously with respect to the host, but ordered with respect
to the stream), and explicitly synchronize the stream with respect to the host.
We simulate this behaviour in the Vulkan model by maintaining a thread-local
vkCommandBuffer
instance, and queueing up (or eagerly executing, depending on
the availability of the VK_KHR_push_descriptor
extension). When we synchronize
the stream, we end the command buffer recording, submit it to the device queue,
and wait on the corresponding fence.