aco/gfx12: decrease max_nsa_vgprs for VSAMPLE

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29330>
This commit is contained in:
Rhys Perry 2024-05-23 11:43:06 +01:00 committed by Marge Bot
parent b1b3237590
commit 12b4bdc134
3 changed files with 12 additions and 2 deletions

View file

@ -6068,7 +6068,11 @@ static MIMG_instruction*
emit_mimg(Builder& bld, aco_opcode op, Temp dst, Temp rsrc, Operand samp, std::vector<Temp> coords,
Operand vdata = Operand(v1))
{
bool is_vsample = !samp.isUndefined() || op == aco_opcode::image_msaa_load;
size_t nsa_size = bld.program->dev.max_nsa_vgprs;
if (!is_vsample && bld.program->gfx_level >= GFX12)
nsa_size++; /* VIMAGE can encode one more VADDR */
nsa_size = bld.program->gfx_level >= GFX11 || coords.size() <= nsa_size ? nsa_size : 0;
const bool strict_wqm = coords[0].regClass().is_linear_vgpr();

View file

@ -175,7 +175,10 @@ init_program(Program* program, Stage stage, const struct aco_shader_info* info,
program->dev.scratch_global_offset_max = 4095;
}
if (program->gfx_level >= GFX11) {
if (program->gfx_level >= GFX12) {
/* Same as GFX11, except one less for VSAMPLE. */
program->dev.max_nsa_vgprs = 3;
} else if (program->gfx_level >= GFX11) {
/* GFX11 can have only 1 NSA dword. The last VGPR isn't included here because it contains the
* rest of the address.
*/

View file

@ -800,8 +800,11 @@ validate_ir(Program* program)
check(instr->operands[i].regClass() == v1,
"GFX10 MIMG VADDR must be v1 if NSA is used", instr.get());
} else {
unsigned num_scalar =
program->gfx_level >= GFX12 ? (instr->operands.size() - 4) : 4;
if (instr->opcode != aco_opcode::image_bvh_intersect_ray &&
instr->opcode != aco_opcode::image_bvh64_intersect_ray && i < 7) {
instr->opcode != aco_opcode::image_bvh64_intersect_ray &&
i < 3 + num_scalar) {
check(instr->operands[i].regClass() == v1,
"first 4 GFX11 MIMG VADDR must be v1 if NSA is used", instr.get());
}