aco: Add Primitive Ordered Pixel Shading pseudo-instructions

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Vitaliy Triang3l Kuzmin <triang3l@yandex.ru>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22250>
This commit is contained in:
Vitaliy Triang3l Kuzmin
2023-04-03 21:22:02 +03:00
committed by Marge Bot
parent 94d2888da2
commit f8e744f07f
3 changed files with 36 additions and 1 deletions
@@ -2406,6 +2406,11 @@ lower_to_hw_instr(Program* program)
}
break;
}
case aco_opcode::p_pops_gfx9_add_exiting_wave_id: {
bld.sop2(aco_opcode::s_add_i32, instr->definitions[0], instr->definitions[1],
Operand(pops_exiting_wave_id, s1), instr->operands[0]);
break;
}
case aco_opcode::p_bpermute_gfx6: {
emit_gfx6_bpermute(program, instr, bld);
break;
+28
View File
@@ -293,6 +293,34 @@ opcode("p_cbranch_nz", format=Format.PSEUDO_BRANCH)
opcode("p_barrier", format=Format.PSEUDO_BARRIER)
# Primitive Ordered Pixel Shading pseudo-instructions.
# For querying whether the current wave can enter the ordered section on GFX9-10.3, doing
# s_add_i32(pops_exiting_wave_id, op0), but in a way that it's different from a usual SALU
# instruction so that it's easier to maintain the volatility of pops_exiting_wave_id and to handle
# the polling specially in scheduling.
# Definitions:
# - Result SGPR;
# - Clobbered SCC.
# Operands:
# - s1 value to add, usually -(current_wave_ID + 1) (or ~current_wave_ID) to remap the exiting wave
# ID from wrapping [0, 0x3FF] to monotonic [0, 0xFFFFFFFF].
opcode("p_pops_gfx9_add_exiting_wave_id")
# Indicates that the wait for the completion of the ordered section in overlapped waves has been
# finished on GFX9-10.3. Not lowered to any hardware instructions.
opcode("p_pops_gfx9_overlapped_wave_wait_done")
# Indicates that a POPS ordered section has ended, hints that overlapping waves can possibly
# continue execution. The overlapping waves may actually be resumed by this instruction or anywhere
# later, however, especially taking into account the fact that there can be multiple ordered
# sections in a wave (for instance, if one is chosen in divergent control flow in the source
# shader), thus multiple p_pops_gfx9_ordered_section_done instructions. At least one must be present
# in the program if POPS is used, however, otherwise the location of the end of the ordered section
# will be undefined. Only needed on GFX9-10.3 (GFX11+ ordered section is until the last export,
# can't be exited early). Not lowered to any hardware instructions.
opcode("p_pops_gfx9_ordered_section_done")
opcode("p_spill")
opcode("p_reload")
+3 -1
View File
@@ -357,7 +357,9 @@ can_eliminate(aco_ptr<Instruction>& instr)
}
if (instr->definitions.empty() || instr->opcode == aco_opcode::p_phi ||
instr->opcode == aco_opcode::p_linear_phi || instr->definitions[0].isNoCSE())
instr->opcode == aco_opcode::p_linear_phi ||
instr->opcode == aco_opcode::p_pops_gfx9_add_exiting_wave_id ||
instr->definitions[0].isNoCSE())
return false;
return true;