mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-21 10:00:36 +01:00
panfrost: Move bifrost_lanes_per_warp to common
Whereas the compiler needs to know the warp size for lowering divergent indirects, the driver needs to know it to report the subgroup size. Move the Bifrost-specific helper to common and add the trivial implementation for Midgard. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17265>
This commit is contained in:
parent
6f3eea5ddb
commit
fbe430fae9
3 changed files with 19 additions and 14 deletions
|
|
@ -55,17 +55,4 @@ bifrost_get_quirks(unsigned product_id)
|
|||
}
|
||||
}
|
||||
|
||||
/* How many lanes per architectural warp (subgroup)? Used to lower divergent
|
||||
* indirects. */
|
||||
|
||||
static inline unsigned
|
||||
bifrost_lanes_per_warp(unsigned product_id)
|
||||
{
|
||||
switch (product_id >> 12) {
|
||||
case 6: return 4;
|
||||
case 7: return 8;
|
||||
default: return 16;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -4566,7 +4566,7 @@ bi_optimize_nir(nir_shader *nir, unsigned gpu_id, bool is_blend)
|
|||
nir_convert_to_lcssa(nir, true, true);
|
||||
NIR_PASS_V(nir, nir_divergence_analysis);
|
||||
NIR_PASS_V(nir, bi_lower_divergent_indirects,
|
||||
bifrost_lanes_per_warp(gpu_id));
|
||||
pan_subgroup_size(gpu_id >> 12));
|
||||
NIR_PASS_V(nir, nir_shader_instructions_pass,
|
||||
nir_invalidate_divergence, nir_metadata_all, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -502,4 +502,22 @@ bool pan_nir_lower_64bit_intrin(nir_shader *shader);
|
|||
bool pan_lower_helper_invocation(nir_shader *shader);
|
||||
bool pan_lower_sample_pos(nir_shader *shader);
|
||||
|
||||
/*
|
||||
* Helper returning the subgroup size. Generally, this is equal to the number of
|
||||
* threads in a warp. For Midgard (including warping models), this returns 1, as
|
||||
* subgroups are not supported.
|
||||
*/
|
||||
static inline unsigned
|
||||
pan_subgroup_size(unsigned arch)
|
||||
{
|
||||
if (arch >= 9)
|
||||
return 16;
|
||||
else if (arch >= 7)
|
||||
return 8;
|
||||
else if (arch >= 6)
|
||||
return 4;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue