Skip to main content

struct buffer_state

Declaration

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

Description

State for a single buffer.

Member Variables

std::string debug_name
celerity::range<3> range
size_t elem_size
in bytes
size_t elem_align
in bytes
dense_map<memory_id, buffer_memory_state> memories
Per-memory and per-allocation state of this buffer.
region_map<memory_mask> up_to_date_memories
Contains a mask for every memory_id that either was written to by the original-producer instruction or that has already been made coherent previously.
region_map<instruction*> original_writers
Tracks the instruction that initially produced each buffer element on the local node - this can be a kernel, host task, region-receive or reduce-instruction, or - in case of a host-initialized buffer - an epoch. It is different from `buffer_allocation_state::last_writers` in that it never contains copy instructions. Copy- and send source regions are split on their original producer instructions to facilitate computation-communication overlap when different producers finish at different times.
region_map<memory_id> original_write_memories
Tracks the memory to which the original_writer instruction wrote each buffer element. `original_write_memories[box]` is meaningless when `up_to_date_memories[box]` is empty (i.e. the buffer is not up-to-date on the local node due to being uninitialized or await-pushed without being consumed).
std::vector<region_receive> pending_receives
std::vector<gather_receive> pending_gathers

Member Function Overview

  • apply_epoch(instruction * epoch) → void
  • buffer_state(const celerity::range<3> & range, size_t elem_size, size_t elem_align, size_t n_memories) → explicit
  • track_original_write(const region<3> & region, instruction * instr, memory_id mid) → void

Member Functions

void apply_epoch(instruction* epoch)

Description

Replace all tracked instructions that are older than epoch with epoch.

Parameters

instruction* epoch

explicit buffer_state(
    const celerity::range<3>& range,
    size_t elem_size,
    size_t elem_align,
    size_t n_memories)

Parameters

const celerity::range<3>& range
size_t elem_size
size_t elem_align
size_t n_memories

void track_original_write(const region<3>& region,
                          instruction* instr,
                          memory_id mid)

Parameters

const region<3>& region
instruction* instr
memory_id mid