radeonsi: reduce sgpr count for scratch_offset when aco

aco add scratch_offset to shader args explicitly.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24989>
This commit is contained in:
Qiang Yu
2023-08-06 11:12:17 +08:00
parent 5ef7c54829
commit c77a57b981

View File

@@ -2877,11 +2877,22 @@ bool si_compile_shader(struct si_screen *sscreen, struct ac_llvm_compiler *compi
}
}
/* Add the scratch offset to input SGPRs. */
/* Add/remove the scratch offset to/from input SGPRs. */
if (sel->screen->info.gfx_level < GFX11 &&
(sel->screen->info.family < CHIP_GFX940 || sel->screen->info.has_graphics) &&
shader->config.scratch_bytes_per_wave && !si_is_merged_shader(shader))
shader->info.num_input_sgprs += 1; /* scratch byte offset */
!si_is_merged_shader(shader)) {
if (shader->use_aco) {
/* When aco scratch_offset arg is added explicitly at the beginning.
* After compile if no scratch used, reduce the input sgpr count.
*/
if (!shader->config.scratch_bytes_per_wave)
shader->info.num_input_sgprs--;
} else {
/* scratch_offset arg is added by llvm implicitly */
if (shader->info.num_input_sgprs)
shader->info.num_input_sgprs++;
}
}
/* Calculate the number of fragment input VGPRs. */
if (sel->stage == MESA_SHADER_FRAGMENT) {