panvk: Lower shared memory

Copy the code. Fixes workgroup tests, now compute kernels should work properly
on Bifrost.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16123>
This commit is contained in:
Alyssa Rosenzweig
2022-04-23 19:04:43 -04:00
committed by Marge Bot
parent 179d9e3511
commit 4e111c259c
3 changed files with 34 additions and 0 deletions

View File

@@ -25,5 +25,6 @@ include = [
"dEQP-VK.pipeline.sampler.view_type.*.format.r*.address_modes.all_mode_clamp_to_border*",
"dEQP-VK.spirv_assembly.instruction.compute.opquantize.*",
"dEQP-VK.spirv_assembly.instruction.compute.shader_default_output.*",
"dEQP-VK.spirv_assembly.instruction.compute.workgroup_memory.*",
"dEQP-VK.ssbo.layout.single_basic_type.*",
]

View File

@@ -17,3 +17,8 @@ KHR-GLES31.core.draw_indirect.advanced-twoPass-transformFeedback-elements
# fail seen here and in others
# https://gitlab.freedesktop.org/mesa/mesa/-/jobs/19776551
dEQP-GLES31.functional.ssbo.layout.random.all_shared_buffer.36
# InternalError (Variable pointers requested but feature not returned at
# vktAmberTestCase.cpp:364)
dEQP-VK.spirv_assembly.instruction.compute.vector_shuffle.vector_shuffle

View File

@@ -4,6 +4,9 @@
* Derived from tu_shader.c which is:
* Copyright © 2019 Google LLC
*
* Also derived from anv_pipeline.c which is
* Copyright © 2015 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@@ -493,6 +496,18 @@ panvk_lower_load_push_constant(nir_builder *b, nir_instr *instr, void *data)
return true;
}
static void
shared_type_info(const struct glsl_type *type, unsigned *size, unsigned *align)
{
assert(glsl_type_is_vector_or_scalar(type));
uint32_t comp_size = glsl_type_is_boolean(type)
? 4 : glsl_get_bit_size(type) / 8;
unsigned length = glsl_get_vector_elements(type);
*size = comp_size * length,
*align = comp_size * (length == 3 ? 4 : length);
}
struct panvk_shader *
panvk_per_arch(shader_create)(struct panvk_device *dev,
gl_shader_stage stage,
@@ -567,6 +582,19 @@ panvk_per_arch(shader_create)(struct panvk_device *dev,
NIR_PASS_V(nir, nir_lower_explicit_io,
nir_var_mem_push_const,
nir_address_format_32bit_offset);
if (gl_shader_stage_uses_workgroup(stage)) {
if (!nir->info.shared_memory_explicit_layout) {
NIR_PASS_V(nir, nir_lower_vars_to_explicit_types,
nir_var_mem_shared,
shared_type_info);
}
NIR_PASS_V(nir, nir_lower_explicit_io,
nir_var_mem_shared,
nir_address_format_32bit_offset);
}
NIR_PASS_V(nir, nir_shader_instructions_pass,
panvk_lower_load_push_constant,
nir_metadata_block_index |