diff --git a/src/microsoft/clc/clc_compiler.c b/src/microsoft/clc/clc_compiler.c index 6fc9d0c4c82..853cc63fb21 100644 --- a/src/microsoft/clc/clc_compiler.c +++ b/src/microsoft/clc/clc_compiler.c @@ -1340,6 +1340,11 @@ clc_to_dxil(struct clc_context *ctx, nir_variable *work_properties_var = add_work_properties_var(dxil, nir, &cbv_id); + memcpy(metadata->local_size, nir->info.cs.local_size, + sizeof(metadata->local_size)); + memcpy(metadata->local_size_hint, nir->info.cs.local_size_hint, + sizeof(metadata->local_size)); + // Patch the localsize before calling clc_nir_lower_system_values(). if (conf) { for (unsigned i = 0; i < ARRAY_SIZE(nir->info.cs.local_size); i++) { @@ -1355,6 +1360,14 @@ clc_to_dxil(struct clc_context *ctx, nir->info.cs.local_size[i] = conf->local_size[i]; } + memcpy(metadata->local_size, nir->info.cs.local_size, + sizeof(metadata->local_size)); + } else { + /* Make sure there's at least one thread that's set to run */ + for (unsigned i = 0; i < ARRAY_SIZE(nir->info.cs.local_size); i++) { + if (nir->info.cs.local_size[i] == 0) + nir->info.cs.local_size[i] = 1; + } } NIR_PASS_V(nir, clc_nir_lower_kernel_input_loads, inputs_var); @@ -1428,11 +1441,6 @@ clc_to_dxil(struct clc_context *ctx, goto err_free_dxil; } - memcpy(metadata->local_size, nir->info.cs.local_size, - sizeof(metadata->local_size)); - memcpy(metadata->local_size_hint, nir->info.cs.local_size_hint, - sizeof(metadata->local_size)); - nir_foreach_variable_with_modes(var, nir, nir_var_mem_ssbo) { if (var->constant_initializer) { if (glsl_type_is_array(var->type)) {