Skip to main content

class runtime::impl

Declaration

class runtime::impl : public runtime,
                      private delegate,
                      private delegate,
                      private delegate { /* full declaration omitted */ };

Declared at: src/runtime.cc:88

Inherits from: runtime, task_manager::delegate, scheduler::delegate, executor::delegate

Member Variables

std::thread::id m_application_thread
std::unique_ptr<config> m_cfg
size_t m_num_nodes = 0
node_id m_local_nid = 0
size_t m_num_local_devices = 0
size_t m_num_live_queues = 0
std::unordered_set<buffer_id> m_live_buffers
std::unordered_set<host_object_id> m_live_host_objects
buffer_id m_next_buffer_id = 0
raw_allocation_id m_next_user_allocation_id = 1
host_object_id m_next_host_object_id = 0
reduction_id m_next_reduction_id = no_reduction_id + 1
task_graph m_tdag
std::unique_ptr<task_manager> m_task_mngr
std::unique_ptr<scheduler> m_schdlr
std::unique_ptr<executor> m_exec
std::optional<task_id> m_latest_horizon_reached
std::atomic<size_t> m_latest_epoch_reached
task_id m_last_epoch_pruned_before = 0
std::unique_ptr<detail::task_recorder> m_task_recorder
std::unique_ptr<detail::command_recorder> m_command_recorder
std::unique_ptr<detail::instruction_recorder> m_instruction_recorder
std::unique_ptr< detail::thread_pinning::thread_pinner> m_thread_pinner

Member Function Overview

Inherited from runtime:

Member Functions

buffer_id create_buffer(const range<3>& range,
                        size_t elem_size,
                        size_t elem_align,
                        allocation_id user_aid)

Declared at: src/runtime.cc:113

Parameters

const range<3>& range
size_t elem_size
size_t elem_align
allocation_id user_aid

host_object_id create_host_object(
    std::unique_ptr<host_object_instance>
        instance)

Declared at: src/runtime.cc:119

Parameters

std::unique_ptr<host_object_instance> instance

void create_queue()

Declared at: src/runtime.cc:107


reduction_id create_reduction(
    std::unique_ptr<reducer> reducer)

Declared at: src/runtime.cc:123

Parameters

std::unique_ptr<reducer> reducer

allocation_id create_user_allocation(void* ptr)

Declared at: src/runtime.cc:111

Parameters

void* ptr

void destroy_buffer(buffer_id bid)

Declared at: src/runtime.cc:117

Parameters

buffer_id bid

void destroy_host_object(host_object_id hoid)

Declared at: src/runtime.cc:121

Parameters

host_object_id hoid

void destroy_queue()

Declared at: src/runtime.cc:109


task_id fence(
    buffer_access access,
    std::unique_ptr<task_promise> fence_promise)

Declared at: src/runtime.cc:101

Parameters

buffer_access access
std::unique_ptr<task_promise> fence_promise

task_id fence(
    host_object_effect effect,
    std::unique_ptr<task_promise> fence_promise)

Declared at: src/runtime.cc:103

Parameters

host_object_effect effect
std::unique_ptr<task_promise> fence_promise

void flush_scheduler()

Declared at: src/runtime.cc:129


impl(const runtime::impl&)

Declared at: src/runtime.cc:92

Parameters

const runtime::impl&

impl(int* argc,
     char*** argv,
     const devices_or_selector&
         user_devices_or_selector)

Declared at: src/runtime.cc:90

Parameters

int* argc
char*** argv
const devices_or_selector& user_devices_or_selector

impl(runtime::impl&&)

Declared at: src/runtime.cc:93

Parameters

runtime::impl&&

bool is_dry_run() const

Declared at: src/runtime.cc:125


impl& operator=(runtime::impl&&)

Declared at: src/runtime.cc:95

Parameters

runtime::impl&&

impl& operator=(const runtime::impl&)

Declared at: src/runtime.cc:94

Parameters

const runtime::impl&

void set_buffer_debug_name(
    buffer_id bid,
    const std::string& debug_name)

Declared at: src/runtime.cc:115

Parameters

buffer_id bid
const std::string& debug_name

void set_scheduler_lookahead(
    experimental::lookahead lookahead)

Declared at: src/runtime.cc:127

Parameters

experimental::lookahead lookahead

task_id submit(raw_command_group&& cg)

Declared at: src/runtime.cc:99

Parameters

raw_command_group&& cg

task_id sync(detail::epoch_action action)

Declared at: src/runtime.cc:105

Parameters

detail::epoch_action action

~impl()

Declared at: src/runtime.cc:97


void epoch_reached(task_id epoch_tid)

Description

Called from the executor thread as soon as an epoch_instruction has finished executing.

Declared at: src/runtime.cc:187

Parameters

task_id epoch_tid

void flush(
    std::vector<const instruction*> instructions,
    std::vector<outbound_pilot> pilot)

Description

Called whenever new instructions have been generated and inserted into the instruction graph, and / or new pilot messages have been generated that must be transmitted to peer nodes before they can accept data transmitted through send_instructions originating from the local node. The vector of instructions is in topological order of dependencies, and so is the concatenation of all vectors that are passed through this function. Topological order here means that sequential execution in that order would fulfill all internal dependencies. The instruction graph generator guarantees that instruction pointers are stable and the pointed-to instructions are both immutable and safe to read from other threads. This is exposed as a single function on vectors to minimize lock contention in a threaded delegate implementations.

Declared at: src/runtime.cc:181

Parameters

std::vector<const instruction*> instructions
std::vector<outbound_pilot> pilot

void horizon_reached(task_id horizon_tid)

Description

Called from the executor thread as soon as a horizon_instruction has finished executing.

Declared at: src/runtime.cc:186

Parameters

task_id horizon_tid

bool is_unreferenced() const

Description

True when no buffers, host objects or queues are live that keep the runtime alive.

Declared at: src/runtime.cc:190


void maybe_prune_task_graph()

Declared at: src/runtime.cc:175


void on_scheduler_busy()

Declared at: src/runtime.cc:183


void on_scheduler_idle()

Declared at: src/runtime.cc:182


void require_call_from_application_thread() const

Description

Panic when not called from m_application_thread (see that variable for more info on the matter). Since there are thread-safe and non thread-safe member functions, we call this check at the beginning of all the non-safe ones.

Declared at: src/runtime.cc:173


void task_created(const task* tsk)

Description

Called whenever new tasks have been generated and inserted into the tasks graph.

Declared at: src/runtime.cc:178

Parameters

const task* tsk