From c2a81ebe19f98b025b296fcadc279b4358d37345 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timur=20Krist=C3=B3f?= Date: Thu, 11 Mar 2021 12:43:56 +0100 Subject: [PATCH] nir: Add default unsigned upper bound configuration. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Timur Kristóf Reviewed-by: Rhys Perry Part-of: --- src/compiler/nir/nir_range_analysis.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/compiler/nir/nir_range_analysis.c b/src/compiler/nir/nir_range_analysis.c index 115787b..f4ee069 100644 --- a/src/compiler/nir/nir_range_analysis.c +++ b/src/compiler/nir/nir_range_analysis.c @@ -1252,6 +1252,21 @@ lookup_input(nir_shader *shader, unsigned driver_location) driver_location); } +/* The config here should be generic enough to be correct on any HW. */ +static const nir_unsigned_upper_bound_config default_ub_config = { + .min_subgroup_size = 1u, + .max_subgroup_size = UINT16_MAX, + .max_work_group_invocations = UINT16_MAX, + .max_work_group_count = {UINT16_MAX, UINT16_MAX, UINT16_MAX}, + .max_work_group_size = {UINT16_MAX, UINT16_MAX, UINT16_MAX}, + .vertex_attrib_max = { + UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, + UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, + UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, + UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX, + }, +}; + uint32_t nir_unsigned_upper_bound(nir_shader *shader, struct hash_table *range_ht, nir_ssa_scalar scalar, @@ -1259,6 +1274,8 @@ nir_unsigned_upper_bound(nir_shader *shader, struct hash_table *range_ht, { assert(scalar.def->bit_size <= 32); + if (!config) + config = &default_ub_config; if (nir_ssa_scalar_is_const(scalar)) return nir_ssa_scalar_as_uint(scalar); -- 2.7.4