diff --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc index e2c7270089..5f0a98b24c 100644 --- a/src/cpu/o3/cpu.cc +++ b/src/cpu/o3/cpu.cc @@ -844,6 +844,28 @@ FullO3CPU::removeThread(ThreadID tid) */ } +template +void +FullO3CPU::setVectorsAsReady(ThreadID tid) +{ + if (vecMode == Enums::Elem) { + for (auto v = 0; v < TheISA::NumVecRegs; v++) + for (auto e = 0; e < TheISA::NumVecElemPerVecReg; e++) + scoreboard.setReg( + commitRenameMap[tid].lookup( + RegId(VecElemClass, v, e) + ) + ); + } else if (vecMode == Enums::Full) { + for (auto v = 0; v < TheISA::NumVecRegs; v++) + scoreboard.setReg( + commitRenameMap[tid].lookup( + RegId(VecRegClass, v) + ) + ); + } +} + template void FullO3CPU::switchRenameMode(ThreadID tid, UnifiedFreeList* freelist) @@ -860,6 +882,7 @@ FullO3CPU::switchRenameMode(ThreadID tid, UnifiedFreeList* freelist) renameMap[tid].switchMode(vecMode); commitRenameMap[tid].switchMode(vecMode); renameMap[tid].switchFreeList(freelist); + setVectorsAsReady(tid); } } diff --git a/src/cpu/o3/cpu.hh b/src/cpu/o3/cpu.hh index 01f58dfd35..c3d911b97c 100644 --- a/src/cpu/o3/cpu.hh +++ b/src/cpu/o3/cpu.hh @@ -313,6 +313,12 @@ class FullO3CPU : public BaseO3CPU /** Traps to handle given fault. */ void trap(const Fault &fault, ThreadID tid, const StaticInstPtr &inst); + /** + * Mark vector fields in scoreboard as ready right after switching + * vector mode, since software may read vectors at this time. + */ + void setVectorsAsReady(ThreadID tid); + /** Check if a change in renaming is needed for vector registers. * The vecMode variable is updated and propagated to rename maps. *