18#include <fletcher/common.h>
A Context for a platform where a RecordBatches can be prepared for processing by the Kernel.
uint64_t num_recordbatches() const
Return the number of RecordBatches in this context.
std::vector< DeviceBuffer > device_buffers_
Prepared/cached buffers on the device.
std::shared_ptr< arrow::RecordBatch > recordbatch(size_t i) const
Return the i-th arrow::RecordBatch of this context.
size_t GetQueueSize() const
Obtain the size (in bytes) of all buffers currently enqueued.
uint64_t num_buffers() const
Return the number of device buffers in this context.
std::shared_ptr< Platform > platform_
The platform this context is running on.
std::vector< std::shared_ptr< arrow::RecordBatch > > host_batches_
The RecordBatches on the host side.
std::vector< MemType > host_batch_memtype_
Whether the RecordBatch must be prepared or cached for the device.
Context(std::shared_ptr< Platform > platform)
Context constructor.
std::vector< RecordBatchDescription > host_batch_desc_
The descriptions of the RecordBatches on the host side.
Status Enable()
Enable the usage of the enqueued buffers by the device.
~Context()
Deconstruct the context object, freeing all allocated device buffers.
DeviceBuffer device_buffer(size_t i) const
Return the i-th DeviceBuffer of this context.
std::shared_ptr< Platform > platform() const
Return the platform this context is active on.
Status QueueRecordBatch(const std::shared_ptr< arrow::RecordBatch > &record_batch, MemType mem_type=MemType::ANY)
Enqueue an arrow::RecordBatch for usage on the device.
static Status Make(std::shared_ptr< Context > *context, const std::shared_ptr< Platform > &platform)
Create a new context on a specific platform.
Contains all Fletcher classes and functions for use in run-time applications.
MemType
Enumeration for different types of memory management.
@ CACHE
Cache the data to on-board memory of the device.
@ ANY
Apply the least effort to make the data available to the device.
bool available_to_device
Whether this buffer has been made available to the device.
DeviceBuffer()=default
Construct a default DeviceBuffer.
Mode mode
The access mode as seen by the accelerator kernel.
DeviceBuffer(const uint8_t *host_address, int64_t size, MemType type, Mode access_mode)
Construct a new DeviceBuffer.
da_t device_address
The device-side address of this buffer.
MemType memory
The memory type of this buffer.
bool was_alloced
Whether this buffer was allocated on the device using Platform malloc.
const uint8_t * host_address
The host-side mirror address of this buffer.
int64_t size
The size of this buffer in bytes.
Status return value of all Fletcher run-time functions.