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:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user