radv: Refactor required subgroup size in pipeline key.

This is to allow setting required subgroup size and
full subgroups on more than just the compute stage.

Use an enum (not the actual subgroup size integer)
so that we can have some bits reserved there for
future use.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23925>
This commit is contained in:
Timur Kristóf
2023-06-29 14:27:25 +02:00
parent b8fbce045e
commit 8982bd6045
8 changed files with 53 additions and 33 deletions

View File

@@ -139,6 +139,7 @@ radv_pipeline_init_scratch(const struct radv_device *device, struct radv_pipelin
struct radv_pipeline_key
radv_generate_pipeline_key(const struct radv_device *device, const struct radv_pipeline *pipeline,
const VkPipelineShaderStageCreateInfo *stages, const unsigned num_stages,
VkPipelineCreateFlags flags)
{
struct radv_pipeline_key key;
@@ -155,6 +156,26 @@ radv_generate_pipeline_key(const struct radv_device *device, const struct radv_p
key.tex_non_uniform = device->instance->tex_non_uniform;
for (unsigned i = 0; i < num_stages; ++i) {
const VkPipelineShaderStageCreateInfo *const stage = &stages[i];
const VkPipelineShaderStageRequiredSubgroupSizeCreateInfo *const subgroup_size =
vk_find_struct_const(stage->pNext, PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO);
const gl_shader_stage s = vk_to_mesa_shader_stage(stage->stage);
if (subgroup_size) {
if (subgroup_size->requiredSubgroupSize == 32)
key.subgroups[s].required_size = RADV_REQUIRED_WAVE32;
else if (subgroup_size->requiredSubgroupSize == 64)
key.subgroups[s].required_size = RADV_REQUIRED_WAVE64;
else
unreachable("Unsupported required subgroup size.");
}
if (stage->flags & VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT) {
key.subgroups[s].require_full = 1;
}
}
return key;
}