Skip to main content

Queue

Struct Queue 

Source
pub struct Queue(/* private fields */);
Expand description

A serialized host producer for one native GPU PM4 queue.

Implementations§

Source§

impl Queue

Source

pub unsafe fn prepare( &self, kernel: &Kernel, grid: [u32; 3], block: [u16; 3], arguments: &[Argument<'_>], ) -> Result<PreparedGpu>

Prepare immutable commands and backing for repeated native execution.

§Safety

Arguments and launch dimensions must satisfy the kernel’s memory contract. The caller orders conflicting accesses across other queues.

Source

pub unsafe fn prepare_batch( &self, commands: &[(PreparedGpu, bool)], ) -> Result<PreparedGpu>

Combine prepared dispatches into one immutable indirect command buffer. A true flag establishes a system-memory dependency on preceding nodes.

§Safety

The supplied barriers must order every conflicting access. Commands must obey their kernel contracts and must not use this batch’s storage elsewhere.

Source

pub unsafe fn prepare_profiled_batch( &self, commands: &[(PreparedGpu, bool)], labels: &[String], ) -> Result<ProfiledGpu>

Instrument every prepared command, including nested batches as one span. Completion barriers serialize the sampled commands. This is diagnostic execution; use ordinary batches for end-to-end performance decisions.

§Safety

The same kernel and cross-queue contracts as prepare_batch apply.

Source

pub fn prepare_wait(&self, completion: &Completion) -> Result<PreparedGpu>

Prepare a device-side wait for an immutable completion point. The source fence and all indirect resources remain owned through retirement.

Source

pub unsafe fn dispatch( &self, kernel: &Kernel, grid: [u32; 3], block: [u16; 3], arguments: &[Argument<'_>], ) -> Result<Completion>

Prepare and publish a single invocation.

§Safety

The kernel and its arguments must obey the declared memory contract; callers order conflicting accesses on other queues.

Source§

impl Queue

Source

pub fn family_ordinal(&self) -> u32

Exact native family used by this queue and its visibility recipes.

Source

pub fn command(&self) -> QueueCommand

Native command representation.

Source

pub fn device(&self) -> &Device

Device whose address domain this queue executes in.

Source

pub fn prepare_copy( &self, destination: &Buffer, destination_offset: usize, source: &Buffer, source_offset: usize, length: usize, ) -> Result<PreparedGpu>

Prepare a copy of any nonempty, in-bounds, non-overlapping byte range. Large transfers are split to fit the selected engine. The returned completion covers every part; operands remain retained until retirement.

Source

pub fn prepare_fill( &self, destination: &Buffer, offset: usize, length: usize, value: u8, ) -> Result<PreparedGpu>

Prepare a byte fill, splitting large ranges for the selected engine.

Examples found in repository?
examples/unified_probe.rs (line 16)
6fn main() -> Result<()> {
7    let fabric = Fabric::resolve()?;
8    let gpu = Device::open(Engine::Gpu, 0)?;
9    let npu = Device::open(Engine::Xdna, 0)?;
10    let buffer = fabric.allocate(1 << 20, &[gpu.clone(), npu.clone()])?;
11    println!(
12        "GPU address={:#x}, XDNA DMA address={:#x}",
13        buffer.device_address(&gpu)?,
14        buffer.device_address(&npu)?
15    );
16    let fill = gpu.queue()?.prepare_fill(&buffer, 0, buffer.len(), 0x5a)?;
17    unsafe { fill.dispatch() }?.wait()?;
18    let mut bytes = vec![0; buffer.len()];
19    buffer.read(0, &mut bytes)?;
20    assert!(bytes.iter().all(|&byte| byte == 0x5a));
21    println!("native shared allocation: {} bytes verified", bytes.len());
22    Ok(())
23}

Trait Implementations§

Source§

impl Clone for Queue

Source§

fn clone(&self) -> Self

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

Auto Trait Implementations§

§

impl Freeze for Queue

§

impl RefUnwindSafe for Queue

§

impl Send for Queue

§

impl Sync for Queue

§

impl Unpin for Queue

§

impl UnsafeUnpin for Queue

§

impl UnwindSafe for Queue

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

Source§

type Flavor = MayDrop

The DropFlavor that wraps T into Self
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

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

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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