









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










This lecture will cover a series of large computers that drove research for about 20 or 30 years, beginning in 1963 with the CDC–6600 and continuing until the Cray–3 in 1993. We begin with a review of data hazards in a pipelined processor, using this as a way to view vector processors as specialized pipelines. We then recall the definition of a vector, noting how this motivates parallel computation. We shall detour a bit in order to consider Flynn’s Taxonom y, proposed in 1966 as a way to categorize processors by instruction and data streams. As seen within Flynn’s taxonomy, vector processors are SIMD – Single Instruction Multiple Data. We shall consider the theoretical speedup possible due to such an architecture and also the practical limits set by Amdahl’s Law. We shall close this lecture with observations on the advantages of vector processors over standard processors (called “scalar processors” in this context) and note that most of those advantages are due to the structure of the problem that is being solved. Put another way, it is the structure of the problem itself that allows the computer program solving that problem to be written in a way that makes good use of the vector facilities offered by these advanced computers.
Recall that the pipelined CPU attempts to maintain a number of instructions in the datapath, each in a distinct stage of execution. Recall also that the semantics of the program cannot depend on whether or not the datapath is pipelined; the result is the same independent of implementation. The classic assembly language example of data hazards resembles the following code. The result that is placed into register $2 must be used by other instructions in the pipeline before that result has been written into the register. SUB $2, $1, $ AND $12, $2, $ OR $13, $6, $ ADD $14, $2, $ SW $15, 100($2) One can write analogs of this in a higher level language. X = A + B + C ; Y = X + D ; Z = Y + E ;
In scientific literature we often see that operations are applied to vectors as well as to scalars. Consider three four–dimensional vectors: A, B, C. One might write a vector addition as C = A + B. In common programming languages, this is implemented either as a loop or as its equivalent unrolled form. The loop: For ( K = 1; K++, K < 5 ) C[K] = A[K] + B[K] ; The equivalent code: C[1] = A[1] + B[1] ; C[2] = A[2] + B[2] ; C[3] = A[3] + B[3] ; C[4] = A[4] + B[4] ; The unrolled loop shows one important feature: there are no data hazards that cannot be avoided by a good compiler.
There are quite a few more vector operations that are of use. Almost all of these operations can be considered the generic equivalent of the above code or of the next code sample, which implements the dot product or inner product. Consider two four–dimensional vectors: A and B. Here is the code, written as a loop. Dot = 0 ; For ( K = 1; K++, K < 5 ) Dot = Dot + A[K]B[K] ; There is an obvious data hazard here, as the output is updated on every loop. This can be handled by a good compiler. The language theorists worry about loop structures, such as the following, which is full of data hazards. Fortunately, these loops are rare in realistic code. A[1] = B[1] ; For ( K = 2; K++; K < 5 ) A[K] = A[K – 1] + B[K] ; Bottom Line : For many important classes of problems, it is possible to write code that has few, if any, data hazards. This is the origin of vector processors.
Consider two processors: a simple SISD design and a SIMD design that has eight independent processors available for executing code. Is it the case that the SIMD is eight times faster. The answer is “Not likely”. We can show that the SIMD will be no more than eight times faster. The actual speedup depends on the fraction of code that can be “farmed out” to the individual processors. The theoretical description of this speedup is called “Amdahl’s Law” , named after Gene Amdahl who discovered it while working on high–speed computation. The law can be stated in terms of two variables. For SIMD, these would be N the number of processors available F the fraction of the code that is essentially SIMD code and that can be executed in parallel; 0.0 F 1.0. Amdahl’s Law: Speedup = [ (1 – F) + F / N ]
[ (1 – F) + F / N ]
. The maximum speedup is then 1.0 / (1 – F); it is determined by the fraction of the code that is essentially sequential and cannot be assigned to parallel execution units.
Vector processors will be seen to be specialized SIMD designs. Let’s discuss Flynn’s other two categories before moving on. MISD Multiple Instruction Streams, Single Data Stream This appears to have been added by Flynn in order to be complete. According to our textbook authors, “Although MISD fills out Flynn’s classification, it is difficult to envision. … multiple instruction streams with multiple data streams (MIMD) are easier to imagine than multiple instructions with a single data stream (MISD)”. I can imagine a MISD machine in terms of “competing algorithms”; given a problem for which there is no single best algorithm, we just try them all at the same time. There are no examples of MISD architecture at present. MIMD Multiple Instruction Streams, Multiple Data Streams Here the computer is designed as a cluster of cooperating processors, each with an independent data stream. The first example was the C.mmp processor built at Carnegie Mellon University in the 1970’s. It comprised 16 interconnected PDP–11’s. MIMD machines did not become popular until the late 1980’s at which time the size of microprocessors allowed for faster connections. We shall return to MIMD.
Here I just quote the textbook. Note that many of the advantages of a vector processor depend on the structure of the problem for which the program has been written. “Advantages of vector computers over traditional SISD processors include the following:
In one way, a vector architecture can be considered as a specialized superscalar design. A typical non–vector superscalar design dispatches instructions to a number of execution units that can work in parallel. The basic vector design adds a vector unit, that itself might contain a number of independent functional units. The performance of a vector processor is dependent on the performance of each of the scalar units and the vector unit. When introduced in 1976, the Cray–1 was often popular due to the speed of its scalar units; it was the fastest non–vector processor of its day.
The following instructions are taken from the DLXV, which is a didactic computer based on the Cray–1. This design is documented in the textbook Computer Architecture: A Quantitative Approach by John L. Hennessy and David A. Patterson – the other textbook by our textbook authors. The DLXV design calls for vector registers of 64 entities. Here are a few instructions. Instruction Operands Function ADDV V1, V2, V3 Add elements of V2 and V3, then put each result in V1. For ( K = 1; K++, K < 65 ) V1[K] = V2[K] + V3[K] ; ADDSV V1, F0, V2 Add the scalar F0 to each element of V2 and place the result in V1. For ( K = 1; K++, K < 65 ) V1[K] = V2[K] + F0 ; MULTV V1, V2, V3 Multiply elements of V2 and V3, put each result in V1. For ( K = 1; K++, K < 65 ) V1[K] = V2[K] * V3[K] ; LV V1, A1 Load vector register V1 from the 64–word block of memory beginning at address A1.
Using the above instructions as examples, we make a few comments. Data Hazard Analysis Let’s unwrap the addition loop represented by ADDV V1, V2, V3. V1[1] = V2[K] + V3[K] ; V1[2] = V2[2] + V3[2] ; And so forth V1[63] = V2[63] + V3[63] ; V1[64] = V2[64] + V3[64] ; Note that there are no data hazards in this unrolled version, so no data hazards in the single vector instruction (unless the compiler is quite poorly designed). Amount of Work Note that the single vector instruction can correspond to the execution of 64 scalar instructions in a normal SISD architecture. This makes very good use of the bandwidth to the Instruction Cache that fronts the memory. One instruction is fetched and does the work of sixty four, with 63 fewer instruction fetches. Remember that the goal is to make the best use of primary memory, which is inherently much slower than the execution units in the CPU.