diff --git a/src/panfrost/compiler/kraid/encode_v9.rs b/src/panfrost/compiler/kraid/encode_v9.rs index 24875c62f63..24f3e11b599 100644 --- a/src/panfrost/compiler/kraid/encode_v9.rs +++ b/src/panfrost/compiler/kraid/encode_v9.rs @@ -840,6 +840,14 @@ macro_rules! v9_op_match { }; } +fn v9_op_info(op: &Op, arch: u8) -> Option<&InstructionInfo> { + v9_op_match!(op, |op| op.get_info(arch)) +} + +pub fn v9_op_is_message(op: &Op, arch: u8) -> bool { + v9_op_info(op, arch).is_some_and(|info| info.is_message) +} + fn encode_instr( ip: i64, instr: &Instr, diff --git a/src/panfrost/compiler/kraid/message_slots.rs b/src/panfrost/compiler/kraid/message_slots.rs index 85ed85293ab..a28f7a136d3 100644 --- a/src/panfrost/compiler/kraid/message_slots.rs +++ b/src/panfrost/compiler/kraid/message_slots.rs @@ -4,19 +4,11 @@ use crate::flow::FlowWaitBit; use crate::ir::*; -fn op_is_message(op: &Op) -> bool { - // TODO: Make this real - matches!( - op, - Op::LdPka(_) | Op::LeaPka(_) | Op::Load(_) | Op::Store(_) - ) -} - impl Shader<'_> { pub fn assign_message_slots(&mut self) { for b in self.blocks.iter_mut() { for i in b.instrs.iter_mut() { - if op_is_message(&i.op) { + if self.model.op_is_message(&i.op) { i.flow.set_msg_slot_idx(0); i.flow.set_wait_bit(FlowWaitBit::Slot0); } diff --git a/src/panfrost/compiler/kraid/model.rs b/src/panfrost/compiler/kraid/model.rs index d04ec19e5d3..86908df37ae 100644 --- a/src/panfrost/compiler/kraid/model.rs +++ b/src/panfrost/compiler/kraid/model.rs @@ -10,6 +10,8 @@ pub trait Model { fn encode_shader(&self, s: &Shader<'_>) -> Vec; + fn op_is_message(&self, op: &Op) -> bool; + fn small_constants(&self) -> &[SmallConstant]; } @@ -35,6 +37,10 @@ impl Model for ValhallModel { encode_v9(s, self.arch) } + fn op_is_message(&self, op: &Op) -> bool { + v9_op_is_message(op, self.arch) + } + fn small_constants(&self) -> &[SmallConstant] { &self.sc_table }