class command_graph_generator
Declaration
class command_graph_generator { /* full declaration omitted */ };
Declared at: include/command_graph_generator.h:77
Member Variables
- size_t m_num_nodes
- node_id m_local_nid
- policy_set m_policy
- command_id m_next_cid = 0
- command_graph* m_cdag
- command_set m_execution_front
- std::unordered_map<buffer_id, buffer_state> m_buffers
- std::unordered_map<host_object_id, host_object_state> m_host_objects
- std::unordered_map<collective_group_id, collective_group_state> m_collective_groups
- command* m_epoch_for_new_commands = nullptr
- command_id m_epoch_last_pruned_before = 0
- command* m_current_horizon = nullptr
- size_t m_test_chunk_multiplier = 1
- std::vector<reduction_id> m_completed_reductions
- std::unordered_map<command_id, buffer_read_map> m_command_buffer_reads
- detail::command_recorder* m_recorder = nullptr
- static const write_command_state no_command = {}
- static const node_id reduction_initializer_nid = 0
Member Aliases
- using batch = std::vector<const command*>;
- using buffer_read_map = std::unordered_map<buffer_id, region<3>>;
- using buffer_requirements_list = std::vector<buffer_requirements>;
Member Function Overview
- build_task(const task & tsk) → std::vector<const command *>
- command_graph_generator(size_t num_nodes, node_id local_nid, command_graph & cdag, detail::command_recorder * recorder, const policy_set & policy = default_policy_set())
- notify_buffer_created(buffer_id bid, const range<3> & range, bool host_initialized) → void
- notify_buffer_debug_name_changed(buffer_id bid, const std::string & debug_name) → void
- notify_buffer_destroyed(buffer_id bid) → void
- notify_host_object_created(host_object_id hoid) → void
- notify_host_object_destroyed(host_object_id hoid) → void
- test_set_chunk_multiplier(size_t multiplier) → void
- add_dependency(command * from, command * to, dependency_kind kind, dependency_origin origin) → void
- compute_per_chunk_requirements(const task & tsk, const std::vector<assigned_chunk> & chunks) const → assigned_chunks_with_requirements
- template <class Command, typename... CtorParamsAndRecordWithFn>
create_command(batch & current_batch, CtorParamsAndRecordWithFn &&... args) → Command * - template <class Command, typename... CtorParamsAndRecordWithFn, size_t... CtorParamIndices, size_t RecordWithFnIndex>
create_command_internal(batch & current_batch, std::tuple<CtorParamsAndRecordWithFn...> && ctor_params_and_record_with, std::index_sequence<CtorParamIndices...>, std::index_sequence<RecordWithFnIndex>) → Command * - default_policy_set() → static constexpr policy_set
- generate_anti_dependencies(const task & tsk, buffer_id bid, const region_map<write_command_state> & last_writers_map, const region<3> & write_req, command * write_cmd) → void
- generate_await_pushes(batch & current_batch, const task & tsk, const assigned_chunks_with_requirements & chunks_with_requirements) → void
- generate_distributed_commands(batch & current_batch, const task & tsk) → void
- generate_epoch_command(batch & current_batch, const task & tsk) → void
- generate_epoch_dependencies(command * cmd) → void
- generate_horizon_command(batch & current_batch, const task & tsk) → void
- generate_pushes(batch & current_batch, const task & tsk, const assigned_chunks_with_requirements & chunks_with_requirements) → void
- get_buffer_requirements_for_mapped_access(const task & tsk, const box<3> & box) const → buffer_requirements_list
- is_recording() const → bool
- print_buffer_debug_label(buffer_id bid) const → std::string
- reduce_execution_front_to(command * new_front) → void
- report_overlapping_writes(const task & tsk, const box_vector<3> & local_chunks) const → void
- resolve_pending_reductions(batch & current_batch, const task & tsk, const assigned_chunks_with_requirements & chunks_with_requirements) → void
- set_epoch_for_new_commands(command * epoch_or_horizon) → void
- split_task_and_assign_chunks(const task & tsk) const → std::vector<assigned_chunk>
- update_local_buffer_fresh_regions(const task & tsk, const std::unordered_map<buffer_id, region<3>> & per_buffer_local_writes) → void
Member Functions
¶std::vector<const command*> build_task(
const task& tsk)
std::vector<const command*> build_task(
const task& tsk)
Description
Generates the set of commands required to execute the given task. This includes resolving local data dependencies, generating await push commands for local reads of remote data, as well as push commands for remote reads of local data. Commands are returned in topologically sorted order, i.e., sequential execution would satisfy all internal dependencies.
Declared at: include/command_graph_generator.h:136
Parameters
- const task& tsk
¶command_graph_generator(
size_t num_nodes,
node_id local_nid,
command_graph& cdag,
detail::command_recorder* recorder,
const policy_set& policy =
default_policy_set())
command_graph_generator(
size_t num_nodes,
node_id local_nid,
command_graph& cdag,
detail::command_recorder* recorder,
const policy_set& policy =
default_policy_set())
Declared at: include/command_graph_generator.h:119
Parameters
- size_t num_nodes
- node_id local_nid
- command_graph& cdag
- detail::command_recorder* recorder
- const policy_set& policy = default_policy_set()
¶void notify_buffer_created(buffer_id bid,
const range<3>& range,
bool host_initialized)
void notify_buffer_created(buffer_id bid,
const range<3>& range,
bool host_initialized)
Declared at: include/command_graph_generator.h:122
Parameters
¶void notify_buffer_debug_name_changed(
buffer_id bid,
const std::string& debug_name)
void notify_buffer_debug_name_changed(
buffer_id bid,
const std::string& debug_name)
Declared at: include/command_graph_generator.h:124
Parameters
- buffer_id bid
- const std::string& debug_name
¶void notify_buffer_destroyed(buffer_id bid)
void notify_buffer_destroyed(buffer_id bid)
Declared at: include/command_graph_generator.h:126
Parameters
- buffer_id bid
¶void notify_host_object_created(
host_object_id hoid)
void notify_host_object_created(
host_object_id hoid)
Declared at: include/command_graph_generator.h:128
Parameters
- host_object_id hoid
¶void notify_host_object_destroyed(
host_object_id hoid)
void notify_host_object_destroyed(
host_object_id hoid)
Declared at: include/command_graph_generator.h:130
Parameters
- host_object_id hoid
¶void test_set_chunk_multiplier(size_t multiplier)
void test_set_chunk_multiplier(size_t multiplier)
Description
Only for testing: Instead of (at most) a single chunk per node, generate multiplier
chunks per node for each task. This is to ensure that CDAG generation logic works for arbitrary numbers of chunks, even though we don't provide a way for users to specify more than one chunk per node... yet.
Declared at: include/command_graph_generator.h:141
Parameters
- size_t multiplier
¶void add_dependency(command* from,
command* to,
dependency_kind kind,
dependency_origin origin)
void add_dependency(command* from,
command* to,
dependency_kind kind,
dependency_origin origin)
Description
Adds a new dependency between two commands and records it if recording is enabled.
Declared at: include/command_graph_generator.h:198
Parameters
- command* from
- command* to
- dependency_kind kind
- dependency_origin origin
¶assigned_chunks_with_requirements
compute_per_chunk_requirements(
const task& tsk,
const std::vector<assigned_chunk>& chunks)
const
assigned_chunks_with_requirements
compute_per_chunk_requirements(
const task& tsk,
const std::vector<assigned_chunk>& chunks)
const
Declared at: include/command_graph_generator.h:244
Parameters
- const task& tsk
- const std::vector<assigned_chunk>& chunks
¶template <class Command,
typename... CtorParamsAndRecordWithFn>
Command* create_command(
batch& current_batch,
CtorParamsAndRecordWithFn&&... args)
template <class Command,
typename... CtorParamsAndRecordWithFn>
Command* create_command(
batch& current_batch,
CtorParamsAndRecordWithFn&&... args)
Description
Wrapper around command_graph::create that adds commands to the current batch. Records the command if a recorder is present. Invoke as create <command -type>(command-ctor-params, [ & ](const auto record_debug_info) { return record_debug_info(command-record-additional-ctor-params)})
Declared at: include/command_graph_generator.h:190
Template Parameters
- Command
- CtorParamsAndRecordWithFn
Parameters
- batch& current_batch
- CtorParamsAndRecordWithFn&&... args
¶template <class Command,
typename... CtorParamsAndRecordWithFn,
size_t... CtorParamIndices,
size_t RecordWithFnIndex>
Command* create_command_internal(
batch& current_batch,
std::tuple<CtorParamsAndRecordWithFn...>&&
ctor_params_and_record_with,
std::index_sequence<CtorParamIndices...>,
std::index_sequence<RecordWithFnIndex>)
template <class Command,
typename... CtorParamsAndRecordWithFn,
size_t... CtorParamIndices,
size_t RecordWithFnIndex>
Command* create_command_internal(
batch& current_batch,
std::tuple<CtorParamsAndRecordWithFn...>&&
ctor_params_and_record_with,
std::index_sequence<CtorParamIndices...>,
std::index_sequence<RecordWithFnIndex>)
Declared at: include/command_graph_generator.h:159
Template Parameters
- Command
- CtorParamsAndRecordWithFn
- size_t CtorParamIndices
- size_t RecordWithFnIndex
Parameters
- batch& current_batch
- std::tuple<CtorParamsAndRecordWithFn...>&& ctor_params_and_record_with
- std::index_sequence<CtorParamIndices...>
- std::index_sequence<RecordWithFnIndex>
¶static constexpr policy_set default_policy_set()
static constexpr policy_set default_policy_set()
Declared at: include/command_graph_generator.h:289
¶void generate_anti_dependencies(
const task& tsk,
buffer_id bid,
const region_map<write_command_state>&
last_writers_map,
const region<3>& write_req,
command* write_cmd)
void generate_anti_dependencies(
const task& tsk,
buffer_id bid,
const region_map<write_command_state>&
last_writers_map,
const region<3>& write_req,
command* write_cmd)
Declared at: include/command_graph_generator.h:269
Parameters
- const task& tsk
- buffer_id bid
- const region_map<write_command_state>& last_writers_map
- const region<3>& write_req
- command* write_cmd
¶void generate_await_pushes(
batch& current_batch,
const task& tsk,
const assigned_chunks_with_requirements&
chunks_with_requirements)
void generate_await_pushes(
batch& current_batch,
const task& tsk,
const assigned_chunks_with_requirements&
chunks_with_requirements)
Description
For all local chunks, find read requirements on remote data. Generate a single await push command for each buffer that awaits the entire required region. This will then be fulfilled by one or more incoming pushes.
Declared at: include/command_graph_generator.h:258
Parameters
- batch& current_batch
- const task& tsk
- const assigned_chunks_with_requirements& chunks_with_requirements
¶void generate_distributed_commands(
batch& current_batch,
const task& tsk)
void generate_distributed_commands(
batch& current_batch,
const task& tsk)
Description
Generates command(s) that need to be processed by every node in the system, because they may require data transfers.
Declared at: include/command_graph_generator.h:267
Parameters
- batch& current_batch
- const task& tsk
¶void generate_epoch_command(batch& current_batch,
const task& tsk)
void generate_epoch_command(batch& current_batch,
const task& tsk)
Declared at: include/command_graph_generator.h:276
Parameters
- batch& current_batch
- const task& tsk
¶void generate_epoch_dependencies(command* cmd)
void generate_epoch_dependencies(command* cmd)
Declared at: include/command_graph_generator.h:280
Parameters
- command* cmd
¶void generate_horizon_command(
batch& current_batch,
const task& tsk)
void generate_horizon_command(
batch& current_batch,
const task& tsk)
Declared at: include/command_graph_generator.h:278
Parameters
- batch& current_batch
- const task& tsk
¶void generate_pushes(
batch& current_batch,
const task& tsk,
const assigned_chunks_with_requirements&
chunks_with_requirements)
void generate_pushes(
batch& current_batch,
const task& tsk,
const assigned_chunks_with_requirements&
chunks_with_requirements)
Description
For all remote chunks, find read requirements intersecting with owned buffer regions and generate push commands for those regions.
Declared at: include/command_graph_generator.h:253
Parameters
- batch& current_batch
- const task& tsk
- const assigned_chunks_with_requirements& chunks_with_requirements
¶buffer_requirements_list
get_buffer_requirements_for_mapped_access(
const task& tsk,
const box<3>& box) const
buffer_requirements_list
get_buffer_requirements_for_mapped_access(
const task& tsk,
const box<3>& box) const
Declared at: include/command_graph_generator.h:242
Parameters
¶bool is_recording() const
bool is_recording() const
Description
True if a recorder is present and create_command() will call the record_with
lambda passed as its last parameter.
Declared at: include/command_graph_generator.h:150
¶std::string print_buffer_debug_label(
buffer_id bid) const
std::string print_buffer_debug_label(
buffer_id bid) const
Declared at: include/command_graph_generator.h:297
Parameters
- buffer_id bid
¶void reduce_execution_front_to(command* new_front)
void reduce_execution_front_to(command* new_front)
Declared at: include/command_graph_generator.h:274
Parameters
- command* new_front
¶void report_overlapping_writes(
const task& tsk,
const box_vector<3>& local_chunks) const
void report_overlapping_writes(
const task& tsk,
const box_vector<3>& local_chunks) const
Declared at: include/command_graph_generator.h:282
Parameters
- const task& tsk
- const box_vector<3>& local_chunks
¶void resolve_pending_reductions(
batch& current_batch,
const task& tsk,
const assigned_chunks_with_requirements&
chunks_with_requirements)
void resolve_pending_reductions(
batch& current_batch,
const task& tsk,
const assigned_chunks_with_requirements&
chunks_with_requirements)
Description
Resolve requirements on buffers with pending reductions. For local chunks, create a reduction command and a single await_push command that receives the partial reduction results from all other nodes. For remote chunks, always create a push command, regardless of whether we own a partial reduction result or not. This is required because remote nodes do not know how many partial reduction results there are.
Declared at: include/command_graph_generator.h:250
Parameters
- batch& current_batch
- const task& tsk
- const assigned_chunks_with_requirements& chunks_with_requirements
¶void set_epoch_for_new_commands(
command* epoch_or_horizon)
void set_epoch_for_new_commands(
command* epoch_or_horizon)
Declared at: include/command_graph_generator.h:272
Parameters
- command* epoch_or_horizon
¶std::vector<assigned_chunk>
split_task_and_assign_chunks(
const task& tsk) const
std::vector<assigned_chunk>
split_task_and_assign_chunks(
const task& tsk) const
Declared at: include/command_graph_generator.h:240
Parameters
- const task& tsk
¶void update_local_buffer_fresh_regions(
const task& tsk,
const std::unordered_map<buffer_id,
region<3>>&
per_buffer_local_writes)
void update_local_buffer_fresh_regions(
const task& tsk,
const std::unordered_map<buffer_id,
region<3>>&
per_buffer_local_writes)
Description
Determine which local data is fresh or stale by comparing global (task-level) and local writes.
Declared at: include/command_graph_generator.h:261
Parameters
- const task& tsk
- const std::unordered_map<buffer_id, region<3>>& per_buffer_local_writes