v3dv: implement VK_KHR_device_group
We only support one device group with a single device, so the implementation is trivial. Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11037>
This commit is contained in:
parent
c672b23857
commit
234e1b7356
|
@ -425,8 +425,8 @@ Vulkan 1.1 -- all DONE: anv, lvp, radv, tu, vn
|
|||
VK_KHR_bind_memory2 DONE (anv, lvp, radv, tu, v3dv, vn)
|
||||
VK_KHR_dedicated_allocation DONE (anv, lvp, radv, tu, v3dv, vn)
|
||||
VK_KHR_descriptor_update_template DONE (anv, lvp, radv, tu, vn)
|
||||
VK_KHR_device_group DONE (lvp, tu, vn)
|
||||
VK_KHR_device_group_creation DONE (lvp, tu, vn)
|
||||
VK_KHR_device_group DONE (lvp, tu, v3dv, vn)
|
||||
VK_KHR_device_group_creation DONE (lvp, tu, v3dv, vn)
|
||||
VK_KHR_external_fence DONE (anv, lvp, radv, tu, vn)
|
||||
VK_KHR_external_fence_capabilities DONE (anv, lvp, radv, tu, vn)
|
||||
VK_KHR_external_memory DONE (anv, lvp, radv, tu, v3dv, vn)
|
||||
|
|
|
@ -5488,3 +5488,10 @@ v3dv_CmdDispatchIndirect(VkCommandBuffer commandBuffer,
|
|||
cmd_buffer_emit_pre_dispatch(cmd_buffer);
|
||||
cmd_buffer_dispatch_indirect(cmd_buffer, buffer, offset);
|
||||
}
|
||||
|
||||
void
|
||||
v3dv_CmdSetDeviceMask(VkCommandBuffer commandBuffer, uint32_t deviceMask)
|
||||
{
|
||||
/* Nothing to do here since we only support a single device */
|
||||
assert(deviceMask = 0x1);
|
||||
}
|
||||
|
|
|
@ -104,6 +104,7 @@ v3dv_EnumerateInstanceVersion(uint32_t *pApiVersion)
|
|||
VK_USE_PLATFORM_DISPLAY_KHR)
|
||||
|
||||
static const struct vk_instance_extension_table instance_extensions = {
|
||||
.KHR_device_group_creation = true,
|
||||
#ifdef VK_USE_PLATFORM_DISPLAY_KHR
|
||||
.KHR_display = true,
|
||||
#endif
|
||||
|
@ -132,6 +133,7 @@ get_device_extensions(const struct v3dv_physical_device *device,
|
|||
*ext = (struct vk_device_extension_table) {
|
||||
.KHR_bind_memory2 = true,
|
||||
.KHR_dedicated_allocation = true,
|
||||
.KHR_device_group = true,
|
||||
.KHR_external_memory = true,
|
||||
.KHR_external_memory_fd = true,
|
||||
.KHR_get_memory_requirements2 = true,
|
||||
|
@ -915,6 +917,36 @@ v3dv_EnumeratePhysicalDevices(VkInstance _instance,
|
|||
return vk_outarray_status(&out);
|
||||
}
|
||||
|
||||
VkResult
|
||||
v3dv_EnumeratePhysicalDeviceGroups(
|
||||
VkInstance _instance,
|
||||
uint32_t *pPhysicalDeviceGroupCount,
|
||||
VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties)
|
||||
{
|
||||
V3DV_FROM_HANDLE(v3dv_instance, instance, _instance);
|
||||
VK_OUTARRAY_MAKE(out, pPhysicalDeviceGroupProperties,
|
||||
pPhysicalDeviceGroupCount);
|
||||
|
||||
VkResult result = instance_ensure_physical_device(instance);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
assert(instance->physicalDeviceCount == 1);
|
||||
|
||||
vk_outarray_append(&out, p) {
|
||||
p->physicalDeviceCount = 1;
|
||||
memset(p->physicalDevices, 0, sizeof(p->physicalDevices));
|
||||
p->physicalDevices[0] =
|
||||
v3dv_physical_device_to_handle(&instance->physicalDevice);
|
||||
p->subsetAllocation = false;
|
||||
|
||||
vk_foreach_struct(ext, p->pNext)
|
||||
v3dv_debug_ignored_stype(ext->sType);
|
||||
}
|
||||
|
||||
return vk_outarray_status(&out);
|
||||
}
|
||||
|
||||
void
|
||||
v3dv_GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceFeatures *pFeatures)
|
||||
|
@ -1006,6 +1038,20 @@ v3dv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
v3dv_GetDeviceGroupPeerMemoryFeatures(VkDevice device,
|
||||
uint32_t heapIndex,
|
||||
uint32_t localDeviceIndex,
|
||||
uint32_t remoteDeviceIndex,
|
||||
VkPeerMemoryFeatureFlags *pPeerMemoryFeatures)
|
||||
{
|
||||
assert(localDeviceIndex == 0 && remoteDeviceIndex == 0);
|
||||
*pPeerMemoryFeatures = VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT |
|
||||
VK_PEER_MEMORY_FEATURE_COPY_DST_BIT |
|
||||
VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT |
|
||||
VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
v3dv_physical_device_vendor_id(struct v3dv_physical_device *dev)
|
||||
{
|
||||
|
@ -1847,6 +1893,11 @@ v3dv_AllocateMemory(VkDevice _device,
|
|||
case VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR:
|
||||
fd_info = (void *)ext;
|
||||
break;
|
||||
case VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO:
|
||||
/* We don't support VK_KHR_buffer_device_address or multiple
|
||||
* devices per device group, so we can ignore this.
|
||||
*/
|
||||
break;
|
||||
case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR:
|
||||
/* We don't have particular optimizations associated with memory
|
||||
* allocations that won't be suballocated to multiple resources.
|
||||
|
|
|
@ -172,7 +172,9 @@ v3dv_DestroyPipeline(VkDevice _device,
|
|||
}
|
||||
|
||||
static const struct spirv_to_nir_options default_spirv_options = {
|
||||
.caps = { false },
|
||||
.caps = {
|
||||
.device_group = true,
|
||||
},
|
||||
.ubo_addr_format = nir_address_format_32bit_index_offset,
|
||||
.ssbo_addr_format = nir_address_format_32bit_index_offset,
|
||||
.phys_ssbo_addr_format = nir_address_format_64bit_global,
|
||||
|
@ -228,6 +230,7 @@ const nir_shader_compiler_options v3dv_nir_options = {
|
|||
.lower_wpos_pntc = true,
|
||||
.lower_rotate = true,
|
||||
.lower_to_scalar = true,
|
||||
.lower_device_index_to_zero = true,
|
||||
.has_fsub = true,
|
||||
.has_isub = true,
|
||||
.vertex_id_zero_based = false, /* FIXME: to set this to true, the intrinsic
|
||||
|
|
Loading…
Reference in New Issue