diff --git a/crates/cognitive-shader-driver/src/attention_mask.rs b/crates/cognitive-shader-driver/src/attention_mask.rs index 58f4c6d4..03373875 100644 --- a/crates/cognitive-shader-driver/src/attention_mask.rs +++ b/crates/cognitive-shader-driver/src/attention_mask.rs @@ -8,13 +8,12 @@ //! `AttentionMaskSoA` is `!Send` by design (non-atomic interior mutation). //! Callers that need cross-thread access must wrap in `tokio::sync::Mutex`. //! -//! # Registration -//! This file is intentionally NOT registered in `lib.rs`. The main thread -//! adds `pub mod attention_mask;` after the sprint-12 fleet completes. +//! # MailboxId +//! Imports the canonical `MailboxId` alias from +//! `lance_graph_contract::collapse_gate` (also re-exported here for ergonomic +//! `use cognitive_shader_driver::attention_mask::MailboxId` access). -/// Re-export the canonical `MailboxId` alias so this module compiles -/// standalone without an explicit `--extern` flag. -pub type MailboxId = u32; +pub use lance_graph_contract::collapse_gate::MailboxId; // ── SoA row ────────────────────────────────────────────────────────────────── diff --git a/crates/cognitive-shader-driver/src/attention_mask_actor.rs b/crates/cognitive-shader-driver/src/attention_mask_actor.rs index 14a540ff..8e2a7a8e 100644 --- a/crates/cognitive-shader-driver/src/attention_mask_actor.rs +++ b/crates/cognitive-shader-driver/src/attention_mask_actor.rs @@ -33,6 +33,25 @@ pub trait AttentionMaskBackend { fn is_active(&self, mailbox_id: MailboxId) -> bool; } +/// Production-backend impl: wires the sibling `attention_mask::AttentionMaskSoA` +/// into the actor without forcing downstream consumers to write a newtype +/// (Rust orphan rules would block them — neither the trait nor the SoA is +/// theirs). Per codex P2 review on PR #388. +impl AttentionMaskBackend for crate::attention_mask::AttentionMaskSoA { + fn touch(&mut self, mailbox_id: MailboxId, w_slot: u8) -> bool { + crate::attention_mask::AttentionMaskSoA::touch(self, mailbox_id, w_slot) + } + fn evict_lru(&mut self) -> Option { + crate::attention_mask::AttentionMaskSoA::evict_lru(self) + } + fn tick(&mut self) { + crate::attention_mask::AttentionMaskSoA::tick(self) + } + fn is_active(&self, mailbox_id: MailboxId) -> bool { + crate::attention_mask::AttentionMaskSoA::is_active(self, mailbox_id) + } +} + pub struct AttentionMaskActor { inner: B, pending_evictions: Vec,