Skip to main content

struct buffer_allocation_state

Declaration

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

Description

Per-allocation state for a single buffer. This is where we track last-writer instructions and access fronts.

Member Variables

allocation_id aid
detail::box<3> box
in buffer coordinates
region_map<access_front> last_writers
in buffer coordinates
region_map<access_front> last_concurrent_accesses
in buffer coordinates

Member Function Overview

Member Functions

void apply_epoch(instruction* epoch)

Description

Replace all tracked instructions that older than epoch with epoch.

Parameters

instruction* epoch

void begin_concurrent_writes(
    const region<3>& region)

Description

Replace the current access front with an empty write-front. This is done in preparation of writes from device kernels and host tasks.

Parameters

const region<3>& region

explicit buffer_allocation_state(
    allocation_id aid,
    alloc_instruction* ainstr,
    const detail::box<3>& allocated_box,
    const range<3>& buffer_range)

Parameters

allocation_id aid
alloc_instruction* ainstr
const detail::box<3>& allocated_box
const range<3>& buffer_range

void track_atomic_write(const region<3>& region,
                        instruction* instr)

Description

Replace the current access front with a write. The write is treated as "atomic" in the sense that there is never a second, concurrent write operation happening simultaneously. This is true for all writes except those from device kernels and host tasks, which might specify overlapping write-accessors.

Parameters

const region<3>& region
instruction* instr

void track_concurrent_read(
    const region<3>& region,
    instruction* instr)

Description

Add instr to the active set of concurrent reads, or replace the current access front if the last access was not a read.

Parameters

const region<3>& region
instruction* instr

void track_concurrent_write(
    const region<3>& region,
    instruction* instr)

Description

Add an instruction to the current set of concurrent writes. This is used to track writes from device kernels and host tasks and requires begin_concurrent_writes to be called beforehand. Multiple concurrent writes will only occur when a task declares overlapping writes and overlapping-write detection is disabled via the error policy. In order to still produce an executable (albeit racy instruction graph) in that case, we track multiple last-writers for the same buffer element.

Parameters

const region<3>& region
instruction* instr