radeonsi: assume that constant load_local_group_size has been optimized out

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6782>
This commit is contained in:
Marek Olšák 2020-09-18 02:21:26 -04:00
parent 0492adaca7
commit 16afaf0355
2 changed files with 3 additions and 18 deletions

View File

@ -356,22 +356,8 @@ LLVMValueRef si_llvm_get_block_size(struct ac_shader_abi *abi)
{ {
struct si_shader_context *ctx = si_shader_context_from_abi(abi); struct si_shader_context *ctx = si_shader_context_from_abi(abi);
LLVMValueRef values[3]; assert(ctx->shader->selector->info.base.cs.local_size_variable);
LLVMValueRef result; return ac_get_arg(&ctx->ac, ctx->block_size);
unsigned i;
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);
result = ac_build_gather_values(&ctx->ac, values, 3);
} else {
result = ac_get_arg(&ctx->ac, ctx->block_size);
}
return result;
} }
void si_llvm_declare_compute_memory(struct si_shader_context *ctx) void si_llvm_declare_compute_memory(struct si_shader_context *ctx)

View File

@ -352,8 +352,7 @@ void si_nir_scan_shader(const struct nir_shader *nir, struct si_shader_info *inf
info->uses_subgroup_info = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_LOCAL_INVOCATION_INDEX) || info->uses_subgroup_info = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_LOCAL_INVOCATION_INDEX) ||
nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_SUBGROUP_ID) || nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_SUBGROUP_ID) ||
nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_NUM_SUBGROUPS); nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_NUM_SUBGROUPS);
info->uses_variable_block_size = info->base.cs.local_size_variable && info->uses_variable_block_size = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_LOCAL_GROUP_SIZE);
nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_LOCAL_GROUP_SIZE);
info->uses_drawid = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_DRAW_ID); info->uses_drawid = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_DRAW_ID);
info->uses_primid = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_PRIMITIVE_ID) || info->uses_primid = nir->info.system_values_read & BITFIELD64_BIT(SYSTEM_VALUE_PRIMITIVE_ID) ||
nir->info.inputs_read & VARYING_BIT_PRIMITIVE_ID; nir->info.inputs_read & VARYING_BIT_PRIMITIVE_ID;