aco, radv: Add load_grid_size_from_user_sgpr to aco options.

v2 by Timur Kristóf:
- Rebase this patch.

Signed-off-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21696>
This commit is contained in:
Qiang Yu 2022-09-22 21:47:49 +08:00 committed by Marge Bot
parent 3058ab6090
commit 978220c99a
4 changed files with 9 additions and 5 deletions

View file

@ -8317,7 +8317,7 @@ visit_intrinsic(isel_context* ctx, nir_intrinsic_instr* instr)
case nir_intrinsic_scoped_barrier: emit_scoped_barrier(ctx, instr); break;
case nir_intrinsic_load_num_workgroups: {
Temp dst = get_ssa_temp(ctx, &instr->dest.ssa);
if (ctx->args->load_grid_size_from_user_sgpr) {
if (ctx->options->load_grid_size_from_user_sgpr) {
bld.copy(Definition(dst), get_arg(ctx, ctx->args->ac.num_work_groups));
} else {
Temp addr = get_arg(ctx, ctx->args->ac.num_work_groups);

View file

@ -172,6 +172,7 @@ struct aco_compiler_options {
bool record_ir;
bool record_stats;
bool has_ls_vgpr_init_bug;
bool load_grid_size_from_user_sgpr;
uint8_t enable_mrt_output_nan_fixup;
bool wgp_mode;
enum radeon_family family;

View file

@ -141,7 +141,8 @@ radv_aco_convert_pipe_key(struct aco_stage_input *aco_info,
static inline void
radv_aco_convert_opts(struct aco_compiler_options *aco_info,
const struct radv_nir_compiler_options *radv)
const struct radv_nir_compiler_options *radv,
const struct radv_shader_args *radv_args)
{
radv_aco_convert_pipe_key(&aco_info->key, &radv->key);
ASSIGN_FIELD(robust_buffer_access);
@ -157,6 +158,8 @@ radv_aco_convert_opts(struct aco_compiler_options *aco_info,
ASSIGN_FIELD(address32_hi);
ASSIGN_FIELD(debug.func);
ASSIGN_FIELD(debug.private_data);
ASSIGN_FIELD(debug.private_data);
aco_info->load_grid_size_from_user_sgpr = radv_args->load_grid_size_from_user_sgpr;
}
#undef ASSIGN_VS_STATE_FIELD
#undef ASSIGN_VS_STATE_FIELD_CP

View file

@ -2387,7 +2387,7 @@ shader_compile(struct radv_device *device, struct nir_shader *const *shaders, in
} else {
struct aco_shader_info ac_info;
struct aco_compiler_options ac_opts;
radv_aco_convert_opts(&ac_opts, &options);
radv_aco_convert_opts(&ac_opts, &options, args);
radv_aco_convert_shader_info(&ac_info, info);
aco_compile_shader(&ac_opts, &ac_info, shader_count, shaders, args, &radv_aco_build_shader_binary, (void **)&binary);
}
@ -2543,7 +2543,7 @@ radv_create_vs_prolog(struct radv_device *device, const struct radv_vs_prolog_ke
struct aco_vs_prolog_key ac_key;
struct aco_compiler_options ac_opts;
radv_aco_convert_shader_info(&ac_info, &info);
radv_aco_convert_opts(&ac_opts, &options);
radv_aco_convert_opts(&ac_opts, &options, &args);
radv_aco_convert_vs_prolog_key(&ac_key, key);
aco_compile_vs_prolog(&ac_opts, &ac_info, &ac_key, &args, &radv_aco_build_shader_part,
(void **)&binary);
@ -2608,7 +2608,7 @@ radv_create_ps_epilog(struct radv_device *device, const struct radv_ps_epilog_ke
struct aco_ps_epilog_key ac_key;
struct aco_compiler_options ac_opts;
radv_aco_convert_shader_info(&ac_info, &info);
radv_aco_convert_opts(&ac_opts, &options);
radv_aco_convert_opts(&ac_opts, &options, &args);
radv_aco_convert_ps_epilog_key(&ac_key, key);
aco_compile_ps_epilog(&ac_opts, &ac_info, &ac_key, &args, &radv_aco_build_shader_part,
(void **)&binary);