&sel->active_samplers_and_images);
program->shader.is_monolithic = true;
- program->reads_variable_block_size =
- sel->info.uses_block_size && sel->info.base.cs.local_size[0] == 0;
+ program->reads_variable_block_size = sel->info.uses_variable_block_size;
program->num_cs_user_data_dwords =
sel->info.base.cs.user_data_components_amd;
return 0;
}
+ /* Compile a variable block size using the maximum variable size. */
+ if (shader->selector->info.base.cs.local_size_variable)
+ return SI_MAX_VARIABLE_THREADS_PER_BLOCK;
+
uint16_t *local_size = shader->selector->info.base.cs.local_size;
unsigned max_work_group_size = (uint32_t)local_size[0] *
(uint32_t)local_size[1] *
(uint32_t)local_size[2];
-
- if (!max_work_group_size) {
- /* This is a variable group size compute shader,
- * compile it for the maximum possible group size.
- */
- max_work_group_size = SI_MAX_VARIABLE_THREADS_PER_BLOCK;
- }
+ assert(max_work_group_size);
return max_work_group_size;
}
declare_per_stage_desc_pointers(ctx, true);
if (shader->selector->info.uses_grid_size)
ac_add_arg(&ctx->args, AC_ARG_SGPR, 3, AC_ARG_INT, &ctx->args.num_work_groups);
- if (shader->selector->info.uses_block_size &&
- shader->selector->info.base.cs.local_size[0] == 0)
+ if (shader->selector->info.uses_variable_block_size)
ac_add_arg(&ctx->args, AC_ARG_SGPR, 3, AC_ARG_INT, &ctx->block_size);
unsigned cs_user_data_dwords =
LLVMValueRef values[3];
LLVMValueRef result;
unsigned i;
- uint16_t *local_size = ctx->shader->selector->info.base.cs.local_size;
- if (local_size[0] != 0) {
+ if (!ctx->shader->selector->info.base.cs.local_size_variable) {
+ uint16_t *local_size = ctx->shader->selector->info.base.cs.local_size;
+
for (i = 0; i < 3; ++i)
values[i] = LLVMConstInt(ctx->ac.i32, local_size[i], 0);
break;
case nir_intrinsic_load_local_group_size:
/* The block size is translated to IMM with a fixed block size. */
- if (info->base.cs.local_size[0] == 0)
- info->uses_block_size = true;
+ if (info->base.cs.local_size_variable)
+ info->uses_variable_block_size = true;
break;
case nir_intrinsic_load_local_invocation_id:
case nir_intrinsic_load_work_group_id: {