radv: Implement & expose VK_EXT_pipeline_library_group_handles.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21406>
This commit is contained in:
Bas Nieuwenhuizen
2023-02-18 16:16:27 +01:00
committed by Marge Bot
parent d0f7587109
commit ed76833705
6 changed files with 26 additions and 4 deletions

View File

@@ -572,6 +572,7 @@ Khronos extensions that are not part of any Vulkan version:
VK_EXT_non_seamless_cube_map DONE (anv, lvp, radv, tu)
VK_EXT_pci_bus_info DONE (anv, radv, vn)
VK_EXT_physical_device_drm DONE (anv, radv, tu, v3dv, vn)
VK_EXT_pipeline_library_group_handles DONE (radv)
VK_EXT_pipeline_robustness DONE (v3dv)
VK_EXT_post_depth_coverage DONE (anv/gfx10+, lvp, radv/gfx10+)
VK_EXT_primitive_topology_list_restart DONE (anv, lvp, radv, tu, v3dv, vn)

View File

@@ -0,0 +1 @@
VK_EXT_pipeline_library_group_handles on RADV

View File

@@ -630,6 +630,7 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device
#endif
.EXT_pipeline_creation_cache_control = true,
.EXT_pipeline_creation_feedback = true,
.EXT_pipeline_library_group_handles = true,
.EXT_post_depth_coverage = device->rad_info.gfx_level >= GFX10,
.EXT_primitive_topology_list_restart = true,
.EXT_primitives_generated_query = true,
@@ -1810,6 +1811,12 @@ radv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
features->rayQuery = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_LIBRARY_GROUP_HANDLES_FEATURES_EXT: {
VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT *features =
(VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT *)ext;
features->pipelineLibraryGroupHandles = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR: {
VkPhysicalDeviceRayTracingPipelineFeaturesKHR *features =
(VkPhysicalDeviceRayTracingPipelineFeaturesKHR *)ext;

View File

@@ -142,6 +142,7 @@ radv_pipeline_destroy(struct radv_device *device, struct radv_pipeline *pipeline
struct radv_library_pipeline *library_pipeline = radv_pipeline_to_library(pipeline);
ralloc_free(library_pipeline->ctx);
free(library_pipeline->group_handles);
} else if (pipeline->type == RADV_PIPELINE_GRAPHICS_LIB) {
struct radv_graphics_lib_pipeline *gfx_pipeline_lib =
radv_pipeline_to_graphics_lib(pipeline);

View File

@@ -227,6 +227,11 @@ radv_rt_pipeline_library_create(VkDevice _device, VkPipelineCache _cache,
if (!local_create_info.pStages || !local_create_info.pGroups)
goto fail;
VkResult result =
radv_create_group_handles(device, &local_create_info, &pipeline->group_handles);
if (result != VK_SUCCESS)
goto fail;
if (local_create_info.stageCount) {
pipeline->stage_count = local_create_info.stageCount;
@@ -326,6 +331,7 @@ radv_rt_pipeline_library_create(VkDevice _device, VkPipelineCache _cache,
free((void *)local_create_info.pStages);
return VK_SUCCESS;
fail:
free(pipeline->groups);
ralloc_free(pipeline->ctx);
free((void *)local_create_info.pGroups);
free((void *)local_create_info.pStages);
@@ -567,16 +573,20 @@ radv_GetRayTracingShaderGroupHandlesKHR(VkDevice device, VkPipeline _pipeline, u
uint32_t groupCount, size_t dataSize, void *pData)
{
RADV_FROM_HANDLE(radv_pipeline, pipeline, _pipeline);
struct radv_ray_tracing_pipeline *rt_pipeline = radv_pipeline_to_ray_tracing(pipeline);
struct radv_pipeline_group_handle *handles;
if (pipeline->type == RADV_PIPELINE_LIBRARY) {
handles = radv_pipeline_to_library(pipeline)->group_handles;
} else {
handles = radv_pipeline_to_ray_tracing(pipeline)->group_handles;
}
char *data = pData;
STATIC_ASSERT(sizeof(*rt_pipeline->group_handles) <= RADV_RT_HANDLE_SIZE);
STATIC_ASSERT(sizeof(*handles) <= RADV_RT_HANDLE_SIZE);
memset(data, 0, groupCount * RADV_RT_HANDLE_SIZE);
for (uint32_t i = 0; i < groupCount; ++i) {
memcpy(data + i * RADV_RT_HANDLE_SIZE, &rt_pipeline->group_handles[firstGroup + i],
sizeof(*rt_pipeline->group_handles));
memcpy(data + i * RADV_RT_HANDLE_SIZE, &handles[firstGroup + i], sizeof(*handles));
}
return VK_SUCCESS;

View File

@@ -2215,6 +2215,8 @@ struct radv_library_pipeline {
struct {
uint8_t sha1[SHA1_DIGEST_LENGTH];
} *hashes;
struct radv_pipeline_group_handle *group_handles;
};
struct radv_graphics_lib_pipeline {