Skip to main content

class out_of_order_engine

Declaration

class out_of_order_engine { /* full declaration omitted */ };

Description

State machine controlling when and in what manner instructions are assigned to execution resources in adherence to the dependency graph. Based on their type, instructions can either be assigned to begin executing immediately as soon as all their predecessors are complete, or they can be enqueued eagerly in one of the backend's thread queues or in-order device queues to hide launch latencies where possible.

Member Variables

std::unique_ptr< out_of_order_engine_detail::engine_impl> m_impl

Member Aliases

  • using lane_id = size_t;

Member Function Overview

Member Functions

[[nodiscard]] std::optional<assignment>
assign_one()

Description

Produce an assignment for one instruction for which either all predecessors have completed, or for which all incomplete predecessors can be implicitly fulfilled by submitting to the same backend queue. If multiple instructions are eligible, assign the one with the highest priority.


void complete_assigned(instruction_id iid)

Description

Call once an instruction that was previously returned from assign_one has completed synchronously or asynchronously. For simplicity it is permitted to mark assigned instructions as completed in any order, even if that would violate internal dependency order.

Parameters

instruction_id iid

size_t get_assignment_queue_length() const

Description

Returns the number of instructions currently awaiting normal or eager assignment (diagnostic use only).


bool is_idle() const

Description

True when all submitted instructions have completed.


out_of_order_engine& operator=(
    const out_of_order_engine&)

Parameters

const out_of_order_engine&

out_of_order_engine& operator=(
    out_of_order_engine&&)

Parameters

out_of_order_engine&&

explicit out_of_order_engine(
    const system_info& system)

Description

Constructor requires a system_info to enumerate devices and perform memory_id -> device_id mapping.

Parameters

const system_info& system

out_of_order_engine(const out_of_order_engine&)

Parameters

const out_of_order_engine&

out_of_order_engine(out_of_order_engine&&)

Parameters

out_of_order_engine&&

void submit(const instruction* instr)

Description

Begin tracking an instruction so that it is eventually returned through assign_one. Must be called in topological order of dependencies, i.e. no instruction must be submitted before one of its predecessors in the graph.

Parameters

const instruction* instr

~out_of_order_engine()