diff --git a/docs/features.txt b/docs/features.txt index c86c059b472..f55d5f4aa15 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -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) diff --git a/src/broadcom/vulkan/v3dv_cmd_buffer.c b/src/broadcom/vulkan/v3dv_cmd_buffer.c index 8cc820b47c9..8cdab17da75 100644 --- a/src/broadcom/vulkan/v3dv_cmd_buffer.c +++ b/src/broadcom/vulkan/v3dv_cmd_buffer.c @@ -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); +} diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c index 2e447e1c6cb..79893bc734b 100644 --- a/src/broadcom/vulkan/v3dv_device.c +++ b/src/broadcom/vulkan/v3dv_device.c @@ -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. diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c index 25c33a5ed68..430a58c842d 100644 --- a/src/broadcom/vulkan/v3dv_pipeline.c +++ b/src/broadcom/vulkan/v3dv_pipeline.c @@ -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