diff options
author | Alexandru Dutu <alexandru.dutu@amd.com> | 2016-09-16 12:29:01 -0400 |
---|---|---|
committer | Alexandru Dutu <alexandru.dutu@amd.com> | 2016-09-16 12:29:01 -0400 |
commit | 791837645002679eb3f7f71469d151c10c533d5c (patch) | |
tree | a439673ec08094ef232631307d3edba5f20c8673 /src | |
parent | d5c8c5d3db1954ff4e33dade0812fed7b60a9269 (diff) | |
download | gem5-791837645002679eb3f7f71469d151c10c533d5c.tar.xz |
gpu-compute: Changing reconvergenceStack type
std::stack has no iterators, therefore the reconvergence stack can't be
iterated without poping elements off. We will be using std::list instead to be
able to iterate for saving and restoring purposes.
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu-compute/wavefront.cc | 14 | ||||
-rw-r--r-- | src/gpu-compute/wavefront.hh | 51 |
2 files changed, 29 insertions, 36 deletions
diff --git a/src/gpu-compute/wavefront.cc b/src/gpu-compute/wavefront.cc index 76a0bdf9e..3deb11961 100644 --- a/src/gpu-compute/wavefront.cc +++ b/src/gpu-compute/wavefront.cc @@ -873,7 +873,7 @@ Wavefront::pushToReconvergenceStack(uint32_t pc, uint32_t rpc, const VectorMask& mask) { assert(mask.count()); - reconvergenceStack.emplace(new ReconvergenceStackEntry(pc, rpc, mask)); + reconvergenceStack.emplace_back(new ReconvergenceStackEntry{pc, rpc, mask}); } void @@ -886,7 +886,7 @@ Wavefront::popFromReconvergenceStack() execMask().to_string<char, std::string::traits_type, std::string::allocator_type>().c_str(), pc()); - reconvergenceStack.pop(); + reconvergenceStack.pop_back(); DPRINTF(WavefrontStack, "%3i %s\n", pc(), execMask().to_string<char, std::string::traits_type, @@ -904,32 +904,32 @@ Wavefront::discardFetch() uint32_t Wavefront::pc() const { - return reconvergenceStack.top()->pc; + return reconvergenceStack.back()->pc; } uint32_t Wavefront::rpc() const { - return reconvergenceStack.top()->rpc; + return reconvergenceStack.back()->rpc; } VectorMask Wavefront::execMask() const { - return reconvergenceStack.top()->execMask; + return reconvergenceStack.back()->execMask; } bool Wavefront::execMask(int lane) const { - return reconvergenceStack.top()->execMask[lane]; + return reconvergenceStack.back()->execMask[lane]; } void Wavefront::pc(uint32_t new_pc) { - reconvergenceStack.top()->pc = new_pc; + reconvergenceStack.back()->pc = new_pc; } uint32_t diff --git a/src/gpu-compute/wavefront.hh b/src/gpu-compute/wavefront.hh index 4fe66ecfe..20007bd83 100644 --- a/src/gpu-compute/wavefront.hh +++ b/src/gpu-compute/wavefront.hh @@ -52,6 +52,27 @@ static const int MAX_NUM_INSTS_PER_WF = 12; +/** + * A reconvergence stack entry conveys the necessary state to implement + * control flow divergence. + */ +struct ReconvergenceStackEntry { + /** + * PC of current instruction. + */ + uint32_t pc; + /** + * PC of the immediate post-dominator instruction, i.e., the value of + * @a pc for the first instruction that will be executed by the wavefront + * when a reconvergence point is reached. + */ + uint32_t rpc; + /** + * Execution mask. + */ + VectorMask execMask; +}; + /* * Arguments for the hsail opcode call, are user defined and variable length. * The hardware/finalizer can support arguments in hardware or use memory to @@ -120,34 +141,6 @@ class CallArgMem } }; -/** - * A reconvergence stack entry conveys the necessary state to implement - * control flow divergence. - */ -class ReconvergenceStackEntry { - - public: - ReconvergenceStackEntry(uint32_t new_pc, uint32_t new_rpc, - VectorMask new_mask) : pc(new_pc), rpc(new_rpc), - execMask(new_mask) { - } - - /** - * PC of current instruction. - */ - uint32_t pc; - /** - * PC of the immediate post-dominator instruction, i.e., the value of - * @a pc for the first instruction that will be executed by the wavefront - * when a reconvergence point is reached. - */ - uint32_t rpc; - /** - * Execution mask. - */ - VectorMask execMask; -}; - class Wavefront : public SimObject { public: @@ -368,7 +361,7 @@ class Wavefront : public SimObject * point (branch instruction), and shrinks every time the wavefront * reaches a reconvergence point (immediate post-dominator instruction). */ - std::stack<std::unique_ptr<ReconvergenceStackEntry>> reconvergenceStack; + std::deque<std::unique_ptr<ReconvergenceStackEntry>> reconvergenceStack; }; #endif // __WAVEFRONT_HH__ |