Fast pipelined matrix multiplier
AssigneeIndustrial Technology Research Institute
InventorsJinn-Shyan Wang, Jinn-Nan Kao
Life of this patent
Estimating the term…
Abstract
A circuit and algorithm for multiplying three matrices is disclosed having a first multiplication stage for multiplying a first matrix with a second matrix to produce an intermediate product matrix. Additionally, the circuit and algorithm have a second stage for multiplying a third matrix with the intermediate product matrix to compute the final product matrix. Each stage is provided with a plurality of bit processing element pipelines for generating the elements of the product matrix of that stage. In each stage, one pipeline is provided for generating each column of the product matrix and each pipeline within a stage operates in parallel with the other pipelines of that stage.
Claims16
A matrix multiplication circuit comprising:
- a first stage for multiplying a first matrix X having elements x.sub.ij, i-1 . . . I, j=1 . . . J with a second matrix A having elements a.sub.jk, k=1 . . . k, said first stage comprising:
- a first plurality of pipeline circuits which operate in parallel, each pipeline circuit for sequentially outputting the elements:
- ##EQU7## of an intermediate product matrix Y=X.multidot.Z for a particular value of k;
- and
- a second stage for receiving the elements y.sub.ik as said elements y.sub.ik are output by the first stage and for multiplying said elements y.sub.ik with a third matrix C having elements c.sub.li, said second stage comprising:
- a second plurality of pipeline circuits which operate in parallel, each pipeline circuit of the second stage for sequentially outputting the products c.sub.li y.sub.ik for a particular value k;
- and
- associated accumulator means, each accumulator means for selectively accumulating products c.sub.li y.sub.ik for particular values of l from the associated pipeline circuit so that each accumulator means generates the elements ##EQU8## of a product matrix Z=C.multidot.2Y.
A matrix multiplication circuit comprising:
- a first stage for multiplying a first matrix X having elements x.sub.ij, i=1 . . . I, j=1 . . . J with a second matrix C.sup.t having elements c.sup.t.sub.jk, k=1 . . . K, said first stage comprising:
- a first plurality of pipeline circuits which operate in parallel, each pipeline circuit for sequentially outputting the elements:
- ##EQU9## of an intermediate matrix for a particular value of k;
- and a second stage for receiving the elements y.sub.ik as said elements y.sub.ik are output by the first stage and for multiplying said elements y.sub.ik with a third matrix C having elements C.sub.li, said second stage comprising:
- a second plurality of pipeline circuits which operate in parallel, each pipeline circuit of the second stage for sequentially outputting the products c.sub.li y.sub.ik for a particular value k;
- and
- associated accumulator means, each accumulator means for selectively accumulating products c.sub.li y.sub.ik for particular values of l from the associated pipeline circuit so that each accumulator means generates the sum ##EQU10## wherein each pipeline circuit of the first stage, for multiplying the elements of a first sequence x.sub.11, x.sub.12, . . . , z.sub.11, x.sub.21, x.sub.22, . . . x.sub.21, . . . ,x.sub.11 with the elements of a second sequence comprising I repetitions of the sequence:
- c.sup.t.sub.1k, c.sup.t.sub.2k, . . . , c.sup.t.sub.Jk for a particular value of k, comprises:
- a first processing element simultaneously receiving two inputs per cycle comprising the first bit of each element of said first sequence and each element of said second sequence, said first processing element outputting the products of said two inputs thereto, one per cycle;
- a plurality of processing elements labeled, 2, . . . , m, . . . , M, where M is the number of bits of each element of said first sequence, the m.sup.th processing element receiving two inputs per cycle comprising the m.sup.th bit of an element of said first sequence and a corresponding element of said second sequence, said m.sup.th processing element outputting the sum of the product of said two inputs thereto and the sum of the m-1.sup.th processing element.
A matrix multiplication circuit comprising:
- a first stage for multiplying a first matrix X having elements x.sub.ij, i=1 . . . I, j=1 . . . J with a second matrix C.sub.t having elements c.sup.t.sub.jk, k=1 . . . K, said first stage comprising:
- a first plurality of pipeline circuits which operate in parallel, each pipeline circuit for sequentially outputting the elements:
- ##EQU11## of an intermediate matrix for a particular value of k;
- and a second stage for receiving the elements y.sub.ik as said elements y.sub.ik are output by the first stage for multiplying said elements y.sub.ik with a third matrix C having elements C.sub.li, said second stage comprising:
- a second plurality of pipeline circuits which operate in parallel, each pipeline circuit of the second stage for sequentially outputting the products c.sub.li y.sub.ik for a particular value k;
- and
- associated accumulator means, each accumulator means for selectively accumulating products c.sub.li y.sub.ik for particular values of l from the associated pipeline circuit so that each accumulator means generates the sum ##EQU12## wherein each pipeline circuit of the second stage, for multiplying the elements of a first sequence c.sub.11, c.sub.21, . . . , c.sub.L1, c.sub.12, c.sub.22, . . . , c.sub.L2, . . . , c.sub.L1 with the elements of second sequence comprising L repetitions of each element of the sequence:
- y.sub.1k, y.sub.2k, . . . , y.sub.1k for a particular value of k, comprises:
- a first processing element simultaneously receiving two inputs per cycle comprising the first bit of each element of said first sequence and each element of said second sequence, said first processing element outputting the products of said two inputs thereto, one per cycle;
- a plurality of processing elements labeled 2, . . . , p, . . . , p, where p is the number of bits of each element of said first sequence, the p.sup.th processing element receiving two inputs per cycle comprising the p.sup.th bit of each element of said first sequence and each element of said second sequence, said p.sup.th processing element outputting the sum of the product of said two inputs thereto and the sum of the p-1.sup.th processing element.
A method for multiplying three matrices comprising the steps of:
- in a first multiplication circuit stage, multiplying a first matrix X having elements x.sub.ij i= 1 . . . I, j=1 . . . J with a second matrix A having elements a.sub.jk, k=1 . . . K said multiplication step of said first stage comprising:
- in a first plurality of pipeline circuits, sequentially generating, in each pipeline circuit simultaneously, the elements:
- ##EQU13## of an intermediate product matrix Y=X.multidot.A for a particular value of k;
- and
- in a second multiplication circuit stage, receiving the elements y.sub.ik as said elements y.sub.ik are generated by the first stage and multiplying said elements y.sub.ik with a third matrix C having elements c.sub.li, said multiplication step of said second stage comprising the steps of:
- in a second plurality of pipeline circuits, sequentially generating the products c.sub.li y.sub.ik for a particular value k from each pipeline circuit simultaneously;
- and
- in associated accumulator means, selectively accumulating said products c.sub.li y.sub.ik for particular values of l from the associated pipeline circuit so that each accumulator means generates the elements ##EQU14## of a product matrix Z=C.multidot.Y.
A circuit for multiplying three matrices, C, having elements C.sub.li, i=1 . . . I, l=1 . . . L, X having elements x.sub.ij, j=1 . . . J, and A, having elements a.sub.jk, k=1 . . . K, said circuit comprising:
- a first stage having a first plurality of circuits, each capable of simultaneously multiplying each element a.sub.jk in a particular column k of A with a corresponding element x.sub.ij in a j.sup.th column of X and capable of simultaneously sequentially outputting the elements ##EQU15## of said particular k.sup.th column of an intermediate product matrix Y=X.multidot.A, and
- a second stage having a second plurality of circuits, each capable of simultaneously receiving the elements y.sub.ik of a particular column k of Y as said elements y.sub.ik are outputted by a corresponding first circuit, capable of multiplying each element c.sub.li of C with a corresponding received element y.sub.ik in an i.sup.th row of said particular column k of Y and capable of outputting each product c.sub.li y.sub.ik for a particular value k, and
- a plurality of associated accumulators, each capable of receiving said products c.sub.li y.sub.ik of a particular column k of a corresponding second circuit and capable of selectively accumulating said products for particular values of l to generate the elements ##EQU16## of a product matrix Z=C.multidot.Y.
A process for multiplying three matrices, C, having elements c.sub.li, i=1 . . . I, l=1 . . . L, X, having elements x.sub.ij, j=1 . . . J, and A, having elements a.sub.jk, k=1 . . . k, said process comprising the steps of:
- simultaneously, in each of a first plurality of pipelined circuits of a first stage, sequentially multiplying each a.sub.jk in a particular column k of A with a corresponding element k.sub.ij in a j.sup.th column of X and simultaneously sequentially outputting the elements ##EQU17## of said particular k.sup.th column of an intermediate product matrix Y=X.multidot.A,
- simultaneously, in each of a second plurality of pipelined circuits of a second stage, receiving the elements y.sub.ik of a particular column k of Y as said elements y.sub.ik are outputted by a corresponding first pipelined circuit, multiplying each element c.sub.li of C with a corresponding received element y.sub.ik in an i.sup.th row of said particular column k of Y and outputting each product c.sub.li y.sub.ik for said particular value k, and
- in each accumulator associated with a second pipelined circuit of said second stage, simultaneously receiving each product c.sub.li y.sub.ik for a particular value k and selectively accumulating products for particular values of l to generate the elements ##EQU18## of a product matrix Z=C.multidot.Y.
Dependencies are inferred from the claim text.