diff --git a/src/panfrost/compiler/kraid/compile.rs b/src/panfrost/compiler/kraid/compile.rs index 7896eee59a1..a824271f9f2 100644 --- a/src/panfrost/compiler/kraid/compile.rs +++ b/src/panfrost/compiler/kraid/compile.rs @@ -81,6 +81,10 @@ pub extern "C" fn kraid_compile_nir( dump_shader(&s, "after register assignment"); s.validate(); + s.assign_message_slots(); + dump_shader(&s, "after message slot assignment"); + s.validate(); + let bin = model.encode_shader(&s); dynarray_append_vec(binary, bin); } diff --git a/src/panfrost/compiler/kraid/lib.rs b/src/panfrost/compiler/kraid/lib.rs index a15bbcf2c27..b6cd1f694ff 100644 --- a/src/panfrost/compiler/kraid/lib.rs +++ b/src/panfrost/compiler/kraid/lib.rs @@ -9,6 +9,7 @@ mod encode_v9; mod flow; mod ir; mod isa; +mod message_slots; mod model; mod nir; mod ops; diff --git a/src/panfrost/compiler/kraid/message_slots.rs b/src/panfrost/compiler/kraid/message_slots.rs new file mode 100644 index 00000000000..85ed85293ab --- /dev/null +++ b/src/panfrost/compiler/kraid/message_slots.rs @@ -0,0 +1,26 @@ +// Copyright © 2026 Collabora, Ltd. +// SPDX-License-Identifier: MIT + +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) { + i.flow.set_msg_slot_idx(0); + i.flow.set_wait_bit(FlowWaitBit::Slot0); + } + } + } + } +}