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
impl ExecutionPlan
Sourcepub fn serialize_descriptor(&self) -> Result<Vec<u8>>
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.
Sourcepub fn validate_serialized_descriptor(&self, descriptor: &[u8]) -> Result<()>
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
impl ExecutionPlan
Sourcepub const fn semantic_graph(&self) -> &SemanticGraph
pub const fn semantic_graph(&self) -> &SemanticGraph
Return the canonical backend-independent graph captured by this plan.
Sourcepub const fn semantic_lowering(&self) -> &SemanticLoweringAnalysis
pub const fn semantic_lowering(&self) -> &SemanticLoweringAnalysis
Return the validated semantic-to-executable lowering provenance.
Sourcepub fn captured_resources(&self) -> &[CapturedResourceDesc]
pub fn captured_resources(&self) -> &[CapturedResourceDesc]
Return deterministic physical-resource lifetime and stable-frame evidence.
Sourcepub fn semantic_bindings(&self) -> &[SemanticStorageBinding]
pub fn semantic_bindings(&self) -> &[SemanticStorageBinding]
Return the handle-free semantic value-to-resource capture table.
Sourcepub fn alias_materialization_fallback_reason(&self) -> Option<&str>
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.
Sourcepub fn upload_matrix_input<T: Element>(
&mut self,
captured: &Matrix,
values: &[T],
) -> Result<()>
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.
Sourcepub fn bind_matrix_input(
&mut self,
captured: &Matrix,
replacement: &Matrix,
) -> Result<()>
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.
Sourcepub const fn binding_count(&self) -> usize
pub const fn binding_count(&self) -> usize
Return the number of entries in the compiled specialization contract.
Donor: oa::ExecutionPlan::bindingCount.
Sourcepub fn input_binding_count(&self) -> usize
pub fn input_binding_count(&self) -> usize
Return the number of contract entries with an input role.
Donor: oa::ExecutionPlan::inputBindingCount.
Sourcepub fn output_binding_count(&self) -> usize
pub fn output_binding_count(&self) -> usize
Return the number of contract entries with an output role.
Donor: oa::ExecutionPlan::outputBindingCount.
Sourcepub fn binding(&self, slot: u32) -> Result<ExecutionBindingDesc>
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.
Sourcepub const fn binding_contract_hash(&self) -> u64
pub const fn binding_contract_hash(&self) -> u64
Return the deterministic hash of the compiled specialization contract.
Donor: oa::ExecutionPlan::bindingContractHash.
Sourcepub fn validate_specialization_inputs(&self, inputs: &[Matrix]) -> Result<()>
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.
Sourcepub fn diagnostics(&self) -> ExecutionPlanDiagnostics
pub fn diagnostics(&self) -> ExecutionPlanDiagnostics
Return current graph, cache, submission, rebinding, and fallback counters.
Sourcepub fn is_complete(&self) -> Result<bool>
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.
Sourcepub fn wait(&self) -> Result<()>
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.
Sourcepub fn reset(self) -> Result<()>
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.
Sourcepub fn debug_report_json(&self, name: &str) -> String
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.