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>
}
}
-/* 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
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);
}
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