Closed bdh0404 closed 4 years ago
Nevermind. I fixed it. suspend thread at PIMCommand in src/cpu/o3/cpu.cc, activate thread at functionalAccess in src/mem/abstract_mem.cc. Change the threadid value of PIMSenderState from t_info->contextId() to tc->threadId(), pass the threaded in recvFunctional() in src/pim/pim_kernel.cc. The segmentation fault happens because the thread that is suspended by CPU is different from that of activated by PIM is different. You must match it.
Hi, thanks for your effort! I met the same error but I am not familiar with the source code. I really appreciate it if you could give me some detailed instructions.
At src/cpu/o3/cpu.cc,
template <class Impl>
bool
FullO3CPU<Impl>::PIMCommand(ThreadContext *tc, uint64_t in1, uint64_t in2, uint64_t out1)
{
...
Addr pimAddr[3] = { in1, in2, out1};
std::vector<Addr> pimpAddr;
const Addr pc = t_info->instAddr();
Packet::PIMSenderState* vdata=new Packet::PIMSenderState(curTick(),pimAddr[0],pimAddr[1],pimAddr[2],_cpuId);
vdata->threadid=t_info->contextId(); // this must be changed to vdata->threadid=tc->threadId();
...
Packet::PIMSenderState* data = new Packet::PIMSenderState(curTick(),
pimpAddr, _cpuId);
data->threadid = tc->threadid;
...
_status = Running;
// add suspendContext(tc->threadId());
return true;
}
At src/mem/abstract_mem.cc,
void
PIMKernel::recvFunctional(PacketPtr pkt)
{
recv_pim_commands++;
// receive pim commands from the host
Packet::PIMSenderState* senderState = dynamic_cast<Packet::PIMSenderState*>(pkt->senderState);
Packet::PIMSenderState* data=new Packet::PIMSenderState(_id,-1);
for(int i=0;i<senderState->addr.size();i++){
data->addr.push_back(senderState->addr[i]);
}
// add data->threadid = senderState->threadid;
This is from my memory, I cannot sure, because I did this workaround for 2 years ago.
Thank you very much! Long-awaited screen output:
3324899000: system.pim_kernerls: Try to send write req [0x28d38]-[2]
3324899000: system.pim_kernerls: Writen to the memory [0x28d38]-[2] [2]
3324915000: system.pim_kernerls: Receive [0x28d38] [2]- 4950 [3] : status [4]
3324916000: system.pim_kernerls: Finished PIM oprations
3324917000: system.mem_ctrls: Remove PIM operations from the Queue [0x28d38] [0x28d30] -> [0x28d38]
(pim_test.cpp) : PIM [0x140737488350520] [0x140737488350512] -> [0x140737488350520]
3329244000: system.cpu: Translated Physical Address for PIM [0x7fffffffed38] -> [0x28d38]
3329244000: system.cpu: Translated Physical Address for PIM [0x7fffffffed30] -> [0x28d30]
3329244000: system.cpu: Translated Physical Address for PIM [0x7fffffffed38] -> [0x28d38]
3329244000: system.cpu.dcache: Flushed by coherence [28d00]
3329244000: system.mem_ctrls: Add PIM operations to the Queue [0x28d38] [0x28d30] -> [0x28d38]
3329244000: system.pim_kernerls: Store Reg[0] [0x28d38]
3329244000: system.pim_kernerls: Store Reg[1] [0x28d30]
3329244000: system.pim_kernerls: Store Reg[2] [0x28d38]
3329244000: system.pim_kernerls: Start processing data read of Reg[0]
3329244000: system.pim_kernerls: Try to send read req [0x28d38] - ID[0]
3329244000: system.pim_kernerls: Sent read to the memory [0x28d38] - [0]
3329245000: system.cpu: The access is blocked by PIM Coherence [28d28]
3329245000: system.cpu: SuspendContext 0
3329245000: system.pim_kernerls: Start processing data read of Reg[1]
3329245000: system.pim_kernerls: Try to send read req [0x28d30] - ID[1]
3329245000: system.pim_kernerls: Failed sending read to the memory 1
3329245000: system.pim_kernerls: Retry to Memory [0x28d30]-[1]
3329259000: system.pim_kernerls: Receive [0x28d38] [0]- 4950 [3] : status [2]
3329309000: system.pim_kernerls: Receive [0x28d30] [1]- 100 [3] : status [2]
3330310000: system.pim_kernerls: Start processing data write of Reg[2]
3330310000: system.pim_kernerls: Try to send write req [0x28d38]-[2]
3330310000: system.pim_kernerls: Writen to the memory [0x28d38]-[2] [2]
3330326000: system.pim_kernerls: Receive [0x28d38] [2]- 5050 [3] : status [4]
3330327000: system.pim_kernerls: Finished PIM oprations
3330328000: system.mem_ctrls: Remove PIM operations from the Queue [0x28d38] [0x28d30] -> [0x28d38]
(pim_test.cpp) : Result: 5050
Exiting @ tick 3359614500 because exiting with last active thread context
Another question. I am a freshman. I guess you know a lot about simulators like GEM5, PIMSim, etc. So, could you give me some suggestions or URLs to get familiar with the source code more quickly?
With the current code that simulates hellopim with PIMAdder and Out of Order CPUs, Segmentation Fault happens. There is code for supporting OoO CPUs, but that doesn't work. Did you abandon the OoO Segmentation Fault bug? If so, I have to fix the bug my own for research.