Skip to main content

struct engine_impl

Declaration

struct engine_impl { /* full declaration omitted */ };

Member Variables

const system_info system
target_state host_queue_target_state
dense_map<device_id, target_state> device_queue_target_states
std::unordered_map<instruction_id, incomplete_instruction_state> incomplete_instructions
The set of all instructions between submit() and complete_assigned(). Keyed by `instruction_id` to allow collecting successors through iterating over a newly submitted instruction's dependencies, which are given in terms of instruction ids. Any dependency that is not found in `incomplete_instructions` is assumed to have completed earlier (triggering its removal from the map).
std::priority_queue< const instruction*, std::vector<const instruction*>, instruction_priority_less> assignment_queue
Queue of all instructions in `conditional_eagerly_assignable_state` and `unconditional_assignable_state`, in decreasing order of instruction priority.

Member Function Overview

Member Functions

std::optional<assignment> assign_one()


void complete(instruction_id iid)

Parameters

instruction_id iid

explicit engine_impl(const system_info& system)

Parameters

const system_info& system

engine_impl(const engine_impl&)

Parameters

const engine_impl&

engine_impl(engine_impl&&)

Parameters

engine_impl&&

lane_id get_free_lane_id(
    target tgt,
    const std::optional<device_id>& device)

Description

Linearly search for a lane that has no in-flight instructions within a target_state. If none exists, add an additional lane.

Parameters

target tgt
const std::optional<device_id>& device

lane_state& get_lane_state(
    target tgt,
    const std::optional<device_id>& device,
    lane_id lane)

Description

Retrieve state for an existing lane.

Parameters

target tgt
const std::optional<device_id>& device
lane_id lane

target_state& get_target_state(
    target tgt,
    const std::optional<device_id>& device)

Parameters

target tgt
const std::optional<device_id>& device

bool is_idle() const


engine_impl& operator=(const engine_impl&)

Parameters

const engine_impl&

engine_impl& operator=(engine_impl&&)

Parameters

engine_impl&&

incomplete_instruction_state* pop_assignable()

Description

Return the highest-priority instruction from assignment_queue that is unconditionally assignable (helper).


void submit(const instruction* instr)

Parameters

const instruction* instr

void try_mark_for_assignment(
    incomplete_instruction_state& node)

Description

Attempt to replace assignment state for an incomplete instruction with conditional_eagerly_assignable_state or unconditional_assignable_state in response to either the initial submission or to completion of one or more predecessors. If successful, the instruction ends up in assignment_queue.

Parameters

incomplete_instruction_state& node

~engine_impl()