adjust SimX's split/join to match RTL.

This commit is contained in:
Blaise Tine 2024-08-28 18:46:30 -07:00
parent 74a47ebbe4
commit 41e41c9688
4 changed files with 18 additions and 23 deletions

View file

@ -30,17 +30,6 @@
using namespace vortex;
Emulator::ipdom_entry_t::ipdom_entry_t(const ThreadMask &tmask, Word PC)
: tmask(tmask)
, PC(PC)
, fallthrough(false)
{}
Emulator::ipdom_entry_t::ipdom_entry_t(const ThreadMask &tmask)
: tmask(tmask)
, fallthrough(true)
{}
Emulator::warp_t::warp_t(const Arch& arch)
: ireg_file(arch.num_threads(), std::vector<Word>(MAX_NUM_REGS))
, freg_file(arch.num_threads(), std::vector<uint64_t>(MAX_NUM_REGS))
@ -85,7 +74,7 @@ Emulator::Emulator(const Arch &arch, const DCRS &dcrs, Core* core)
, core_(core)
, warps_(arch.num_warps(), arch)
, barriers_(arch.num_barriers(), 0)
, ipdom_size_((arch.num_threads()-1) * 2)
, ipdom_size_(arch.num_threads()-1)
{
this->clear();
}

View file

@ -57,10 +57,15 @@ public:
private:
struct ipdom_entry_t {
ipdom_entry_t(const ThreadMask &tmask, Word PC);
ipdom_entry_t(const ThreadMask &tmask);
ipdom_entry_t(const ThreadMask &orig_tmask, const ThreadMask &else_tmask, Word PC)
: orig_tmask (orig_tmask)
, else_tmask (else_tmask)
, PC (PC)
, fallthrough(false)
{}
ThreadMask tmask;
ThreadMask orig_tmask;
ThreadMask else_tmask;
Word PC;
bool fallthrough;
};

View file

@ -1347,11 +1347,9 @@ void Emulator::execute(const Instr &instr, uint32_t wid, instr_trace_t *trace) {
} else {
next_tmask = else_tmask;
}
// push reconvergence thread mask onto the stack
warp.ipdom_stack.emplace(warp.tmask);
// push not taken thread mask onto the stack
// push reconvergence and not-taken thread mask onto the stack
auto ntaken_tmask = ~next_tmask & warp.tmask;
warp.ipdom_stack.emplace(ntaken_tmask, next_pc);
warp.ipdom_stack.emplace(warp.tmask, ntaken_tmask, next_pc);
}
// return divergent state
for (uint32_t t = thread_start; t < num_threads; ++t) {
@ -1372,11 +1370,14 @@ void Emulator::execute(const Instr &instr, uint32_t wid, instr_trace_t *trace) {
std::cout << "IPDOM stack is empty!\n" << std::flush;
std::abort();
}
next_tmask = warp.ipdom_stack.top().tmask;
if (!warp.ipdom_stack.top().fallthrough) {
if (warp.ipdom_stack.top().fallthrough) {
next_tmask = warp.ipdom_stack.top().orig_tmask;
warp.ipdom_stack.pop();
} else {
next_tmask = warp.ipdom_stack.top().else_tmask;
next_pc = warp.ipdom_stack.top().PC;
warp.ipdom_stack.top().fallthrough = true;
}
warp.ipdom_stack.pop();
}
} break;
case 4: {

View file

@ -12,7 +12,7 @@
TestSuite* testSuite = nullptr;
const char* kernel_file = "kernel.vxbin";
int count = 1;
int count = 64;
std::unordered_set<std::string> selected;
std::unordered_set<std::string> excluded;
int testid_s = 0;