SMAUG
Simulating Machine Learning Applications on gem5-Aladdin
smv_accel_pool.h
1 #ifndef _OPERATORS_SMV_SMV_ACCELERATOR_POOL_H_
2 #define _OPERATORS_SMV_SMV_ACCELERATOR_POOL_H_
3 
4 #include <vector>
5 #include <deque>
6 #include <memory>
7 
8 namespace smaug {
9 
33  public:
34  SmvAcceleratorPool(int _size);
35 
37  void addFinishFlag(int accelIdx, std::unique_ptr<volatile int> finishFlag);
38 
40  void joinAll();
41 
53  int getNextAvailableAccelerator(int currAccelIdx);
54 
55  protected:
57  void join(int accelIdx);
58 
60  int size;
61 
63  std::vector<std::deque<std::unique_ptr<volatile int>>> finishFlags;
64 };
65 
66 } // namespace smaug
67 
68 #endif
smaug::SmvAcceleratorPool::size
int size
Number of accelerators in the pool.
Definition: smv_accel_pool.h:60
smaug::SmvAcceleratorPool::addFinishFlag
void addFinishFlag(int accelIdx, std::unique_ptr< volatile int > finishFlag)
Add a finish flag for the specified accelerator.
Definition: smv_accel_pool.cpp:12
smaug::SmvAcceleratorPool::joinAll
void joinAll()
Wait until all the finish flags turn complete.
Definition: smv_accel_pool.cpp:32
smaug::SmvAcceleratorPool::join
void join(int accelIdx)
Wait until this accelerator's finish flags turn complete.
Definition: smv_accel_pool.cpp:19
smaug
The smaug namespace is the parent namespace of all C++ code in SMAUG.
Definition: backend.cpp:38
smaug::SmvAcceleratorPool
Implements a pool of worker accelerators.
Definition: smv_accel_pool.h:32
smaug::SmvAcceleratorPool::finishFlags
std::vector< std::deque< std::unique_ptr< volatile int > > > finishFlags
Active finish flags for all the accelerators in the pool.
Definition: smv_accel_pool.h:63
smaug::SmvAcceleratorPool::getNextAvailableAccelerator
int getNextAvailableAccelerator(int currAccelIdx)
Get the next accelerator and wait if it's still busy.
Definition: smv_accel_pool.cpp:39