Skip to main content

ExecutionPlan

Struct ExecutionPlan 

Source
pub struct ExecutionPlan { /* private fields */ }
Expand description

Engine-associated executable work captured for repeated submission.

The captured executable structure is immutable. Read-only Matrix inputs may be rebound to shape- and dtype-identical storage while preserving the graph identity. Replays cache one recorded Vulkan command per binding set, so rotating through a bounded set of input buffers reuses the recorded commands after the first submission of each set.

Implementations§

Source§

impl ExecutionPlan

Source

pub fn serialize_descriptor(&self) -> Result<Vec<u8>>

Serialize this compiled plan into a deterministic, handle-free descriptor suitable for persisting alongside cache metadata.

The "OAEXPLAN" envelope and FNV-1a checksum match the donor’s ExecutionPlan::serializeDescriptor; the payload is a Rust-native format at its own version and is not byte-compatible with the C++ descriptor.

§Errors

Returns an error when a captured resource identity or serialized count exceeds the format limits, or when the compiled plan is internally inconsistent.

Source

pub fn validate_serialized_descriptor(&self, descriptor: &[u8]) -> Result<()>

Validate a persisted descriptor against this compiled plan.

The envelope must be well formed and the payload must equal a fresh serialization of this plan byte for byte — the donor’s cache revalidation semantic.

§Errors
  • InvalidArgument: truncated header or invalid magic.
  • FailedPrecondition: unsupported version or descriptor mismatch.
  • DataLoss: invalid payload length or checksum mismatch.
Source§

impl ExecutionPlan

Source

pub const fn semantic_graph(&self) -> &SemanticGraph

Return the canonical backend-independent graph captured by this plan.

Source

pub const fn semantic_lowering(&self) -> &SemanticLoweringAnalysis

Return the validated semantic-to-executable lowering provenance.

Source

pub fn captured_resources(&self) -> &[CapturedResourceDesc]

Return deterministic physical-resource lifetime and stable-frame evidence.

Source

pub fn semantic_bindings(&self) -> &[SemanticStorageBinding]

Return the handle-free semantic value-to-resource capture table.

Source

pub fn alias_materialization_fallback_reason(&self) -> Option<&str>

Return why transient alias materialization fell back to distinct storage.

The plan remains executable when this returns Some; diagnostics count the decision as one fallback and report zero materialized alias savings.

Source

pub fn upload_matrix_input<T: Element>( &mut self, captured: &Matrix, values: &[T], ) -> Result<()>

Upload values into one stable captured Matrix input slot.

The captured shape, dtype, descriptor slot, and graph identity remain unchanged. The slot rotates through a bounded triple-buffered staging ring: each upload writes the next ring buffer and rebinds it, so a pending prior replay stalls only when the target ring buffer is still consumed by an in-flight submission. The captured Matrix’s own buffer mirrors each upload, so the stable value remains coherent for host reads.

§Errors

Returns an error when captured is not a ring-bound read-only plan input, the element type or count differs, or prior completion/upload fails.

Source

pub fn bind_matrix_input( &mut self, captured: &Matrix, replacement: &Matrix, ) -> Result<()>

Rebind one read-only Matrix input while preserving its captured contract.

captured remains the stable slot identity even after repeated rebinding. The replacement must have the same shape and dtype, belong to the plan’s engine, and not alias another resource already used by the plan. Rebinding does not submit or wait; the next submission records one command buffer per unseen binding set and later submissions of the same set reuse it.

§Errors

Returns an error when either Matrix belongs to another engine, their shape or dtype differs, captured is not a read-only plan input, the replacement aliases another plan resource, or its production state is invalid.

Source

pub const fn binding_count(&self) -> usize

Return the number of entries in the compiled specialization contract.

Donor: oa::ExecutionPlan::bindingCount.

Source

pub fn input_binding_count(&self) -> usize

Return the number of contract entries with an input role.

Donor: oa::ExecutionPlan::inputBindingCount.

Source

pub fn output_binding_count(&self) -> usize

Return the number of contract entries with an output role.

Donor: oa::ExecutionPlan::outputBindingCount.

Source

pub fn binding(&self, slot: u32) -> Result<ExecutionBindingDesc>

Return the contract entry at slot.

Donor: oa::ExecutionPlan::binding.

§Errors

Returns InvalidArgument when slot is out of range.

Source

pub const fn binding_contract_hash(&self) -> u64

Return the deterministic hash of the compiled specialization contract.

Donor: oa::ExecutionPlan::bindingContractHash.

Source

pub fn validate_specialization_inputs(&self, inputs: &[Matrix]) -> Result<()>

Validate specialization input matrices against the compiled contract.

Validation checks the exact shape, dtype, strides, and byte offset of each contract input in order. It deliberately does not rebind resources: dynamic dimensions select or recapture another checked plan rather than mutating this plan’s recorded command buffers.

Donor: oa::ExecutionPlan::validateSpecializationInputs.

§Errors

Returns InvalidArgument when the input count differs, and FailedPrecondition when any input’s contract requires another plan or is not a matrix.

Source

pub fn diagnostics(&self) -> ExecutionPlanDiagnostics

Return current graph, cache, submission, rebinding, and fallback counters.

Source

pub fn is_complete(&self) -> Result<bool>

Return whether the most recently submitted replay has completed.

A plan that has not been submitted is complete.

§Errors

Returns an error when Vulkan cannot query the originating timeline.

Source

pub fn wait(&self) -> Result<()>

Wait for the most recently submitted replay and its host retirement.

Same-queue timeline order means completion of the latest replay also proves completion of every earlier replay submitted through this plan.

§Errors

Returns an error when Vulkan completion or host retirement waiting fails.

Source

pub fn reset(self) -> Result<()>

Wait for pending replay and consume the plan, releasing retained state.

This is the Rust ownership equivalent of the donor’s mutable reset: plan capture constructs a new value rather than repopulating an empty shell. Destruction remains non-blocking when this explicit boundary is not used.

§Errors

Returns an error from ExecutionPlan::wait. The consumed plan still drops safely on error; submitted resources remain owned by engine retirement.

Source

pub fn debug_report_json(&self, name: &str) -> String

Return the deterministic normalized executable graph report as JSON.

Resource and hazard-domain IDs follow first graph access. Vulkan handles, device addresses, descriptor indices, and push payloads are omitted.

Trait Implementations§

Source§

impl Debug for ExecutionPlan

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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<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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

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> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

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.