Method and system for efficient matrix multiplication in a SIMD processor architecture
AssigneeTibet Mimar
InventorTibet Mimar
Life of this patent
Estimating the term…
Abstract
The new system provides for efficient implementation of matrix multiplication in a SIMD processor. The new system provides ability to map any element of a source vector register to be paired with any element of a second source vector register for vector operations, and specifically vector multiply and vector-multiply-accumulate operations to implement a variety of matrix multiplications without the additional permute or data re-ordering instructions. Operations such as DCT and Color-space transformations for video processing could be very efficiently implemented using this system.
Claims29
A method for performing matrix multiplication of a first matrix and a second matrix in parallel, comprising:
- a) providing a vector register array with the ability to store a plurality of vectors, wherein each of said plurality of vectors contains N vector elements, said plurality of vectors includes a first source vector, a second source vector, and a control vector;
- b) storing elements of a column of said first matrix into said first source vector;
- c) storing elements of a respective row of said second matrix into said second source vector, wherein said respective row is equal-numbered as said column;
- d) storing mapping information of said first source vector and said second source vector into said control vector;
- e) mapping elements of said first source vector;
- f) mapping elements of said second source vector;
- g) performing a vector multiplication of respective elements of said mapped first source vector and said mapped second source vector;
- h) performing a vector addition of results of said vector multiplication to a vector accumulator;
- i) repeating steps of b through h for all column vectors of said first matrix;
- and
- wherein steps of e through g are performed by a vector multiply instruction in a single pipelined clock cycle.
The method of claim 6, wherein subset of output matrix elements are calculated if N is less than M*P, and steps of claim 18 are repeated for remainder of said output matrix elements.
An execution unit for performing matrix multiplication of a first matrix with a second matrix using a plurality of computational units in parallel, the execution unit comprising:
- a vector register file with multiple ports including a plurality of vector registers wherein each of said plurality of vector registers storing N vector elements, and said vector register file containing a first source vector as a first operand, a second source vector as a second operand, and a control vector register as a third operand of a vector instruction;
- means for mapping elements of said first source vector and said second source vector in accordance with said control vector register, said first source vector elements comprising a numbered column of said first matrix, and said second source vector elements comprising a respective numbered row of said second matrix;
- a vector computational unit, comprising said plurality of computational units, wherein mapped elements of source vectors provide paired vector elements as inputs to each of said plurality of computational units;
- a vector accumulator, wherein output of said vector computational unit is stored or accumulated with previous partial results;
- wherein at least one vector multiply instruction is executed for performing matrix multiplication of first column of said first matrix with first row of said second matrix with a single clock cycle throughput;
- and
- wherein a plurality of vector multiply-accumulate instructions are executed for performing matrix multiplication of second and subsequent columns of said first matrix with respective second and subsequent rows of said second matrix and accumulation of partial results by said vector accumulator, each of said plurality of vector multiply-accumulate instructions is executed with single clock cycle throughput.
A method for performing matrix multiplication of a first matrix with a second matrix calculating multiple values of an output matrix in parallel, the method comprising:
- a) performing matrix multiplication of first column of said first matrix with first row of said second matrix in a first set of steps performed by using a vector multiply instruction in a single clock cycle, said first set of steps comprising:
- storing at least first column of said first matrix in a first source vector, and storing at least first row of said second matrix in a second source vector;
- pairing elements of said first source vector and said second source vector as source value pairs for vector operations, wherein said first source vector and said second source vector are mapped in accordance with matrix multiplication requirement;
- and
- performing a vector multiply operation of said paired elements of said first source vector and said second source vector, and storing output of said vector multiply operation in an output vector;
- b) performing matrix multiplication of second column of said first matrix with second row of said second matrix in a second set of steps performed by using a vector multiply-accumulate instruction in a single clock cycle, said second set of steps comprising:
- storing at least second column of said first matrix in said first source vector, and storing at least second row of said second matrix in said second source vector;
- repeating the step of pairing elements;
- performing a vector multiply-accumulate operation by way of multiplying said paired elements of said first source vector and said second source vector, summing output of said vector multiply-accumulate operation with respective elements of said output vector, and storing output of summing in said output vector;
- and
- c) repeating said second set of steps for the rest of the columns of said first matrix and the rest of the rows of said second matrix.
Dependencies are inferred from the claim text.