InvestorsHub Logo
icon url

HailMary

12/18/03 12:27 PM

#21106 RE: sgolds #21094

I would think the 400 hidden registers are used for context shifts between threads.

You are thinking too high up with the context shifts. OoO registers are for instruction level scheduling level that is much lower level.

Say an instruction comes in and wants to write to register R1 and read from register R2 and a memory location. Now say a 2nd sequential instruction comes in and wants to write to R3 and read from R1 and R2. This 2nd instruction depends on the 1st, so it must wait for it.

Now say a 3rd sequential instruction comes in that also wants to write to R1 and reads from register R4 and R5. There is no interdependency between the 1st and 2nd instructions and this 3rd instruction, yet this 3rd instruction must wait for the 1st instruction to complete before writing to R1 when no OoO registers are available. With an OoO register the processor can execute this 3rd instruction without waiting for the 1st instruction to complete its write to R1. It maps the logical R1 register name to another OoO register for this 3rd instruction. Any instructions that come after this 3rd instruction that use R1 will use the mapped register (Note the first R1 write from instruction 1 was mapped to a physical register too).

This was a simple example, but should give you and idea of the usage of OoO registers. In reality the compiler would have likely caught the dependency above and used different registers to write to, but if you get into highly dynamic sequences (branches with many possible execution paths) only instruction level scheduling will work well, which is why OoO is so important still even with advances in compilers.

icon url

Petz

12/18/03 2:40 PM

#21124 RE: sgolds #21094

Because the compiler cannot see anything about the dynamic execution of a program or know what is in the registers when a subroutine is called from diverse places in a huge programming project.

My mind was on a different page than yours. I was discussing whether having a huge number of addressable, non-hidden registers can eliminate storage of intermediate results in temporary memory variables. This applies to Itanium which doesn't use OOO execution.

With that many registers you might think you never need a temp variable. But, no, the compiler can't just willy nilly use any register unless it saves it and restores it on exit.

Having a huge number of registers is necessary for the Itanium architecture so that new results don't overwrite old results that are still needed for other computations. On an x86 OOO machine, the CPU does this automatically by having many hidden registers and "knowing" exactly what is in each one.

Petz