SMAUG
Simulating Machine Learning Applications on gem5-Aladdin
smv_pooling_op.h
1 #ifndef _OPERATORS_SMV_SMV_POOLING_OP_H_
2 #define _OPERATORS_SMV_SMV_POOLING_OP_H_
3 
4 #include "smaug/core/backend.h"
6 #include "smaug/operators/pooling_op.h"
7 
8 namespace smaug {
9 
10 namespace smv {
11 
13 namespace pool {
14 
15 extern const int kVectorSize;
16 
17 class TilingOptimizer;
18 
19 } // namespace pool
20 } // namespace smv
21 
23 class SmvPoolingOp : public PoolingOp<SmvBackend> {
24  public:
26  void tile() override;
27  void run() override;
28  friend class smv::pool::TilingOptimizer;
29 
30  protected:
31  void runNHWC(TiledTensor& inputs, TiledTensor& outputs);
32 
33  std::array<TiledTensor, 2> tiledTensors;
34 };
35 
37 class SmvMaxPoolingOp : public SmvPoolingOp {
38  public:
39  SmvMaxPoolingOp(const std::string& name, Workspace* workspace)
40  : SmvPoolingOp(name, OpType::MaxPooling, workspace){};
41  void tile() override;
42  void run() override;
43 };
44 
46 class SmvAvgPoolingOp : public SmvPoolingOp {
47  public:
48  SmvAvgPoolingOp(const std::string& name, Workspace* workspace)
49  : SmvPoolingOp(name, OpType::AveragePooling, workspace){};
50  void tile() override;
51  void run() override;
52 };
53 
54 } // namespace smaug
55 
56 #endif
57 
smaug::SmvMaxPoolingOp::run
void run() override
Executes the Operator.
Definition: smv_pooling_op.cpp:136
smaug::SmvPoolingOp
Base class for SMV pooling oeprators.
Definition: smv_pooling_op.h:23
smaug::smv::pool::TilingOptimizer
Tiling optimizer for pooling operators on SMV.
Definition: smv_pooling_tiling.h:19
smaug::Workspace
Workspace is the container and owner of all Tensors and Operators in the Network.
Definition: workspace.h:17
smaug::TiledTensor
A multidimensional container of Tensors.
Definition: tensor.h:552
smaug::SmvAvgPoolingOp::run
void run() override
Executes the Operator.
Definition: smv_pooling_op.cpp:138
smaug::SmvMaxPoolingOp
Max-pooling operator on SMV.
Definition: smv_pooling_op.h:37
smaug::SmvAvgPoolingOp
Average pooling operator on SMV.
Definition: smv_pooling_op.h:46
smaug::Operator::outputs
std::vector< TensorBase * > outputs
An ordered list of output tensors produced by this operator.
Definition: operator.h:141
smaug::SmvPoolingOp::run
void run() override
Executes the Operator.
Definition: smv_pooling_op.cpp:109
smaug
The smaug namespace is the parent namespace of all C++ code in SMAUG.
Definition: backend.cpp:38
common.h
Utilities for writing and invoking Aladdin kernels from Operators.
smaug::PoolingOp
Implements a pooling operator.
Definition: pooling_op.h:22
smaug::Operator::inputs
std::vector< TensorBase * > inputs
An ordered list of input tensors consumed by this operator.
Definition: operator.h:134