v3dv: implement VK_KHR_workgroup_memory_explicit_layout

There is an issue with some Amber tests for this feature using
a larger number of workgroup invocations than supported without
checking the limit. I filed and issue [1] (and a CL with a fix), but
meanwhile we want to flag those as expected crashes for CI.

[1] https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/3913

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18337>
This commit is contained in:
Iago Toral Quiroga
2022-08-31 12:39:32 +02:00
committed by Marge Bot
parent 2b00ba23c2
commit ffd3ef35bb
4 changed files with 23 additions and 3 deletions

View File

@@ -530,7 +530,7 @@ Khronos extensions that are not part of any Vulkan version:
VK_KHR_swapchain DONE (anv, dzn, lvp, panvk, pvr, radv, tu, v3dv, vn)
VK_KHR_swapchain_mutable_format DONE (anv, lvp, radv, tu, v3dv, vn)
VK_KHR_wayland_surface DONE (anv, dzn, lvp, panvk, radv, tu, v3dv, vn)
VK_KHR_workgroup_memory_explicit_layout DONE (anv, radv)
VK_KHR_workgroup_memory_explicit_layout DONE (anv, radv, v3dv)
VK_KHR_win32_keyed_mutex not started
VK_KHR_win32_surface DONE (dzn, lvp)
VK_KHR_xcb_surface DONE (anv, dzn, lvp, radv, tu, v3dv, vn)

View File

@@ -355,3 +355,9 @@ spec@!opengl 2.0@max-samplers border,Fail
# https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/3759
dEQP-VK.pipeline.monolithic.color_write_enable_maxa.cwe_after_bind.attachments4_more0,Crash
# https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/3913
dEQP-VK.compute.workgroup_memory_explicit_layout.copy_memory.two_invocations,Crash
dEQP-VK.compute.workgroup_memory_explicit_layout.zero_ext.block,Crash
dEQP-VK.compute.workgroup_memory_explicit_layout.zero_ext.other_block,Crash
dEQP-VK.compute.workgroup_memory_explicit_layout.zero_ext.block_with_offset,Crash

View File

@@ -156,6 +156,7 @@ get_device_extensions(const struct v3dv_physical_device *device,
.KHR_timeline_semaphore = true,
.KHR_uniform_buffer_standard_layout = true,
.KHR_synchronization2 = true,
.KHR_workgroup_memory_explicit_layout = true,
#ifdef V3DV_USE_WSI_PLATFORM
.KHR_swapchain = true,
.KHR_swapchain_mutable_format = true,
@@ -1285,6 +1286,16 @@ v3dv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_FEATURES_KHR: {
VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR *features =
(VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR *)ext;
features->workgroupMemoryExplicitLayout = true;
features->workgroupMemoryExplicitLayoutScalarBlockLayout = false;
features->workgroupMemoryExplicitLayout8BitAccess = true;
features->workgroupMemoryExplicitLayout16BitAccess = true;
break;
}
default:
v3dv_debug_ignored_stype(ext->sType);
break;

View File

@@ -182,6 +182,7 @@ static const struct spirv_to_nir_options default_spirv_options = {
.vk_memory_model = true,
.vk_memory_model_device_scope = true,
.physical_storage_buffer_address = true,
.workgroup_memory_explicit_layout = true,
},
.ubo_addr_format = nir_address_format_32bit_index_offset,
.ssbo_addr_format = nir_address_format_32bit_index_offset,
@@ -3127,8 +3128,10 @@ shared_type_info(const struct glsl_type *type, unsigned *size, unsigned *align)
static void
lower_cs_shared(struct nir_shader *nir)
{
NIR_PASS(_, nir, nir_lower_vars_to_explicit_types,
nir_var_mem_shared, shared_type_info);
if (!nir->info.shared_memory_explicit_layout) {
NIR_PASS(_, nir, nir_lower_vars_to_explicit_types,
nir_var_mem_shared, shared_type_info);
}
NIR_PASS(_, nir, nir_lower_explicit_io,
nir_var_mem_shared, nir_address_format_32bit_offset);
}