50#include "debug/Activity.hh"
51#include "debug/Rename.hh"
52#include "params/BaseO3CPU.hh"
72 "Number of cycles rename is running",
73 "Number of cycles rename is idle",
75 "Number of cycles rename is squashing",
76 "Number of cycles rename is blocking",
77 "Number of cycles rename is unblocking",
78 "Number of cycles rename stalled for serializing inst",
92 fatal(
"renameWidth (%d) is larger than compiled limit (%d),\n"
93 "\tincrease MaxWidth in src/cpu/o3/limits.hh\n",
98 for (uint32_t tid = 0; tid <
MaxThreads; tid++) {
106 stalls[tid] = {
false,
false};
115 return cpu->name() +
".rename";
121 "Number of cycles spent in each rename state"),
123 "Number of instructions processed by rename"),
125 "Number of squashed instructions processed by rename"),
127 "Number of times rename has blocked due to ROB full"),
129 "Number of times rename has blocked due to IQ full"),
131 "Number of times rename has blocked due to LQ full"),
133 "Number of times rename has blocked due to SQ full"),
135 "Number of times there has been no free registers"),
137 "Number of destination operands rename has renamed"),
139 "Number of register rename lookups that rename has made"),
141 "Number of integer rename lookups"),
143 "Number of floating rename lookups"),
145 "Number of vector rename lookups"),
147 "Number of vector predicate rename lookups"),
149 "Number of matrix rename lookups"),
151 "Number of HB maps that are committed"),
153 "Number of HB maps that are undone due to squashing"),
155 "count of serializing insts renamed"),
157 "count of temporary serializing insts renamed"),
159 "count of insts added to the skid buffer"),
161 "count of registers freed and written back to integer free list"),
163 "count of registers freed and written back to floating point free list")
203 cpu->getProbeManager(),
"Rename");
268 for (
int i = -
cpu->renameQueue.getPast();
275 for (
int i = -
cpu->timeBuffer.getPast();
298 iew_ptr->ldstQueue.numFreeLoadEntries(tid);
300 iew_ptr->ldstQueue.numFreeStoreEntries(tid);
348 !
insts[tid].empty() ||
366 assert(
insts[tid].empty());
375 DPRINTF(
Rename,
"[tid:%i] [squash sn:%llu] Squashing instructions.\n",
390 "Rename will resume serializing after squash\n",
432 bool status_change =
false;
444 rename(status_change, tid);
452 DPRINTF(Activity,
"Activity this cycle.\n");
453 cpu->activityThisCycle();
458 if (
fromCommit->commitInfo[tid].doneSeqNum != 0 &&
501 toDecode->renameUnblock[tid] =
false;
507 toDecode->renameUnblock[tid] =
false;
515 "Not blocked, so attempting to run stage.\n",
544 if (insts_available == 0) {
545 DPRINTF(
Rename,
"[tid:%i] Nothing to do, breaking out early.\n",
560 int min_free_entries = free_rob_entries;
564 if (free_iq_entries < min_free_entries) {
565 min_free_entries = free_iq_entries;
570 if (min_free_entries <= 0) {
572 "[tid:%i] Blocking due to no free ROB/IQ/ entries.\n"
573 "ROB has %i free entries.\n"
574 "IQ has %i free entries.\n",
575 tid, free_rob_entries, free_iq_entries);
584 }
else if (min_free_entries < insts_available) {
587 "Will have to block this cycle. "
588 "%i insts available, "
589 "but only %i insts can be renamed due to ROB/IQ/LSQ limits.\n",
590 tid, insts_available, min_free_entries);
592 insts_available = min_free_entries;
604 "%i available instructions to send iew.\n",
605 tid, insts_available);
609 "%i insts pipelining from Rename | "
610 "%i insts dispatched to IQ last cycle.\n",
618 }
else if (!insts_to_rename.empty()) {
619 insts_to_rename.front()->setSerializeBefore();
623 int renamed_insts = 0;
626 DPRINTF(
Rename,
"[tid:%i] Sending instructions to IEW.\n", tid);
628 assert(!insts_to_rename.empty());
637 if (inst->isLoad()) {
639 DPRINTF(
Rename,
"[tid:%i] Cannot rename due to no free LQ\n",
647 if (inst->isStore() || inst->isAtomic()) {
649 DPRINTF(
Rename,
"[tid:%i] Cannot rename due to no free SQ\n",
657 insts_to_rename.pop_front();
662 "Removing [sn:%llu] PC:%s from rename skidBuffer\n",
663 tid, inst->seqNum, inst->pcState());
666 if (inst->isSquashed()) {
669 "instruction %i with PC %s is squashed, skipping.\n",
670 tid, inst->seqNum, inst->pcState());
672 ++
stats.squashedInsts;
682 "Processing instruction [sn:%llu] with PC %s.\n",
683 tid, inst->seqNum, inst->pcState());
690 " lack of free physical registers to rename to.\n");
692 insts_to_rename.push_front(inst);
693 ++
stats.fullRegistersEvents;
708 if (inst->isSerializeBefore() && !inst->isSerializeHandled()) {
709 DPRINTF(
Rename,
"Serialize before instruction encountered.\n");
711 if (!inst->isTempSerializeBefore()) {
713 inst->setSerializeHandled();
715 stats.tempSerializing++;
727 }
else if ((inst->isStoreConditional() || inst->isSerializeAfter()) &&
728 !inst->isSerializeHandled()) {
729 DPRINTF(
Rename,
"Serialize after instruction encountered.\n");
733 inst->setSerializeHandled();
742 if (inst->isAtomic() || inst->isStore()) {
744 }
else if (inst->isLoad()) {
753 inst->renameEndTick =
curTick() - inst->fetchTick;
767 stats.renamedInsts += renamed_insts;
776 if (insts_available) {
782 toDecode->renameUnblock[tid] =
false;
791 while (!
insts[tid].empty()) {
792 inst =
insts[tid].front();
794 insts[tid].pop_front();
796 assert(tid == inst->threadNumber);
798 DPRINTF(
Rename,
"[tid:%i] Inserting [sn:%llu] PC: %s into Rename "
799 "skidBuffer\n", tid, inst->seqNum, inst->pcState());
807 InstQueue::iterator it;
808 warn(
"Skidbuffer contents:\n");
810 warn(
"[tid:%i] %s [sn:%llu].\n", tid,
811 (*it)->staticInst->disassemble(
812 inst->pcState().instAddr()),
815 panic(
"Skidbuffer Exceeded Max Size");
823 for (
int i = 0;
i < insts_from_decode; ++
i) {
825 insts[inst->threadNumber].push_back(inst);
826 inst->renameTick =
curTick() - inst->fetchTick;
844 bool any_unblocking =
false;
848 any_unblocking =
true;
854 if (any_unblocking) {
858 DPRINTF(Activity,
"Activating stage.\n");
867 DPRINTF(Activity,
"Deactivating stage.\n");
891 toDecode->renameUnblock[tid] =
false;
917 toDecode->renameUnblock[tid] =
true;
937 hb_it->instSeqNum > squashed_seq_num) {
940 DPRINTF(
Rename,
"[tid:%i] Removing history entry with sequence "
941 "number %i (archReg: %d, newPhysReg: %d, prevPhysReg: %d).\n",
942 tid, hb_it->instSeqNum, hb_it->archReg.index(),
943 hb_it->newPhysReg->index(), hb_it->prevPhysReg->index());
951 if (hb_it->newPhysReg != hb_it->prevPhysReg) {
954 renameMap[tid]->setEntry(hb_it->archReg, hb_it->prevPhysReg);
978 DPRINTF(
Rename,
"[tid:%i] Removing a committed instruction from the "
979 "history buffer %u (size=%i), until [sn:%llu].\n",
989 }
else if (hb_it->instSeqNum > inst_seq_num) {
991 "Old sequence number encountered. "
992 "Ensure that a syscall happened recently.\n",
1003 hb_it->instSeqNum <= inst_seq_num) {
1005 DPRINTF(
Rename,
"[tid:%i] Freeing up older rename of reg %i (%s), "
1007 tid, hb_it->prevPhysReg->index(),
1008 hb_it->prevPhysReg->className(),
1014 if (hb_it->newPhysReg != hb_it->prevPhysReg) {
1015 freeList->addReg(hb_it->prevPhysReg);
1020 if (hb_it->prevPhysReg->classValue()==
IntRegClass) {
1021 ++
stats.intReturned;
1025 ++
stats.committedMaps;
1036 unsigned num_src_regs = inst->numSrcRegs();
1041 for (
int src_idx = 0; src_idx < num_src_regs; src_idx++) {
1042 const RegId& src_reg = inst->srcRegIdx(src_idx);
1046 renamed_reg = map->
lookup(flat_reg);
1061 stats.vecPredLookups++;
1076 "Looking up %s arch reg %i, got phys reg %i (%s)\n",
1081 inst->renameSrcReg(src_idx, renamed_reg);
1087 "Register %d (flat: %d) (%s) is ready.\n",
1091 inst->markSrcRegReady(src_idx);
1095 "Register %d (flat: %d) (%s) is not ready.\n",
1109 unsigned num_dest_regs = inst->numDestRegs();
1113 for (
int dest_idx = 0; dest_idx < num_dest_regs; dest_idx++) {
1114 const RegId& dest_reg = inst->destRegIdx(dest_idx);
1120 rename_result = map->
rename(flat_dest_regid);
1122 inst->flattenedDestIdx(dest_idx, flat_dest_regid);
1128 "Renaming arch reg %i (%s) to physical reg %i (%i).\n",
1130 rename_result.first->index(),
1131 rename_result.first->flatIndex());
1135 rename_result.first,
1136 rename_result.second);
1141 "Adding instruction to history buffer (size=%i).\n",
1150 inst->renameDestReg(dest_idx,
1151 rename_result.first,
1152 rename_result.second);
1154 ++
stats.renamedOperands;
1186 "calcFreeLQEntries: free lqEntries: %d, loadsInProgress: %d, "
1187 "loads dispatchedToLQ: %d\n",
1189 fromIEW->iewInfo[tid].dispatchedToLQ);
1199 "storesInProgress: %d, stores dispatchedToSQ: %d\n",
1201 fromIEW->iewInfo[tid].dispatchedToSQ);
1208 unsigned inst_count = 0;
1225 if (
fromIEW->iewUnblock[tid]) {
1234 bool ret_val =
false;
1237 DPRINTF(
Rename,
"[tid:%i] Stall from IEW stage detected.\n", tid);
1240 DPRINTF(
Rename,
"[tid:%i] Stall: ROB has 0 free entries.\n", tid);
1243 DPRINTF(
Rename,
"[tid:%i] Stall: IQ has 0 free entries.\n", tid);
1246 DPRINTF(
Rename,
"[tid:%i] Stall: LSQ has 0 free entries.\n", tid);
1250 DPRINTF(
Rename,
"[tid:%i] Stall: Serialize stall and ROB is not "
1262 if (
fromIEW->iewInfo[tid].usedIQ)
1265 if (
fromIEW->iewInfo[tid].usedLSQ) {
1277 "Free LQ: %i, Free SQ: %i, FreeRM %i(%i %i %i %i %i %i %i)\n",
1292 DPRINTF(
Rename,
"[tid:%i] %i instructions not yet in ROB\n",
1313 DPRINTF(
Rename,
"[tid:%i] Squashing instructions due to squash from "
1319 }
else if (!
fromCommit->commitInfo[tid].robSquashing &&
1321 DPRINTF(
Rename,
"[tid:%i] Freeing phys regs of misspeculated "
1322 "instructions.\n", tid);
1338 DPRINTF(
Rename,
"[tid:%i] Done blocking, switching to unblocking.\n",
1353 "[tid:%i] Done squashing, switching to serialize.\n", tid);
1359 "[tid:%i] Done squashing, switching to unblocking.\n",
1364 DPRINTF(
Rename,
"[tid:%i] Done squashing, switching to running.\n",
1373 DPRINTF(
Rename,
"[tid:%i] Done with serialize stall, switching to "
1374 "unblocking.\n", tid);
1382 DPRINTF(
Rename,
"[tid:%i] Processing instruction [%lli] with "
1383 "PC %s.\n", tid, serial_inst->seqNum, serial_inst->pcState());
1386 serial_inst->clearSerializeBefore();
1391 insts[tid].push_front(serial_inst);
1394 DPRINTF(
Rename,
"[tid:%i] Instruction must be processed by rename."
1395 " Adding to front of list.\n", tid);
1410 if (inst_list.empty()) {
1417 inst_list.front()->setSerializeBefore();
1425 ++
stats.ROBFullEvents;
1428 ++
stats.IQFullEvents;
1431 ++
stats.LQFullEvents;
1434 ++
stats.SQFullEvents;
1437 panic(
"Rename full stall stat should be incremented for a reason!");
1452 cprintf(
"Seq num: %i\nArch reg[%s]: %i New phys reg:"
1453 " %i[%s] Old phys reg: %i[%s]\n",
1454 (*buf_it).instSeqNum,
1455 (*buf_it).archReg.className(),
1456 (*buf_it).archReg.index(),
1457 (*buf_it).newPhysReg->index(),
1458 (*buf_it).newPhysReg->className(),
1459 (*buf_it).prevPhysReg->index(),
1460 (*buf_it).prevPhysReg->className());
const RegIndex & flatIndex() const
Flat index accessor.
constexpr RegIndex index() const
Visible RegId methods.
constexpr const char * className() const
Return a const char* with the register class name.
ProbePointArg generates a point for the class of Arg.
Register ID: describe an architectural register with its class and index.
constexpr RegClassType classValue() const
void setNumPinnedWrites(int num_writes)
constexpr RegIndex index() const
Index accessors.
int getNumPinnedWrites() const
RegId flatten(const BaseISA &isa) const
constexpr const char * className() const
Return a const char* with the register class name.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual BaseISA * getIsaPtr() const =0
O3CPU class, has each of the stages (fetch through commit) within it, as well as all of the time buff...
DynInstPtr serializeInst[MaxThreads]
The serialize instruction that rename has stalled on.
void incrFullStat(const FullSource &source)
Function used to increment the stat that corresponds to the source of the stall.
ThreadID numThreads
The number of threads active in rename.
TimeBuffer< RenameStruct >::wire toIEW
Wire to write any information heading to IEW.
void sortInsts()
Separates instructions from decode into individual lists of instructions sorted by thread.
ThreadStatus renameStatus[MaxThreads]
Per-thread status.
Rename(CPU *_cpu, const BaseO3CPUParams ¶ms)
Rename constructor.
TimeBuffer< TimeStruct >::wire toDecode
Wire to write infromation heading to previous stages.
TimeBuffer< RenameStruct > * renameQueue
Rename instruction queue.
unsigned commitToRenameDelay
Delay between commit and rename, in ticks.
int storesInProgress[MaxThreads]
Count of Store instructions in progress that have been sent off to the IQ and ROB,...
int instsInProgress[MaxThreads]
Count of instructions in progress that have been sent off to the IQ and ROB, but are not yet included...
int calcFreeIQEntries(ThreadID tid)
Calculates the number of free IQ entries for a specific thread.
void startupStage()
Initializes variables for the stage.
ProbePointArg< DynInstPtr > * ppRename
To probe when register renaming for an instruction is complete.
bool blockThisCycle
Whether or not rename needs to block this cycle.
void renameSrcRegs(const DynInstPtr &inst, ThreadID tid)
Renames the source registers of an instruction.
void doSquash(const InstSeqNum &squash_seq_num, ThreadID tid)
Executes actual squash, removing squashed instructions.
void renameDestRegs(const DynInstPtr &inst, ThreadID tid)
Renames the destination registers of an instruction.
unsigned skidBufferMax
The maximum skid buffer size.
std::list< ThreadID > * activeThreads
Pointer to the list of active threads.
UnifiedFreeList * freeList
Free list interface.
void tick()
Ticks rename, which processes all input signals and attempts to rename as many instructions as possib...
void readFreeEntries(ThreadID tid)
Gets the number of free entries for a specific thread.
std::deque< DynInstPtr > InstQueue
int calcFreeROBEntries(ThreadID tid)
Calculates the number of free ROB entries for a specific thread.
int iewToRenameDelay
Delay between iew and rename, in ticks.
RenameStatus _status
Rename status.
void renameInsts(ThreadID tid)
Renames instructions for the given thread.
void setFreeList(UnifiedFreeList *fl_ptr)
Sets pointer to the free list.
bool emptyROB[MaxThreads]
Records if the ROB is empty.
void rename(bool &status_change, ThreadID tid)
Determines what to do based on rename's current status.
TimeBuffer< TimeStruct >::wire fromIEW
Wire to get IEW's output from backwards time buffer.
std::vector< PhysRegIdPtr > freeingInProgress[MaxThreads]
Hold phys regs to be released after squash finish.
std::string name() const
Returns the name of rename.
std::list< RenameHistory > historyBuffer[MaxThreads]
A per-thread list of all destination register renames, used to either undo rename mappings or free ol...
TimeBuffer< DecodeStruct >::wire fromDecode
Wire to get decode's output from decode queue.
void serializeAfter(InstQueue &inst_list, ThreadID tid)
Either serializes on the next instruction available in the InstQueue, or records that it must seriali...
gem5::o3::Rename::RenameStats stats
TimeBuffer< DecodeStruct > * decodeQueue
Decode instruction queue interface.
unsigned renameWidth
Rename width, in instructions.
void setRenameMap(UnifiedRenameMap::PerThreadUnifiedRenameMap &rm_ptr)
Sets pointer to rename maps (per-thread structures).
bool resumeUnblocking
Whether or not rename needs to resume clearing out the skidbuffer after squashing.
InstQueue skidBuffer[MaxThreads]
Skid buffer between rename and decode.
Scoreboard * scoreboard
Pointer to the scoreboard.
void drainSanityCheck() const
Perform sanity checks after a drain.
bool skidsEmpty()
Returns if all of the skid buffers are empty.
IEW * iew_ptr
Pointer to IEW stage.
int calcFreeSQEntries(ThreadID tid)
Calculates the number of free SQ entries for a specific thread.
void dumpHistory()
Debugging function used to dump history buffer of renamings.
FullSource
Enum to record the source of a structure full stall.
UnifiedRenameMap * renameMap[MaxThreads]
Rename map interface.
bool block(ThreadID tid)
Switches rename to blocking, and signals back that rename has become blocked.
int loadsInProgress[MaxThreads]
Count of Load instructions in progress that have been sent off to the IQ and ROB, but are not yet inc...
TimeBuffer< TimeStruct >::wire fromCommit
Wire to get commit's output from backwards time buffer.
bool unblock(ThreadID tid)
Switches rename to unblocking if the skid buffer is empty, and signals back that rename has unblocked...
TimeBuffer< TimeStruct > * timeBuffer
Pointer to main time buffer used for backwards communication.
unsigned toIEWIndex
The index of the instruction in the time buffer to IEW that rename is currently using.
void removeFromHistory(InstSeqNum inst_seq_num, ThreadID tid)
Removes a committed instruction's rename history.
void setTimeBuffer(TimeBuffer< TimeStruct > *tb_ptr)
Sets the main backwards communication time buffer pointer.
void takeOverFrom()
Takes over from another CPU's thread.
Stalls stalls[MaxThreads]
Tracks which stages are telling decode to stall.
void regProbePoints()
Registers probes.
void setActiveThreads(std::list< ThreadID > *at_ptr)
Sets pointer to list of active threads.
void resetStage()
Reset this pipeline stage.
bool checkStall(ThreadID tid)
Checks if any stages are telling rename to block.
InstQueue insts[MaxThreads]
Queue of all instructions coming from decode this cycle.
void skidInsert(ThreadID tid)
Inserts unused instructions from a given thread into the skid buffer, to be renamed once rename unblo...
void readStallSignals(ThreadID tid)
Reads signals telling rename to block/unblock.
void updateStatus()
Updates overall rename status based on all of the threads' statuses.
bool checkSignalsAndUpdate(ThreadID tid)
Checks the signals and updates the status.
void squash(const InstSeqNum &squash_seq_num, ThreadID tid)
Squashes all instructions in a thread.
bool isDrained() const
Has the stage drained?
void setScoreboard(Scoreboard *_scoreboard)
Sets pointer to the scoreboard.
FreeEntries freeEntries[MaxThreads]
Per-thread tracking of the number of free entries of back-end structures.
int calcFreeLQEntries(ThreadID tid)
Calculates the number of free LQ entries for a specific thread.
Commit * commit_ptr
Pointer to commit stage.
bool serializeOnNextInst[MaxThreads]
Records if rename needs to serialize on the next instruction for any thread.
ProbePointArg< SeqNumRegPair > * ppSquashInRename
To probe when an instruction is squashed and the register mapping for it needs to be undone.
int decodeToRenameDelay
Delay between decode and rename, in ticks.
void clearStates(ThreadID tid)
Clear all thread-specific states.
bool wroteToTimeBuffer
Variable that tracks if decode has written to the time buffer this cycle.
void setDecodeQueue(TimeBuffer< DecodeStruct > *dq_ptr)
Sets pointer to time buffer coming from decode.
bool resumeSerialize
Whether or not rename needs to resume a serialize instruction after squashing.
void setRenameQueue(TimeBuffer< RenameStruct > *rq_ptr)
Sets pointer to time buffer used to communicate to the next stage.
unsigned validInsts()
Returns the number of valid instructions coming from decode.
Implements a simple scoreboard to track which registers are ready.
FreeList class that simply holds the list of free integer and floating point registers.
Unified register rename map for all classes of registers.
SimpleRenameMap::RenameInfo RenameInfo
PhysRegIdPtr lookup(const RegId &arch_reg) const
Look up the physical register mapped to an architectural register.
std::array< UnifiedRenameMap, MaxThreads > PerThreadUnifiedRenameMap
RenameInfo rename(const RegId &arch_reg)
Tell rename map to get a new free physical register to remap the specified architectural register.
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
#define panic(...)
This implements a cprintf based panic() function.
#define fatal(...)
This implements a cprintf based fatal() function.
static constexpr int MaxThreads
void removeCommThreadInsts(ThreadID tid, CommStruct &comm_struct)
Remove instructions belonging to given thread from the given comm struct's instruction array.
RefCountingPtr< DynInst > DynInstPtr
static constexpr int MaxWidth
const FlagsType pdf
Print the percent of the total that this entry represents.
const FlagsType nozero
Don't print if this is zero.
const FlagsType total
Print the total.
Copyright (c) 2024 Arm Limited All rights reserved.
int16_t ThreadID
Thread index/ID type.
void cprintf(const char *format, const Args &...args)
Tick curTick()
The universal simulation clock.
@ MatRegClass
Matrix Register.
@ FloatRegClass
Floating-point register.
@ CCRegClass
Condition-code register.
@ VecRegClass
Vector Register.
@ IntRegClass
Integer register.
@ MiscRegClass
Control (misc) register.
@ VecElemClass
Vector Register Native Elem lane.
Struct that defines the information passed from rename to IEW.
Holds the information for each destination register rename.
statistics::Scalar matLookups
statistics::Scalar ROBFullEvents
Stat for total number of times that the ROB starts a stall in rename.
statistics::Scalar renamedOperands
Stat for total number of renamed destination registers.
statistics::Scalar fpLookups
statistics::Scalar fullRegistersEvents
Stat for total number of times that rename runs out of free registers to use to rename.
statistics::Scalar fpReturned
Number of registers freed and written back to floating point free list.
statistics::Scalar squashedInsts
Stat for total number of squashed instructions that rename discards.
statistics::Scalar IQFullEvents
Stat for total number of times that the IQ starts a stall in rename.
statistics::Scalar vecPredLookups
static std::string statusDefinitions[ThreadStatusMax]
statistics::Scalar intReturned
Number of registers freed and written back to integer free list.
statistics::Scalar renamedInsts
Stat for total number of renamed instructions.
statistics::Scalar LQFullEvents
Stat for total number of times that the LQ starts a stall in rename.
statistics::Scalar lookups
Stat for total number of source register rename lookups.
statistics::Scalar vecLookups
statistics::Vector status
Stat for total number of cycles spent in each rename state.
statistics::Scalar tempSerializing
Number of instructions marked as temporarily serializing.
statistics::Scalar serializing
Number of serialize instructions handled.
statistics::Scalar undoneMaps
Stat for total number of mappings that were undone due to a squash.
static std::string statusStrings[ThreadStatusMax]
statistics::Scalar committedMaps
Stat for total number of committed renaming mappings.
statistics::Scalar intLookups
RenameStats(statistics::Group *parent)
statistics::Scalar SQFullEvents
Stat for total number of times that the SQ starts a stall in rename.
statistics::Scalar skidInsts
Number of instructions inserted into skid buffers.
Struct that defines all backwards communication.
RenameComm renameInfo[MaxThreads]
bool renameUnblock[MaxThreads]
bool renameBlock[MaxThreads]