SMAUG
Simulating Machine Learning Applications on gem5-Aladdin
smv_tiling_common.h
1 #ifndef _OPERATORS_SMV_TILING_COMMON_H_
2 #define _OPERATORS_SMV_TILING_COMMON_H_
3 
4 #include "smaug/core/tensor.h"
5 
6 namespace smaug {
7 namespace smv {
8 
13 enum TilingDims {
14  None,
15  DimN,
16  DimNC,
17  DimNH,
18  DimNW,
19  DimNHW,
20  DimNCH,
21  DimNCW,
22  Invalid
23 };
24 
29 struct TilingConfig {
30  public:
32  TensorShape _weights = TensorShape(),
33  TensorShape _outputs = TensorShape())
34  : inputs(_inputs), weights(_weights), outputs(_outputs) {}
35 
36  int getTotalSize() const {
37  return inputs.storageSize() + weights.storageSize() +
38  outputs.storageSize();
39  }
40 
41  TensorShape inputs;
42  TensorShape weights;
43  TensorShape outputs;
44  TilingDims inputTilingDims;
45  TilingDims weightTilingDims;
46  TilingDims outputTilingDims;
47 };
48 
49 std::ostream& operator<<(std::ostream& os, const TilingDims& dims);
50 std::ostream& operator<<(std::ostream& os, const TilingConfig& config);
51 
52 bool needsNwiseTiling(TilingDims dim);
53 
54 bool needsCwiseTiling(TilingDims dim);
55 
56 bool needsHwiseTiling(TilingDims dim);
57 
58 bool needsWwiseTiling(TilingDims dim);
59 
60 } // namespace smv
61 } // namespace smaug
62 
63 #endif
smaug::smv::TilingDims
TilingDims
The set of supported tiling strategies.
Definition: smv_tiling_common.h:13
smaug::TensorShape
TensorShape describes the shape of a Tensor.
Definition: tensor.h:35
smaug::smv::TilingConfig
A TilingConfig describes tiling strategies and optimal tile sizes for inputs, weights,...
Definition: smv_tiling_common.h:29
smaug
The smaug namespace is the parent namespace of all C++ code in SMAUG.
Definition: backend.cpp:38