pub struct Queue(/* private fields */);Expand description
A serialized host producer for one native GPU PM4 queue.
Implementations§
Source§impl Queue
impl Queue
Sourcepub unsafe fn prepare(
&self,
kernel: &Kernel,
grid: [u32; 3],
block: [u16; 3],
arguments: &[Argument<'_>],
) -> Result<PreparedGpu>
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.
Sourcepub unsafe fn prepare_batch(
&self,
commands: &[(PreparedGpu, bool)],
) -> Result<PreparedGpu>
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.
Sourcepub unsafe fn prepare_profiled_batch(
&self,
commands: &[(PreparedGpu, bool)],
labels: &[String],
) -> Result<ProfiledGpu>
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.
Sourcepub fn prepare_wait(&self, completion: &Completion) -> Result<PreparedGpu>
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.
Sourcepub unsafe fn dispatch(
&self,
kernel: &Kernel,
grid: [u32; 3],
block: [u16; 3],
arguments: &[Argument<'_>],
) -> Result<Completion>
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
impl Queue
Sourcepub fn family_ordinal(&self) -> u32
pub fn family_ordinal(&self) -> u32
Exact native family used by this queue and its visibility recipes.
Sourcepub fn command(&self) -> QueueCommand
pub fn command(&self) -> QueueCommand
Native command representation.
Sourcepub fn prepare_copy(
&self,
destination: &Buffer,
destination_offset: usize,
source: &Buffer,
source_offset: usize,
length: usize,
) -> Result<PreparedGpu>
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.
Sourcepub fn prepare_fill(
&self,
destination: &Buffer,
offset: usize,
length: usize,
value: u8,
) -> Result<PreparedGpu>
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?
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§
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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> ⓘ
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> ⓘ
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