Class Buffer

Inheritance Relationships

Derived Types

Class Documentation

class Buffer

The base buffer class. Buffer implementations should extend this class and override the methods.

Subclassed by amdinfer::VartTensorBuffer, amdinfer::VectorBuffer

Public Functions

virtual ~Buffer() = default

Destroy the Buffer object.

virtual void *data(size_t offset) = 0

Get a pointer to the underlying data of the buffer.

Parameters

offset – For non-contiguous buffers, an offset may be needed to choose which pointer to return. Buffer implementations may ignore this value if unneeded.

Returns

void*

virtual void reset() = 0

Reset the buffer. This should be called prior to returning the buffer to its buffer pool.

virtual size_t write(void *data, size_t offset, size_t size)

Write arbitrary data from an address into this buffer.

Parameters
  • data – pointer to data

  • offset – offset to start writing the data

  • size – size of the data to write in bytes

Returns

size_t number of bytes actually written

template<typename T>
inline size_t write(T value, size_t offset)

Write a bool value to the buffer.

Parameters

value – value to write