1<!--- Licensed to the Apache Software Foundation (ASF) under one --> 2<!--- or more contributor license agreements. See the NOTICE file --> 3<!--- distributed with this work for additional information --> 4<!--- regarding copyright ownership. The ASF licenses this file --> 5<!--- to you under the Apache License, Version 2.0 (the --> 6<!--- "License"); you may not use this file except in compliance --> 7<!--- with the License. You may obtain a copy of the License at --> 8 9<!--- http://www.apache.org/licenses/LICENSE-2.0 --> 10 11<!--- Unless required by applicable law or agreed to in writing, --> 12<!--- software distributed under the License is distributed on an --> 13<!--- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY --> 14<!--- KIND, either express or implied. See the License for the --> 15<!--- specific language governing permissions and limitations --> 16<!--- under the License. --> 17 18 19## Components 20 21### VulkanDeviceAPI 22 23Implements the TVM DeviceAPI interface. Owns the core Vulkan datastructures. Is 24responsible for initializing the Vulkan instance and devices, querying for 25possible extensions. 26 27### VulkanThreadEntry 28 29Thread-local state for the Vulkan runtime. Maintains a staging buffer (for 30copies), and a VulkanStream per device. 31 32### VulkanWrappedFunc 33 34Responsible for launching computation kernels. Responsible for obtaining a 35VulkanPipeline instance (from the VulkanModuleNode), and launches the kernel 36(via immediate or deferred mode) on the active VulkanStream instance. 37 38## Stream execution in the Vulkan programming model. 39 40The natural model for TVM DeviceAPI implementation and runtime follows the CUDA 41API model. That is, we launch "kernels" onto a (implicit or explicit) "stream" 42(which execute asynchronously with respect to the host, but ordered with respect 43to the stream), and explicitly synchronize the stream with respect to the host. 44We simulate this behaviour in the Vulkan model by maintaining a thread-local 45`vkCommandBuffer` instance, and queueing up (or eagerly executing, depending on 46the availability of the `VK_KHR_push_descriptor` extension). When we synchronize 47the stream, we end the command buffer recording, submit it to the device queue, 48and wait on the corresponding fence. 49