Skip to main content

TensorOpScheduler

Struct TensorOpScheduler 

Source
pub struct TensorOpScheduler {
    pub ops: HashMap<u64, TensorOp>,
    /* private fields */
}
Expand description

Priority-based tensor operation scheduler with dependency tracking.

See the module-level documentation for a full usage example.

Fields§

§ops: HashMap<u64, TensorOp>

All registered operations keyed by op_id.

Implementations§

Source§

impl TensorOpScheduler

Source

pub fn new() -> Self

Creates an empty scheduler.

Source

pub fn enqueue( &mut self, name: String, priority: OpPriority, deps: Vec<u64>, flops: u64, ) -> u64

Enqueues a new operation and returns its assigned op_id.

The operation starts in OpStatus::Pending regardless of whether its dependency list is empty. Call advance_tick to promote operations with satisfied dependencies to OpStatus::Ready.

§Arguments
  • name – Human-readable operation name.
  • priority – Scheduling priority.
  • deps – IDs of operations that must complete before this one runs.
  • flops – Estimated floating-point operations for resource accounting.
Source

pub fn advance_tick(&mut self)

Advances the scheduler tick by one and re-evaluates dependency readiness.

Each OpStatus::Pending operation whose every dependency is in OpStatus::Completed is promoted to OpStatus::Ready.

Source

pub fn start_op(&mut self, op_id: u64) -> bool

Attempts to transition the operation to OpStatus::Running.

Returns true on success. Returns false if the operation does not exist or is not in OpStatus::Ready state.

Source

pub fn complete_op(&mut self, op_id: u64) -> bool

Attempts to transition the operation to OpStatus::Completed.

Returns true on success. Returns false if the operation does not exist or is not in OpStatus::Running state.

Source

pub fn fail_op(&mut self, op_id: u64, reason: String) -> bool

Attempts to transition the operation to OpStatus::Failed.

The operation must be in OpStatus::Running or OpStatus::Ready state. Returns true on success, false otherwise.

Source

pub fn next_ready(&self) -> Option<u64>

Returns the op_id of the highest-priority OpStatus::Ready operation.

Ties in priority are broken by the lowest op_id (FIFO within priority). Returns None if no operations are currently in Ready state.

Source

pub fn stats(&self) -> SchedulerStats

Returns a snapshot of aggregate scheduler statistics.

Trait Implementations§

Source§

impl Default for TensorOpScheduler

Source§

fn default() -> Self

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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