pub struct DeviceContext {
pub device: DeviceSpec,
pub device_handle: Arc<Device>,
pub signal: Arc<dyn TimelineSignal>,
pub timeline: AtomicU64,
pub allocator: Arc<dyn Allocator>,
}Expand description
Per-device execution context.
Each device has its own timeline signal, queue, and allocator. This enables parallel execution across devices with proper synchronization.
Fields§
§device: DeviceSpecDevice specification (CPU, CUDA:0, etc.).
device_handle: Arc<Device>Device abstraction for rendering/compiling/executing.
signal: Arc<dyn TimelineSignal>Timeline signal for this device’s operations.
timeline: AtomicU64Current timeline value (monotonically increasing).
allocator: Arc<dyn Allocator>Allocator for this device.
Implementations§
Source§impl DeviceContext
impl DeviceContext
Sourcepub fn new(device: Arc<Device>, signal: Arc<dyn TimelineSignal>) -> Self
pub fn new(device: Arc<Device>, signal: Arc<dyn TimelineSignal>) -> Self
Create a new device context.
Sourcepub fn next_timeline(&self) -> u64
pub fn next_timeline(&self) -> u64
Get the next timeline value and increment.
Sourcepub fn current_timeline(&self) -> u64
pub fn current_timeline(&self) -> u64
Get the current timeline value.
Sourcepub fn signal_completion(&self, value: u64)
pub fn signal_completion(&self, value: u64)
Signal that operations up to the given timeline value are complete.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DeviceContext
impl !RefUnwindSafe for DeviceContext
impl Send for DeviceContext
impl Sync for DeviceContext
impl Unpin for DeviceContext
impl UnsafeUnpin for DeviceContext
impl !UnwindSafe for DeviceContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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