ngscopeclient v0.2.2
Loading...
Searching...
No Matches
Files | Classes | Functions | Variables
Collaboration diagram for Vulkan acceleration:

Files

file  ComputePipeline.cpp
 Implementation of ComputePipeline.
 
file  ComputePipeline.h
 Declaration of ComputePipeline.
 
file  NamedDebugRange.h
 Declaration of NamedDebugRange.
 
file  VulkanInit.cpp
 Vulkan initialization.
 

Classes

class  ComputePipeline
 Encapsulates a Vulkan compute pipeline and all necessary resources to use it. More...
 

Functions

bool VulkanInitInstance (bool skipGLFW, bool &vulkan11Available, bool &vulkan12Available, bool &hasPhysicalDeviceProperties2)
 Do context-level Vulkan initialization.
 
void VulkanPrintPhysicalDeviceInfo (size_t i, vk::raii::PhysicalDevice &device, bool hasPhysicalDeviceProperties2)
 Log info about a Vulkan physical device.
 
void VulkanCreateDevice (vk::raii::PhysicalDevice &device, bool vulkan11Available, bool vulkan12Available, bool hasPhysicalDeviceProperties2)
 Actually create the selected Vulkan device and set all of the global Vulkan feature flags appropriately.
 
bool VulkanInit (bool skipGLFW)
 Initialize a Vulkan context for compute.
 
bool IsDevicePreferred (const vk::PhysicalDeviceProperties &a, const vk::PhysicalDeviceProperties &b)
 Checks if a given Vulkan device is "better" than another.
 
void VulkanCleanup ()
 Free all global Vulkan resources in the correct order.
 

Variables

vk::raii::Context g_vkContext
 Global Vulkan context.
 
unique_ptr< vk::raii::Instance > g_vkInstance
 Global Vulkan instance.
 
shared_ptr< vk::raii::Deviceg_vkComputeDevice
 The Vulkan device selected for compute operations (may or may not be same device as rendering)
 
unique_ptr< vk::raii::CommandPool > g_vkTransferCommandPool
 Command pool for AcceleratorBuffer transfers.
 
unique_ptr< vk::raii::CommandBuffer > g_vkTransferCommandBuffer
 Command buffer for AcceleratorBuffer transfers.
 
shared_ptr< QueueHandleg_vkTransferQueue
 Queue for AcceleratorBuffer transfers.
 
std::unique_ptr< QueueManagerg_vkQueueManager
 Allocates QueueHandle objects.
 
mutex g_vkTransferMutex
 Mutex for interlocking access to g_vkTransferCommandBuffer and g_vkTransferCommandPool.
 
uint32_t g_vkPinnedMemoryType
 Vulkan memory type for CPU-based memory that is also GPU-readable.
 
uint32_t g_vkLocalMemoryType
 Vulkan memory type for GPU-based memory (generally not CPU-readable, except on unified memory systems)
 
uint8_t g_vkComputeDeviceUuid [16]
 UUID of g_vkComputeDevice.
 
uint32_t g_vkComputeDeviceDriverVer
 Driver version of g_vkComputeDevice.
 
vk::raii::PhysicalDevice * g_vkComputePhysicalDevice
 Physical device for g_vkComputeDevice.
 
uint32_t g_vkPinnedMemoryHeap = 0
 Heap from which g_vkPinnedMemoryType is allocated.
 
uint32_t g_vkLocalMemoryHeap = 0
 Heap from which g_vkLocalMemoryType is allocated.
 
bool g_hasShaderFloat64 = false
 Indicates whether the float64 type is available for use in shaders and SSBOs.
 
bool g_hasShaderInt64 = false
 Indicates whether the int64 type is available for use in shaders and SSBOs.
 
bool g_hasShaderInt16 = false
 Indicates whether the int16 type is available for use in shaders and SSBOs.
 
bool g_hasShaderInt8 = false
 Indicates whether the int8 type is available for use in shaders and SSBOs.
 
bool g_hasShaderAtomicFloat = false
 Indicates whether atomic operations on the float type are available in shaders.
 
bool g_hasShaderAtomicInt64 = false
 Indicates whether atomic operations on the int64 type are available in shaders.
 
bool g_hasDebugUtils = false
 Indicates whether the VK_EXT_debug_utils extension is available.
 
bool g_hasMemoryBudget = false
 Indicates whether the VK_EXT_memory_budget extension is available.
 
bool g_hasPushDescriptor = false
 Indicates whether the VK_KHR_push_descriptor extension is available.
 
bool g_vulkanDeviceHasUnifiedMemory = false
 Indicates whether the Vulkan device is unified memory.
 
size_t g_maxComputeGroupCount [3] = {0}
 Maximum size of a Vulkan dispatch group for compute shaders, in each axis.
 
bool g_vulkanDeviceIsIntelMesa = false
 Indicates that the Vulkan driver is Mesa on an Intel GPU.
 
bool g_vulkanDeviceIsAnyMesa = false
 Indicates that the Vulkan driver is Mesa on any GPU.
 
bool g_vulkanDeviceIsMoltenVK = false
 Indicates that the Vulkan driver is MoltenVK.
 
bool g_vulkanDeviceIsApplePV = false
 Indicates that the Vulkan driver is an Apple paravirtualization device.
 

Detailed Description

Function Documentation

◆ IsDevicePreferred()

bool IsDevicePreferred ( const vk::PhysicalDeviceProperties &  a,
const vk::PhysicalDeviceProperties &  b 
)

Checks if a given Vulkan device is "better" than another.

Parameters
aOne of two devices being considered
bThe second device being considered
Returns
True if we should use device B over A

◆ VulkanInit()

bool VulkanInit ( bool  skipGLFW)

Initialize a Vulkan context for compute.

Parameters
skipGLFWDo not initalize GLFW (workaround for what looks like gtk or video driver bug). This was a workaround used by glscopeclient and should probably be removed as it's not used now.

◆ VulkanInitInstance()

bool VulkanInitInstance ( bool  skipGLFW,
bool vulkan11Available,
bool vulkan12Available,
bool hasPhysicalDeviceProperties2 
)

Do context-level Vulkan initialization.

Parameters
skipGLFWDo not initialize GLFW.

This is needed for headless use of libscopehal in unit tests or ATE applications, which may be executed on a machine that does not have a display server running

◆ VulkanPrintPhysicalDeviceInfo()

void VulkanPrintPhysicalDeviceInfo ( size_t  i,
vk::raii::PhysicalDevice &  device,
bool  hasPhysicalDeviceProperties2 
)

Log info about a Vulkan physical device.

Does not actually set any "feature present" flags since we don't yet know if we're going to use this device

Variable Documentation

◆ g_vkQueueManager

std::unique_ptr<QueueManager> g_vkQueueManager

Allocates QueueHandle objects.

This is a single global resource, all QueueHandles must be obtained through this object.

◆ g_vkTransferCommandBuffer

unique_ptr<vk::raii::CommandBuffer> g_vkTransferCommandBuffer

Command buffer for AcceleratorBuffer transfers.

This is a single global resource interlocked by g_vkTransferMutex and is used for convenience and code simplicity when parallelism isn't that important.

◆ g_vkTransferCommandPool

unique_ptr<vk::raii::CommandPool> g_vkTransferCommandPool

Command pool for AcceleratorBuffer transfers.

This is a single global resource interlocked by g_vkTransferMutex and is used for convenience and code simplicity when parallelism isn't that important.

◆ g_vkTransferQueue

shared_ptr<QueueHandle> g_vkTransferQueue

Queue for AcceleratorBuffer transfers.

This is a single global resource interlocked by g_vkTransferMutex and is used for convenience and code simplicity when parallelism isn't that important.

◆ g_vulkanDeviceHasUnifiedMemory

bool g_vulkanDeviceHasUnifiedMemory = false

Indicates whether the Vulkan device is unified memory.

Unified memory means that all memory allocations for compute shaders are from a single heap which is accessible to both the CPU and GPU with roughly equal performance, and there is no device-local memory with higher performance.

For example, AMD APUs, Intel integrated GPUs, and Apple Silicon platforms are unified memory.

Discrete PCIe GPUs typically are not.