Apparatus and methods for matrix multiplication
AssigneeCambricon Technologies Corporation Limited
InventorsXiao Zhang, Shaoli Liu, Tianshi Chen, Yunji Chen
Life of this patent
Estimating the term…
Abstract
Aspects for matrix multiplication in neural network are described herein. The aspects may include a controller unit configured to receive a matrix-multiply-matrix (MM) instruction that includes a first starting address of a first matrix, a first size of the first matrix, a second starting address of a second matrix, and a second size of the second matrix; multiple computation modules configured to respectively multiply, in response to the MM instruction, row vectors of the first matrix with column vectors of the second matrix to generate one or more result elements; and an interconnection unit configured to combine the result elements to generate one or more row vectors of a result matrix.
Claims16
An apparatus for matrix multiplication in a neural network, comprising:
- a controller unit configured to receive a matrix-multiply-matrix (MM) instruction that includes a first starting address of a first matrix, a first size of the first matrix, a second starting address of a second matrix, and a second size of the second matrix;
- multiple computation modules configured to:
- receive the first matrix based on the first starting address and the first size of the first matrix,
- receive the second matrix based on the second starting address and the second size of the second matrix,
- respectively multiply, in response to the MM instruction, row vectors of the first matrix with column vectors of the second matrix to generate one or more result elements, and
- an interconnection unit configured to combine the result elements to generate one or more row vectors of a result matrix, wherein at least one of the multiple computation modules is configured to combine the row vectors to generate the result matrix,
- wherein the multiple computation modules include a master computation module configured to receive, in response to the MM instruction, the first matrix and transmit one of the row vectors of the first matrix to one or more slave computation modules,
- wherein the multiple computation modules include the one or more slave computation modules respectively configured to:
- store one of the column vectors of the second matrix,
- receive the one of the row vectors of the first matrix from the master computation module, and
- multiply the received row vector of the first matrix with the stored column vector of the second matrix to generate the result element.
A method for matrix multiplication in a neural network, comprising:
- receiving, by a controller unit, a matrix-multiply-matrix (MM) instruction that includes a first starting address of a first matrix, a first size of the first matrix, a second starting address of a second matrix, and a second size of the second matrix;
- receiving, by multiple computation modules, the first matrix based the first starting address and the first size of the first matrix, wherein the receiving the first matrix includes receiving, by a master computation module of the multiple computation modules, in response to the MM instruction, the first matrix and transmitting, by the master computation module, one of the row vectors of the first matrix to one or more slave computation modules;
- receiving, by the multiple computation modules, the second matrix based on the second starting address and the second size of the second matrix;
- respectively multiplying, in response to the MM instruction by the multiple computation modules, row vectors of the first matrix with column vectors of the second matrix to generate one or more result elements, wherein the multiplying includes:
- respectively storing, by the one or more slave computation modules of the multiple computation modules, one of the column vectors of the second matrix,
- respectively receiving, by the one or more slave computation modules, the one of the row vectors of the first matrix from the master computation module, and
- respectively multiplying, by the one or more slave computation modules, the received row vector of the first matrix with the stored column vector of the second matrix to generate the result element;
- combining, by an interconnection unit, the result elements to generate one or more row vectors of a result matrix;
- and
- combining, by at least one of the multiple computation modules, the row vectors to generate the result matrix.
Dependencies are inferred from the claim text.