Skip to main content

class backend

Declaration

class backend { /* full declaration omitted */ };

Description

The backend is responsible for asynchronously allocating device- and device-accessible host memory, copying data between host and device allocations, and launching host tasks and device kernels. Asynchronous work must be explicitly assigned to in-order queue ids as assigned by out_of_order_engine.

Member Function Overview

  • backend(const backend &)
  • backend(backend &&)
  • backend()
  • check_async_errors() → virtual void
  • debug_alloc(size_t size) → virtual void *
  • debug_free(void * ptr) → virtual void
  • enqueue_device_alloc(device_id memory_device, size_t size, size_t alignment) → virtual async_event
  • enqueue_device_copy(device_id device, size_t device_lane, const void * source_base, void * dest_base, const box<3> & source_box, const box<3> & dest_box, const region<3> & copy_region, size_t elem_size) → virtual async_event
  • enqueue_device_free(device_id memory_device, void * ptr) → virtual async_event
  • enqueue_device_kernel(device_id device, size_t device_lane, const device_kernel_launcher & launcher, std::vector<closure_hydrator::accessor_info> accessor_infos, const box<3> & execution_range, const std::vector<void *> & reduction_ptrs) → virtual async_event
  • enqueue_host_alloc(size_t size, size_t alignment) → virtual async_event
  • enqueue_host_copy(size_t host_lane, const void * source_base, void * dest_base, const box<3> & source_box, const box<3> & dest_box, const region<3> & copy_region, size_t elem_size) → virtual async_event
  • enqueue_host_free(void * ptr) → virtual async_event
  • enqueue_host_task(size_t host_lane, const host_task_launcher & launcher, std::vector<closure_hydrator::accessor_info> accessor_infos, const box<3> & execution_range, const communicator * collective_comm) → virtual async_event
  • get_system_info() const → virtual const system_info &
  • init() → virtual void
  • operator=(backend &&) → backend &
  • operator=(const backend &) → backend &
  • ~backend() → virtual

Member Functions

backend(const backend&)

Parameters

const backend&

backend(backend&&)

Parameters

backend&&

backend()


virtual void check_async_errors()

Description

Check internal queues and panic if any asynchronous errors occurred.


virtual void* debug_alloc(size_t size)

Description

Synchronously allocates device-accessible host memory. This is slow and meant for debugging purposes only.

Parameters

size_t size

virtual void debug_free(void* ptr)

Description

Synchronously frees device-accessible host memory. This is slow and meant for debugging purposes only.

Parameters

void* ptr

virtual async_event enqueue_device_alloc(
    device_id memory_device,
    size_t size,
    size_t alignment)

Description

Schedules the allocation of device memory with the specified size and alignment. The operation will complete in-order with respect to any other asynchronous alloc and free operation on the same backend.

Parameters

device_id memory_device
size_t size
size_t alignment

virtual async_event enqueue_device_copy(
    device_id device,
    size_t device_lane,
    const void* source_base,
    void* dest_base,
    const box<3>& source_box,
    const box<3>& dest_box,
    const region<3>& copy_region,
    size_t elem_size)

Description

Enqueues an n-dimensional copy between two device-accessible allocations (at least one device-native). The operation will complete in-order with respect to any other asynchronous device operation on device and device_lane.

Parameters

device_id device
size_t device_lane
const void* source_base
void* dest_base
const box<3>& source_box
const box<3>& dest_box
const region<3>& copy_region
size_t elem_size

virtual async_event enqueue_device_free(
    device_id memory_device,
    void* ptr)

Description

Schedules the release of memory allocated via enqueue_device_alloc. The operation will complete in-order with respect to any other asynchronous alloc and free operation on the same backend.

Parameters

device_id memory_device
void* ptr

virtual async_event enqueue_device_kernel(
    device_id device,
    size_t device_lane,
    const device_kernel_launcher& launcher,
    std::vector<closure_hydrator::accessor_info>
        accessor_infos,
    const box<3>& execution_range,
    const std::vector<void*>& reduction_ptrs)

Description

Enqueues the asynchronous execution of a kernel in an in-order device queue identified by device and device_lane. The operation will complete in-order with respect to any other asynchronous device operation on device and device_lane.

Parameters

device_id device
size_t device_lane
const device_kernel_launcher& launcher
std::vector<closure_hydrator::accessor_info> accessor_infos
const box<3>& execution_range
const std::vector<void*>& reduction_ptrs

virtual async_event enqueue_host_alloc(
    size_t size,
    size_t alignment)

Description

Schedules the allocation of device-accessible host memory with the specified size and alignment. The operation will complete in-order with respect to any other asynchronous alloc and free operation on the same backend.

Parameters

size_t size
size_t alignment

virtual async_event enqueue_host_copy(
    size_t host_lane,
    const void* source_base,
    void* dest_base,
    const box<3>& source_box,
    const box<3>& dest_box,
    const region<3>& copy_region,
    size_t elem_size)

Description

Enqueues an n-dimensional copy between two host allocations (both either device-accessible or user-allocated). The operation will complete in-order with respect to any other asynchronous host operation on host_lane.

Parameters

size_t host_lane
const void* source_base
void* dest_base
const box<3>& source_box
const box<3>& dest_box
const region<3>& copy_region
size_t elem_size

virtual async_event enqueue_host_free(void* ptr)

Description

Schedules the release of memory allocated via enqueue_host_alloc. The operation will complete in-order with respect to any other asynchronous alloc and free operation on the same backend.

Parameters

void* ptr

virtual async_event enqueue_host_task(
    size_t host_lane,
    const host_task_launcher& launcher,
    std::vector<closure_hydrator::accessor_info>
        accessor_infos,
    const box<3>& execution_range,
    const communicator* collective_comm)

Description

Enqueues the asynchronous execution of a host task in a background thread identified by host_lane. The operation will complete in-order with respect to any other asynchronous host operation on host_lane.

Parameters

size_t host_lane
const host_task_launcher& launcher
std::vector<closure_hydrator::accessor_info> accessor_infos
const box<3>& execution_range
const communicator* collective_comm

virtual const system_info& get_system_info() const

Description

Returns metadata about the system as it appears to the backend implementation.


virtual void init()

Description

Performs (possibly latency-intensive) backend initialization. Separate from the constructor to allow this function to be called from a different thread.


backend& operator=(backend&&)

Parameters

backend&&

backend& operator=(const backend&)

Parameters

const backend&

virtual ~backend()