pub struct WgpuBackend { /* private fields */ }Expand description
A real wgpu backend for vyre.
Implementations§
Source§impl WgpuBackend
impl WgpuBackend
Sourcepub fn adapter_info(&self) -> &AdapterInfo
pub fn adapter_info(&self) -> &AdapterInfo
Adapter information selected for this backend instance.
Sourcepub fn device_limits(&self) -> &Limits
pub fn device_limits(&self) -> &Limits
Device limits for this backend instance.
Sourcepub fn acquire() -> Result<Self, BackendError>
pub fn acquire() -> Result<Self, BackendError>
Acquire the backend, probing adapters and returning a structured error when no compatible GPU is found.
Sourcepub fn acquire_adapter(index: usize) -> Result<Self, BackendError>
pub fn acquire_adapter(index: usize) -> Result<Self, BackendError>
Acquire a backend bound to a specific enumerable adapter index.
Sourcepub fn device_queue(&self) -> Arc<(Device, Queue)>
pub fn device_queue(&self) -> Arc<(Device, Queue)>
Consumer-visible snapshot of the live wgpu device + queue.
Sourcepub fn force_device_lost(&self) -> Result<(), BackendError>
pub fn force_device_lost(&self) -> Result<(), BackendError>
Test-only hook that marks the backend device as lost and invalidates caches tied to the current device generation.
Sourcepub fn invalidate_impacted_pipeline_cache(
&self,
intervention_mask: &[u32],
rule_adj: &[u32],
state: &[u32],
join_rules: &[u32],
n: u32,
max_iterations: u32,
pipeline_lineage_cell: &[u32],
pipeline_keys: &[[u8; 32]],
) -> Result<(), BackendError>
pub fn invalidate_impacted_pipeline_cache( &self, intervention_mask: &[u32], rule_adj: &[u32], state: &[u32], join_rules: &[u32], n: u32, max_iterations: u32, pipeline_lineage_cell: &[u32], pipeline_keys: &[[u8; 32]], ) -> Result<(), BackendError>
Invalidate compiled pipeline artifacts selected by a rule-impact mask.
Sourcepub fn invalidate_pipeline_cache_for_changed_op(
&self,
changed_op_handle: u32,
pipeline_lineage_cell: &[u32],
pipeline_keys: &[[u8; 32]],
) -> Result<(), BackendError>
pub fn invalidate_pipeline_cache_for_changed_op( &self, changed_op_handle: u32, pipeline_lineage_cell: &[u32], pipeline_keys: &[[u8; 32]], ) -> Result<(), BackendError>
Convenience wrapper around Self::invalidate_impacted_pipeline_cache
Sourcepub fn invalidate_impacted_disk_cache(
&self,
intervention_mask: &[u32],
rule_adj: &[u32],
state: &[u32],
join_rules: &[u32],
n: u32,
max_iterations: u32,
pipeline_lineage_cell: &[u32],
cache_keys: &[String],
) -> Result<(), BackendError>
pub fn invalidate_impacted_disk_cache( &self, intervention_mask: &[u32], rule_adj: &[u32], state: &[u32], join_rules: &[u32], n: u32, max_iterations: u32, pipeline_lineage_cell: &[u32], cache_keys: &[String], ) -> Result<(), BackendError>
Invalidate disk-cached pipeline artifacts selected by a rule-impact mask.
Sourcepub fn new() -> Result<Self, BackendError>
pub fn new() -> Result<Self, BackendError>
Create the backend if a GPU adapter is available.
Process-wide shared backend handle.
Sourcepub fn dispatch_borrowed_for_each_mapped_output<F>(
&self,
program: &Program,
inputs: &[&[u8]],
config: &DispatchConfig,
visitor: F,
) -> Result<(), BackendError>
pub fn dispatch_borrowed_for_each_mapped_output<F>( &self, program: &Program, inputs: &[&[u8]], config: &DispatchConfig, visitor: F, ) -> Result<(), BackendError>
Dispatch borrowed inputs and visit each mapped output byte slice.
Sourcepub fn dispatch_borrowed_for_each_pod_output<T, F>(
&self,
program: &Program,
inputs: &[&[u8]],
config: &DispatchConfig,
visitor: F,
) -> Result<(), BackendError>
pub fn dispatch_borrowed_for_each_pod_output<T, F>( &self, program: &Program, inputs: &[&[u8]], config: &DispatchConfig, visitor: F, ) -> Result<(), BackendError>
Dispatch borrowed inputs and visit each mapped output as a typed POD slice.
Sourcepub fn dispatch_speculative_prefilter_confirm<F>(
&self,
speculator: &AdaptiveSpeculator,
plan: SpeculativeDispatchPlan<'_>,
inputs: &[&[u8]],
config: &DispatchConfig,
confirm_serial: F,
) -> Result<SpeculativeDispatchOutcome, BackendError>
pub fn dispatch_speculative_prefilter_confirm<F>( &self, speculator: &AdaptiveSpeculator, plan: SpeculativeDispatchPlan<'_>, inputs: &[&[u8]], config: &DispatchConfig, confirm_serial: F, ) -> Result<SpeculativeDispatchOutcome, BackendError>
Dispatch a real prefilter/confirm scan through the adaptive speculative path.
Sourcepub fn dispatch_borrowed_batch(
&self,
jobs: &[(&Program, &[&[u8]], &DispatchConfig)],
) -> Result<Vec<Result<OutputBuffers, BackendError>>, BackendError>
pub fn dispatch_borrowed_batch( &self, jobs: &[(&Program, &[&[u8]], &DispatchConfig)], ) -> Result<Vec<Result<OutputBuffers, BackendError>>, BackendError>
Dispatch a batch of borrowed (Program, inputs, config) triples.
Sourcepub fn dispatch_borrowed_batch_into(
&self,
jobs: &[(&Program, &[&[u8]], &DispatchConfig)],
outputs: &mut [OutputBuffers],
) -> Result<Vec<Result<(), BackendError>>, BackendError>
pub fn dispatch_borrowed_batch_into( &self, jobs: &[(&Program, &[&[u8]], &DispatchConfig)], outputs: &mut [OutputBuffers], ) -> Result<Vec<Result<(), BackendError>>, BackendError>
Dispatch a borrowed batch and write each job’s outputs into caller-owned per-job output buffers.
Sourcepub fn dispatch_batch(
&self,
jobs: &[(Program, Vec<Vec<u8>>, DispatchConfig)],
) -> Result<Vec<Result<OutputBuffers, BackendError>>, BackendError>
pub fn dispatch_batch( &self, jobs: &[(Program, Vec<Vec<u8>>, DispatchConfig)], ) -> Result<Vec<Result<OutputBuffers, BackendError>>, BackendError>
Dispatch an owned batch of (Program, inputs, config) triples.
Sourcepub fn compile_streaming(
&self,
program: &Program,
config: DispatchConfig,
) -> Result<HostIngressStream, BackendError>
pub fn compile_streaming( &self, program: &Program, config: DispatchConfig, ) -> Result<HostIngressStream, BackendError>
Compile a program into a host-ingress wgpu stream.
Sourcepub fn compile_persistent(
&self,
program: &Program,
config: &DispatchConfig,
) -> Result<Arc<WgpuPipeline>, BackendError>
pub fn compile_persistent( &self, program: &Program, config: &DispatchConfig, ) -> Result<Arc<WgpuPipeline>, BackendError>
Compile a program into a persistent pipeline.
Source§impl WgpuBackend
impl WgpuBackend
Sourcepub fn allocate_wgpu_device_buffer(
&self,
byte_len: usize,
) -> Result<Box<dyn DeviceBuffer>, BackendError>
pub fn allocate_wgpu_device_buffer( &self, byte_len: usize, ) -> Result<Box<dyn DeviceBuffer>, BackendError>
Allocate a new GPU-resident buffer of byte_len bytes. The
buffer is created with STORAGE | COPY_SRC | COPY_DST so it can
participate in dispatch as either input or output and round-
trip through upload_device_buffer / download_device_buffer.
§Errors
Returns a backend error if the underlying wgpu allocation fails (e.g. byte_len exceeds device limits).
Sourcepub fn upload_wgpu_device_buffer(
&self,
buffer: &mut dyn DeviceBuffer,
bytes: &[u8],
) -> Result<(), BackendError>
pub fn upload_wgpu_device_buffer( &self, buffer: &mut dyn DeviceBuffer, bytes: &[u8], ) -> Result<(), BackendError>
Upload bytes into a previously-allocated wgpu DeviceBuffer.
Bytes shorter than the allocation are written at offset 0; the
remainder of the buffer is left as-is. Bytes longer than the
allocation are an error.
§Errors
Returns a backend error when the buffer was not allocated by
this backend, when bytes exceeds the buffer’s allocation, or
when the wgpu queue write fails.
Sourcepub fn download_wgpu_device_buffer(
&self,
buffer: &dyn DeviceBuffer,
) -> Result<Vec<u8>, BackendError>
pub fn download_wgpu_device_buffer( &self, buffer: &dyn DeviceBuffer, ) -> Result<Vec<u8>, BackendError>
Download the full byte_len of a previously-allocated wgpu
DeviceBuffer into a fresh Vec<u8>.
§Errors
Returns a backend error when the buffer was not allocated by this backend or when the readback fails (typically: buffer missing COPY_SRC, which the standard allocator path includes).
Sourcepub fn free_wgpu_device_buffer(
&self,
buffer: Box<dyn DeviceBuffer>,
) -> Result<(), BackendError>
pub fn free_wgpu_device_buffer( &self, buffer: Box<dyn DeviceBuffer>, ) -> Result<(), BackendError>
Free a previously-allocated wgpu DeviceBuffer. The wgpu allocation is released when the underlying Arcwgpu::Buffer reaches zero references - dropping the box here is sufficient.
§Errors
Returns a backend error when the buffer was not allocated by this backend.
Source§impl WgpuBackend
impl WgpuBackend
Sourcepub fn lower_to_backend_ir(
&self,
program: &Program,
) -> Result<WgpuProgram, LoweringError>
pub fn lower_to_backend_ir( &self, program: &Program, ) -> Result<WgpuProgram, LoweringError>
Lower core IR into the backend-owned wgpu IR.
Sourcepub fn lower_to_target<'a>(&self, bir: &'a WgpuProgram) -> &'a Module
pub fn lower_to_target<'a>(&self, bir: &'a WgpuProgram) -> &'a Module
Borrow the Naga module produced by lowering (WgpuProgram::from_program).
This avoids cloning the entire naga::Module; callers that need an owned
copy can call .clone() explicitly.
Source§impl WgpuBackend
impl WgpuBackend
Sourcepub fn compile(&self, program: &Program) -> Result<WgpuIR, BackendError>
pub fn compile(&self, program: &Program) -> Result<WgpuIR, BackendError>
Compile a program once for repeated dispatch.
Sourcepub fn dispatch_compiled(
&self,
compiled: &WgpuIR,
inputs: &[MemoryRef<'_>],
config: &DispatchConfig,
) -> Result<Vec<Memory>, BackendError>
pub fn dispatch_compiled( &self, compiled: &WgpuIR, inputs: &[MemoryRef<'_>], config: &DispatchConfig, ) -> Result<Vec<Memory>, BackendError>
Dispatch a previously compiled program artifact.
Source§impl WgpuBackend
impl WgpuBackend
Source§impl WgpuBackend
impl WgpuBackend
Sourcepub fn probe_op(&self, op: UnOp, input: &[u8]) -> Result<Vec<u8>, BackendError>
pub fn probe_op(&self, op: UnOp, input: &[u8]) -> Result<Vec<u8>, BackendError>
Dispatch a canonical one-op f32 unary probe and return raw output bytes.
§Errors
Returns a backend error when input is not one f32, the op is not a
supported f32 unary probe, or the WGSL dispatch/readback fails.
Sourcepub fn probe_op_many(
&self,
op: UnOp,
inputs: &[f32],
) -> Result<Vec<f32>, BackendError>
pub fn probe_op_many( &self, op: UnOp, inputs: &[f32], ) -> Result<Vec<f32>, BackendError>
Dispatch a canonical f32 unary probe over a batch of inputs.
This keeps parity tests from paying one GPU submission and readback per scalar sample. The generated WGSL is keyed by operation, so the backend pipeline cache reuses it across calls.
§Errors
Returns a backend error when the operation is unsupported, the batch is too large for WebGPU dispatch dimensions, or dispatch/readback fails.
Source§impl WgpuBackend
impl WgpuBackend
Sourcepub fn adapter_caps(&self) -> AdapterCaps
pub fn adapter_caps(&self) -> AdapterCaps
Optimizer-facing capability snapshot for this live backend.
Unlike adapter-only probes, this reflects the features that were actually enabled on the device after backend construction.
Sourcepub fn device_profile(&self) -> DeviceProfile
pub fn device_profile(&self) -> DeviceProfile
Driver-neutral capability profile for this live backend.
Sourcepub fn stats(&self) -> WgpuBackendStats
pub fn stats(&self) -> WgpuBackendStats
Observability snapshot - pipeline cache size, buffer-pool stats, and adapter identity. SRE-friendly: consumers feed the returned numbers into prometheus / OpenTelemetry / Datadog pipelines for dashboards and alerting.
Reads use atomic cache counters and the lock-free persistent-pool pointer, so the call is safe for metrics-scrape loops.
Trait Implementations§
Source§impl BackendValidationCapabilities for WgpuBackend
impl BackendValidationCapabilities for WgpuBackend
Source§fn backend_name(&self) -> &'static str
fn backend_name(&self) -> &'static str
Source§fn supports_cast_target(&self, target: &DataType) -> bool
fn supports_cast_target(&self, target: &DataType) -> bool
target.Source§fn supports_subgroup_ops(&self) -> bool
fn supports_subgroup_ops(&self) -> bool
Source§fn supports_indirect_dispatch(&self) -> bool
fn supports_indirect_dispatch(&self) -> bool
Source§fn supports_specialization_constants(&self) -> bool
fn supports_specialization_constants(&self) -> bool
Source§fn supports_distributed_collectives(&self) -> bool
fn supports_distributed_collectives(&self) -> bool
Source§fn backend_capabilities(&self) -> BackendCapabilities
fn backend_capabilities(&self) -> BackendCapabilities
Source§impl Clone for WgpuBackend
impl Clone for WgpuBackend
Source§fn clone(&self) -> WgpuBackend
fn clone(&self) -> WgpuBackend
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WgpuBackend
impl Debug for WgpuBackend
Source§impl Executable for WgpuBackend
impl Executable for WgpuBackend
Source§fn dispatch(
&self,
program: &Program,
inputs: &[MemoryRef<'_>],
config: &DispatchConfig,
) -> Result<Vec<Memory>, BackendError>
fn dispatch( &self, program: &Program, inputs: &[MemoryRef<'_>], config: &DispatchConfig, ) -> Result<Vec<Memory>, BackendError>
Source§impl OptimizerDispatcher for WgpuBackend
impl OptimizerDispatcher for WgpuBackend
Source§fn dispatch(
&self,
program: &Program,
inputs: &[Vec<u8>],
grid_override: Option<[u32; 3]>,
) -> Result<Vec<Vec<u8>>, DispatchError>
fn dispatch( &self, program: &Program, inputs: &[Vec<u8>], grid_override: Option<[u32; 3]>, ) -> Result<Vec<Vec<u8>>, DispatchError>
program with the given byte inputs (one Vec<u8>
per declared input buffer in canonical buffer order). Returns
the declared outputs in the same canonical order. Read moreSource§fn supports_persistent(&self) -> bool
fn supports_persistent(&self) -> bool
Source§fn device_feature_cache_key(&self) -> u64
fn device_feature_cache_key(&self) -> u64
Source§fn alloc_resident(&self, _byte_len: usize) -> Result<u64, DispatchError>
fn alloc_resident(&self, _byte_len: usize) -> Result<u64, DispatchError>
free_resident to release.Source§fn alloc_resident_many(
&self,
byte_lens: &[usize],
) -> Result<Vec<u64>, DispatchError>
fn alloc_resident_many( &self, byte_lens: &[usize], ) -> Result<Vec<u64>, DispatchError>
Source§fn upload_resident(
&self,
_handle: u64,
_bytes: &[u8],
) -> Result<(), DispatchError>
fn upload_resident( &self, _handle: u64, _bytes: &[u8], ) -> Result<(), DispatchError>
Source§fn upload_resident_many(
&self,
uploads: &[(u64, &[u8])],
) -> Result<(), DispatchError>
fn upload_resident_many( &self, uploads: &[(u64, &[u8])], ) -> Result<(), DispatchError>
Source§fn acquire_resident_static_uploads(
&self,
_cache_domain: u64,
payloads: &[&[u8]],
) -> Result<ResidentStaticBufferSet, DispatchError>
fn acquire_resident_static_uploads( &self, _cache_domain: u64, payloads: &[&[u8]], ) -> Result<ResidentStaticBufferSet, DispatchError>
Source§fn release_resident_static_uploads(
&self,
set: ResidentStaticBufferSet,
) -> Result<(), DispatchError>
fn release_resident_static_uploads( &self, set: ResidentStaticBufferSet, ) -> Result<(), DispatchError>
Self::acquire_resident_static_uploads.Source§fn read_resident(&self, _handle: u64) -> Result<Vec<u8>, DispatchError>
fn read_resident(&self, _handle: u64) -> Result<Vec<u8>, DispatchError>
Source§fn read_resident_many(
&self,
handles: &[u64],
) -> Result<Vec<Vec<u8>>, DispatchError>
fn read_resident_many( &self, handles: &[u64], ) -> Result<Vec<Vec<u8>>, DispatchError>
Source§fn read_resident_ranges(
&self,
ranges: &[ResidentReadRange],
) -> Result<Vec<Vec<u8>>, DispatchError>
fn read_resident_ranges( &self, ranges: &[ResidentReadRange], ) -> Result<Vec<Vec<u8>>, DispatchError>
Source§fn read_resident_ranges_into(
&self,
ranges: &[ResidentReadRange],
outputs: &mut Vec<Vec<u8>>,
) -> Result<(), DispatchError>
fn read_resident_ranges_into( &self, ranges: &[ResidentReadRange], outputs: &mut Vec<Vec<u8>>, ) -> Result<(), DispatchError>
Source§fn free_resident(&self, _handle: u64) -> Result<(), DispatchError>
fn free_resident(&self, _handle: u64) -> Result<(), DispatchError>
alloc_resident.Source§fn dispatch_resident(
&self,
_program: &Program,
_handles: &[u64],
_grid_override: Option<[u32; 3]>,
) -> Result<(), DispatchError>
fn dispatch_resident( &self, _program: &Program, _handles: &[u64], _grid_override: Option<[u32; 3]>, ) -> Result<(), DispatchError>
read_resident once at end of pipeline.Source§fn dispatch_resident_sequence(
&self,
steps: &[ResidentDispatchStep<'_>],
) -> Result<(), DispatchError>
fn dispatch_resident_sequence( &self, steps: &[ResidentDispatchStep<'_>], ) -> Result<(), DispatchError>
Source§fn dispatch_resident_sequence_read_many(
&self,
steps: &[ResidentDispatchStep<'_>],
read_handles: &[u64],
) -> Result<Vec<Vec<u8>>, DispatchError>
fn dispatch_resident_sequence_read_many( &self, steps: &[ResidentDispatchStep<'_>], read_handles: &[u64], ) -> Result<Vec<Vec<u8>>, DispatchError>
Source§fn dispatch_resident_sequence_read_ranges(
&self,
steps: &[ResidentDispatchStep<'_>],
read_ranges: &[ResidentReadRange],
) -> Result<Vec<Vec<u8>>, DispatchError>
fn dispatch_resident_sequence_read_ranges( &self, steps: &[ResidentDispatchStep<'_>], read_ranges: &[ResidentReadRange], ) -> Result<Vec<Vec<u8>>, DispatchError>
Source§fn upload_resident_many_sequence_read_many(
&self,
uploads: &[(u64, &[u8])],
steps: &[ResidentDispatchStep<'_>],
read_handles: &[u64],
) -> Result<Vec<Vec<u8>>, DispatchError>
fn upload_resident_many_sequence_read_many( &self, uploads: &[(u64, &[u8])], steps: &[ResidentDispatchStep<'_>], read_handles: &[u64], ) -> Result<Vec<Vec<u8>>, DispatchError>
Source§fn upload_resident_many_sequence_read_ranges(
&self,
uploads: &[(u64, &[u8])],
steps: &[ResidentDispatchStep<'_>],
read_ranges: &[ResidentReadRange],
) -> Result<Vec<Vec<u8>>, DispatchError>
fn upload_resident_many_sequence_read_ranges( &self, uploads: &[(u64, &[u8])], steps: &[ResidentDispatchStep<'_>], read_ranges: &[ResidentReadRange], ) -> Result<Vec<Vec<u8>>, DispatchError>
Source§fn upload_resident_many_sequence_read_many_into(
&self,
uploads: &[(u64, &[u8])],
steps: &[ResidentDispatchStep<'_>],
read_handles: &[u64],
outputs: &mut Vec<Vec<u8>>,
) -> Result<(), DispatchError>
fn upload_resident_many_sequence_read_many_into( &self, uploads: &[(u64, &[u8])], steps: &[ResidentDispatchStep<'_>], read_handles: &[u64], outputs: &mut Vec<Vec<u8>>, ) -> Result<(), DispatchError>
Self::upload_resident_many_sequence_read_many,
but writes readbacks into caller-owned byte slots.Source§fn clear_upload_resident_many_sequence_read_many_into(
&self,
clears: &[(u64, usize)],
uploads: &[(u64, &[u8])],
steps: &[ResidentDispatchStep<'_>],
read_handles: &[u64],
outputs: &mut Vec<Vec<u8>>,
) -> Result<(), DispatchError>
fn clear_upload_resident_many_sequence_read_many_into( &self, clears: &[(u64, usize)], uploads: &[(u64, &[u8])], steps: &[ResidentDispatchStep<'_>], read_handles: &[u64], outputs: &mut Vec<Vec<u8>>, ) -> Result<(), DispatchError>
Self::upload_resident_many_sequence_read_many_into,
but first clears full resident buffers to zero. Read moreSource§fn fill_upload_resident_many_sequence_read_many_into(
&self,
fills: &[(u64, usize, u8)],
uploads: &[(u64, &[u8])],
steps: &[ResidentDispatchStep<'_>],
read_handles: &[u64],
outputs: &mut Vec<Vec<u8>>,
) -> Result<(), DispatchError>
fn fill_upload_resident_many_sequence_read_many_into( &self, fills: &[(u64, usize, u8)], uploads: &[(u64, &[u8])], steps: &[ResidentDispatchStep<'_>], read_handles: &[u64], outputs: &mut Vec<Vec<u8>>, ) -> Result<(), DispatchError>
Self::clear_upload_resident_many_sequence_read_many_into, but fills
each resident buffer with an arbitrary byte value.Source§fn fill_upload_resident_many_sequence_read_ranges_into(
&self,
fills: &[(u64, usize, u8)],
uploads: &[(u64, &[u8])],
steps: &[ResidentDispatchStep<'_>],
read_ranges: &[ResidentReadRange],
outputs: &mut Vec<Vec<u8>>,
) -> Result<(), DispatchError>
fn fill_upload_resident_many_sequence_read_ranges_into( &self, fills: &[(u64, usize, u8)], uploads: &[(u64, &[u8])], steps: &[ResidentDispatchStep<'_>], read_ranges: &[ResidentReadRange], outputs: &mut Vec<Vec<u8>>, ) -> Result<(), DispatchError>
Self::upload_resident_many_sequence_read_ranges_into,
but fills resident buffers first. CUDA overrides this to use device
memset and compact D2H range copies on the same stream.Source§fn upload_resident_many_sequence_read_ranges_into(
&self,
uploads: &[(u64, &[u8])],
steps: &[ResidentDispatchStep<'_>],
read_ranges: &[ResidentReadRange],
outputs: &mut Vec<Vec<u8>>,
) -> Result<(), DispatchError>
fn upload_resident_many_sequence_read_ranges_into( &self, uploads: &[(u64, &[u8])], steps: &[ResidentDispatchStep<'_>], read_ranges: &[ResidentReadRange], outputs: &mut Vec<Vec<u8>>, ) -> Result<(), DispatchError>
Self::upload_resident_many_sequence_read_ranges,
but writes compact readbacks into caller-owned byte slots.impl Sealed for WgpuBackend
Source§impl VyreBackend for WgpuBackend
impl VyreBackend for WgpuBackend
Source§fn id(&self) -> &'static str
fn id(&self) -> &'static str
Source§fn version(&self) -> &'static str
fn version(&self) -> &'static str
Source§fn supported_ops(&self) -> &HashSet<OpId>
fn supported_ops(&self) -> &HashSet<OpId>
Source§fn dispatch(
&self,
program: &Program,
inputs: &[Vec<u8>],
config: &DispatchConfig,
) -> Result<Vec<Vec<u8>>, BackendError>
fn dispatch( &self, program: &Program, inputs: &[Vec<u8>], config: &DispatchConfig, ) -> Result<Vec<Vec<u8>>, BackendError>
Source§fn dispatch_borrowed(
&self,
program: &Program,
inputs: &[&[u8]],
config: &DispatchConfig,
) -> Result<Vec<Vec<u8>>, BackendError>
fn dispatch_borrowed( &self, program: &Program, inputs: &[&[u8]], config: &DispatchConfig, ) -> Result<Vec<Vec<u8>>, BackendError>
Source§fn dispatch_borrowed_into(
&self,
program: &Program,
inputs: &[&[u8]],
config: &DispatchConfig,
outputs: &mut OutputBuffers,
) -> Result<(), BackendError>
fn dispatch_borrowed_into( &self, program: &Program, inputs: &[&[u8]], config: &DispatchConfig, outputs: &mut OutputBuffers, ) -> Result<(), BackendError>
Source§fn dispatch_borrowed_timed(
&self,
program: &Program,
inputs: &[&[u8]],
config: &DispatchConfig,
) -> Result<TimedDispatchResult, BackendError>
fn dispatch_borrowed_timed( &self, program: &Program, inputs: &[&[u8]], config: &DispatchConfig, ) -> Result<TimedDispatchResult, BackendError>
Source§fn dispatch_async(
&self,
program: &Program,
inputs: &[Vec<u8>],
config: &DispatchConfig,
) -> Result<Box<dyn PendingDispatch>, BackendError>
fn dispatch_async( &self, program: &Program, inputs: &[Vec<u8>], config: &DispatchConfig, ) -> Result<Box<dyn PendingDispatch>, BackendError>
Source§fn dispatch_borrowed_async(
&self,
program: &Program,
inputs: &[&[u8]],
config: &DispatchConfig,
) -> Result<Box<dyn PendingDispatch>, BackendError>
fn dispatch_borrowed_async( &self, program: &Program, inputs: &[&[u8]], config: &DispatchConfig, ) -> Result<Box<dyn PendingDispatch>, BackendError>
Source§fn compile_native(
&self,
program: &Program,
config: &DispatchConfig,
) -> Result<Option<Arc<dyn CompiledPipeline>>, BackendError>
fn compile_native( &self, program: &Program, config: &DispatchConfig, ) -> Result<Option<Arc<dyn CompiledPipeline>>, BackendError>
Source§fn allocate_device_buffer(
&self,
byte_len: usize,
) -> Result<Box<dyn DeviceBuffer>, BackendError>
fn allocate_device_buffer( &self, byte_len: usize, ) -> Result<Box<dyn DeviceBuffer>, BackendError>
byte_len bytes. Read moreSource§fn upload_device_buffer(
&self,
buffer: &mut dyn DeviceBuffer,
bytes: &[u8],
) -> Result<(), BackendError>
fn upload_device_buffer( &self, buffer: &mut dyn DeviceBuffer, bytes: &[u8], ) -> Result<(), BackendError>
Source§fn download_device_buffer(
&self,
buffer: &dyn DeviceBuffer,
) -> Result<Vec<u8>, BackendError>
fn download_device_buffer( &self, buffer: &dyn DeviceBuffer, ) -> Result<Vec<u8>, BackendError>
Vec<u8>. Read moreSource§fn free_device_buffer(
&self,
buffer: Box<dyn DeviceBuffer>,
) -> Result<(), BackendError>
fn free_device_buffer( &self, buffer: Box<dyn DeviceBuffer>, ) -> Result<(), BackendError>
Self::allocate_device_buffer. Explicit-free is required
because the substrate does not assume reference-counted backend
handles; consumers are responsible for calling this when done. Read moreSource§fn allocate_resident(&self, byte_len: usize) -> Result<Resource, BackendError>
fn allocate_resident(&self, byte_len: usize) -> Result<Resource, BackendError>
Source§fn upload_resident(
&self,
resource: &Resource,
bytes: &[u8],
) -> Result<(), BackendError>
fn upload_resident( &self, resource: &Resource, bytes: &[u8], ) -> Result<(), BackendError>
Source§fn upload_resident_many(
&self,
uploads: &[(&Resource, &[u8])],
) -> Result<(), BackendError>
fn upload_resident_many( &self, uploads: &[(&Resource, &[u8])], ) -> Result<(), BackendError>
Source§fn upload_resident_at(
&self,
resource: &Resource,
dst_offset_bytes: usize,
bytes: &[u8],
) -> Result<(), BackendError>
fn upload_resident_at( &self, resource: &Resource, dst_offset_bytes: usize, bytes: &[u8], ) -> Result<(), BackendError>
Source§fn upload_resident_at_many(
&self,
uploads: &[(&Resource, usize, &[u8])],
) -> Result<(), BackendError>
fn upload_resident_at_many( &self, uploads: &[(&Resource, usize, &[u8])], ) -> Result<(), BackendError>
Source§fn download_resident(
&self,
resource: &Resource,
) -> Result<Vec<u8>, BackendError>
fn download_resident( &self, resource: &Resource, ) -> Result<Vec<u8>, BackendError>
Source§fn download_resident_into(
&self,
resource: &Resource,
out: &mut Vec<u8>,
) -> Result<(), BackendError>
fn download_resident_into( &self, resource: &Resource, out: &mut Vec<u8>, ) -> Result<(), BackendError>
Source§fn download_resident_range(
&self,
resource: &Resource,
byte_offset: usize,
byte_len: usize,
) -> Result<Vec<u8>, BackendError>
fn download_resident_range( &self, resource: &Resource, byte_offset: usize, byte_len: usize, ) -> Result<Vec<u8>, BackendError>
Source§fn download_resident_range_into(
&self,
resource: &Resource,
byte_offset: usize,
byte_len: usize,
out: &mut Vec<u8>,
) -> Result<(), BackendError>
fn download_resident_range_into( &self, resource: &Resource, byte_offset: usize, byte_len: usize, out: &mut Vec<u8>, ) -> Result<(), BackendError>
Source§fn download_resident_ranges_into(
&self,
ranges: &[(&Resource, usize, usize)],
outputs: &mut [&mut Vec<u8>],
) -> Result<(), BackendError>
fn download_resident_ranges_into( &self, ranges: &[(&Resource, usize, usize)], outputs: &mut [&mut Vec<u8>], ) -> Result<(), BackendError>
Source§fn free_resident(&self, resource: Resource) -> Result<(), BackendError>
fn free_resident(&self, resource: Resource) -> Result<(), BackendError>
VyreBackend::allocate_resident. Read moreSource§fn dispatch_resident_timed(
&self,
program: &Program,
resources: &[Resource],
config: &DispatchConfig,
) -> Result<TimedDispatchResult, BackendError>
fn dispatch_resident_timed( &self, program: &Program, resources: &[Resource], config: &DispatchConfig, ) -> Result<TimedDispatchResult, BackendError>
Source§fn dispatch_with_device_buffers(
&self,
program: &Program,
inputs: &[&dyn DeviceBuffer],
outputs: &mut [&mut dyn DeviceBuffer],
config: &DispatchConfig,
) -> Result<(), BackendError>
fn dispatch_with_device_buffers( &self, program: &Program, inputs: &[&dyn DeviceBuffer], outputs: &mut [&mut dyn DeviceBuffer], config: &DispatchConfig, ) -> Result<(), BackendError>
Source§fn pipeline_cache_snapshot(&self) -> Option<PipelineCacheSnapshot>
fn pipeline_cache_snapshot(&self) -> Option<PipelineCacheSnapshot>
Source§fn supports_subgroup_ops(&self) -> bool
fn supports_subgroup_ops(&self) -> bool
Source§fn supports_f16(&self) -> bool
fn supports_f16(&self) -> bool
DataType::F16)
natively rather than emulating through f32. Read moreSource§fn supports_bf16(&self) -> bool
fn supports_bf16(&self) -> bool
DataType::BF16) natively. Read moreSource§fn supports_tensor_cores(&self) -> bool
fn supports_tensor_cores(&self) -> bool
Source§fn supports_async_compute(&self) -> bool
fn supports_async_compute(&self) -> bool
Source§fn supports_indirect_dispatch(&self) -> bool
fn supports_indirect_dispatch(&self) -> bool
Node::IndirectDispatch). Read moreSource§fn supports_speculation(&self) -> bool
fn supports_speculation(&self) -> bool
Source§fn supports_persistent_thread_dispatch(&self) -> bool
fn supports_persistent_thread_dispatch(&self) -> bool
Source§fn is_distributed(&self) -> bool
fn is_distributed(&self) -> bool
Source§fn max_workgroup_size(&self) -> [u32; 3]
fn max_workgroup_size(&self) -> [u32; 3]
[x, y, z]. Read moreSource§fn max_compute_workgroups_per_dimension(&self) -> u32
fn max_compute_workgroups_per_dimension(&self) -> u32
Source§fn max_compute_invocations_per_workgroup(&self) -> u32
fn max_compute_invocations_per_workgroup(&self) -> u32
Source§fn subgroup_size(&self) -> Option<u32>
fn subgroup_size(&self) -> Option<u32>
None tells the dispatch planner the backend can’t report a
subgroup width - the planner falls back to max_workgroup_size
for its sizing heuristic. Read moreSource§fn max_storage_buffer_bytes(&self) -> u64
fn max_storage_buffer_bytes(&self) -> u64
0 means the backend has not reported a limit, not
“unlimited”. Read moreSource§fn device_profile(&self) -> DeviceProfile
fn device_profile(&self) -> DeviceProfile
Source§fn flush(&self) -> Result<(), BackendError>
fn flush(&self) -> Result<(), BackendError>
Source§fn device_lost(&self) -> bool
fn device_lost(&self) -> bool
Source§fn try_recover(&self) -> Result<(), BackendError>
fn try_recover(&self) -> Result<(), BackendError>
Source§fn dispatch_resident_sequence_read_ranges_into(
&self,
steps: &[ResidentDispatchStep<'_>],
read_ranges: &[ResidentReadRange<'_>],
outputs: &mut [&mut Vec<u8>],
) -> Result<(), BackendError>
fn dispatch_resident_sequence_read_ranges_into( &self, steps: &[ResidentDispatchStep<'_>], read_ranges: &[ResidentReadRange<'_>], outputs: &mut [&mut Vec<u8>], ) -> Result<(), BackendError>
Source§fn dispatch_resident_sequence_read_ranges_timed_into(
&self,
steps: &[ResidentDispatchStep<'_>],
read_ranges: &[ResidentReadRange<'_>],
outputs: &mut [&mut Vec<u8>],
) -> Result<ResidentSequenceTiming, BackendError>
fn dispatch_resident_sequence_read_ranges_timed_into( &self, steps: &[ResidentDispatchStep<'_>], read_ranges: &[ResidentReadRange<'_>], outputs: &mut [&mut Vec<u8>], ) -> Result<ResidentSequenceTiming, BackendError>
VyreBackend::dispatch_resident_sequence_read_ranges_into. Read moreSource§fn dispatch_resident_repeated_sequence_read_ranges_into(
&self,
prefix_steps: &[ResidentDispatchStep<'_>],
repeated_steps: &[ResidentDispatchStep<'_>],
repeat_count: u32,
read_ranges: &[ResidentReadRange<'_>],
outputs: &mut [&mut Vec<u8>],
) -> Result<(), BackendError>
fn dispatch_resident_repeated_sequence_read_ranges_into( &self, prefix_steps: &[ResidentDispatchStep<'_>], repeated_steps: &[ResidentDispatchStep<'_>], repeat_count: u32, read_ranges: &[ResidentReadRange<'_>], outputs: &mut [&mut Vec<u8>], ) -> Result<(), BackendError>
Source§fn backend_metric_snapshot(&self) -> Vec<(&'static str, u64)>
fn backend_metric_snapshot(&self) -> Vec<(&'static str, u64)>
Source§fn supports_grid_sync(&self) -> bool
fn supports_grid_sync(&self) -> bool
Node::Barrier { ordering: MemoryOrdering::GridSync } inside a single dispatch - i.e.
every thread in the entire grid waits at the barrier and
every prior write is globally visible afterwards. Backends
that lack a native grid barrier (workgroup-only fences) must
return false; registration-based dispatch may lower a
GridSync barrier to a host-orchestrated kernel split only
when VyreBackend::allows_host_grid_sync_split also returns
true. Read moreSource§fn cooperative_grid_sync_fits(
&self,
_program: &Program,
_inputs: &[&[u8]],
_config: &DispatchConfig,
) -> Result<bool, BackendError>
fn cooperative_grid_sync_fits( &self, _program: &Program, _inputs: &[&[u8]], _config: &DispatchConfig, ) -> Result<bool, BackendError>
program with these
inputs and config can be made fully resident on this device. Read moreSource§fn allows_host_grid_sync_split(&self) -> bool
fn allows_host_grid_sync_split(&self) -> bool
Source§fn supports_resident_dispatch(&self) -> bool
fn supports_resident_dispatch(&self) -> bool
allocate_resident / upload_resident / dispatch_resident_timed /
dispatch_resident_repeated_sequence_read_ranges_into /
download_resident_* / free_resident) well enough to run a
device-resident dispatch sequence. Read moreSource§fn supports_distributed_collectives(&self) -> bool
fn supports_distributed_collectives(&self) -> bool
AllReduce, AllGather, ReduceScatter, Broadcast). Read moreAuto Trait Implementations§
impl !RefUnwindSafe for WgpuBackend
impl !UnwindSafe for WgpuBackend
impl Freeze for WgpuBackend
impl Send for WgpuBackend
impl Sync for WgpuBackend
impl Unpin for WgpuBackend
impl UnsafeUnpin for WgpuBackend
Blanket Implementations§
Source§impl<T> Backend for Twhere
T: VyreBackend + ?Sized,
impl<T> Backend for Twhere
T: VyreBackend + ?Sized,
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> 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> TypedDispatchExt for Twhere
T: VyreBackend + ?Sized,
impl<T> TypedDispatchExt for Twhere
T: VyreBackend + ?Sized,
Source§fn dispatch_bytes(
&self,
program: &Program,
inputs: &[&[u8]],
config: &DispatchConfig,
) -> Result<Vec<Vec<u8>>, BackendError>
fn dispatch_bytes( &self, program: &Program, inputs: &[&[u8]], config: &DispatchConfig, ) -> Result<Vec<Vec<u8>>, BackendError>
Source§fn dispatch_pod<T>(
&self,
program: &Program,
inputs: &[&[T]],
config: &DispatchConfig,
) -> Result<Vec<Vec<T>>, BackendError>where
T: Pod,
fn dispatch_pod<T>(
&self,
program: &Program,
inputs: &[&[T]],
config: &DispatchConfig,
) -> Result<Vec<Vec<T>>, BackendError>where
T: Pod,
T. Read moreSource§fn dispatch_pod_into<T>(
&self,
program: &Program,
inputs: &[&[T]],
config: &DispatchConfig,
raw_outputs: &mut Vec<Vec<u8>>,
typed_outputs: &mut Vec<Vec<T>>,
) -> Result<(), BackendError>where
T: Pod,
fn dispatch_pod_into<T>(
&self,
program: &Program,
inputs: &[&[T]],
config: &DispatchConfig,
raw_outputs: &mut Vec<Vec<u8>>,
typed_outputs: &mut Vec<Vec<T>>,
) -> Result<(), BackendError>where
T: Pod,
T into
caller-owned storage. Read moreSource§fn dispatch_u32(
&self,
program: &Program,
inputs: &[&[u32]],
config: &DispatchConfig,
) -> Result<Vec<Vec<u32>>, BackendError>
fn dispatch_u32( &self, program: &Program, inputs: &[&[u32]], config: &DispatchConfig, ) -> Result<Vec<Vec<u32>>, BackendError>
Source§fn dispatch_u32_into(
&self,
program: &Program,
inputs: &[&[u32]],
config: &DispatchConfig,
raw_outputs: &mut Vec<Vec<u8>>,
typed_outputs: &mut Vec<Vec<u32>>,
) -> Result<(), BackendError>
fn dispatch_u32_into( &self, program: &Program, inputs: &[&[u32]], config: &DispatchConfig, raw_outputs: &mut Vec<Vec<u8>>, typed_outputs: &mut Vec<Vec<u32>>, ) -> Result<(), BackendError>
u32 inputs and decode outputs into caller-owned
typed storage. Read more