mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-10 03:50:13 +01:00
ir3: add helper to get the subgroup size
Signed-off-by: Job Noorman <jnoorman@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31731>
This commit is contained in:
parent
2e2a36ddb0
commit
0be9ff47b4
3 changed files with 37 additions and 22 deletions
|
|
@ -816,28 +816,8 @@ ir3_nir_post_finalize(struct ir3_shader *shader)
|
|||
* the "real" subgroup size.
|
||||
*/
|
||||
unsigned subgroup_size = 0, max_subgroup_size = 0;
|
||||
switch (shader->options.api_wavesize) {
|
||||
case IR3_SINGLE_ONLY:
|
||||
subgroup_size = max_subgroup_size = compiler->threadsize_base;
|
||||
break;
|
||||
case IR3_DOUBLE_ONLY:
|
||||
subgroup_size = max_subgroup_size = compiler->threadsize_base * 2;
|
||||
break;
|
||||
case IR3_SINGLE_OR_DOUBLE:
|
||||
/* For vertex stages, we know the wavesize will never be doubled.
|
||||
* Lower subgroup_size here, to avoid having to deal with it when
|
||||
* translating from NIR. Otherwise use the "real" wavesize obtained as
|
||||
* a driver param.
|
||||
*/
|
||||
if (s->info.stage != MESA_SHADER_COMPUTE &&
|
||||
s->info.stage != MESA_SHADER_FRAGMENT) {
|
||||
subgroup_size = max_subgroup_size = compiler->threadsize_base;
|
||||
} else {
|
||||
subgroup_size = 0;
|
||||
max_subgroup_size = compiler->threadsize_base * 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
ir3_shader_get_subgroup_size(compiler, &shader->options, s->info.stage,
|
||||
&subgroup_size, &max_subgroup_size);
|
||||
|
||||
nir_lower_subgroups_options options = {
|
||||
.subgroup_size = subgroup_size,
|
||||
|
|
|
|||
|
|
@ -990,6 +990,35 @@ ir3_shader_outputs(const struct ir3_shader *so)
|
|||
return so->nir->info.outputs_written;
|
||||
}
|
||||
|
||||
void
|
||||
ir3_shader_get_subgroup_size(const struct ir3_compiler *compiler,
|
||||
const struct ir3_shader_options *options,
|
||||
gl_shader_stage stage, unsigned *subgroup_size,
|
||||
unsigned *max_subgroup_size)
|
||||
{
|
||||
switch (options->api_wavesize) {
|
||||
case IR3_SINGLE_ONLY:
|
||||
*subgroup_size = *max_subgroup_size = compiler->threadsize_base;
|
||||
break;
|
||||
case IR3_DOUBLE_ONLY:
|
||||
*subgroup_size = *max_subgroup_size = compiler->threadsize_base * 2;
|
||||
break;
|
||||
case IR3_SINGLE_OR_DOUBLE:
|
||||
/* For vertex stages, we know the wavesize will never be doubled.
|
||||
* Lower subgroup_size here, to avoid having to deal with it when
|
||||
* translating from NIR. Otherwise use the "real" wavesize obtained as
|
||||
* a driver param.
|
||||
*/
|
||||
if (stage != MESA_SHADER_COMPUTE && stage != MESA_SHADER_FRAGMENT) {
|
||||
*subgroup_size = *max_subgroup_size = compiler->threadsize_base;
|
||||
} else {
|
||||
*subgroup_size = 0;
|
||||
*max_subgroup_size = compiler->threadsize_base * 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add any missing varyings needed for stream-out. Otherwise varyings not
|
||||
* used by fragment shader will be stripped out.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1075,6 +1075,12 @@ uint64_t ir3_shader_outputs(const struct ir3_shader *so);
|
|||
|
||||
int ir3_glsl_type_size(const struct glsl_type *type, bool bindless);
|
||||
|
||||
void ir3_shader_get_subgroup_size(const struct ir3_compiler *compiler,
|
||||
const struct ir3_shader_options *options,
|
||||
gl_shader_stage stage,
|
||||
unsigned *subgroup_size,
|
||||
unsigned *max_subgroup_size);
|
||||
|
||||
/*
|
||||
* Helper/util:
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue