SMAUG
Simulating Machine Learning Applications on gem5-Aladdin
smv_convolution_op.h
1 #ifndef _OPERATORS_SMV_SMV_CONVOLUTION_OP_H_
2 #define _OPERATORS_SMV_SMV_CONVOLUTION_OP_H_
3 
4 #include "smaug/core/backend.h"
6 #include "smaug/operators/convolution_op.h"
7 
8 namespace smaug {
9 
10 namespace smv {
12 namespace conv {
13 
14 extern const int kNumPEs;
15 extern const int kNumMaccsPerPE;
16 
17 class TilingOptimizer;
18 
19 } // namespace conv
20 } // namespace smv
21 
27 class SmvConvolutionOp : public ConvolutionOp<SmvBackend> {
28  public:
30  void tile() override;
31  void run() override;
32  friend class smv::conv::TilingOptimizer;
33 
34  protected:
38  void runNHWC(TiledTensor& inputs,
39  TiledTensor& weights,
40  TiledTensor& outputs);
41  std::unique_ptr<volatile int> invokeSystolicArrayKernel(
42  unsigned accelId,
43  float16* inputs,
44  float16* weights,
45  float16* outputs,
46  int inputsDims[4],
47  int weightsDims[4],
48  int outputsDims[4],
49  int inputsPad,
50  int weightsPad,
51  int outputPad,
52  int inputHaloPad[4],
53  int stride,
54  int ifmapStart,
55  int kernStart,
56  bool accumulate,
57  bool readInputs,
58  bool readWeights,
59  bool sendResults,
60  ActivationInfo* actInfo);
61 
62  std::array<TiledTensor, 3> tiledTensors;
63 };
64 
65 } // namespace smaug
66 
67 #endif
ActivationInfo
Specifies an activation function and relevant parameters.
Definition: common.h:210
smaug::smv::conv::TilingOptimizer
Tiling optimizer for SMV convolution kernel.
Definition: smv_convolution_tiling.h:19
smaug::SmvConvolutionOp::runNHWC
void runNHWC(TiledTensor &inputs, TiledTensor &weights, TiledTensor &outputs)
Tiling scheduler for this operator.
Definition: smv_convolution_op.cpp:19
smaug::TiledTensor
A multidimensional container of Tensors.
Definition: tensor.h:552
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::ConvolutionOp
The base class for all 4D spatial convolution operators.
Definition: backend.h:33
smaug::SmvConvolutionOp
SMV backend implementation of convolution.
Definition: smv_convolution_op.h:27