Skip to main content

MegakernelConfig

Struct MegakernelConfig 

Source
pub struct MegakernelConfig {
    pub worker_count: u32,
    pub max_wall_time: Duration,
    pub expected_items_per_worker: u32,
    pub workload: MegakernelWorkloadHints,
}
Expand description

Configuration for one megakernel dispatch invocation.

Fields§

§worker_count: u32

Number of persistent worker workgroups.

§max_wall_time: Duration

Maximum wall-clock time the megakernel runs before draining queued work and exiting.

§expected_items_per_worker: u32

Hint to the scheduler about expected items per worker.

§workload: MegakernelWorkloadHints

Optional workload-shape hints consumed by the launch policy.

Implementations§

Source§

impl MegakernelConfig

Source

pub fn validate(&self) -> Result<(), BackendError>

Validate the config and surface actionable errors.

§Errors

Returns an error when the worker count is zero or the wall-clock budget is empty, because either condition would make persistent dispatch unschedulable.

Source

pub fn dispatch_grid( &self, queue_len: u32, max_workgroup_size_x: u32, ) -> [u32; 3]

Compute the direct-dispatch grid for queue_len logical work slots.

worker_count is the caller’s persistent worker-workgroup ceiling; the returned grid never launches more workgroups than that ceiling or the backend occupancy cap.

Source

pub const fn launch_request( &self, queue_len: u32, max_workgroup_size_x: u32, max_compute_workgroups_per_dimension: u32, max_compute_invocations_per_workgroup: u32, ) -> MegakernelLaunchRequest

Build a policy request from this config and adapter limits.

Source

pub fn launch_request_for_tasks( &self, tasks: &[TaskWorkItem], max_workgroup_size_x: u32, max_compute_workgroups_per_dimension: u32, max_compute_invocations_per_workgroup: u32, ) -> Result<MegakernelLaunchRequest, BackendError>

Build a policy request from device-visible continuation task slots.

Paused, completed, empty, running, and faulted tasks do not add launch lanes. Yielded and requeued tasks stay schedulable so the GPU can resume them without a CPU-side republish loop.

§Errors

Returns BackendError when a task slot contains an invalid state word.

Source

pub fn launch_recommendation( &self, queue_len: u32, max_workgroup_size_x: u32, max_compute_workgroups_per_dimension: u32, max_compute_invocations_per_workgroup: u32, ) -> Result<MegakernelLaunchRecommendation, BackendError>

Recommend one launch shape through the shared megakernel policy.

§Errors

Returns BackendError when adapter limits are malformed.

Source

pub fn launch_recommendation_for_tasks( &self, tasks: &[TaskWorkItem], max_workgroup_size_x: u32, max_compute_workgroups_per_dimension: u32, max_compute_invocations_per_workgroup: u32, ) -> Result<MegakernelLaunchRecommendation, BackendError>

Recommend one launch shape for a continuation task queue.

§Errors

Returns BackendError when adapter limits are malformed or any task slot contains an invalid state word.

Trait Implementations§

Source§

impl Clone for MegakernelConfig

Source§

fn clone(&self) -> MegakernelConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MegakernelConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MegakernelConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more