Intel i86W Manual page 171

Table of Contents

Advertisement

PROGRAMMING EXAMPLES
9.9 PIPELINING OF DUAL-OPERATION INSTRUCTIONS
When using dual-operation instructions (all of which are pipelined), code that primes
and flushes the pipelines must take into account both the adder and multiplier pipelines.
Example 9-11 illustrates pipeline usage for a simple single-precision matrix operation:
the dot product of a 1
x
8 row matrix A with an 8
x
1 column matrix B. For the purpose
of tracking values through the pipelines, assume that the actual matrices to be multiplied
have the following values:
A
=
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, B.O]
B
=
B.O
7.0
6.0
5.0
4.0
3.0
2.0
1.0
Assume further that the two matrices are already loaded into registers thus:
A:
f4
=
1.0
f5
=
2.0
f6
=
3.0
f7
=
4.0
f8
=
5.0
f9
=
6.0
flO =7.0
" fll =8.0
B:
fl2
=
8.0
fl3
=
7.0
fl4 = 6.0
fl5 = 5.0
fl6
=
4.0
fl7
=
3.0
fl8 = 2.0
fl9
=
1.0
The calculation to perform is 1.0*8.0
+
2.0*7.0
+ ... +
8.0*1.0 - a series of multipli-
cations followed by additions. The dual-operation instructions are designed precisely to
execute this type of calculation efficiently by using the adder and multiplier in parallel.
At the heart of Example 9-10 is the dual-operation instruction
m12apm,
which multiplies
its operands and adds the multiplier result to the result of the adder.
The priming phase is somewhat different in Example 9-10 than in Example 9-9. Because
the result of the adder is fed back into the adder, it is not possible to simply ignore the
prior contents of the adder pipeline; and because the result of the multiplier is automat-
ically fed into the adder, it is important to consider the effect of the mUltiplier on the
adder pipeline as well. This example waits until unknown results have been flushed from
the multiplier pipeline, then puts zeros in all stages of the adder pipeline.
Because the adder pipeline has three stages, the flushing phase produces three partial
results that must be added together.
9-9

Advertisement

Table of Contents
loading

Table of Contents