diff --git a/src/kosmickrisp/clc/kk_clc.c b/src/kosmickrisp/clc/kk_clc.c index f17403f718e..c18059c1645 100644 --- a/src/kosmickrisp/clc/kk_clc.c +++ b/src/kosmickrisp/clc/kk_clc.c @@ -277,6 +277,11 @@ main(int argc, char **argv) NIR_PASS(_, s, nir_lower_vars_to_explicit_types, nir_var_mem_shared, glsl_get_cl_type_size_align); + /* Workgroup size cannot be lowered when the shader is in library form, + * so we need to lower compute system values again now that it is a + * variant with a distinct entry-point. */ + NIR_PASS(_, s, nir_lower_compute_system_values, NULL); + NIR_PASS(_, s, nir_lower_explicit_io, nir_var_mem_shared, nir_address_format_62bit_generic); @@ -296,8 +301,14 @@ main(int argc, char **argv) NIR_PASS(_, s, nir_convert_from_ssa, true, true); NIR_PASS(_, s, nir_trivialize_registers); - /* nir_lower_explicit_io will create unpack_64 we need to lower */ - NIR_PASS(_, s, nir_opt_algebraic); + /* nir_lower_explicit_io will create unpack_64 we need to lower. + * Perform in a loop to make sure any optimizations that result in + * instructions we don't implement are fully lowered */ + bool progress = false; + do { + progress = false; + NIR_PASS(progress, s, nir_opt_algebraic); + } while (progress); nir_shader_gather_info(s, nir_shader_get_entrypoint(s)); struct nir_to_msl_options options = {};