In particular, the messages needed for GS.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2421>
aco_ptr<Instruction> create_s_mov(Definition dst, Operand src);
+enum sendmsg {
+ sendmsg_none = 0,
+ _sendmsg_gs = 2,
+ _sendmsg_gs_done = 3,
+ sendmsg_save_wave = 4,
+ sendmsg_stall_wave_gen = 5,
+ sendmsg_halt_waves = 6,
+ sendmsg_ordered_ps_done = 7,
+ sendmsg_early_prim_dealloc = 8,
+ sendmsg_gs_alloc_req = 9,
+ sendmsg_id_mask = 0xf,
+};
+
+inline sendmsg
+sendmsg_gs(bool cut, bool emit, unsigned stream)
+{
+ assert(stream < 4);
+ return (sendmsg)((unsigned)_sendmsg_gs | (cut << 4) | (emit << 5) | (stream << 8));
+}
+
+inline sendmsg
+sendmsg_gs_done(bool cut, bool emit, unsigned stream)
+{
+ assert(stream < 4);
+ return (sendmsg)((unsigned)_sendmsg_gs_done | (cut << 4) | (emit << 5) | (stream << 8));
+}
+
class Builder {
public:
struct Result {
}
}
}
+ } else if (instr->format == Format::SOPP) {
+ if (instr->opcode == aco_opcode::s_sendmsg && new_idx > 0) {
+ aco_ptr<Instruction>& pred = new_instructions.back();
+ if (pred->isSALU() &&
+ !pred->definitions.empty() &&
+ pred->definitions[0].physReg() == m0)
+ return 1;
+ }
}
return 0;
event_exp_mrt_null = 1 << 8,
event_gds_gpr_lock = 1 << 9,
event_vmem_gpr_lock = 1 << 10,
+ event_sendmsg = 1 << 11,
};
enum counter_type : uint8_t {
};
static const uint16_t exp_events = event_exp_pos | event_exp_param | event_exp_mrt_null | event_gds_gpr_lock | event_vmem_gpr_lock;
-static const uint16_t lgkm_events = event_smem | event_lds | event_gds | event_flat;
+static const uint16_t lgkm_events = event_smem | event_lds | event_gds | event_flat | event_sendmsg;
static const uint16_t vm_events = event_vmem | event_flat;
static const uint16_t vs_events = event_vmem_store;
case event_smem:
case event_lds:
case event_gds:
+ case event_sendmsg:
return counter_lgkm;
case event_vmem:
return counter_vm;
if (counter == counter_lgkm) {
imm.lgkm = wait_imm::unset_counter;
- events &= ~(event_smem | event_lds | event_gds);
+ events &= ~(event_smem | event_lds | event_gds | event_sendmsg);
}
if (counter == counter_vm) {
}
break;
}
+ case Format::SOPP: {
+ if (instr->opcode == aco_opcode::s_sendmsg ||
+ instr->opcode == aco_opcode::s_sendmsghalt)
+ update_counters(ctx, event_sendmsg, get_barrier_interaction(instr));
+ }
default:
break;
}
case aco_opcode::s_set_gpr_idx_off: {
break;
}
+ case aco_opcode::s_sendmsg: {
+ unsigned id = imm & sendmsg_id_mask;
+ switch (id) {
+ case sendmsg_none:
+ fprintf(output, " sendmsg(MSG_NONE)");
+ break;
+ case _sendmsg_gs:
+ fprintf(output, " sendmsg(gs%s%s, %u)",
+ imm & 0x10 ? ", cut" : "", imm & 0x20 ? ", emit" : "", imm >> 8);
+ break;
+ case _sendmsg_gs_done:
+ fprintf(output, " sendmsg(gs_done%s%s, %u)",
+ imm & 0x10 ? ", cut" : "", imm & 0x20 ? ", emit" : "", imm >> 8);
+ break;
+ case sendmsg_save_wave:
+ fprintf(output, " sendmsg(save_wave)");
+ break;
+ case sendmsg_stall_wave_gen:
+ fprintf(output, " sendmsg(stall_wave_gen)");
+ break;
+ case sendmsg_halt_waves:
+ fprintf(output, " sendmsg(halt_waves)");
+ break;
+ case sendmsg_ordered_ps_done:
+ fprintf(output, " sendmsg(ordered_ps_done)");
+ break;
+ case sendmsg_early_prim_dealloc:
+ fprintf(output, " sendmsg(early_prim_dealloc)");
+ break;
+ case sendmsg_gs_alloc_req:
+ fprintf(output, " sendmsg(gs_alloc_req)");
+ break;
+ }
+ break;
+ }
default: {
if (imm)
fprintf(output, " imm:%u", imm);