|
FreeTensor
|
#include <array.h>
Public Member Functions | |
| ~Array () | |
| Array (Array &&) | |
| Array (const Array &)=delete | |
| Array & | operator= (Array &&) |
| Array & | operator= (const Array &)=delete |
| size_t | size () const |
| size_t | nElem () const |
| const std::vector< size_t > & | shape () const |
| DataType | dtype () const |
| bool | dontDropBorrow () const |
| void | setDontDropBorrow (bool flag) |
| bool | moved () const |
| void | setMoved (bool flag) |
| void * | rawSharedTo (const Ref< Device > &device) |
| void * | rawMovedTo (const Ref< Device > &device) |
| void * | rawInitTo (const Ref< Device > &device) |
| void * | rawTemporarilyCopiedTo (const Ref< Device > &device) |
| void | makePrivateCopy () |
Static Public Member Functions | |
| static Array | moveFromRaw (void *ptr, const std::vector< size_t > &shape, DataType dtype, const Ref< Device > &device) |
| static Array | borrowFromRaw (void *ptr, const std::vector< size_t > &shape, DataType dtype, const Ref< Device > &device, bool dontDropBorrow, bool moved) |
Data stored on a Device or shared by multiple Devices
An Array manages one or more ArrayCopys, locating on different devices. An ArrayCopy can be a memory buffer managed by itself, or can be borrowed from a user object.
When an Array is required for read-only, an ArrayCopy will be copied to a specific device, if there isn't one on the device.
When an Array is requried for write-only, an ArrayCopy will be allocated without initialization on a specific device, if there isn't one, and copies on other devices will be dropped. Writing to a lending user object at a different device is not supported.
When an Array is requried for read-write, an ArrayCopy will be copied to a specific device, if there isn't one, and copies on other devices will be dropped. Writing to a lending user object at a different device is not supported.
| freetensor::Array::~Array | ( | ) |
| freetensor::Array::Array | ( | Array && | other | ) |
|
delete |
|
static |
Borrow from raw pointer.
Please make sure the owner keeps alive. Use keep_alive when exposing with PyBind11
|
inline |
|
inline |
| void freetensor::Array::makePrivateCopy | ( | ) |
Somethings we can't keep track of user objects, so we need to ensure we don't borrow from user data
|
inline |
|
static |
Move from raw pointer. Use with cautious
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |