Skip to main content

TestPipeline

Struct TestPipeline 

Source
pub struct TestPipeline<SrcClk: PlatformClock> { /* private fields */ }
Expand description

concrete graph implementation used for testing.

Implementations§

Source§

impl<SrcClk: PlatformClock> TestPipeline<SrcClk>

Source

pub fn new( node_0: impl Into<SourceNode<TestCounterSourceTensor<SrcClk, 32>, TestTensor, 1>>, node_1: TestIdentityModelNodeTensor<TEST_MAX_BATCH>, node_2: impl Into<SinkNode<TestSinkNodeTensor, TestTensor, 1>>, q_0: TestSpscRingBuf<32>, q_1: TestSpscRingBuf<32>, mgr_0: StaticMemoryManager<TestTensor, 35>, mgr_1: StaticMemoryManager<TestTensor, 35>, ) -> Self

Returns a TestPipeline graph given the nodes and edges.

Trait Implementations§

Source§

impl<SrcClk: PlatformClock> GraphApi<3, 3> for TestPipeline<SrcClk>

Source§

fn get_node_descriptors(&self) -> [NodeDescriptor; 3]

Returns the static descriptors for all nodes in the graph. Read more
Source§

fn get_edge_descriptors(&self) -> [EdgeDescriptor; 3]

Returns the static descriptors for all edges in the graph. Read more
Source§

fn get_node_policies(&self) -> [NodePolicy; 3]

Returns the static NodePolicy for every node in the graph. Read more
Source§

fn get_edge_policies(&self) -> [EdgePolicy; 3]

Returns the static EdgePolicy for every edge in the graph. Read more
Source§

fn edge_occupancy_for<const E: usize>( &self, ) -> Result<EdgeOccupancy, GraphError>

Returns a one-shot occupancy snapshot for edge E. Read more
Source§

fn write_all_edge_occupancies( &self, out: &mut [EdgeOccupancy; 3], ) -> Result<(), GraphError>

Write current occupancy for all edges into out. Read more
Source§

fn refresh_occupancies_for_node<const I: usize, const IN: usize, const OUT: usize>( &self, out: &mut [EdgeOccupancy; 3], ) -> Result<(), GraphError>

Partial refresh: update only entries for edges incident to node I. Read more
Source§

fn step_node_by_index<C, T>( &mut self, index: usize, clock: &C, telemetry: &mut T, ) -> Result<StepResult, NodeError>

Drives a single scheduling step for the node at index. Read more
Source§

fn validate_graph(&self) -> Result<(), GraphError>

Validates the graph topology and policies derived from node and edge descriptors. Read more
Source§

fn node_policy_for<const I: usize, const IN: usize, const OUT: usize>( &self, ) -> NodePolicy
where Self: GraphNodeAccess<I> + GraphNodeTypes<I, IN, OUT>, <Self as GraphNodeAccess<I>>::Node: Node<IN, OUT, <Self as GraphNodeTypes<I, IN, OUT>>::InP, <Self as GraphNodeTypes<I, IN, OUT>>::OutP>,

Returns the static NodePolicy for node I (compile-time index). Read more
Source§

impl<SrcClk: PlatformClock> GraphEdgeAccess<1> for TestPipeline<SrcClk>

Source§

type Edge = EdgeLink<TestSpscRingBuf<32>>

The concrete edge type at index E.
Source§

fn edge_ref(&self) -> &Self::Edge

Immutable access to the edge at index E.
Source§

fn edge_mut(&mut self) -> &mut Self::Edge

Mutable access to the edge at index E.
Source§

impl<SrcClk: PlatformClock> GraphEdgeAccess<2> for TestPipeline<SrcClk>

Source§

type Edge = EdgeLink<TestSpscRingBuf<32>>

The concrete edge type at index E.
Source§

fn edge_ref(&self) -> &Self::Edge

Immutable access to the edge at index E.
Source§

fn edge_mut(&mut self) -> &mut Self::Edge

Mutable access to the edge at index E.
Source§

impl<SrcClk: PlatformClock> GraphNodeAccess<0> for TestPipeline<SrcClk>

Source§

type Node = NodeLink<SourceNode<TestCounterSourceTensor<SrcClk, 32>, Tensor<u32, TEST_TENSOR_ELEMENT_COUNT, 2>, 1>, 0, 1, (), Tensor<u32, TEST_TENSOR_ELEMENT_COUNT, 2>>

The concrete node type at index I.
Source§

fn node_ref(&self) -> &Self::Node

Immutable access to the node at index I.
Source§

fn node_mut(&mut self) -> &mut Self::Node

Mutable access to the node at index I.
Source§

impl<SrcClk: PlatformClock> GraphNodeAccess<1> for TestPipeline<SrcClk>

Source§

type Node = NodeLink<InferenceModel<TestTensorBackend, Tensor<u32, TEST_TENSOR_ELEMENT_COUNT, 2>, Tensor<u32, TEST_TENSOR_ELEMENT_COUNT, 2>, TEST_MAX_BATCH>, 1, 1, Tensor<u32, TEST_TENSOR_ELEMENT_COUNT, 2>, Tensor<u32, TEST_TENSOR_ELEMENT_COUNT, 2>>

The concrete node type at index I.
Source§

fn node_ref(&self) -> &Self::Node

Immutable access to the node at index I.
Source§

fn node_mut(&mut self) -> &mut Self::Node

Mutable access to the node at index I.
Source§

impl<SrcClk: PlatformClock> GraphNodeAccess<2> for TestPipeline<SrcClk>

Source§

type Node = NodeLink<SinkNode<TestSinkNodeTensor, Tensor<u32, TEST_TENSOR_ELEMENT_COUNT, 2>, 1>, 1, 0, Tensor<u32, TEST_TENSOR_ELEMENT_COUNT, 2>, ()>

The concrete node type at index I.
Source§

fn node_ref(&self) -> &Self::Node

Immutable access to the node at index I.
Source§

fn node_mut(&mut self) -> &mut Self::Node

Mutable access to the node at index I.
Source§

impl<SrcClk: PlatformClock> GraphNodeContextBuilder<0, 0, 1> for TestPipeline<SrcClk>
where Self: GraphNodeAccess<0, Node = NodeLink<SourceNode<TestCounterSourceTensor<SrcClk, 32>, TestTensor, 1>, 0, 1, (), TestTensor>>,

Source§

fn make_step_context<'graph, 'telemetry, 'clock, C, T>( &'graph mut self, clock: &'clock C, telemetry: &'telemetry mut T, ) -> StepContext<'graph, 'telemetry, 'clock, 0, 1, <Self as GraphNodeTypes<0, 0, 1>>::InP, <Self as GraphNodeTypes<0, 0, 1>>::OutP, <Self as GraphNodeTypes<0, 0, 1>>::InQ, <Self as GraphNodeTypes<0, 0, 1>>::OutQ, <Self as GraphNodeTypes<0, 0, 1>>::InM, <Self as GraphNodeTypes<0, 0, 1>>::OutM, C, T>

Construct a StepContext for node I. Read more
Source§

fn with_node_and_step_context<'telemetry, 'clock, C, T, R, E>( &mut self, clock: &'clock C, telemetry: &'telemetry mut T, f: impl FnOnce(&mut <Self as GraphNodeAccess<0>>::Node, &mut StepContext<'_, 'telemetry, 'clock, 0, 1, <Self as GraphNodeTypes<0, 0, 1>>::InP, <Self as GraphNodeTypes<0, 0, 1>>::OutP, <Self as GraphNodeTypes<0, 0, 1>>::InQ, <Self as GraphNodeTypes<0, 0, 1>>::OutQ, <Self as GraphNodeTypes<0, 0, 1>>::InM, <Self as GraphNodeTypes<0, 0, 1>>::OutM, C, T>) -> Result<R, E>, ) -> Result<R, E>

Borrowed handoff: in one &mut self borrow, lend both &mut node(I) and a fully wired StepContext to a closure. This avoids overlapping &mut borrows escaping the call.
Source§

impl<SrcClk: PlatformClock> GraphNodeContextBuilder<1, 1, 1> for TestPipeline<SrcClk>
where Self: GraphNodeAccess<1, Node = NodeLink<TestIdentityModelNodeTensor<TEST_MAX_BATCH>, 1, 1, TestTensor, TestTensor>>,

Source§

fn make_step_context<'graph, 'telemetry, 'clock, C, T>( &'graph mut self, clock: &'clock C, telemetry: &'telemetry mut T, ) -> StepContext<'graph, 'telemetry, 'clock, 1, 1, <Self as GraphNodeTypes<1, 1, 1>>::InP, <Self as GraphNodeTypes<1, 1, 1>>::OutP, <Self as GraphNodeTypes<1, 1, 1>>::InQ, <Self as GraphNodeTypes<1, 1, 1>>::OutQ, <Self as GraphNodeTypes<1, 1, 1>>::InM, <Self as GraphNodeTypes<1, 1, 1>>::OutM, C, T>

Construct a StepContext for node I. Read more
Source§

fn with_node_and_step_context<'telemetry, 'clock, C, T, R, E>( &mut self, clock: &'clock C, telemetry: &'telemetry mut T, f: impl FnOnce(&mut <Self as GraphNodeAccess<1>>::Node, &mut StepContext<'_, 'telemetry, 'clock, 1, 1, <Self as GraphNodeTypes<1, 1, 1>>::InP, <Self as GraphNodeTypes<1, 1, 1>>::OutP, <Self as GraphNodeTypes<1, 1, 1>>::InQ, <Self as GraphNodeTypes<1, 1, 1>>::OutQ, <Self as GraphNodeTypes<1, 1, 1>>::InM, <Self as GraphNodeTypes<1, 1, 1>>::OutM, C, T>) -> Result<R, E>, ) -> Result<R, E>

Borrowed handoff: in one &mut self borrow, lend both &mut node(I) and a fully wired StepContext to a closure. This avoids overlapping &mut borrows escaping the call.
Source§

impl<SrcClk: PlatformClock> GraphNodeContextBuilder<2, 1, 0> for TestPipeline<SrcClk>

Source§

fn make_step_context<'graph, 'telemetry, 'clock, C, T>( &'graph mut self, clock: &'clock C, telemetry: &'telemetry mut T, ) -> StepContext<'graph, 'telemetry, 'clock, 1, 0, <Self as GraphNodeTypes<2, 1, 0>>::InP, <Self as GraphNodeTypes<2, 1, 0>>::OutP, <Self as GraphNodeTypes<2, 1, 0>>::InQ, <Self as GraphNodeTypes<2, 1, 0>>::OutQ, <Self as GraphNodeTypes<2, 1, 0>>::InM, <Self as GraphNodeTypes<2, 1, 0>>::OutM, C, T>

Construct a StepContext for node I. Read more
Source§

fn with_node_and_step_context<'telemetry, 'clock, C, T, R, E>( &mut self, clock: &'clock C, telemetry: &'telemetry mut T, f: impl FnOnce(&mut <Self as GraphNodeAccess<2>>::Node, &mut StepContext<'_, 'telemetry, 'clock, 1, 0, <Self as GraphNodeTypes<2, 1, 0>>::InP, <Self as GraphNodeTypes<2, 1, 0>>::OutP, <Self as GraphNodeTypes<2, 1, 0>>::InQ, <Self as GraphNodeTypes<2, 1, 0>>::OutQ, <Self as GraphNodeTypes<2, 1, 0>>::InM, <Self as GraphNodeTypes<2, 1, 0>>::OutM, C, T>) -> Result<R, E>, ) -> Result<R, E>

Borrowed handoff: in one &mut self borrow, lend both &mut node(I) and a fully wired StepContext to a closure. This avoids overlapping &mut borrows escaping the call.
Source§

impl<SrcClk: PlatformClock> GraphNodeTypes<0, 0, 1> for TestPipeline<SrcClk>

Source§

type InP = ()

Payload type for messages consumed by the node.
Source§

type OutP = Tensor<u32, TEST_TENSOR_ELEMENT_COUNT, 2>

Payload type for messages produced by the node.
Source§

type InQ = NoQueue

Queue type used for input ports.
Source§

type OutQ = TestSpscRingBuf<32>

Queue type used for output ports.
Source§

type InM = StaticMemoryManager<(), 1>

Memory manager type for input ports.
Source§

type OutM = StaticMemoryManager<Tensor<u32, TEST_TENSOR_ELEMENT_COUNT, 2>, 35>

Memory manager type for output ports.
Source§

impl<SrcClk: PlatformClock> GraphNodeTypes<1, 1, 1> for TestPipeline<SrcClk>

Source§

type InP = Tensor<u32, TEST_TENSOR_ELEMENT_COUNT, 2>

Payload type for messages consumed by the node.
Source§

type OutP = Tensor<u32, TEST_TENSOR_ELEMENT_COUNT, 2>

Payload type for messages produced by the node.
Source§

type InQ = TestSpscRingBuf<32>

Queue type used for input ports.
Source§

type OutQ = TestSpscRingBuf<32>

Queue type used for output ports.
Source§

type InM = StaticMemoryManager<Tensor<u32, TEST_TENSOR_ELEMENT_COUNT, 2>, 35>

Memory manager type for input ports.
Source§

type OutM = StaticMemoryManager<Tensor<u32, TEST_TENSOR_ELEMENT_COUNT, 2>, 35>

Memory manager type for output ports.
Source§

impl<SrcClk: PlatformClock> GraphNodeTypes<2, 1, 0> for TestPipeline<SrcClk>

Source§

type InP = Tensor<u32, TEST_TENSOR_ELEMENT_COUNT, 2>

Payload type for messages consumed by the node.
Source§

type OutP = ()

Payload type for messages produced by the node.
Source§

type InQ = TestSpscRingBuf<32>

Queue type used for input ports.
Source§

type OutQ = NoQueue

Queue type used for output ports.
Source§

type InM = StaticMemoryManager<Tensor<u32, TEST_TENSOR_ELEMENT_COUNT, 2>, 35>

Memory manager type for input ports.
Source§

type OutM = StaticMemoryManager<(), 1>

Memory manager type for output ports.

Auto Trait Implementations§

§

impl<SrcClk> !Freeze for TestPipeline<SrcClk>

§

impl<SrcClk> !RefUnwindSafe for TestPipeline<SrcClk>

§

impl<SrcClk> Send for TestPipeline<SrcClk>
where SrcClk: Send,

§

impl<SrcClk> !Sync for TestPipeline<SrcClk>

§

impl<SrcClk> Unpin for TestPipeline<SrcClk>
where SrcClk: Unpin,

§

impl<SrcClk> UnsafeUnpin for TestPipeline<SrcClk>
where SrcClk: UnsafeUnpin,

§

impl<SrcClk> UnwindSafe for TestPipeline<SrcClk>
where SrcClk: UnwindSafe,

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.