HiveBrain v1.2.0
Get Started
← Back to all entries
patternModerate

What is instruction throughput and instruction latency?

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
throughputwhatinstructionandlatency

Problem

I was reading an article on an alternative method of modulo reduction and i couldn't understand the following excerpt (Those in bold) :

"A single 32-bit division on a recent x64 processor has a throughput of one instruction every six cycles with a latency of 26 cycles. In contrast, a multiplication has a throughput of one instruction every cycle and a latency of 3 cycles."

Solution

Latency = time from the start of the instruction until the result is available. If your division has a latency of 26 cycles, and you calculate (((x / a) / b) / c), then the result of the division by a is available after 26 cycles. That's when the division by b can start, with the result available after 52 cycles, and the result of dividing by c is available after 78 cycles.

The throughput is one division every six cycles, which means you can start another division every six cycles. So if you want to calculate x/a, y/a, z/a, u/a, v/a, the five divisions can start at cycles 0, 6, 12, 18, 24, and the results are available at cycles 26, 32, 38, 44, and 50.

As an exercise, figure out how long it takes to evaluate (((x / a) / b) / c), (((y / a) / b) / c), (((z / a) / b) / c), (((u / a) / b) / c) and (((v / a) / b) / c) .

Context

StackExchange Computer Science Q#80859, answer score: 10

Revisions (0)

No revisions yet.