v3dv: implement VK_KHR_zero_initialize_workgroup_memory

This only requires that we call the relevant lowering pass in NIR.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18312>
This commit is contained in:
Iago Toral Quiroga
2022-08-30 09:12:30 +02:00
parent a68a2805bf
commit ca33c319e5
3 changed files with 78 additions and 61 deletions
+1 -1
View File
@@ -481,7 +481,7 @@ Vulkan 1.3 -- all DONE: anv, radv, lvp
VK_KHR_shader_non_semantic_info DONE (anv, radv, tu, v3dv, vn)
VK_KHR_shader_terminate_invocation DONE (anv, lvp, radv, tu, vn)
VK_KHR_synchronization2 DONE (anv, lvp, panvk, radv, tu)
VK_KHR_zero_initialize_workgroup_memory DONE (anv, lvp, radv, tu, vn)
VK_KHR_zero_initialize_workgroup_memory DONE (anv, lvp, radv, tu, v3dv, vn)
VK_EXT_4444_formats DONE (anv, lvp, radv, tu, v3dv, vn)
VK_EXT_extended_dynamic_state DONE (anv, lvp, radv, tu, vn)
VK_EXT_extended_dynamic_state2 DONE (anv, lvp, radv, tu, vn)
+15
View File
@@ -652,6 +652,21 @@ v3d_lower_nir(struct v3d_compile *c)
NIR_PASS(_, c->s, nir_lower_tex, &tex_options);
NIR_PASS(_, c->s, nir_lower_system_values);
if (c->s->info.zero_initialize_shared_memory &&
c->s->info.shared_size > 0) {
/* All our BOs allocate full pages, so the underlying allocation
* for shared memory will always be a multiple of 4KB. This
* ensures that we can do an exact number of full chunk_size
* writes to initialize the memory independently of the actual
* shared_size used by the shader, which is a requirement of
* the initialization pass.
*/
const unsigned chunk_size = 16; /* max single store size */
NIR_PASS(_, c->s, nir_zero_initialize_shared_memory,
ALIGN(c->s->info.shared_size, chunk_size), chunk_size);
}
NIR_PASS(_, c->s, nir_lower_compute_system_values, NULL);
NIR_PASS(_, c->s, nir_lower_vars_to_scratch,
+62 -60
View File
@@ -118,69 +118,70 @@ get_device_extensions(const struct v3dv_physical_device *device,
struct vk_device_extension_table *ext)
{
*ext = (struct vk_device_extension_table) {
.KHR_8bit_storage = true,
.KHR_16bit_storage = true,
.KHR_bind_memory2 = true,
.KHR_buffer_device_address = true,
.KHR_copy_commands2 = true,
.KHR_create_renderpass2 = true,
.KHR_dedicated_allocation = true,
.KHR_device_group = true,
.KHR_driver_properties = true,
.KHR_descriptor_update_template = true,
.KHR_depth_stencil_resolve = true,
.KHR_external_fence = true,
.KHR_external_fence_fd = true,
.KHR_external_memory = true,
.KHR_external_memory_fd = true,
.KHR_external_semaphore = true,
.KHR_external_semaphore_fd = true,
.KHR_format_feature_flags2 = true,
.KHR_get_memory_requirements2 = true,
.KHR_image_format_list = true,
.KHR_imageless_framebuffer = true,
.KHR_performance_query = device->caps.perfmon,
.KHR_relaxed_block_layout = true,
.KHR_maintenance1 = true,
.KHR_maintenance2 = true,
.KHR_maintenance3 = true,
.KHR_maintenance4 = true,
.KHR_multiview = true,
.KHR_pipeline_executable_properties = true,
.KHR_separate_depth_stencil_layouts = true,
.KHR_shader_float_controls = true,
.KHR_shader_non_semantic_info = true,
.KHR_sampler_mirror_clamp_to_edge = true,
.KHR_spirv_1_4 = true,
.KHR_storage_buffer_storage_class = true,
.KHR_timeline_semaphore = true,
.KHR_uniform_buffer_standard_layout = true,
.KHR_8bit_storage = true,
.KHR_16bit_storage = true,
.KHR_bind_memory2 = true,
.KHR_buffer_device_address = true,
.KHR_copy_commands2 = true,
.KHR_create_renderpass2 = true,
.KHR_dedicated_allocation = true,
.KHR_device_group = true,
.KHR_driver_properties = true,
.KHR_descriptor_update_template = true,
.KHR_depth_stencil_resolve = true,
.KHR_external_fence = true,
.KHR_external_fence_fd = true,
.KHR_external_memory = true,
.KHR_external_memory_fd = true,
.KHR_external_semaphore = true,
.KHR_external_semaphore_fd = true,
.KHR_format_feature_flags2 = true,
.KHR_get_memory_requirements2 = true,
.KHR_image_format_list = true,
.KHR_imageless_framebuffer = true,
.KHR_performance_query = device->caps.perfmon,
.KHR_relaxed_block_layout = true,
.KHR_maintenance1 = true,
.KHR_maintenance2 = true,
.KHR_maintenance3 = true,
.KHR_maintenance4 = true,
.KHR_multiview = true,
.KHR_pipeline_executable_properties = true,
.KHR_separate_depth_stencil_layouts = true,
.KHR_shader_float_controls = true,
.KHR_shader_non_semantic_info = true,
.KHR_sampler_mirror_clamp_to_edge = true,
.KHR_spirv_1_4 = true,
.KHR_storage_buffer_storage_class = true,
.KHR_timeline_semaphore = true,
.KHR_uniform_buffer_standard_layout = true,
#ifdef V3DV_USE_WSI_PLATFORM
.KHR_swapchain = true,
.KHR_swapchain_mutable_format = true,
.KHR_incremental_present = true,
.KHR_swapchain = true,
.KHR_swapchain_mutable_format = true,
.KHR_incremental_present = true,
#endif
.KHR_variable_pointers = true,
.KHR_vulkan_memory_model = true,
.EXT_4444_formats = true,
.EXT_color_write_enable = true,
.EXT_custom_border_color = true,
.EXT_inline_uniform_block = true,
.EXT_external_memory_dma_buf = true,
.EXT_host_query_reset = true,
.EXT_image_drm_format_modifier = true,
.EXT_index_type_uint8 = true,
.EXT_line_rasterization = true,
.EXT_physical_device_drm = true,
.EXT_pipeline_creation_cache_control = true,
.EXT_pipeline_creation_feedback = true,
.EXT_private_data = true,
.EXT_provoking_vertex = true,
.EXT_separate_stencil_usage = true,
.EXT_texel_buffer_alignment = true,
.EXT_vertex_attribute_divisor = true,
.KHR_variable_pointers = true,
.KHR_vulkan_memory_model = true,
.KHR_zero_initialize_workgroup_memory = true,
.EXT_4444_formats = true,
.EXT_color_write_enable = true,
.EXT_custom_border_color = true,
.EXT_inline_uniform_block = true,
.EXT_external_memory_dma_buf = true,
.EXT_host_query_reset = true,
.EXT_image_drm_format_modifier = true,
.EXT_index_type_uint8 = true,
.EXT_line_rasterization = true,
.EXT_physical_device_drm = true,
.EXT_pipeline_creation_cache_control = true,
.EXT_pipeline_creation_feedback = true,
.EXT_private_data = true,
.EXT_provoking_vertex = true,
.EXT_separate_stencil_usage = true,
.EXT_texel_buffer_alignment = true,
.EXT_vertex_attribute_divisor = true,
#ifdef ANDROID
.ANDROID_native_buffer = true,
.ANDROID_native_buffer = true,
#endif
};
}
@@ -1119,6 +1120,7 @@ v3dv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
.pipelineCreationCacheControl = true,
.privateData = true,
.maintenance4 = true,
.shaderZeroInitializeWorkgroupMemory = true,
};
VkPhysicalDeviceVulkan12Features vk12 = {