Uops.info: Characterizing Latency, Throughput, and Port Usage on Intel
arxiv.org
arxiv.org
Is the testing code open source? There is no obvious link from the main page.
https://github.com/RRZE-HPC/OSACA
?
It would be nice to see something with a more open and responsive development process compared to IACA.
For example, Agner gives a latency of 2 for pop r while uops.info gives 6.
Agner says himself that he "arbitrarily" divides the latency between load and store type instructions in these cases which gives the mostly meaningless value of 2 for load-type instructions.
It is actually not the definition that uops.info uses. Instead, it uses a definition that takes into account that different operands of an instruction might be ready at different times (see section 4.1 of the paper that mentions Intel's definition as a "common definition" and then continues to introduce the new definition). Furthermore, uops.info also considers latency differences that can occur if an instruction uses the same register for multiple operands (the SHLD instruction is an example for this).
In theory "it is complicated" because an instruction might have N inputs and M outputs and the latency matrix might have different values for every element in that N x M matrix, but in practice instructions have 1 output and the inputs are usually symmetric with regards to latency so one figure is enough for most. It's worth calling out the exceptions though, and uops.info is supposed to do that I think (an example would be great).
On Sandy Bridge, for example, the result of the "AESDEC XMM1, XMM2" instruction is ready 8 cycles after XMM1 becomes available. If only XMM2 is on the critical path, however, the result is already available after a bit more than one cycle.
On Nehalem, the SHLD R1, R2, imm instruction has, according to Intel's manual, http://instlatx64.atw.hu/, and IACA, a latency of 4 cycles. Agner Fog reports a latency of 3 cycles. The measurements on uops.info show that the latency from R1 to R1 is 3 cycles, while the latency from R2 to R1 is 4 cycles.
Anyways, it is all there, using your SHLD example:
http://uops.info/html-instr/SHLD-1633.html
You can see the varying latencies on Nehalem for op1->op1 versus op2->op1.
Great work!
Besides division, are there other instructions that are known/expected/suspected to have different execution times based on the values in the input registers?
You didn't include immediates in your question, but it was included in the quote you referred to so it's worth mentioning adc with immediate zero, which is "twice as fast" [2] from Sandy Bridge through Haswell.
Of course many FP instruction have value-dependent performance, particularly with denormals (although it is common even if denormals don't occur).
FWIW recent AMD chips seem to have fixed-latency integer dividers.
[1] https://www.realworldtech.com/forum/?threadid=179004
[2] https://github.com/travisdowns/uarch-bench/wiki/Intel-Perfor...