Skip to main content

qualia_core_db/wgsl_forge/execute/
compute.rs

1use super::super::{schedule::Schedule, ForgeError};
2use super::memory::BufferView;
3
4/// A strictly stateless execution bridge designed to execute WGSL Forge IR operations.
5/// It operates exclusively on pre-allocated, heap-free `BufferView` slices
6/// provisioned by a higher-level `QualiaSlabAllocator`.
7pub trait QualiaCompute {
8    /// Dispatches a kernel using the supplied `Schedule` and buffer views.
9    ///
10    /// # Arguments
11    /// * `buffers` - Lightweight pointers to the pre-allocated contiguous device memory.
12    /// * `schedule` - The generated schedule bounding the workgroups.
13    /// * `element_count` - The domain size for dynamic offset tracking.
14    ///
15    /// # Returns
16    /// The hardware execution time in nanoseconds, if supported, otherwise ForgeError.
17    fn dispatch(
18        &self,
19        buffers: &[BufferView],
20        schedule: &Schedule,
21        element_count: usize,
22    ) -> Result<u64, ForgeError>;
23}