From: Connor Abbott Date: Tue, 12 Nov 2019 10:06:39 +0000 (+0100) Subject: aco: Make num_workgroups and local_invocation_ids one argument each X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4d6676d78a4dc01a7affa5a97a24108685eae7ea;p=mesa.git aco: Make num_workgroups and local_invocation_ids one argument each To match the LLVM argument setup code. Reviewed-by: Daniel Schürmann --- diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index 3b5bf0cc763..856e73366db 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -5494,17 +5494,21 @@ void visit_intrinsic(isel_context *ctx, nir_intrinsic_instr *instr) case nir_intrinsic_memory_barrier_shared: emit_memory_barrier(ctx, instr); break; - case nir_intrinsic_load_num_work_groups: - case nir_intrinsic_load_work_group_id: + case nir_intrinsic_load_num_work_groups: { + Temp dst = get_ssa_temp(ctx, &instr->dest.ssa); + bld.copy(Definition(dst), Operand(ctx->num_workgroups)); + emit_split_vector(ctx, dst, 3); + break; + } case nir_intrinsic_load_local_invocation_id: { Temp dst = get_ssa_temp(ctx, &instr->dest.ssa); - Temp* ids; - if (instr->intrinsic == nir_intrinsic_load_num_work_groups) - ids = ctx->num_workgroups; - else if (instr->intrinsic == nir_intrinsic_load_work_group_id) - ids = ctx->workgroup_ids; - else - ids = ctx->local_invocation_ids; + bld.copy(Definition(dst), Operand(ctx->local_invocation_ids)); + emit_split_vector(ctx, dst, 3); + break; + } + case nir_intrinsic_load_work_group_id: { + Temp dst = get_ssa_temp(ctx, &instr->dest.ssa); + Temp* ids = ctx->workgroup_ids; bld.pseudo(aco_opcode::p_create_vector, Definition(dst), ids[0].id() ? Operand(ids[0]) : Operand(1u), ids[1].id() ? Operand(ids[1]) : Operand(1u), diff --git a/src/amd/compiler/aco_instruction_selection_setup.cpp b/src/amd/compiler/aco_instruction_selection_setup.cpp index 5c9c0e925ac..c3f2832fa8f 100644 --- a/src/amd/compiler/aco_instruction_selection_setup.cpp +++ b/src/amd/compiler/aco_instruction_selection_setup.cpp @@ -125,10 +125,10 @@ struct isel_context { bool needs_instance_id; /* CS inputs */ - Temp num_workgroups[3] = {Temp(0, s1), Temp(0, s1), Temp(0, s1)}; + Temp num_workgroups = Temp(0, s3); Temp workgroup_ids[3] = {Temp(0, s1), Temp(0, s1), Temp(0, s1)}; Temp tg_size = Temp(0, s1); - Temp local_invocation_ids[3] = {Temp(0, v1), Temp(0, v1), Temp(0, v1)}; + Temp local_invocation_ids = Temp(0, v3); /* VS output information */ unsigned num_clip_distances; @@ -992,9 +992,7 @@ Pseudo_instruction *add_startpgm(struct isel_context *ctx) declare_global_input_sgprs(ctx, &user_sgpr_info, &args, ctx->descriptor_sets); if (ctx->program->info->cs.uses_grid_size) { - add_arg(&args, s1, &ctx->num_workgroups[0], user_sgpr_info.user_sgpr_idx); - add_arg(&args, s1, &ctx->num_workgroups[1], user_sgpr_info.user_sgpr_idx + 1); - add_arg(&args, s1, &ctx->num_workgroups[2], user_sgpr_info.user_sgpr_idx + 2); + add_arg(&args, s3, &ctx->num_workgroups, user_sgpr_info.user_sgpr_idx); set_loc_shader(ctx, AC_UD_CS_GRID_SIZE, &user_sgpr_info.user_sgpr_idx, 3); } assert(user_sgpr_info.user_sgpr_idx == user_sgpr_info.num_sgpr); @@ -1009,9 +1007,7 @@ Pseudo_instruction *add_startpgm(struct isel_context *ctx) if (ctx->options->supports_spill || ctx->scratch_enabled) add_arg(&args, s1, &ctx->program->scratch_offset, idx++); - add_arg(&args, v1, &ctx->local_invocation_ids[0], vgpr_idx++); - add_arg(&args, v1, &ctx->local_invocation_ids[1], vgpr_idx++); - add_arg(&args, v1, &ctx->local_invocation_ids[2], vgpr_idx++); + add_arg(&args, v3, &ctx->local_invocation_ids, vgpr_idx++); break; } default: