|
SMAUG
Simulating Machine Learning Applications on gem5-Aladdin
|
A multidimensional container of Tensors. More...
#include <tensor.h>
A multidimensional container of Tensors.
Each of the tensors in a TiledTensor represents one tile or rectangular section of a large tensor. TileTensor can be iterated over via a TensorIndexIterator just like ordinary Tensors, except each iteration produces a Tensor instead of scalar data.
Classes | |
| struct | CopyTilesArgs |
| struct | Tile |
| A tile is a rectangular portion of a larger Tensor. More... | |
Public Member Functions | |
| TiledTensor (Tensor *_origTensor=nullptr, bool _useRawTensor=false) | |
| TiledTensor (const TensorShape &shape, Tensor *_origTensor=nullptr, bool _useRawTensor=false) | |
| Construct a TiledTensor. More... | |
| virtual bool | containsData () const |
| TensorIndexIterator | startIndex () const |
| const Tensor * | operator[] (int index) const |
| Returns a const pointer to the Tensor at the given linear index. | |
| Tensor *& | operator[] (int index) |
| Returns a mutable reference to the Tensor at the given linear index. | |
| int | size () const |
| bool | isDimNHTiled () const |
| Returns true if this TiledTensor is tiled along the N and H logical dimensions. | |
| Tensor * | getTileWithData (int index) |
| Returns a Tensor at the specified tile position, with data copied from the original tensor. | |
| void | setTile (int index, const std::vector< int > &origin, Tensor *tensor, bool copyData) |
| Set the specified tile to the provided Tensor, and optionally copy data into it. | |
| void | copyDataToAllTiles () |
| Copies data (if needed) to all the tiles from the original Tensor. | |
| void | untile () |
| Copies data from the TiledTensor into the original Tensor. More... | |
Public Member Functions inherited from smaug::TensorBase | |
| TensorBase (const std::string &_name, const TensorShape &_shape) | |
| TensorBase (const TensorProto &tensorProto) | |
| std::string | getName () const |
| const TensorShape & | getShape () const |
| int | ndims () const |
| int | dim (int index) const |
| int | getTotalDim (int index) const |
| int | getDataStorageFormat () const |
| DataType | getDataType () const |
| int | getDataTypeSize () const |
| bool | isDead () const |
| void | setDead (bool _dead=true) |
Static Public Member Functions | |
| static void * | tileCopyWorker (void *_args) |
Protected Types | |
| enum | TileDataOperation { Scatter, Gather } |
| Specifies what to do with the data in the original Tensor and tiles. More... | |
Protected Member Functions | |
| Tile * | getTile (int index) |
| void | copyDataToTile (Tile *tile) |
| Copy data (if needed) to this tile from the original Tensor. | |
| void | gatherDataFromTile (Tile *tile) |
| Copy data from this tile to the original Tensor. | |
| void | parallelCopyTileData (TileDataOperation op) |
| Split the work (data filling or gathering) across multiple threads. | |
Protected Attributes | |
| bool | useRawTensor |
| True if we should use copyRawTensorData() for copying data. | |
| Tensor * | origTensor |
| The original Tensor that was tiled into this TiledTensor. | |
| bool | dataFilled |
| True if all the tiles have data filled. | |
| std::vector< Tile > | tiles |
| The list of Tiles, indexed using a TensorIndexIterator. | |
Protected Attributes inherited from smaug::TensorBase | |
| std::string | name |
| Name of of the Tensor. More... | |
| TensorShape | shape |
| Shape of the Tensor. | |
| DataStorageFormat | dataFormat |
| Indicates the compression format of the data. More... | |
| DataType | dataType |
| bool | dead |
| If true, the tensor is dead, which means it is on an untaken control flow path. More... | |
|
protected |
|
inline |
Construct a TiledTensor.
| shape | The shape of the TiledTensor - that is, the number of tiles in each dimension. Alignment padding is ignored here. |
| _origTensor | The Tensor that is being tiled. |
| _useRawTensor | If true, data from the original Tensor is memcpy'ed into the all the tiles, instead of being copied element-wise from/to a specific region. Only useful for broadcasting data into the tiles. |
| void smaug::TiledTensor::untile | ( | ) |
Copies data from the TiledTensor into the original Tensor.
We name it "untile" because what it does reverses the tiling process.
Definition at line 153 of file tensor.cpp.
1.8.18