aco: always set scratch_offset in startpgm

This patch also moves private_segment_buffer and
scratch_offset to Program to easily access it.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
This commit is contained in:
Daniel Schürmann
2019-10-30 18:24:39 +01:00
parent b0de16b7de
commit c79972b604
3 changed files with 22 additions and 23 deletions
@@ -97,8 +97,6 @@ struct isel_context {
/* scratch */
bool scratch_enabled = false;
Temp private_segment_buffer = Temp(0, s2); /* also the part of the scratch descriptor on compute */
Temp scratch_offset = Temp(0, s1);
/* inputs common for merged stages */
Temp merged_wave_info = Temp(0, s1);
@@ -929,7 +927,7 @@ void add_startpgm(struct isel_context *ctx)
/* this needs to be in sgprs 0 and 1 */
if (ctx->options->supports_spill || user_sgpr_info.need_ring_offsets || ctx->scratch_enabled) {
add_arg(&args, s2, &ctx->private_segment_buffer, 0);
add_arg(&args, s2, &ctx->program->private_segment_buffer, 0);
set_loc_shader_ptr(ctx, AC_UD_SCRATCH_RING_OFFSETS, &user_sgpr_info.user_sgpr_idx);
}
@@ -961,8 +959,8 @@ void add_startpgm(struct isel_context *ctx)
else
declare_streamout_sgprs(ctx, &args, &idx);
if (ctx->scratch_enabled)
add_arg(&args, s1, &ctx->scratch_offset, idx++);
if (ctx->options->supports_spill || ctx->scratch_enabled)
add_arg(&args, s1, &ctx->program->scratch_offset, idx++);
declare_vs_input_vgprs(ctx, &args);
break;
@@ -973,8 +971,8 @@ void add_startpgm(struct isel_context *ctx)
assert(user_sgpr_info.user_sgpr_idx == user_sgpr_info.num_sgpr);
add_arg(&args, s1, &ctx->prim_mask, user_sgpr_info.user_sgpr_idx);
if (ctx->scratch_enabled)
add_arg(&args, s1, &ctx->scratch_offset, user_sgpr_info.user_sgpr_idx + 1);
if (ctx->options->supports_spill || ctx->scratch_enabled)
add_arg(&args, s1, &ctx->program->scratch_offset, user_sgpr_info.user_sgpr_idx + 1);
ctx->program->config->spi_ps_input_addr = 0;
ctx->program->config->spi_ps_input_ena = 0;
@@ -1039,8 +1037,8 @@ void add_startpgm(struct isel_context *ctx)
if (ctx->program->info->cs.uses_local_invocation_idx)
add_arg(&args, s1, &ctx->tg_size, idx++);
if (ctx->scratch_enabled)
add_arg(&args, s1, &ctx->scratch_offset, idx++);
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++);