KR20220126018A - Calculation device for efficient parallel processing of matrix operation and memory device including the same - Google Patents
Calculation device for efficient parallel processing of matrix operation and memory device including the same Download PDFInfo
- Publication number
- KR20220126018A KR20220126018A KR1020210030067A KR20210030067A KR20220126018A KR 20220126018 A KR20220126018 A KR 20220126018A KR 1020210030067 A KR1020210030067 A KR 1020210030067A KR 20210030067 A KR20210030067 A KR 20210030067A KR 20220126018 A KR20220126018 A KR 20220126018A
- Authority
- KR
- South Korea
- Prior art keywords
- input
- matrix
- output
- accumulators
- operator
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F17/00—Digital computing or data processing equipment or methods, specially adapted for specific functions
- G06F17/10—Complex mathematical operations
- G06F17/16—Matrix or vector computation, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F7/00—Methods or arrangements for processing data by operating upon the order or content of the data handled
- G06F7/38—Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
- G06F7/48—Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
- G06F7/52—Multiplying; Dividing
- G06F7/523—Multiplying only
- G06F7/53—Multiplying only in parallel-parallel fashion, i.e. both operands being entered in parallel
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F7/00—Methods or arrangements for processing data by operating upon the order or content of the data handled
- G06F7/38—Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
- G06F7/48—Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
- G06F7/544—Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices for evaluating functions by calculation
- G06F7/5443—Sum of products
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
- G06F9/4893—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues taking into account power or heat criteria
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Pure & Applied Mathematics (AREA)
- Mathematical Optimization (AREA)
- Computational Mathematics (AREA)
- Mathematical Analysis (AREA)
- General Engineering & Computer Science (AREA)
- Computing Systems (AREA)
- Software Systems (AREA)
- Mathematical Physics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Algebra (AREA)
- Complex Calculations (AREA)
- Image Processing (AREA)
- Multi Processors (AREA)
Abstract
Description
본 발명은 반도체 집적 회로에 관한 것으로서, 더욱 상세하게는 행렬 연산의 효율적 병렬처리를 위한 연산 장치 및 상기 연산 장치를 포함하는 메모리 장치에 관한 것이다.BACKGROUND OF THE
도 1a는 종래 기술에 따른 행렬 연산을 수행하는 일 예를 나타내는 도면이다.1A is a diagram illustrating an example of performing a matrix operation according to the prior art.
도 1a를 참조하면, 원소들(a11, a12, ..., a1m, a21, a22, ..., a2m, ..., an1, an2, ..., anm)을 포함하는 n*m(n, m은 각각 2 이상의 자연수) 차원의 행렬과 성분들(x1, x2, ..., xm)을 포함하는 m 차원의 입력 벡터의 곱셈에 의하여 성분들(y1, y2, ..., yn)을 포함하는 n 차원의 출력 벡터가 획득된다. 상기 출력 벡터의 각 성분은 상기 행렬의 해당하는 열 벡터 또는 행 벡터와 입력 벡터의 내적으로 정의된다. 이 때, 두 벡터의 내적은 각 벡터의 성분들을 차례로 곱한 후 모두 더하여 획득될 수 있다. 예를 들어, y1= a11*x1+a12*x2+...+a1m*xm일 수 있다.1A , the elements (a 11 , a 12 , ..., a 1m , a 21 , a 22 , ..., a 2m , ..., a n1 , a n2 , ..., a By multiplication of an n*m ( n , m is a natural number equal to or greater than 2 ) dimension matrix containing An n-dimensional output vector comprising the components y 1 , y 2 , ..., y n is obtained. Each component of the output vector is defined as the dot product of the input vector and the corresponding column or row vector of the matrix. In this case, the dot product of two vectors may be obtained by sequentially multiplying the components of each vector and then adding them all together. For example, y 1 = a 11 *x 1 +a 12 *x 2 +...+a 1m *x m .
도 1b는 도 1a의 행렬 연산을 수행하는 종래 기술에 따른 연산 장치를 나타내는 블록도이다.FIG. 1B is a block diagram illustrating an arithmetic apparatus according to the related art for performing the matrix operation of FIG. 1A.
도 1b를 참조하면, 연산 장치(10)는 복수의 MAC(multiplier-and-accumulator)들(201, 202, ..., 20k)(k는 2 이상의 자연수)을 포함한다. 복수의 MAC들(201~20k) 각각은 복수의 곱셈기들(211, 212, ..., 21k) 중 하나 및 복수의 누산기들(231, 232, ..., 23k) 중 하나를 포함한다.Referring to FIG. 1B , the
복수의 곱셈기들(211~21k) 각각은 복수의 제1 입력들(IN11, IN12, ..., IN1k) 중 하나 및 복수의 제2 입력들(IN21, IN22, ..., IN2k) 중 하나를 수신하며, 두 개의 입력을 곱하여 출력한다.Each of the plurality of
복수의 누산기들(231~23k) 각각은 복수의 곱셈기들(211~21k) 중 하나와 연결되고, 복수의 가산기들(251, 252, ..., 25k) 중 하나 및 복수의 누적레지스터들(271, 272, ..., 27k) 중 하나를 포함하며, 복수의 곱셈기들(211~21k) 중 하나의 출력을 누적하여 더한 후 복수의 출력들(OUT1, OUT2, ..., OUTk) 중 하나를 발생한다.Each of the plurality of
행렬과 벡터의 차원이 커지면 병렬 처리를 위해 도 1b와 같이 복수의 MAC들(201~20k)을 사용하여 내적을 부분적으로 구한 후 그 값들을 합하여 전체 내적을 구할 수 있다. 다만, 도 1b의 종래의 연산 장치(10)는 k개의 MAC들(201~20k)을 포함하는 경우에 상기 행렬의 원소들과 상기 벡터의 성분들 중 각각 k개를 입력으로 수신하고 이를 위해 상기 벡터의 성분들을 중복하여 수신하기 때문에, 메모리 및 버스 대역폭의 사용이 증가하는 문제가 있었다.When the dimensions of the matrix and the vector are increased, the dot product may be partially obtained using a plurality of
본 발명의 일 목적은 행렬 연산을 수행하는데 있어서 메모리 및 버스 대역폭 사용 감소를 위한 연산 장치를 제공하는 것이다.SUMMARY OF THE INVENTION One object of the present invention is to provide an arithmetic device for reducing memory and bus bandwidth usage in performing a matrix operation.
본 발명의 다른 목적은 상기 연산 장치를 포함함으로써 행렬 연산을 수행하는데 있어서 성능 향상 및 전력 소모 감소를 위한 메모리 장치를 제공하는 것이다.Another object of the present invention is to provide a memory device for improving performance and reducing power consumption in performing a matrix operation by including the computing device.
상기 일 목적을 달성하기 위해, 본 발명의 실시예들에 따른 연산 장치는 복수의 누적연산기들을 포함하는 하나 이상의 연산기그룹을 포함한다. 상기 복수의 누적연산기들은 입력 벡터 성분들을 수신하는 제1 입력 단자, 및 행렬의 원소들을 수신하는 제2 입력 단자를 각각 포함하고, 상기 입력 벡터 성분들과 상기 행렬의 원소들에 대한 누적 연산을 수행하여 출력 벡터 성분들 중 하나를 각각 발생한다. 상기 복수의 누적연산기들 각각은 제1 연산기, 제2 연산기 및 누적레지스터를 포함한다. 상기 제1 연산기는 상기 제1 입력 단자로부터 수신되는 상기 입력 벡터 성분들 및 상기 제2 입력 단자로부터 수신되는 상기 행렬의 원소들에 대한 제1 연산을 수행하여 상기 제1 연산의 결과를 발생한다. 상기 제2 연산기는 상기 제1 연산기로부터 출력되는 상기 제1 연산의 결과 및 상기 누적레지스터로부터 제공되는 누적 결과에 대한 제2 연산을 수행하여 상기 제2 연산의 결과를 발생한다. 상기 누적레지스터는 상기 제2 연산기로부터 출력되는 상기 제2 연산의 결과를 누적하여 상기 누적 결과를 발생하고, 최종적으로 상기 출력 벡터 성분들 중 하나를 발생한다. 하나의 상기 연산기그룹에 포함되는 상기 복수의 누적연산기들의 상기 제1 입력 단자는 공통으로 연결된다.In order to achieve the above object, a computing device according to embodiments of the present invention includes one or more operator groups including a plurality of accumulators. Each of the plurality of accumulators includes a first input terminal for receiving input vector elements and a second input terminal for receiving matrix elements, and performs an accumulation operation on the input vector elements and the matrix elements. to generate each one of the output vector components. Each of the plurality of accumulators includes a first operator, a second operator, and an accumulation register. The first operator generates a result of the first operation by performing a first operation on the input vector components received from the first input terminal and the elements of the matrix received from the second input terminal. The second operator generates a result of the second operation by performing a second operation on the result of the first operation output from the first operator and the accumulation result provided from the accumulation register. The accumulation register generates the accumulation result by accumulating the results of the second operation output from the second operator, and finally generates one of the output vector components. The first input terminals of the plurality of accumulators included in one operator group are connected in common.
일 실시예에서, 복수의 상기 연산기그룹들은 복수의 입력 벡터들에 일대일로 대응하여 입력 벡터 성분들을 수신하고 복수의 출력 벡터들에 일대일로 대응하여 출력 벡터 성분들을 발생할 수 있다. 서로 다른 상기 연산기그룹에 속하는 복수의 누적연산기들을 포함하는 복수의 교차연산기그룹들을 포함할 수 있다. 하나의 상기 교차연산기그룹에 포함되는 상기 복수의 누적연산기들의 상기 제2 입력 단자는 공통으로 연결될 수 있다.In an embodiment, the plurality of operator groups may receive input vector components in a one-to-one correspondence with a plurality of input vectors and generate output vector components in one-to-one correspondence with a plurality of output vectors. It may include a plurality of crossover operator groups including a plurality of accumulators belonging to the different operator groups. The second input terminals of the plurality of accumulators included in one crossover operator group may be connected in common.
일 실시예에서, 상기 제1 연산기는 곱셈기이고, 상기 제1 연산은 곱셈이며, 상기 제2 연산기는 가산기이고, 상기 제2 연산은 덧셈이며, 상기 복수의 누적연산기들 각각은 MAC(multiplier-and-accumulator)일 수 있다.In an embodiment, the first operator is a multiplier, the first operation is a multiplication, the second operator is an adder, the second operation is an addition, and each of the plurality of accumulators is a multiplier-and (MAC) operator. -accumulator).
일 실시예에서, 상기 복수의 누적연산기들 각각은 상기 누적레지스터에 의해 발생되는 상기 누적 결과를 임시로 저장하는 적어도 하나의 쉐도우(shadow) 레지스터를 더 포함할 수 있다.In an embodiment, each of the plurality of accumulators may further include at least one shadow register that temporarily stores the accumulation result generated by the accumulation register.
일 실시예에서, 상기 복수의 누적연산기들 각각은 보조 입력을 수신하는 보조 입력 단자, 및 상기 입력 벡터 성분들을 수신하는 상기 제1 입력 단자와 연결되고, 선택 신호에 기초하여 상기 보조 입력 및 상기 입력 벡터 성분들 중 하나를 선택하여 상기 제1 연산기에 제공하는 멀티플렉서를 더 포함할 수 있다.In one embodiment, each of the plurality of accumulators is connected to an auxiliary input terminal for receiving an auxiliary input, and the first input terminal for receiving the input vector components, and based on a selection signal, the auxiliary input and the input It may further include a multiplexer that selects one of the vector components and provides it to the first operator.
일 실시예에서, 상기 복수의 누적연산기들 중 제1 누적연산기는 보조 입력을 수신하는 보조 입력 단자, 및 상기 입력 벡터 성분들을 수신하는 상기 제1 입력 단자와 연결되고, 선택 신호에 기초하여 상기 보조 입력 및 상기 입력 벡터 성분들 중 하나를 선택하여 상기 제1 연산기에 제공하는 멀티플렉서를 더 포함할 수 있다. 상기 복수의 누적연산기들 중 상기 제1 누적연산기와 인접하여 배치되는 적어도 하나의 누적연산기는 상기 제1 누적연산기와 상기 멀티플렉서를 공유할 수 있다.In an embodiment, a first accumulator of the plurality of accumulators is connected to an auxiliary input terminal for receiving an auxiliary input, and the first input terminal for receiving the input vector components, and based on a selection signal A multiplexer may further include an input and a multiplexer that selects one of the input vector components and provides it to the first operator. At least one accumulator disposed adjacent to the first accumulator among the plurality of accumulators may share the multiplexer with the first accumulator.
일 실시예에서, 상기 복수의 누적연산기들 각각의 2개의 입력들 중 어느 하나는 0 또는 1의 값을 갖는 이진 값이고, 상기 제1 누적연산기는 상기 이진 값에 따라 0을 출력하거나 다른 하나의 입력을 바이패스 시키는 게이팅 회로로 구현될 수 있다.In one embodiment, any one of the two inputs of each of the plurality of accumulators is a binary value having a value of 0 or 1, and the first accumulator outputs 0 or the other one according to the binary value. It can be implemented as a gating circuit that bypasses the input.
일 실시예에서, 상기 복수의 누적연산기들 각각의 2개의 입력들 중 어느 하나는 n진 정수 값(n은 2이상의 자연수)이고 다른 하나는 정수 지수를 갖는 n의 거듭제곱 값이고, 상기 제1 누적연산기는 상기 n진 정수 입력을 상기 정수 지수만큼 쉬프트 시키는 회로로 구현될 수 있다.In one embodiment, one of the two inputs of each of the plurality of accumulators is a base n integer value (n is a natural number greater than or equal to 2) and the other is a value of a power of n having an integer exponent, and the first The accumulator may be implemented as a circuit for shifting the n-base integer input by the integer exponent.
일 실시예에서, 상기 복수의 누적연산기들 각각의 2개의 입력들 중 어느 하나는 n진 부동소수점 값(n은 2이상의 자연수)이고 다른 하나는 정수 지수를 갖는 n의 거듭제곱 값이고, 상기 제1 누적연산기는 상기 n진 부동소수점 입력의 가수를 바이패스 시키고 상기 두 입력의 지수를 더하는 회로로 구현될 수 있다.In one embodiment, one of the two inputs of each of the plurality of accumulators is an n-base floating-point value (n is a natural number greater than or equal to 2) and the other is a value to a power of n having an integer exponent, and the The 1 accumulator may be implemented as a circuit that bypasses the mantissa of the n-base floating-point input and adds the exponents of the two inputs.
일 실시예에서, 상기 복수의 누적연산기들 각각의 2개의 입력들 중 어느 하나를 1로 고정하여 상기 제1 연산기를 바이패스시키고, 상기 제2 연산기는 상기 제1 연산기에 의해 바이패스된 값을 상기 누적레지스터의 값과 비교하여 둘 중 큰 값을 출력하는 비교기로 구현될 수 있다.In one embodiment, the first operator is bypassed by fixing any one of two inputs of each of the plurality of accumulators to 1, and the second operator is the value bypassed by the first operator. It may be implemented as a comparator that compares the value of the accumulation register and outputs the larger of the two values.
일 실시예에서, 상기 행렬은 합성곱 행렬이고, 상기 입력 벡터와 상기 출력 벡터는 입력 행렬과 출력 행렬을 각각 열벡터로 바꾸어 얻어질 수 있다.In an embodiment, the matrix is a convolution matrix, and the input vector and the output vector may be obtained by changing the input matrix and the output matrix into column vectors, respectively.
일 실시예에서, 상기 행렬은 복수의 필터 행렬들에 대응하는 확장된 합성곱 행렬이고, 상기 출력 벡터는 상기 복수의 필터 행렬들에 대응하는 확장된 출력 벡터일 수 있다.In an embodiment, the matrix may be an extended convolution matrix corresponding to a plurality of filter matrices, and the output vector may be an extended output vector corresponding to the plurality of filter matrices.
일 실시예에서, 상기 행렬은 합성곱 행렬 또는 패킹된 합성곱 행렬이고, 상기 복수의 입력 벡터들과 상기 복수의 출력 벡터들은 복수의 입력 행렬들과 복수의 출력 행렬들을 각각 벡터로 바꾸어 얻어질 수 있다.In one embodiment, the matrix is a convolution matrix or a packed convolution matrix, and the plurality of input vectors and the plurality of output vectors may be obtained by converting a plurality of input matrices and a plurality of output matrices into vectors, respectively. have.
일 실시예에서, 상기 행렬은 분할된 합성곱 행렬이고, 상기 복수의 입력 벡터들과 상기 복수의 출력 벡터들은 복수의 분할된 입력 행렬들과 복수의 분할된 출력 행렬들을 각각 벡터로 바꾸어 얻어질 수 있다.In an embodiment, the matrix is a partitioned convolution matrix, and the plurality of input vectors and the plurality of output vectors may be obtained by converting a plurality of partitioned input matrices and a plurality of partitioned output matrices into vectors, respectively. have.
상기 다른 목적을 달성하기 위해, 본 발명의 실시예들에 따른 메모리 장치는 메모리 셀 어레이, 행 디코더, 열 디코더, 게이팅 회로, 입출력 데이터 구동 회로, 입출력 버퍼 및 연산 회로를 포함한다. 상기 메모리 셀 어레이는 복수의 행들 및 복수의 열들을 형성하도록 배열되는 복수의 메모리 셀들을 포함하고, 행렬의 원소들 또는 상기 행렬의 원소들을 생성하기 위한 행렬 생성 정보를 저장한다. 상기 행 디코더는 행 어드레스에 기초하여, 상기 복수의 행들 중 목표 행을 선택하기 위한 행 선택 신호를 발생한다. 상기 열 디코더는 열 어드레스에 기초하여, 상기 목표 행에 포함되는 열들 중 목표 열을 선택하기 위한 열 선택 신호를 발생한다. 상기 게이팅 회로는 상기 열 선택 신호에 기초하여 상기 목표 열을 선택한다. 상기 입출력 데이터 구동 회로는 상기 게이팅 회로를 통해 상기 목표 열에 입력 데이터를 기입하거나 상기 목표 열에 저장된 데이터를 출력 데이터로서 출력한다. 상기 입출력 버퍼는 상기 입출력 데이터 구동 회로와 연결되고, 입력 벡터 성분들 및 출력 벡터 성분들을 저장한다. 상기 연산 회로는 상기 게이팅 회로 및 상기 입출력 버퍼와 연결되고, 복수의 누적연산기들을 포함하는 하나 이상의 연산기그룹을 포함하며, 상기 입출력 버퍼로부터 제공되는 상기 입력 벡터 성분들과 상기 게이팅 회로를 통해 제공되는 상기 행렬의 원소들 또는 상기 게이팅 회로를 통해 제공되는 상기 행렬 생성 정보를 참조하여 생성되는 상기 행렬의 원소들을 상기 복수의 누적연산기들에서 입력 벡터 기준 방식으로 연산하여 상기 출력 벡터 성분들을 획득하고, 상기 출력 벡터 성분들을 상기 입출력 버퍼에 제공한다. 상기 복수의 누적연산기들 각각은, 상기 입력 벡터 성분들을 수신하는 제1 입력 단자, 및 상기 행렬의 원소들을 수신하는 제2 입력 단자를 포함하고, 상기 입력 벡터 성분들과 상기 행렬의 원소들에 대한 누적 연산을 수행하여 상기 출력 벡터 성분들 중 하나를 발생한다. 상기 복수의 누적연산기들 각각은 제1 연산기, 제2 연산기 및 누적레지스터를 포함한다. 상기 제1 연산기는 상기 제1 입력 단자로부터 수신되는 상기 입력 벡터 성분들 및 상기 제2 입력 단자로부터 수신되는 상기 행렬의 원소들에 대한 제1 연산을 수행하여 상기 제1 연산의 결과를 발생한다. 상기 제2 연산기는 상기 제1 연산기로부터 출력되는 상기 제1 연산의 결과 및 상기 누적레지스터로부터 제공되는 누적 결과에 대한 제2 연산을 수행하여 상기 제2 연산의 결과를 발생한다. 상기 누적레지스터는 상기 제2 연산기로부터 출력되는 상기 제2 연산의 결과를 누적하여 상기 누적 결과를 발생하고, 최종적으로 상기 출력 벡터 성분들 중 하나를 발생한다. 하나의 상기 연산기그룹에 포함되는 상기 복수의 누적연산기들의 상기 제1 입력 단자는 공통으로 연결된다.In order to achieve the above object, a memory device according to embodiments of the present invention includes a memory cell array, a row decoder, a column decoder, a gating circuit, an input/output data driving circuit, an input/output buffer, and an arithmetic circuit. The memory cell array includes a plurality of memory cells arranged to form a plurality of rows and a plurality of columns, and stores elements of a matrix or matrix generation information for generating elements of the matrix. The row decoder generates a row selection signal for selecting a target row from among the plurality of rows based on a row address. The column decoder generates a column selection signal for selecting a target column from among columns included in the target row, based on a column address. The gating circuit selects the target column based on the column selection signal. The input/output data driving circuit writes input data into the target column through the gating circuit or outputs data stored in the target column as output data. The input/output buffer is connected to the input/output data driving circuit and stores input vector components and output vector components. The operation circuit is connected to the gating circuit and the input/output buffer, and includes one or more operator groups including a plurality of accumulators, the input vector components provided from the input/output buffer and the gating circuit provided through the gating circuit. The plurality of accumulators operate on the elements of the matrix generated with reference to the elements of the matrix or the matrix generation information provided through the gating circuit in an input vector reference method to obtain the output vector components, and the output Vector components are provided to the input/output buffer. Each of the plurality of accumulators includes a first input terminal for receiving the input vector components, and a second input terminal for receiving the elements of the matrix, wherein the input vector components and the elements of the matrix An accumulation operation is performed to generate one of the output vector components. Each of the plurality of accumulators includes a first operator, a second operator, and an accumulation register. The first operator generates a result of the first operation by performing a first operation on the input vector components received from the first input terminal and the elements of the matrix received from the second input terminal. The second operator generates a result of the second operation by performing a second operation on the result of the first operation output from the first operator and the accumulation result provided from the accumulation register. The accumulation register generates the accumulation result by accumulating the results of the second operation output from the second operator, and finally generates one of the output vector components. The first input terminals of the plurality of accumulators included in one operator group are connected in common.
일 실시예에서, 복수의 상기 연산기그룹들은 복수의 입력 벡터들에 일대일로 대응하여 입력 벡터 성분들을 수신하고 복수의 출력 벡터들에 일대일로 대응하여 출력 벡터 성분들을 발생할 수 있다. 서로 다른 상기 연산기그룹에 속하는 복수의 누적연산기들을 포함하는 복수의 교차연산기그룹들을 포함할 수 있다. 하나의 상기 교차연산기그룹에 포함되는 상기 복수의 누적연산기들의 상기 제2 입력 단자는 공통으로 연결될 수 있다.In an embodiment, the plurality of operator groups may receive input vector components in a one-to-one correspondence with a plurality of input vectors and generate output vector components in one-to-one correspondence with a plurality of output vectors. It may include a plurality of crossover operator groups including a plurality of accumulators belonging to the different operator groups. The second input terminals of the plurality of accumulators included in one crossover operator group may be connected in common.
일 실시예에서, 상기 제1 연산기는 곱셈기이고, 상기 제1 연산은 곱셈이며, 상기 제2 연산기는 가산기이고, 상기 제2 연산은 덧셈이며, 상기 복수의 누적연산기들 각각은 MAC(multiplier-and-accumulator)일 수 있다.In an embodiment, the first operator is a multiplier, the first operation is a multiplication, the second operator is an adder, the second operation is an addition, and each of the plurality of accumulators is a multiplier-and (MAC) operator. -accumulator).
일 실시예에서, 상기 복수의 누적연산기들 각각은 상기 누적레지스터에 의해 발생되는 상기 누적 결과를 임시로 저장하는 적어도 하나의 쉐도우(shadow) 레지스터를 더 포함할 수 있다.In an embodiment, each of the plurality of accumulators may further include at least one shadow register that temporarily stores the accumulation result generated by the accumulation register.
일 실시예에서, 상기 복수의 누적연산기들 각각은 보조 입력을 수신하는 보조 입력 단자, 및 상기 입력 벡터 성분들을 수신하는 상기 제1 입력 단자와 연결되고, 선택 신호에 기초하여 상기 보조 입력 및 상기 입력 벡터 성분들 중 하나를 선택하여 상기 제1 연산기에 제공하는 멀티플렉서를 더 포함할 수 있다.In one embodiment, each of the plurality of accumulators is connected to an auxiliary input terminal for receiving an auxiliary input, and the first input terminal for receiving the input vector components, and based on a selection signal, the auxiliary input and the input It may further include a multiplexer that selects one of the vector components and provides it to the first operator.
일 실시예에서, 상기 복수의 누적연산기들 중 제1 누적연산기는 보조 입력을 수신하는 보조 입력 단자, 및 상기 입력 벡터 성분들을 수신하는 상기 제1 입력 단자와 연결되고, 선택 신호에 기초하여 상기 보조 입력 및 상기 입력 벡터 성분들 중 하나를 선택하여 상기 제1 연산기에 제공하는 멀티플렉서를 더 포함할 수 있다. 상기 복수의 누적연산기들 중 상기 제1 누적연산기와 인접하여 배치되는 적어도 하나의 누적연산기는 상기 제1 누적연산기와 상기 멀티플렉서를 공유할 수 있다.In an embodiment, a first accumulator of the plurality of accumulators is connected to an auxiliary input terminal for receiving an auxiliary input, and the first input terminal for receiving the input vector components, and based on a selection signal A multiplexer may further include an input and a multiplexer that selects one of the input vector components and provides it to the first operator. At least one accumulator disposed adjacent to the first accumulator among the plurality of accumulators may share the multiplexer with the first accumulator.
일 실시예에서, 상기 복수의 누적연산기들 각각의 2개의 입력들 중 어느 하나는 0 또는 1의 값을 갖는 이진 값이고, 상기 제1 누적연산기는 상기 이진 값에 따라 0을 출력하거나 다른 하나의 입력을 바이패스 시키는 게이팅 회로로 구현될 수 있다.In one embodiment, any one of the two inputs of each of the plurality of accumulators is a binary value having a value of 0 or 1, and the
일 실시예에서, 상기 복수의 누적연산기들 각각의 2개의 입력들 중 어느 하나는 n진 정수 값(n은 2이상의 자연수)이고 다른 하나는 정수 지수를 갖는 n의 거듭제곱 값이고, 상기 제1 누적연산기는 상기 n진 정수 입력을 상기 정수 지수만큼 쉬프트 시키는 회로로 구현될 수 있다.In one embodiment, one of the two inputs of each of the plurality of accumulators is a base n integer value (n is a natural number greater than or equal to 2) and the other is a value of a power of n having an integer exponent, and the first The accumulator may be implemented as a circuit for shifting the n-base integer input by the integer exponent.
일 실시예에서, 상기 복수의 누적연산기들 각각의 2개의 입력들 중 어느 하나는 n진 부동소수점 값(n은 2이상의 자연수)이고 다른 하나는 정수 지수를 갖는 n의 거듭제곱 값이고, 상기 제1 누적연산기는 상기 n진 부동소수점 입력의 가수를 바이패스 시키고 상기 두 입력의 지수를 더하는 회로로 구현될 수 있다.In one embodiment, one of the two inputs of each of the plurality of accumulators is an n-base floating-point value (n is a natural number greater than or equal to 2) and the other is a value to a power of n having an integer exponent, and the
일 실시예에서, 상기 복수의 누적연산기들 각각의 2개의 입력들 중 어느 하나를 1로 고정하여 상기 제1 연산기를 바이패스시키고, 상기 제2 연산기는 상기 제1 연산기에 의해 바이패스된 값을 상기 누적레지스터의 값과 비교하여 둘 중 큰 값을 출력하는 비교기로 구현될 수 있다.In one embodiment, the first operator is bypassed by fixing any one of two inputs of each of the plurality of accumulators to 1, and the second operator is the value bypassed by the first operator. It may be implemented as a comparator that compares the value of the accumulation register and outputs the larger of the two values.
일 실시예에서, 상기 행렬은 합성곱 행렬이고, 상기 입력 벡터와 상기 출력 벡터는 입력 행렬과 출력 행렬을 각각 열벡터로 바꾸어 얻어질 수 있다.In an embodiment, the matrix is a convolution matrix, and the input vector and the output vector may be obtained by changing the input matrix and the output matrix into column vectors, respectively.
일 실시예에서, 상기 행렬은 복수의 필터 행렬들에 대응하는 확장된 합성곱 행렬이고, 상기 출력 벡터는 상기 복수의 필터 행렬들에 대응하는 확장된 출력 벡터일 수 있다.In an embodiment, the matrix may be an extended convolution matrix corresponding to a plurality of filter matrices, and the output vector may be an extended output vector corresponding to the plurality of filter matrices.
일 실시예에서, 상기 행렬은 합성곱 행렬 또는 패킹된 합성곱 행렬이고, 상기 복수의 입력 벡터들과 상기 복수의 출력 벡터들은 복수의 입력 행렬들과 복수의 출력 행렬들을 각각 벡터로 바꾸어 얻어질 수 있다.In one embodiment, the matrix is a convolution matrix or a packed convolution matrix, and the plurality of input vectors and the plurality of output vectors may be obtained by converting a plurality of input matrices and a plurality of output matrices into vectors, respectively. have.
일 실시예에서, 상기 행렬은 분할된 합성곱 행렬이고, 상기 복수의 입력 벡터들과 상기 복수의 출력 벡터들은 복수의 분할된 입력 행렬들과 복수의 분할된 출력 행렬들을 각각 벡터로 바꾸어 얻어질 수 있다.In an embodiment, the matrix is a partitioned convolution matrix, and the plurality of input vectors and the plurality of output vectors may be obtained by converting a plurality of partitioned input matrices and a plurality of partitioned output matrices into vectors, respectively. have.
일 실시예에서, 상기 메모리 장치는 상기 열 어드레스에 기초하여, 상기 목표 행에 포함되고 두 개 이상의 열들을 각각 포함하는 복수의 라인들 중 상기 목표 열을 포함하는 목표 라인을 선택하기 위한 라인 선택 신호를 발생하는 라인 디코더를 더 포함할 수 있다. 상기 게이팅 회로는 상기 라인 선택 신호에 기초하여 상기 목표 라인을 선택하는 제1 게이팅 회로와 상기 열 선택 신호에 기초하여 상기 목표 열을 선택하는 제2 게이팅 회로를 포함할 수 있다. 상기 입출력 데이터 구동 회로는 상기 제1 및 제2 게이팅 회로들을 통해 상기 목표 열에 상기 입력 데이터를 기입하거나 상기 목표 열에 저장된 데이터를 상기 출력 데이터로서 출력할 수 있다. 상기 연산 회로는 상기 제1 게이팅 회로와 연결될 수 있다.In an embodiment, the memory device is a line selection signal for selecting a target line including the target column from among a plurality of lines included in the target row and each including two or more columns, based on the column address It may further include a line decoder for generating The gating circuit may include a first gating circuit that selects the target line based on the line selection signal and a second gating circuit that selects the target column based on the column selection signal. The input/output data driving circuit may write the input data in the target column or output data stored in the target column as the output data through the first and second gating circuits. The operation circuit may be connected to the first gating circuit.
일 실시예에서, 상기 열 디코더는 상기 열 어드레스 및 열 선택 정보에 기초하여, 상기 목표 행에 포함되는 열들 중 복수의 목표 열들을 한 번에 선택하기 위한 다중 열 선택 신호를 발생하는 다중 열 디코더이고, 상기 게이팅 회로는 상기 다중 열 선택 신호에 기초하여 상기 복수의 목표 열들을 한 번에 선택하고, 상기 입출력 데이터 구동 회로는 상기 게이팅 회로를 통해 상기 복수의 목표 열들에 상기 입력 데이터를 한 번에 기입하거나 상기 복수의 목표 열들에 저장된 데이터를 한 번에 상기 출력 데이터로서 출력하며, 상기 목표 행에 포함되는 상기 복수의 목표 열들에 대응하는 상기 열 어드레스는 연속적이지 않을 수 있다.In one embodiment, the column decoder is a multi-column decoder that generates a multi-column selection signal for selecting a plurality of target columns from among columns included in the target row at a time based on the column address and column selection information, , the gating circuit selects the plurality of target columns at once based on the multi-column selection signal, and the input/output data driving circuit writes the input data to the plurality of target columns at a time through the gating circuit Alternatively, data stored in the plurality of target columns may be output as the output data at a time, and the column addresses corresponding to the plurality of target columns included in the target row may not be consecutive.
상기와 같은 본 발명의 실시예들에 따른 연산 장치 및 메모리 장치에서는, 입력 벡터의 성분들 및 행렬의 원소들을 입력 받아 누적 연산을 수행하는데 있어서, 입력 벡터 기준 방식을 적용하여 복수의 누적연산기들(예를 들어, 복수의 MAC들)의 제1 입력 단자들을 공통으로 연결함으로써, 입력 벡터의 성분이 복수의 누적연산기들의 입력으로 가해지는 횟수를 줄일 수 있다. 따라서, 종래의 연산 장치와 비교하였을 때, 메모리 및 버스 대역폭 사용이 감소하고, 결과적으로 기존 방식에 비해 성능 및 전력 소모 관점에서 유리하게 된다.In the arithmetic device and the memory device according to the embodiments of the present invention as described above, when receiving input vector components and matrix elements and performing an accumulation operation, a plurality of accumulators ( For example, by connecting the first input terminals of the plurality of MACs in common, it is possible to reduce the number of times that the component of the input vector is applied to the inputs of the plurality of accumulators. Therefore, compared with the conventional computing device, memory and bus bandwidth usage is reduced, and as a result, it is advantageous in terms of performance and power consumption compared to the conventional method.
도 1a는 종래 기술에 따른 행렬 연산을 수행하는 일 예를 나타내는 도면이다.
도 1b는 도 1a의 행렬 연산을 수행하는 종래 기술에 따른 연산 장치를 나타내는 블록도이다.
도 2a는 본 발명의 실시예들에 따른 행렬 연산을 수행하는 일 예를 나타내는 도면이다.
도 2b는 도 2a의 행렬 연산을 수행하는 본 발명의 실시예들에 따른 연산 장치를 나타내는 블록도이다.
도 3a는 본 발명의 실시예들에 따른 연산 장치를 나타내는 블록도이다.
도 3b는 도 3a의 연산 장치에 포함되는 누적연산기의 다른 예를 나타내는 블록도이다.
도 3c는 도 3a의 연산 장치를 확장하여 복수의 입력 벡터들을 병렬로 처리함으로써 연산 수행 시간을 단축하는 예를 나타내는 블록도이다.
도 4a 및 4b는 도 3a의 연산 장치에 포함되는 누적연산기의 또 다른 예를 나타내는 블록도들이다.
도 5a, 5b, 5c, 5d 및 5e는 본 발명의 실시예들에 따른 연산 장치들을 이용하여 두 행렬의 합성곱 및 이를 응용한 연산을 수행하는 예들을 설명하기 위한 도면들이다.
도 6a, 6b 및 6c는 본 발명의 실시예들에 따른 연산 장치를 이용하여 두 행렬의 합성곱을 수행하는 다른 예를 설명하기 위한 도면들이다.
도 7, 8 및 9는 본 발명의 실시예들에 따른 연산 장치를 포함하는 메모리 장치를 나타내는 블록도들이다.1A is a diagram illustrating an example of performing a matrix operation according to the prior art.
FIG. 1B is a block diagram illustrating an arithmetic apparatus according to the related art for performing the matrix operation of FIG. 1A.
2A is a diagram illustrating an example of performing a matrix operation according to embodiments of the present invention.
FIG. 2B is a block diagram illustrating an operation device according to embodiments of the present invention that performs the matrix operation of FIG. 2A.
3A is a block diagram illustrating a computing device according to embodiments of the present invention.
3B is a block diagram illustrating another example of an accumulator included in the computing device of FIG. 3A .
FIG. 3C is a block diagram illustrating an example of shortening a calculation execution time by extending the calculation device of FIG. 3A to process a plurality of input vectors in parallel.
4A and 4B are block diagrams illustrating another example of an accumulator included in the computing device of FIG. 3A.
5A, 5B, 5C, 5D, and 5E are diagrams for explaining examples of performing a convolution of two matrices and an operation applying the same by using calculation devices according to embodiments of the present invention.
6A, 6B, and 6C are diagrams for explaining another example of performing a convolution of two matrices using an arithmetic device according to embodiments of the present invention.
7, 8, and 9 are block diagrams illustrating a memory device including an arithmetic unit according to embodiments of the present invention.
본문에 개시되어 있는 본 발명의 실시예들에 대해서, 특정한 구조적 내지 기능적 설명들은 단지 본 발명의 실시예를 설명하기 위한 목적으로 예시된 것으로, 본 발명의 실시예들은 다양한 형태로 실시될 수 있으며 본문에 설명된 실시예들에 한정되는 것으로 해석되어서는 아니 된다.With respect to the embodiments of the present invention disclosed in the text, specific structural or functional descriptions are only exemplified for the purpose of describing the embodiments of the present invention, and the embodiments of the present invention may be embodied in various forms. It should not be construed as being limited to the embodiments described in .
본 발명은 다양한 변경을 가할 수 있고 여러 가지 형태를 가질 수 있는바, 특정 실시예들을 도면에 예시하고 본문에 상세하게 설명하고자 한다. 그러나 이는 본 발명을 특정한 개시 형태에 대해 한정하려는 것이 아니며, 본 발명의 사상 및 기술 범위에 포함되는 모든 변경, 균등물 내지 대체물을 포함하는 것으로 이해되어야 한다.Since the present invention can have various changes and can have various forms, specific embodiments are illustrated in the drawings and described in detail in the text. However, this is not intended to limit the present invention to the specific disclosed form, it should be understood to include all modifications, equivalents and substitutes included in the spirit and scope of the present invention.
제1, 제2 등의 용어는 다양한 구성요소들을 설명하는데 사용될 수 있지만, 상기 구성요소들은 상기 용어들에 의해 한정되어서는 안 된다. 상기 용어들은 하나의 구성요소를 다른 구성요소로부터 구별하는 목적으로 사용될 수 있다. 예를 들어, 본 발명의 권리 범위로부터 이탈되지 않은 채 제1 구성요소는 제2 구성요소로 명명될 수 있고, 유사하게 제2 구성요소도 제1 구성요소로 명명될 수 있다.Terms such as first, second, etc. may be used to describe various elements, but the elements should not be limited by the terms. The above terms may be used for the purpose of distinguishing one component from another. For example, without departing from the scope of the present invention, a first component may be referred to as a second component, and similarly, a second component may also be referred to as a first component.
어떤 구성요소가 다른 구성요소에 "연결되어" 있다거나 "접속되어" 있다고 언급된 때에는, 그 다른 구성요소에 직접적으로 연결되어 있거나 또는 접속되어 있을 수도 있지만, 중간에 다른 구성요소가 존재할 수도 있다고 이해되어야 할 것이다. 반면에, 어떤 구성요소가 다른 구성요소에 "직접 연결되어" 있다거나 "직접 접속되어" 있다고 언급된 때에는, 중간에 다른 구성요소가 존재하지 않는 것으로 이해되어야 할 것이다. 구성요소들 간의 관계를 설명하는 다른 표현들, 즉 "~사이에"와 "바로 ~사이에" 또는 "~에 이웃하는"과 "~에 직접 이웃하는" 등도 마찬가지로 해석되어야 한다.When a component is referred to as being “connected” or “connected” to another component, it may be directly connected or connected to the other component, but it is understood that other components may exist in between. it should be On the other hand, when it is said that a certain element is "directly connected" or "directly connected" to another element, it should be understood that the other element does not exist in the middle. Other expressions describing the relationship between elements, such as "between" and "immediately between" or "neighboring to" and "directly adjacent to", etc., should be interpreted similarly.
본 출원에서 사용한 용어는 단지 특정한 실시예를 설명하기 위해 사용된 것으로, 본 발명을 한정하려는 의도가 아니다. 단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함한다. 본 출원에서, "포함하다" 또는 "가지다" 등의 용어는 설명된 특징, 숫자, 단계, 동작, 구성요소, 부분품 또는 이들을 조합한 것이 존재함을 지정하려는 것이지, 하나 또는 그 이상의 다른 특징들이나 숫자, 단계, 동작, 구성요소, 부분품 또는 이들을 조합한 것들의 존재 또는 부가 가능성을 미리 배제하지 않는 것으로 이해되어야 한다.The terms used in the present application are only used to describe specific embodiments, and are not intended to limit the present invention. The singular expression includes the plural expression unless the context clearly dictates otherwise. In the present application, terms such as "comprise" or "have" are intended to designate that the described feature, number, step, operation, component, part, or combination thereof exists, and is intended to indicate that one or more other features or numbers are present. , it is to be understood that it does not preclude the possibility of the presence or addition of steps, operations, components, parts, or combinations thereof.
다르게 정의되지 않는 한, 기술적이거나 과학적인 용어를 포함해서 여기서 사용되는 모든 용어들은 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자에 의해 일반적으로 이해되는 것과 동일한 의미이다. 일반적으로 사용되는 사전에 정의되어 있는 것과 같은 용어들은 관련 기술의 문맥상 가지는 의미와 일치하는 의미인 것으로 해석되어야 하며, 본 출원에서 명백하게 정의하지 않는 한, 이상적이거나 과도하게 형식적인 의미로 해석되지 않는다.Unless defined otherwise, all terms used herein, including technical and scientific terms, have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. Terms such as those defined in commonly used dictionaries should be interpreted as having meanings consistent with the context of the related art, and unless explicitly defined in the present application, they are not to be interpreted in an ideal or excessively formal meaning. .
본 발명에서, 벡터를 편의상 열벡터로 표현하여 행렬 연산에 관한 실시예들을 설명하고 있으나 벡터의 표현을 열벡터로 한정하는 것은 아니다. 행벡터가 열벡터의 전치 행렬임을 감안하면, 벡터를 행벡터로 표현하여도 해당하는 행렬 연산에 관한 실시예를 쉽게 구성하고 설명할 수 있다.In the present invention, embodiments related to matrix operations are described by expressing vectors as column vectors for convenience, but the expression of vectors is not limited to column vectors. Considering that a row vector is a transpose matrix of a column vector, even if a vector is expressed as a row vector, an embodiment related to a corresponding matrix operation can be easily constructed and described.
이하, 첨부한 도면들을 참조하여, 본 발명의 바람직한 실시예를 보다 상세하게 설명하고자 한다. 도면상의 동일한 구성요소에 대해서는 동일한 참조부호를 사용하고 동일한 구성요소에 대해서 중복된 설명은 생략한다.Hereinafter, preferred embodiments of the present invention will be described in more detail with reference to the accompanying drawings. The same reference numerals are used for the same components in the drawings, and repeated descriptions of the same components are omitted.
도 2a는 본 발명의 실시예들에 따른 행렬 연산을 수행하는 일 예를 나타내는 도면이다.2A is a diagram illustrating an example of performing a matrix operation according to embodiments of the present invention.
도 2a를 참조하면, 도 1a를 참조하여 상술한 것과 유사하게, 원소들(a11, a12, ..., a1m, a21, a22, ..., a2m, ..., an1, an2, ..., anm)을 포함하는 n*m(n, m은 각각 2 이상의 자연수) 차원의 행렬과 성분들(x1, x2, ..., xm)을 포함하는 m 차원의 입력 벡터의 곱셈에 의하여 성분들(y1, y2, ..., yn)을 포함하는 n 차원의 출력 벡터가 획득된다. 다만, 도 1a를 참조하여 상술한 것과 다르게, 도 2a에서는 상기 입력 벡터의 개별 성분을 기준으로 하여 상기 출력 벡터의 각 성분에 기여하는 값을 계산한 후 이를 누적하여 상기 출력 벡터의 각 성분을 구한다. 도 2a에 도시된 입력 벡터 기준 방식을 적용하는 경우에, 도 2b를 참조하여 후술하는 것처럼 복수의 MAC들의 입력 단자들 중 하나를 공통으로 묶을 수 있다.Referring to FIG. 2A , similar to that described above with reference to FIG. 1A , elements a 11 , a 12 , ..., a 1m , a 21 , a 22 , ..., a 2m , ..., n*m (n, m are each a natural number greater than or equal to 2) dimensional matrix containing a n1 , a n2 , ..., a nm ) and components (x 1 , x 2 , ..., x m ) An n-dimensional output vector including the components (y 1 , y 2 , ..., y n ) is obtained by multiplication of the containing m-dimensional input vector. However, unlike the one described above with reference to FIG. 1A, in FIG. 2A, values contributing to each component of the output vector are calculated based on individual components of the input vector, and then accumulated to obtain each component of the output vector. . When the input vector reference method shown in FIG. 2A is applied, one of the input terminals of the plurality of MACs may be commonly bundled as will be described later with reference to FIG. 2B.
도 2b는 도 2a의 행렬 연산을 수행하는 본 발명의 실시예들에 따른 연산 장치를 나타내는 블록도이다.FIG. 2B is a block diagram illustrating an operation device according to embodiments of the present invention that performs the matrix operation of FIG. 2A.
도 2b를 참조하면, 연산 장치(100)는 복수의 MAC(multiplier-and-accumulator)들(2001, 2002, ..., 200k)(k는 2 이상의 자연수)을 포함한다. 복수의 MAC들(2001~200k) 각각은 복수의 곱셈기들(2101, 2102, ..., 210k) 중 하나 및 복수의 누산기들(2301, 2302, ..., 230k) 중 하나를 포함한다.Referring to FIG. 2B , the
복수의 곱셈기들(2101~210k) 각각은 제1 입력(IN1) 및 복수의 제2 입력들(IN21, IN22, ..., IN2k) 중 하나를 수신하며, 두 개의 입력을 곱하여 출력한다. 예를 들어, 제1 입력(IN1)은 도 2a의 상기 입력 벡터의 성분들(x1, x2, ..., xm)이고, 복수의 제2 입력들(IN21~IN2k) 각각은 도 2a의 상기 행렬의 원소들(a11, a12, ..., a1m, a21, a22, ..., a2m, ..., an1, an2, ..., anm) 중 동일한 열에 배치되는 원소들일 수 있다.Each of the plurality of
복수의 누산기들(2301~230k) 각각은 복수의 곱셈기들(2101~210k) 중 하나와 연결되며, 복수의 곱셈기들(2101~210k) 중 하나의 출력을 누산하여 복수의 출력들(OUT1, OUT2, ..., OUTk) 중 하나를 발생한다.Each of the plurality of
복수의 누산기들(2301~230k) 각각은 복수의 가산기들(2501, 2502, ..., 250k) 중 하나 및 복수의 누적레지스터들(2701, 2702, ..., 270k) 중 하나를 포함한다. 복수의 가산기들(2501~250k) 각각은 복수의 곱셈기들(2101~210k) 중 하나의 출력 및 복수의 누적레지스터들(2701~270k) 중 하나의 출력을 더하여 출력한다. 복수의 누적레지스터들(2701~270k) 각각은 복수의 가산기들(2501~250k) 중 하나의 출력을 저장하고 최종적으로 복수의 출력들(OUT1~OUTk) 중 하나를 발생한다.Each of the plurality of
일 실시예에서, MAC(2001)의 제1 입력(IN1) 및 제2 입력(IN21)은 상기 입력 벡터의 성분들(x1, x2, ..., xm) 및 상기 행렬의 원소들(a11, a12, ..., a1m)을 순차적으로 수신하며, MAC(2001)의 출력(OUT1)은 상기 출력 벡터의 성분(y1), 즉 a11*x1+a12*x2+...+a1m*xm에 대응할 수 있다. 예를 들어, 최초 동작 시에 MAC(2001)의 제1 입력(IN1) 및 제2 입력(IN21)에는 각각 x1 및 a11이 입력되고, 이에 대한 곱셈, 덧셈 및 누적을 수행하여 누적레지스터(2701)에 a11*x1이 저장될 수 있다. 이후에, MAC(2001)의 제1 입력(IN1) 및 제2 입력(IN21)에는 각각 x2 및 a12가 입력되고, 이에 대한 곱셈, 덧셈 및 누적을 수행하여 누적레지스터(2701)에 a11*x1+a12*x2가 저장될 수 있다. 이러한 방식으로, 최종적으로 누적레지스터(2701)에 a11*x1+a12*x2+...+a1m*xm이 저장되고 출력될 수 있다. 이와 유사하게, MAC(2002)의 출력(OUT2)은 상기 출력 벡터의 성분(y2), 즉 a21*x1+a22*x2+...+a2m*xm에 대응할 수 있다.In one embodiment, the first input IN1 and the second input IN21 of the
도 2a에 도시된 입력 벡터 기준 방식을 적용하는 경우에, 도 2b에 도시된 것과 같이 복수의 MAC들(2001~200k)을 사용하여 병렬처리 할 때 복수의 MAC들(2001~200k)에 가해지는 상기 입력 벡터의 성분이 모두 같으므로, 복수의 MAC들(2001~200k)의 입력 단자들 중 하나를 공통으로 묶을 수 있다. 예를 들어, 상기 입력 벡터의 성분들(x1, x2, ..., xm)을 제1 입력(IN1)으로서 수신하는 복수의 MAC들(2001~200k)의 제1 입력 단자들을 공통으로 연결하여 하나의 입력 단자로 사용할 수 있다.In the case of applying the input vector reference method shown in FIG. 2A, as shown in FIG. 2B, when parallel processing is performed using a plurality of
본 발명의 실시예들에 따른 연산 장치(100)에서는, 상술한 것처럼 복수의 MAC들(2001~200k)의 상기 제1 입력 단자들을 공통으로 연결함으로써, 상기 입력 벡터의 성분이 복수의 MAC들(2001~200k)의 입력으로 가해지는 횟수를 줄일 수 있다. 구체적으로, 도 2b의 본 발명의 실시예들에 따른 연산 장치(100)는 k개의 MAC들(2001~200k)을 포함하는 경우에 (k+1)개의 입력을 수신할 수 있다. 따라서, 도 1b의 종래의 연산 장치(10)와 비교하였을 때, 메모리 및 버스 대역폭 사용이 감소하고, 결과적으로 기존 방식에 비해 성능 및 전력 소모 관점에서 유리하게 된다.In the
도 3a는 본 발명의 실시예들에 따른 연산 장치를 나타내는 블록도이다.3A is a block diagram illustrating a computing device according to embodiments of the present invention.
도 3a를 참조하면, 연산 장치(300)는 복수의 누적연산기들(4001, 4002, ..., 400k)(k는 2 이상의 자연수)을 포함한다. 복수의 누적연산기들(4001~400k) 각각은 복수의 제1 연산기들(4101, 4102, ..., 410k) 중 하나 및 복수의 누산기들(4301, 4302, ..., 430k) 중 하나를 포함한다.Referring to FIG. 3A , the
복수의 제1 연산기들(4101~410k) 각각은 제1 입력(IN1) 및 복수의 제2 입력들(IN21, IN22, ..., IN2k) 중 하나를 수신하며, 두 개의 입력에 대한 제1 연산을 수행하여 출력한다. 예를 들어, 제1 입력(IN1)은 도 2a의 상기 입력 벡터의 성분들(x1, x2, ..., xm)이고, 복수의 제2 입력들(IN21~IN2k) 각각은 도 2a의 상기 행렬의 원소들(a11, a12, ..., a1m, a21, a22, ..., a2m, ..., an1, an2, ..., anm) 중 동일한 열에 배치되는 원소들일 수 있다.Each of the plurality of
복수의 누산기들(4301~430k) 각각은 복수의 제1 연산기들(4101~410k) 중 하나와 연결되며, 복수의 제1 연산기들(4101~410k) 중 하나의 출력을 누산하여 복수의 출력들(OUT1, OUT2, ..., OUTk) 중 하나를 발생한다.Each of the plurality of
복수의 누산기들(4301~430k) 각각은 복수의 제2 연산기들(4501, 4502, ..., 450k) 중 하나 및 복수의 누적레지스터들(4701, 4702, ..., 470k) 중 하나를 포함한다. 복수의 제2 연산기들(4501~450k) 각각은 복수의 제1 연산기들(4101~410k) 중 하나의 출력 및 복수의 누적레지스터들(4701~470k) 중 하나의 출력에 대한 제2 연산을 수행하여 출력한다. 복수의 누적레지스터들(4701~470k) 각각은 복수의 제2 연산기들(4501~450k) 중 하나의 출력을 저장하고 최종적으로 복수의 출력들(OUT1~OUTk) 중 하나를 발생한다.Each of the plurality of
도 2a에 도시된 입력 벡터 기준 방식을 적용하는 경우에, 도 3a에 도시된 것과 같이 복수의 누적연산기들(4001~400k)을 사용하여 병렬처리 할 때 복수의 누적연산기들(4001~400k)에 가해지는 상기 입력 벡터의 성분이 모두 같으므로, 복수의 누적연산기들(4001~400k)의 입력 단자들 중 하나를 공통으로 묶을 수 있다. 예를 들어, 상기 입력 벡터의 성분들(x1, x2, ..., xm)을 제1 입력(IN1)으로서 수신하는 복수의 누적연산기들(4001~400k)의 제1 입력 단자들을 공통으로 연결하여 하나의 입력 단자로 사용할 수 있다.In the case of applying the input vector reference method shown in FIG. 2A, when parallel processing is performed using a plurality of
본 발명의 실시예들에 따른 연산 장치(300)에서는, 상술한 것처럼 복수의 누적연산기들(4001~400k)의 상기 제1 입력 단자들을 공통으로 연결함으로써, 상기 입력 벡터의 성분이 복수의 누적연산기들(4001~400k)의 입력으로 가해지는 횟수를 줄일 수 있다. 구체적으로, 도 3a의 본 발명의 실시예들에 따른 연산 장치(300)는 k개의 누적연산기들(4001~400k)을 포함하는 경우에 (k+1)개의 입력을 수신할 수 있다. 따라서, 메모리 및 버스 대역폭 사용이 감소하고, 결과적으로 성능 및 전력 소모 관점에서 유리하게 된다.In the
도 3a의 연산 장치(300)는 도 2b의 연산 장치(100)의 복수의 곱셈기들(2101~210k) 및 복수의 가산기들(2501~250k)을 각각 복수의 제1 연산기들(4101~410k) 및 복수의 제2 연산기들(4501~450k)로 일반화한 경우를 나타내고 있다.The
도 3a의 복수의 누적연산기들(4001, 4002, ..., 400k)은 디지털 회로 또는 아날로그 회로로 구현될 수 있다. 예를 들어, 복수의 누산기들(4301, 4302, ..., 430k)은 아날로그 적분 회로로 구현될 수 있다.The plurality of
일 실시예에서, 도 3a의 복수의 제1 연산기들(4101~410k) 각각을 곱셈기로 구현하고 복수의 제2 연산기들(4501~450k) 각각은 가산기로 구현하는 경우에, 도 3a의 연산 장치(300)는 도 2b에 도시된 것처럼 통상의 행렬과 입력 벡터의 곱셈을 수행할 수 있다.In one embodiment, when each of the plurality of
일 실시예에서, 도 3a의 복수의 누적연산기들(4001~400k) 각각의 2개의 입력들 중 어느 하나가 0 또는 1의 값을 가지는 이진 값인 경우에, 도 3a의 복수의 제1 연산기들(4101~410k) 각각은 상기 이진 값에 따라 온-오프 동작을 하는 게이팅 회로로 구현되어 곱셈을 수행할 수 있다. 예를 들어, 어느 하나의 입력(예를 들어, 제1 입력(IN1))이 0인 경우에, 복수의 제1 연산기들(4101~410k) 각각은 0의 값을 출력할 수 있고, 어느 하나의 입력(예를 들어, 제1 입력(IN1))이 1인 경우에, 복수의 제1 연산기들(4101~410k) 각각은 다른 하나의 입력(예를 들어, 복수의 제2 입력들(IN21~IN2k) 중 하나)을 그대로 출력할 수 있다.In one embodiment, when any one of two inputs of each of the plurality of
일 실시예에서, 도 3a의 복수의 누적연산기들(4001~400k) 각각의 2개의 입력들 중 어느 하나가 이진 정수 값(또는 이진법으로 표현된 정수 값)이고 다른 하나가 정수 지수를 갖는 2의 거듭제곱 값인 경우에, 도 3a의 복수의 제1 연산기들(4101~410k) 각각은 상기 정수 입력을 상기 정수 지수만큼 쉬프트 시킨 정수 값을 출력하는 회로로 구현되어 상기 제1 연산(예를 들어, 곱셈)을 수행할 수 있다. 예를 들어, 어느 하나의 입력(예를 들어, 제1 입력(IN1))이 6(즉, 이진수 1010)이고 다른 하나의 입력(예를 들어, 복수의 제2 입력들(IN21~IN2k) 중 하나)이 22인 경우에, 복수의 제1 연산기들(4101~410k) 각각은 1010을 2만큼 쉬프트 시킨 101000을 출력할 수 있다. 이 때, 상기 정수 지수를 갖는 상기 2의 거듭제곱 값 대신 상기 정수 지수만을 입력으로 받으면 데이터 사이즈가 작아져서 필요 메모리 사이즈를 줄이고 메모리 및 버스 대역폭 사용을 절약할 수 있다.In one embodiment, one of the two inputs of each of the plurality of
상기 실시예는 입력 데이터 형식이 n진법(n은 2 이상의 자연수)으로 표현한 데이터 형식인 경우로 확장될 수 있다. 즉, 도 3a의 복수의 누적연산기들(4001~400k) 각각의 2개의 입력들 중 어느 하나가 n진 정수 값(또는 n진법으로 표현된 정수 값)이고 다른 하나가 정수 지수를 갖는 n의 거듭제곱 값인 경우에, 도 3a의 복수의 제1 연산기들(4101~410k) 각각은 상기 n진 정수 입력을 상기 정수 지수만큼 쉬프트 시킨 정수 값을 출력하는 회로로 구현되어 상기 제1 연산(예를 들어, 곱셈)을 수행할 수 있다.The above embodiment can be extended to a case where the input data format is a data format expressed in base n (n is a natural number equal to or greater than 2). That is, one of two inputs of each of the plurality of
일 실시예에서, 도 3a의 복수의 누적연산기들(4001~400k) 각각의 2개의 입력들 중 어느 하나가 이진 부동소수점 값(또는 밑이 2이고 지수와 가수가 이진법으로 표현된 부동소수점 값)이고 다른 하나가 정수 지수를 갖는 2의 거듭제곱 값인 경우에, 도 3a의 복수의 제1 연산기들(4101~410k) 각각은 지수끼리 더해지고 가수는 상기 이진 부동소수점 입력의 가수를 그대로 유지시킨 이진 부동소수점 값을 출력하는 회로로 구현되어 상기 제1 연산(예를 들어, 곱셈)을 수행할 수 있다. 이 때, 상기 정수 지수를 갖는 상기 2의 거듭제곱 값 대신 상기 정수 지수만을 입력으로 받으면 데이터 사이즈가 작아져서 필요 메모리 사이즈를 줄이고 메모리 및 버스 대역폭 사용을 절약할 수 있다.In one embodiment, any one of the two inputs of each of the plurality of
상기 실시예는 입력 데이터 형식이 n진법(n은 2 이상의 자연수)으로 표현된 데이터 형식인 경우로 확장될 수 있다. 즉, 도 3a의 복수의 누적연산기들(4001~400k) 각각의 2개의 입력들 중 어느 하나가 n진 부동소수점 값(또는 밑이 n이고 지수와 가수가 n진법으로 표현된 부동소수점 값)이고 다른 하나가 정수 지수를 갖는 n의 거듭제곱 값인 경우에, 도 3a의 복수의 제1 연산기들(4101~410k) 각각은 지수끼리 더해지고 가수는 상기 n진 부동소수점 입력의 가수를 그대로 유지시킨 n진 부동소수점 값을 출력하는 회로로 구현되어 상기 제1 연산(예를 들어, 곱셈)을 수행할 수 있다.The above embodiment can be extended to a case in which the input data format is a data format expressed in base n (n is a natural number equal to or greater than 2). That is, any one of the two inputs of each of the plurality of
일 실시예에서, 도 3a의 복수의 제1 연산기들(4101~410k) 각각의 2개의 입력들 중 어느 하나(예를 들어, 상기 입력 벡터의 성분을 수신하는 제1 입력(IN1))를 1로 고정시켜서 복수의 제1 연산기들(4101~410k)을 바이패스(bypass) 시키고, 복수의 제2 연산기들(4501~450k) 각각은 복수의 제1 연산기들(4101~410k) 각각에 의해 바이패스된 값을 누적 레지스터의 값과 비교하여 둘 중 큰 값을 출력하는 비교기로 구현하는 경우에, 복수의 누적연산기들(4001~400k) 각각은 2개의 입력들 중 다른 하나(예를 들어, 복수의 제2 입력들(IN21~IN2k) 중 하나)로 주어지는 상기 행렬의 원소들 중 최대값을 출력하는 최대 풀링(max pooling) 연산을 수행할 수 있다. 상기 비교기는 감산기와 멀티플렉서로 구성되므로, 가산기에 약간의 회로 추가로 구현할 수 있다.In one embodiment, any one of two inputs of each of the plurality of
도 3b는 도 3a의 연산 장치에 포함되는 누적연산기의 다른 예를 나타내는 블록도이다.3B is a block diagram illustrating another example of an accumulator included in the computing device of FIG. 3A .
도 3b를 참조하면, 누적연산기(402)는 제1 연산기(412) 및 누산기(432)를 포함하며, 누산기(432)는 제2 연산기(452), 누적레지스터(472a) 및 적어도 하나의 쉐도우(shadow) 레지스터(472b)를 포함한다.3B, the
쉐도우 레지스터(472b)를 더 포함하는 것을 제외하면, 도 3b의 누적연산기(402)는 도 3a의 복수의 누적연산기들(4001~400k)과 실질적으로 동일할 수 있다. 도 3b의 제1 연산기(412), 누산기(432), 제2 연산기(452), 누적레지스터(472a), 제1 입력(IN1), 제2 입력(IN2) 및 출력(OUT)은 각각 도 3a의 복수의 제1 연산기들(4101~410k), 복수의 누산기들(4301~430k), 복수의 제2 연산기들(4501~450k), 복수의 누적레지스터들(4701~470k), 제1 입력(IN1), 복수의 제2 입력들(IN21~IN2k) 및 복수의 출력들(OUT1~OUTk)에 대응할 수 있다.Except for further including the
쉐도우 레지스터(472b)는 누적레지스터(472a)의 값(예를 들어, 상기 누적 결과)을 임시로 저장할 수 있다. 또한, 쉐도우 레지스터(472b)에 저장된 값을 누적레지스터(472a)에 써 넣을 수 있다. 편의상 도 3b에서는 하나의 쉐도우 레지스터(472b)만을 도시하였으나, 쉐도우 레지스터(472b)의 개수는 실시예에 따라서 다양하게 변경될 수 있다.The
도 3c는 도 3a의 연산 장치(300)를 확장하여 복수의 입력 벡터들을 병렬로 처리함으로써 연산 수행 시간을 단축하는 예를 나타내는 블록도이다.FIG. 3C is a block diagram illustrating an example of shortening the calculation execution time by extending the
도 3c를 참조하면, 연산 장치(500)는 복수의 누적연산기들(5011, 5021. , 50kq)(k, q는 각각 2 이상의 자연수)을 포함하며, 각 누적연산기들은 복수의 제1 입력들(IN11, IN12, ..., IN1q) 중 하나 및 복수의 제2 입력들(IN21, IN22, ..., IN2k) 중 하나를 수신하고 복수의 출력들(OUT11, OUT21, ..., OUTkq) 중 하나를 발생하며 연산기그룹들(5001, 5002, , 500q) 중 하나에 속하고 교차연산기그룹들(5010, 5020, , 50k0) 중 하나에 속한다. 하나의 연산기그룹에 속하는 누적연산기들은 제1 입력 단자들이 하나로 연결되어 있어서 제1 입력을 공통으로 수신한다. 하나의 교차연산기그룹에 속하는 누적연산기들은 서로 다른 연산기그룹에 속하며 제2 입력 단자들이 하나로 연결되어 있어서 제2 입력을 공통으로 수신한다. 상기 연산기그룹 각각은 도 3a의 연산 장치(300)에 해당한다.Referring to FIG. 3C , the
하나의 행렬과 복수의 입력 벡터들이 주어졌을 때 도 3a의 연산 장치(300)를 반복적으로 사용하여 상기 행렬과 각각의 입력 벡터에 관한 행렬 연산을 순차적으로 수행하고 해당하는 출력 벡터들을 순차적으로 구할 수 있지만, 도 3c와 같이 상기 연산 장치(300) 또는 연산기그룹(5001, 5002, , 500q)을 여러 개 사용하여 상기 복수의 입력 벡터들에 일대일로 대응하도록 하고 상기 행렬 연산을 병렬로 수행하면 상기 행렬 연산 수행에 필요한 시간을 단축할 수 있다. 이때, 상기 행렬 연산에 사용되는 행렬이 동일하므로 각 연산기그룹에 인가되는 행렬의 원소들이 동일할 수 있으며, 특히 각각의 교차연산기그룹에 속하는 누적연산기들의 제2 입력이 같을 수 있고 따라서 하나의 교차연산기그룹에 속하는 누적연산기들의 제2 입력 단자들을 하나로 연결하고 제2 입력을 공통으로 수신할 수 있다.When one matrix and a plurality of input vectors are given, the matrix operation on the matrix and each input vector can be sequentially performed by repeatedly using the
상기 복수의 입력 벡터들 각각을 열벡터로 갖는 입력 행렬을 만들면 상기 행렬 연산은 상기 행렬과 상기 입력 행렬에 관한 행렬 연산과 본질적으로 동일하다. 따라서 행렬과 행렬의 연산을 도 3a의 연산 장치(300) 또는 도 3c의 연산 장치(500)를 사용하여 수행할 수 있다.When an input matrix having each of the plurality of input vectors as a column vector is created, the matrix operation is essentially the same as the matrix operation on the matrix and the input matrix. Accordingly, the matrix and the operation of the matrix may be performed using the calculating
도 4a 및 4b는 도 3a의 연산 장치에 포함되는 누적연산기의 또 다른 예를 나타내는 블록도들이다.4A and 4B are block diagrams illustrating another example of an accumulator included in the computing device of FIG. 3A.
도 4a를 참조하면, 누적연산기(404)는 제1 연산기(414), 누산기(434) 및 멀티플렉서(494)를 포함하며, 누산기(434)는 제2 연산기(454) 및 누적레지스터(474)를 포함한다.Referring to FIG. 4A , the
멀티플렉서(494)를 더 포함하는 것을 제외하면, 도 4a의 누적연산기(404)는 도 3a의 복수의 누적연산기들(4001~400k)과 실질적으로 동일할 수 있다. 도 4a의 제1 연산기(414), 누산기(434), 제2 연산기(454), 누적레지스터(474), 제1 입력(IN1), 제2 입력(IN2) 및 출력(OUT)은 각각 도 3a의 복수의 제1 연산기들(4101~410k), 복수의 누산기들(4301~430k), 복수의 제2 연산기들(4501~450k), 복수의 누적레지스터들(4701~470k), 제1 입력(IN1), 복수의 제2 입력들(IN21~IN2k) 및 복수의 출력들(OUT1~OUTk)에 대응할 수 있다.Except for further including a
멀티플렉서(494)는 보조 입력(AIN1)을 수신하는 보조 입력 단자, 및 제1 입력(IN1)을 수신하는 상기 제1 입력 단자와 연결되고, 선택 신호(SS1)에 기초하여 보조 입력(AIN1) 및 제1 입력(IN1) 중 하나를 선택하여 제1 연산기(414)에 제공할 수 있다. 또한, 멀티플렉서(494)는 보조 입력(AIN1) 및 제1 입력(IN1) 중 선택된 하나를 보조 출력(AOUT1)으로 제공할 수 있다. 보조 출력(AOUT1)은 인접한 누적연산기에 포함되는 멀티플렉서의 보조 입력으로 이용될 수 있다.The
다시 말하면, 도 4a의 누적연산기(404)는 제1 연산기(414)의 상기 제1 입력 단자에 멀티플렉서(494)를 추가하여 보조 입력(AIN1)을 선택할 수 있고, 멀티플렉서(494)의 출력을 보조 출력(AOUT1)으로 출력할 수 있다. 이러한 누적연산기(404)를 복수 개 사용하여 병렬처리 할 때 상기 보조 입력 단자를 통하여 인접한 누적연산기의 보조 출력을 보조 입력으로 수신할 수 있으므로, 필요한 개수의 누적연산기의 입력 단자를 공통으로 묶어 사용할 수 있고, 행렬과 입력 벡터의 곱셈을 위해 누적연산기를 할당할 때 자유도가 증가할 수 있다.In other words, the
도 4b를 참조하면, 복수의 누적연산기들(4041, 4042, ..., 404s)(s는 2 이상의 자연수) 각각은 복수의 제1 연산기들(4141, 4142, ..., 414s) 중 하나 및 복수의 누산기들(4341, 4342, ..., 434s) 중 하나를 포함한다. 복수의 누산기들(4341~434s) 각각은 복수의 제2 연산기들(4541, 4542, ..., 454s) 중 하나 및 복수의 누적레지스터들(4741, 4742, ..., 474s) 중 하나를 포함한다. 누적연산기(4041)는 멀티플렉서(494)를 더 포함할 수 있다.Referring to FIG. 4B , each of the plurality of
누적연산기(4041)가 멀티플렉서(494)를 더 포함하는 것을 제외하면, 도 4b의 복수의 누적연산기들(4041~404s)은 도 3a의 복수의 누적연산기들(4001~400k)과 실질적으로 동일할 수 있다. 도 4b의 복수의 제1 연산기들(4141~414s), 복수의 누산기들(4341~434s), 복수의 제2 연산기들(4541~454s), 복수의 누적레지스터들(4741~474s), 제1 입력(IN1), 복수의 제2 입력들(IN21, IN22, ..., IN2s) 및 복수의 출력들(OUT1, OUT2, ..., OUTs)은 각각 도 3a의 복수의 제1 연산기들(4101~410k), 복수의 누산기들(4301~430k), 복수의 제2 연산기들(4501~450k), 복수의 누적레지스터들(4701~470k), 제1 입력(IN1), 복수의 제2 입력들(IN21~IN2k) 및 복수의 출력들(OUT1~OUTk)에 대응할 수 있다.Except that the
도 4b의 멀티플렉서(494)는 도 4a의 멀티플렉서(494)와 실질적으로 동일할 수 있다. 멀티플렉서(494)는 선택 신호(SS1)에 기초하여 보조 입력(AIN1) 및 제1 입력(IN1) 중 하나를 선택하여 보조 출력(AOUT1)으로 제공할 수 있다. 누적연산기들(4041~404s)은 멀티플렉서(494)를 공유할 수 있다. 복수의 제1 연산기들(4141~414s)은 멀티플렉서(494)에서 제공되는 보조 출력(AOUT1)을 수신함으로써 제1 입력(IN1)과 보조 입력(AIN1)을 선택하여 수신할 수 있다.The
다시 말하면, 도 4b에서는 복수의 누적연산기들(4041~404s)이 서로 공유하는(즉, 공통적으로 연결되는) 상기 제1 입력 단자에 멀티플렉서(494)를 추가하여 보조 입력(AIN1)을 선택할 수 있고 멀티플렉서(494)의 출력을 보조 출력(AOUT1)으로 출력할 수 있다. 도 4a와 비교하였을 때 누적연산기 할당의 자유도는 떨어지지만 멀티플렉서의 개수가 줄어서 면적 관점에서 유리할 수 있다.In other words, in FIG. 4B, the auxiliary input AIN1 can be selected by adding a
한편 도시하지는 않았으나, s번째 누적연산기(404s) 이후의 (s+1)번째 누적연산기는 누적연산기(4041)와 유사하게 멀티플렉서를 포함할 수 있고, 상기 (s+1)번째 누적연산기부터 t(t는 s보다 큰 자연수)번째 누적연산기까지 (t-s)개의 누적연산기들은 상기 (s+1)번째 누적연산기에 포함된 상기 멀티플렉서를 공유할 수 있다. 실시예에 따라서, t는 2*s와 같을 수도 있고 다를 수도 있다.Meanwhile, although not shown, the (s+1)-th accumulator after the s-
도 5a, 5b, 5c, 5d 및 5e는 본 발명의 실시예들에 따른 연산 장치들을 이용하여 두 행렬의 합성곱 및 이를 응용한 연산을 수행하는 예들을 설명하기 위한 도면들이다.5A, 5B, 5C, 5D, and 5E are diagrams for explaining examples of performing a convolution of two matrices and an operation applying the same by using calculation devices according to embodiments of the present invention.
도 5a를 참조하면, 7*8 입력 행렬 X에 3*3 필터 행렬 W를 패딩(padding)은 없고 스트라이드(stride)는 1로 합성곱(convolution)을 수행하면 5*6 출력 행렬 Y를 획득할 수 있다. 합성곱을 수행하면서 출력 행렬 Y의 성분들을 차례로 계산하게 되는데, 이 때 입력 행렬 X의 각 원소가 여러 번씩 참조될 수 있다.Referring to FIG. 5A, if a 3*3 filter matrix W is convolved with no padding and a stride is 1 on a 7*8 input matrix X, a 5*6 output matrix Y can be obtained. can During convolution, the components of the output matrix Y are sequentially calculated. In this case, each element of the input matrix X may be referenced multiple times.
두 행렬 간의 합성곱을 행렬과 벡터 간의 곱셈으로 바꾸어 표현하기 위해 도 5b와 같이 입력 행렬 X와 출력 행렬 Y의 모양을 열벡터로 바꾸어 각각 입력 벡터 x와 출력 벡터 y를 획득할 수 있다. 이 때, xi, yi는 각각 입력 행렬 X와 출력 행렬 Y의 i번째 행의 원소들을 성분으로 갖는 입력 서브벡터 및 출력 서브벡터이다.In order to express the convolution between two matrices by changing the multiplication between the matrix and the vector, the shapes of the input matrix X and the output matrix Y are changed into column vectors to obtain an input vector x and an output vector y, respectively. In this case, xi and yi are an input subvector and an output subvector having elements of the i-th row of the input matrix X and the output matrix Y as components, respectively.
합성곱에 의해 획득하고자 하는 출력 벡터 y의 각 성분은 입력 벡터 x의 성분들의 일차결합으로 표시되므로, 입력 벡터 x를 출력 벡터 y로 변환시켜주는 일차 변환이 있고 이는 도 5c의 합성곱 행렬 A와 같이 표현될 수 있다. 합성곱 행렬 A와 입력 벡터 x를 곱하여 출력 벡터 y를 구한 후 다시 모양을 행렬로 바꾸어 출력 행렬 Y를 구할 수 있다. 따라서 입력 행렬 X와 필터 행렬 W의 합성곱은 입력 벡터 x와 합성곱 행렬 A의 곱셈으로 바꾸어 도 3a의 연산 장치(300)를 이용하여 수행할 수 있다. 이 때 입력 벡터 기준 방식을 적용하여 입력 벡터 x의 각 성분이 한 번씩만 참조될 수 있다.Since each component of the output vector y to be obtained by convolution is expressed as a linear combination of the components of the input vector x, there is a linear transformation that transforms the input vector x into the output vector y, which is can be expressed together. The output vector y is obtained by multiplying the convolution matrix A by the input vector x, and then the output matrix Y can be obtained by changing the shape to a matrix again. Accordingly, the convolution of the input matrix X and the filter matrix W can be performed using the
상기 입력 행렬과 출력 행렬의 모양을 행벡터로 바꾸어 입력 벡터와 출력 벡터를 획득하였다면 합성곱 행렬은 상기 행렬 A의 전치 행렬과 같이 표현될 수 있다.If the input and output vectors are obtained by changing the shapes of the input and output matrices into row vectors, the convolution matrix may be expressed as the transpose matrix of the matrix A.
크기가 같은 복수의 입력 행렬에 하나의 필터 행렬을 반복하여 합성곱하는 것은 상술한 것과 같이 복수의 입력 벡터에 하나의 합성곱 행렬을 반복하여 곱하는 것으로 대체할 수 있으며, 복수의 출력 행렬들 또는 복수의 출력 벡터들을 도 3c의 연산 장치(500)를 이용하여 병렬로 구할 수 있다.Repeated convolution of a plurality of input matrices with the same size can be replaced by repeatedly multiplying a plurality of input vectors with one convolution matrix as described above, and a plurality of output matrices or a plurality of output matrices The output vectors may be obtained in parallel using the
도 5d를 참조하면, 상기 출력 행렬 Y를 수직으로 나누어 복수의 분할된 출력 행렬 Y1과 Y2를 만들고, 상기 입력 행렬 X로부터 복수의 분할된 입력 행렬 X1과 X2를 만들어서 상기 필터 행렬 W와 각각 합성곱하여 Y1과 Y2를 얻도록 할 수 있다. 입력 행렬을 나눌 때 겹치는 영역이 발생하여 분할된 입력 행렬 X1과 X2의 원소의 개수의 합은 입력 행렬 X의 원소의 개수 보다 많게 될 수 있다. 반면에 상술한 것과 같이 상기 입력 행렬 X를 X1과 X2로 나누어 처리할 때 적용되는 분할된 합성곱 행렬 Ad의 원소의 개수는 상기 합성곱 행렬 A의 원소의 개수의 절반 보다 적게 될 수 있다.Referring to FIG. 5D , a plurality of divided output matrices Y 1 and Y 2 are generated by dividing the output matrix Y vertically, and a plurality of divided input matrices X 1 and X 2 are generated from the input matrix X to form the filter matrix W and Y can be convolved to obtain Y 1 and Y 2 respectively. When an input matrix is divided, an overlapping region is generated so that the sum of the number of elements of the divided input matrices X 1 and X 2 may be greater than the number of elements of the input matrix X . On the other hand, when processing the input matrix X by dividing the input matrix X into X 1 and X 2 as described above, the number of elements of the divided convolution matrix A d applied may be less than half the number of elements of the convolution matrix A. have.
마찬가지로 하나의 출력 행렬을 같은 크기의 블록으로 나누어 복수의 분할된 출력 행렬들을 만들고 상응하는 복수의 분할된 입력 행렬들을 만들 수 있으며, 이들을 벡터로 바꾸어서 복수의 분할된 출력 벡터들과 상응하는 복수의 분할된 입력 벡터들을 만들 수 있다. 상기 복수의 분할된 입력 행렬들의 크기가 같으므로 상기 복수의 분할된 입력 벡터에 곱해지는 분할된 합성곱 행렬이 동일할 수 있고 따라서 도 3c의 연산 장치(500)를 이용하여 상기 복수의 분할된 출력 벡터들을 병렬로 구할 수 있다.Similarly, one output matrix can be divided into blocks of the same size to form a plurality of partitioned output matrices, and a plurality of partitioned input matrices can be created. input vectors can be created. Since the plurality of partitioned input matrices have the same size, the partitioned convolution matrix multiplied by the plurality of partitioned input vectors may be the same. Vectors can be found in parallel.
상기 입력 행렬을 상기 복수의 분할된 입력 행렬로 나눌 때 서로 겹쳐지는 영역이 발생하며 이 영역에 속한 원소들은 도 3c의 연산 장치(500)에서 중복하여 수신하게 되는 단점이 있다. 반면에 도 3c의 연산 장치(500)에서 수신하는 상기 분할된 합성곱 행렬의 원소들의 개수가 적어지는 이점이 있고, 아울러 도 3c의 하나의 교차연산기그룹에 속하는 복수의 누적연산기들에서 상기 분할된 합성곱 행렬의 원소들을 공통으로 수신하게 되는 이점이 있다.When the input matrix is divided into the plurality of divided input matrices, regions overlapping each other occur, and elements belonging to this region are repeatedly received by the
도 5e를 참조하면, 상기 필터 행렬 W 외에 다른 필터 행렬 V가 주어져서 상기 입력 행렬 X와 합성곱하는 경우에 상기 필터 행렬 V에 상응하는 합성곱 행렬 Av를 상기 합성곱 행렬 A에 추가하여 확장된 합성곱 행렬 Ae를 만들고 상기 입력 벡터 x와 곱하여 확장된 출력 벡터 ye를 얻을 수 있다.5E, when a filter matrix V other than the filter matrix W is given and convolution is performed with the input matrix X, a convolution matrix A v corresponding to the filter matrix V is added to the convolution matrix A to expand the synthesis A product matrix A e can be created and multiplied by the input vector x to obtain an expanded output vector y e .
마찬가지로 하나의 입력 행렬에 복수의 필터 행렬을 각각 합성곱하는 경우에 각각의 합성곱 행렬로부터 확장된 합성곱 행렬을 만들고 도 3a의 연산 장치(300)를 이용하여 확장된 출력 벡터 또는 상기 복수의 필터 행렬에 상응하는 복수의 출력 벡터를 병렬로 구할 수 있다. 이 때 도 3a의 연산 장치(300)에서 상기 입력 행렬의 원소들을 한 번씩만 수신하게 되는 이점이 있다.Similarly, when a plurality of filter matrices are convolved to one input matrix, an extended convolution matrix is created from each convolution matrix, and an extended output vector or the plurality of filter matrices is generated using the
도 6a, 6b 및 6c는 본 발명의 실시예들에 따른 연산 장치를 이용하여 두 행렬의 합성곱을 수행하는 다른 예를 설명하기 위한 도면들이다.6A, 6B, and 6C are diagrams for explaining another example of performing a convolution of two matrices using an arithmetic device according to embodiments of the present invention.
도 5c의 합성곱 행렬 A는 0이 아닌 원소가 적은 희소 행렬이므로 메모리에 저장하거나 벡터와 곱할 때 시간과 자원의 낭비가 클 수 있다. 상기 합성곱 행렬 A의 구조를 보면, 영행렬이 아닌 부분행렬들이 주대각선 부근에 규칙적으로 배치되어 있고 상기 부분행렬들은 띠 행렬임을 알 수 있다. 이러한 합성곱 행렬 A의 구조적 특성은 필터 행렬의 크기, 패딩 및 스트라이드가 달라져도 유지되며, 이를 활용하여 도 6a, 6b 및 6c에서는 합성곱 행렬과 출력 벡터를 각각 패킹하여 효율적으로 합성곱을 수행하는 방법을 예시한다.Since the convolution matrix A of FIG. 5C is a sparse matrix with a small number of non-zero elements, time and resource waste may be large when stored in a memory or multiplied by a vector. Looking at the structure of the convolution matrix A, it can be seen that submatrices other than the zero matrix are regularly arranged near the main diagonal, and the submatrices are band matrices. The structural characteristics of the convolution matrix A are maintained even when the size, padding, and stride of the filter matrix are changed. exemplify
도 6a를 참조하면, 누적연산기를 사용하여 하나의 출력 서브벡터의 계산이 끝난 후 누적레지스터를 리셋하고, 다음 출력 서브벡터 계산을 위해 상기 누적연산기를 배정함으로써 패킹된 합성곱 행렬 Ap를 얻을 수 있다. 이 때, 패킹된 출력 서브벡터 표기, 예를 들어 y1|y4 는 출력 서브벡터 y1과 y4가 시분할을 통해 동일한 누적연산기들을 공유하여 구해지는 것을 의미한다. 즉, 출력 서브벡터 y1을 먼저 구한 후 동일한 누적연산기들을 사용하여 출력 서브벡터 y4를 구할 수 있다.Referring to FIG. 6A , a packed convolution matrix A p can be obtained by resetting the accumulator register after the calculation of one output subvector is finished using the accumulator and allocating the accumulator for the next output subvector calculation. have. In this case, the packed output subvector notation, for example, y 1 |y 4 means that the output subvectors y 1 and y 4 are obtained by sharing the same accumulators through time division. That is, after obtaining the output subvector y 1 first, the output subvector y 4 can be obtained using the same accumulators.
도 6b를 참조하면, 누적연산기를 사용하여 입력 행렬의 하나의 행에 대한 출력 벡터 성분의 계산이 끝난 후 누적레지스터 값을 임시로 저장하여 놓고, 다음 출력 벡터 성분 계산을 위해 상기 누적연산기를 배정함으로써 패킹된 합성곱 행렬 Ap를 얻을 수 있다. 다음 출력 벡터 성분 계산을 시작하기 전에 상기 누적레지스터를 리셋하거나 이전에 임시로 저장하여 놓은 값을 상기 누적레지스터에 써 넣을 수 있다. 이 때, 패킹된 출력 벡터의 성분 표기, 예를 들어 yi1|yi4 는 출력 벡터의 성분 yi1과 yi4가 시분할을 통해 동일한 누적연산기를 공유하여 구해지는 것을 의미한다. 즉, 입력 행렬의 하나의 행에 대해서 출력 벡터 성분 yi1을 위한 계산을 수행한 후 동일한 누적연산기를 사용하여 출력 벡터 성분 yi4를 위한 계산을 수행할 수 있다.Referring to FIG. 6B , after the calculation of the output vector component for one row of the input matrix is finished using the accumulator, the accumulator value is temporarily stored, and the accumulator is assigned to calculate the next output vector component. A packed convolution matrix A p can be obtained. Before starting the calculation of the next output vector component, the accumulation register may be reset or a previously temporarily stored value may be written into the accumulation register. In this case, the component notation of the packed output vector, for example, y i1 |y i4 , means that the components y i1 and y i4 of the output vector are obtained by sharing the same accumulator through time division. That is, after calculation for the output vector component y i1 is performed with respect to one row of the input matrix, the calculation for the output vector component y i4 may be performed using the same accumulator.
도 6c를 참조하면, 도 6a를 참조하여 상술한 합성곱 행렬 패킹 방식과 도 6b를 참조하여 상술한 합성곱 행렬 패킹 방식을 모두 사용하여 패킹된 합성곱 행렬 Ap를 얻을 수 있다.Referring to FIG. 6C , a packed convolution matrix A p may be obtained by using both the convolution matrix packing method described above with reference to FIG. 6A and the convolution matrix packing method described above with reference to FIG. 6B .
상기 합성곱 행렬과 패킹된 합성곱 행렬들은 구조적으로 명확해서 각 열을 상기 필터 행렬의 원소들을 이용하여 쉽게 구성할 수 있으며 특히 한 열을 적절히 쉬프트 시켜서 이전 열 또는 다음 열을 얻을 수 있다. 따라서 상기 필터 행렬의 원소들로부터 상기 합성곱 행렬 또는 패킹된 합성곱 행렬의 각 열을 생성해 내는 회로를 효율적으로 구현할 수 있다.The convolution matrix and the packed convolution matrices are structurally clear, so that each column can be easily constructed using the elements of the filter matrix. In particular, the previous column or the next column can be obtained by appropriately shifting one column. Accordingly, it is possible to efficiently implement a circuit for generating each column of the convolution matrix or the packed convolution matrix from the elements of the filter matrix.
도 7, 8 및 9는 행렬 연산을 효율적으로 수행하기 위해 본 발명의 실시예들에 따른 연산 장치를 포함하는 메모리 장치를 나타내는 블록도들이다.7, 8, and 9 are block diagrams illustrating a memory device including an arithmetic device according to embodiments of the present invention in order to efficiently perform a matrix operation.
도 7을 참조하면, 메모리 장치(1100)는 메모리 셀 어레이(1110), 행 디코더(1120), 열 디코더(1130), 게이팅 회로(1140), 입출력 데이터 구동 회로(1150), 연산 회로(1000), 및 입출력 버퍼(1010)를 포함한다.Referring to FIG. 7 , the
메모리 셀 어레이(1110)는 복수의 행들 및 복수의 열들을 형성하도록 배열되는 복수의 메모리 셀들을 포함한다. 예를 들어, 메모리 셀 어레이(1110)의 하나의 행은 한 페이지를 구성한다. 메모리 셀 어레이(1110)는 연산할 행렬의 원소들 또는 상기 행렬의 원소들을 생성하기 위한 행렬 생성 정보를 저장한다. 또한 메모리 셀 어레이(1110)는 연산할 입력 벡터의 성분들과 연산 결과로 얻어지는 출력 벡터의 성분들을 저장할 수 있으며 연산의 중간 결과로 얻어지는 출력 벡터 성분의 임시 값들을 저장할 수 있다. 상기 행렬의 원소들을 저장할 때, 입력 벡터 기준 방식 적용에 적합하도록 상기 입력 벡터의 한 성분과 연산되는 상기 행렬의 원소들이 최대한 메모리 셀의 같은 행에 저장 되도록 하며, 이를 위해 필요하면 상기 행렬을 전치하여 저장할 수 있다.The
행 디코더(1120)는 행 어드레스(RADDR)에 기초하여, 상기 복수의 행들 중 목표 메모리 셀을 포함하는 목표 행을 선택하기 위한 행 선택 신호(RSEL)를 발생한다.The
열 디코더(1130)는 열 어드레스(CADDR)에 기초하여, 상기 목표 행에 포함되는 열들 중 상기 목표 메모리 셀을 포함하는 목표 열을 선택하기 위한 열 선택 신호(CSEL)를 발생한다.The
게이팅 회로(1140)는 행 선택 신호(RSEL)에 기초하여 상기 목표 행과 연결된다. 또한, 게이팅 회로(1140)는 열 선택 신호(CSEL)에 기초하여 상기 목표 행에 포함된 상기 목표 열을 선택하여 입출력 데이터 구동 회로(1150) 또는 연산회로(1000)에 연결한다. 예를 들어, 게이팅 회로(1140)는 메모리 셀들을 감지하고 신호를 안정적으로 처리하기 위한 감지 증폭기를 더 포함할 수 있다.The
입출력 데이터 구동 회로(1150)는 상기 목표 열에 입력 데이터(DIN)를 기입하거나 상기 목표 열에 저장된 데이터를 출력 데이터(DOUT)로서 출력한다. 이 때, 데이터 마스크 신호(DMS)에 기초하여 원하지 않는 입력 데이터가 상기 목표 열에 기입되는 것을 방지한다. 예를 들어, 입출력 데이터 구동 회로(1150)는 입력 데이터 구동 회로 및 출력 데이터 구동 회로를 포함할 수 있다.The input/output
상기 목표 열은 열 선택 신호(CSEL)에 기초하여 게이팅 회로(1140)를 통해 입출력 데이터 구동 회로(1150)와 연결될 수 있다. 데이터 기입 동작에서, 상기 입력 데이터 구동 회로에서 수신된 입력 데이터(DIN)는 열 데이터(CDIN) 단위로 게이팅 회로(1140)에 제공되고, 상기 목표 열에 저장될 수 있다. 이 때, 데이터 마스크 신호(DMS)에 기초하여 원하지 않는 데이터가 메모리 셀 어레이(1110)에 저장되는 것을 방지할 수 있다. 데이터 독출 동작에서, 상기 목표 행에 저장된 페이지 데이터(또는 행 데이터)(RD)가 게이팅 회로(1140)에 제공되고, 상기 목표 행에 포함되는 상기 목표 열의 데이터가 열 데이터(CDOUT) 단위로 상기 출력 데이터 구동 회로에 제공되며, 출력 데이터(DOUT)로서 출력될 수 있다.The target column may be connected to the input/output
입출력 버퍼(1010)는 입출력 데이터 구동 회로(1150)와 연결되고, 입력 벡터 및 출력 벡터의 성분들을 저장한다. 예를 들어, 입출력 버퍼(1010)는 상기 입력 벡터의 성분들을 저장하는 입력 버퍼 및 상기 출력 벡터의 성분들을 저장하는 출력 버퍼를 포함할 수 있다. 메모리 장치 외부로부터 수신된 입력 벡터의 성분들이 입출력 데이터 구동 회로(1150)를 거쳐 입출력 버퍼(1010)에 기입될 수 있고, 메모리 셀 어레이(1110)에 저장되어 있는 입력 벡터의 성분들이 게이팅 회로(1140)와 입출력 데이터 구동 회로(1150)를 거쳐 입출력 버퍼(1010)에 기입될 수 있다. 입출력 버퍼(1010)에 저장된 출력 벡터 성분들은 입출력 데이터 구동 회로(1150)를 거쳐 메모리 장치 외부로 독출될 수 있고 입출력 데이터 구동 회로(1150)와 게이팅 회로(1140)를 거쳐 메모리 셀 어레이(1110)에 기입될 수 있다.The input/
연산 회로(1000)는 게이팅 회로(1140) 및 입출력 버퍼(1010)와 연결되고, 복수의 누적연산기들을 포함하며, 게이팅 회로(1140)를 통해 행렬의 원소들을 생성하기 위한 행렬 생성 정보(ASINF)를 제공 받아서 행렬의 원소들(AS)을 생성하는 행렬 원소 생성기를 포함할 수 있다. 예를 들어, 상기 행렬 원소 생성기는 상기 행렬 생성 정보(ASINF)로 행렬의 합성곱에 사용되는 필터 행렬의 원소들을 제공 받아서 합성곱 행렬 또는 패킹된 합성곱 행렬의 원소들을 생성할 수 있다. 입출력 버퍼(1010)로부터 제공되는 입력 벡터의 성분들(XS)과 게이팅 회로(1140) 또는 행렬 원소 생성기를 통해 제공되는 행렬의 원소들(AS)을 상기 누적연산기들에서 입력 벡터 기준 방식으로 연산하여 출력 벡터의 성분들(YS)을 획득하고 입출력 버퍼(1010)에 제공한다. 입출력 버퍼(1010)에 저장되는 입력 벡터 및 출력 벡터의 성분들의 데이터 형식 또는 게이팅 회로(1140)를 통해 제공되는 행렬의 원소들의 데이터 형식과 상기 누적연산기들의 입출력 데이터 형식이 다를 경우 필요한 형변환이 수행될 수 있다.The
상기 복수의 누적연산기들 각각은, 상기 입력 벡터의 성분들을 수신하는 제1 입력 단자, 및 상기 행렬의 원소들을 수신하는 제2 입력 단자를 포함하고, 상기 입력 벡터의 성분들과 상기 행렬의 원소들에 대한 누적 연산을 수행하여 상기 출력 벡터의 성분들 중 하나를 발생한다. 또한, 상기 복수의 누적연산기들의 일부 또는 전체는 상기 제1 입력 단자들이 하나로 연결되어 상기 입력 벡터의 성분들을 공통으로 수신하는 연산기그룹을 형성할 수 있으며, 상기 복수의 누적연산기들 각각 및 상기 연산기그룹은 도 2a, 2b, 3a, 3b, 4a 및 4b를 참조하여 상술한 것처럼 구현될 수 있다. 추가로, 상기 연산기그룹이 복수 개 있을 수 있고 각각의 연산기그룹은 서로 다른 입력 벡터의 성분들을 수신할 수 있으며, 서로 다른 연산기그룹에 속하는 누적연산기들은 제2 입력 단자들이 하나로 연결되어 상기 행렬의 원소들을 공통으로 수신하는 교차연산기그룹을 형성할 수 있고 도 3c를 참조하여 상술한 것처럼 구현될 수 있다.Each of the plurality of accumulators includes a first input terminal for receiving components of the input vector and a second input terminal for receiving elements of the matrix, wherein components of the input vector and elements of the matrix are An accumulation operation is performed on , to generate one of the components of the output vector. In addition, some or all of the plurality of accumulators may form an operator group in which the first input terminals are connected to one and receive components of the input vector in common, each of the plurality of accumulators and the operator group may be implemented as described above with reference to FIGS. 2A, 2B, 3A, 3B, 4A and 4B. In addition, there may be a plurality of operator groups, each operator group may receive different input vector components, and the accumulators belonging to different operator groups may have second input terminals connected to one another to form an element of the matrix It is possible to form a cross-operator group that commonly receives the values, and can be implemented as described above with reference to FIG. 3C.
상기 복수의 누적연산기들의 누적레지스터들 또는 쉐도우 레지스터들이 출력 벡터의 성분(YS)을 저장하는 출력 버퍼의 역할을 겸할 수 있다. 이러한 경우에 입출력 버퍼(1010)의 출력 버퍼는 생략될 수 있다.Accumulation registers or shadow registers of the plurality of accumulators may serve as an output buffer for storing the component YS of the output vector. In this case, the output buffer of the input/
상술한 것처럼, 상기 복수의 누적연산기들의 상기 제1 입력 단자들 또는 상기 제2 입력 단자들을 공통으로 연결함으로써, 상기 입력 벡터의 성분들 또는 상기 행렬의 원소들이 중복으로 인가되는 것을 피할 수 있고, 따라서 메모리 및 버스 대역폭 사용이 감소하고 성능 및 전력 소모 관점에서 유리하게 된다. 또한, 연산 회로(1000)는 게이팅 회로(1140)를 통해 메모리 셀 어레이(1110)에 저장된 행렬의 원소들(AS)을 수신하고, 입출력 버퍼(1010)와 입출력 데이터 구동 회로(1150) 및 게이팅 회로(1140)를 통해 메모리 셀 어레이(1110)에 저장된 입력 벡터의 성분들(XS)을 수신하고 출력 벡터의 성분들(YS)을 메모리 셀 어레이(1110)에 기입함으로써, 행렬 연산과 관련된 데이터들의 경로들을 메모리 장치 내부로 한정할 수 있고, 따라서 메모리 및 버스 대역폭 사용이 감소하고 성능 및 전력 소모 관점에서 유리하게 된다.As described above, by connecting the first input terminals or the second input terminals of the plurality of accumulators in common, it is possible to avoid duplicate application of the elements of the input vector or the elements of the matrix, thus Memory and bus bandwidth usage is reduced, which is advantageous in terms of performance and power consumption. In addition, the
구현상의 이유로 게이팅 회로(1140)를 통해 연산 회로(1000)에 제공되는 상기 행렬의 원소들(AS) 또는 상기 행렬 생성 정보(ASINF)가 입출력 데이터 구동 회로(1150)를 거쳐서 연산 회로(1000)에 제공될 수 있다.For implementation reasons, the elements AS or the matrix generation information ASINF provided to the
구현상의 이유로 상기 행렬 생성 정보가 별도의 메모리 장치에 저장되어 있을 수 있으며, 이 경우에 상기 행렬 생성 정보는 입출력 데이터 구동 회로(1150)를 거쳐서 연산 회로(1000)에 제공될 수 있다.For implementation reasons, the matrix generation information may be stored in a separate memory device. In this case, the matrix generation information may be provided to the
구현상의 이유로 연산 회로(1000) 및 입출력 버퍼(1010)가 별도의 칩에 구현될 수 있다. 이 경우에 두 칩의 연결을 위해 게이팅 회로(1140)와 연산 회로(1000) 사이 및 입출력 데이터 구동 회로(1150)와 입출력 버퍼(1010) 사이에 적절한 입출력 데이터 구동 회로가 삽입될 수 있다.For implementation reasons, the
인공신경망 회로에서 한 층의 출력들은 입력들에 가중치들을 곱하는 행렬 연산 후 활성화 함수를 적용하여 구해진다. 이를 효율적으로 수행하기 위해 연산 회로(1000) 및 입출력 버퍼(1010) 사이에 활성화 함수 회로가 삽입될 수 있다.In an artificial neural network circuit, the outputs of one layer are obtained by applying an activation function after a matrix operation in which the inputs are multiplied by weights. In order to efficiently perform this, an activation function circuit may be inserted between the
한편 도시하지는 않았지만, 행 어드레스(RADDR), 열 어드레스(CADDR) 및 데이터 마스크 신호(DMS)는 외부의 메모리 컨트롤러로부터 제공될 수 있다. 메모리 장치(1100)와 메모리 컨트롤러는 메모리 시스템을 구성할 수 있다.Meanwhile, although not shown, the row address RADDR, the column address CADDR, and the data mask signal DMS may be provided from an external memory controller. The
정리하면, 도 7의 메모리 장치(1100)는 본 발명의 실시예들에 따른 누적연산기를 결합하여 행렬 연산을 효율적으로 수행할 수 있다. 메모리 셀 어레이(1110)에는 행렬의 원소들이 저장되어 있고 이들 데이터는 게이팅 회로(1140)(및 감지 증폭기)를 통하여 연산 회로(1000)로 전달된다. 입력 벡터의 성분들은 상기 입력 버퍼에 저장된 후 연산 회로(1000)에 전달된다. 연산 회로(1000)는 복수의 누적연산기들을 포함하고, 상기 누적연산기들의 제1 입력 단자가 공통으로 묶여 있다. 상기 입력 버퍼에서 받은 상기 입력 벡터의 성분은 상기 누적연산기들의 공통 단자에 가해지고 제2 입력 단자에는 행렬의 원소들이 가해진다. 상기 입력 벡터의 성분에 대해서 출력 벡터의 각 성분에 기여하는 값을 계산한 후 이를 누적하여 출력 벡터의 각 성분을 구한 후 상기 출력 버퍼에 저장한다.In summary, the
도 8을 참조하면, 메모리 장치(1200)는 메모리 셀 어레이(1210), 행 디코더(1220), 라인 디코더(1230), 열 디코더(1240), 제1 게이팅 회로(1250), 제2 게이팅 회로(1260), 입출력 데이터 구동 회로(1270), 연산 회로(1000), 및 입출력 버퍼(1010)를 포함한다.Referring to FIG. 8 , the
게이팅 회로가 두 단으로 형성되고 이에 따라 라인 디코더(1230)를 더 포함하는 것을 제외하면, 도 8의 메모리 장치(1200)는 도 7의 메모리 장치(1100)와 유사한 구조를 가질 수 있다. 도 8에 도시된 것처럼 게이팅 회로를 두 단으로 구성하는 경우에, 제1 게이팅 회로(1250)에 의해 선택되는 복수의 열들을 하나의 라인이라고 정의한다.The
메모리 셀 어레이(1210) 및 행 디코더(1220)는 도 7의 메모리 셀 어레이(1110) 및 행 디코더(1120)와 각각 실질적으로 동일할 수 있다.The
라인 디코더(1230)는 열 어드레스(CADDR)에 기초하여, 상기 목표 행에 포함되는 복수의 라인들 중 상기 목표 메모리 셀을 포함하는 목표 라인을 선택하기 위한 라인 선택 신호(LSEL)를 발생한다. 상기 복수의 라인들 각각은 하나의 행에 포함되고 두 개 이상의 열들을 포함하도록 정의될 수 있다.The
열 디코더(1240)는 열 어드레스(CADDR)에 기초하여, 상기 목표 행에 포함되고 상기 목표 라인에 포함되며 상기 목표 메모리 셀을 포함하는 목표 열을 선택하기 위한 열 선택 신호(CSEL)를 발생한다.The
제1 게이팅 회로(1250)는 행 선택 신호(RSEL)에 기초하여 상기 목표 행과 연결되고, 라인 선택 신호(LSEL)에 기초하여 상기 목표 라인을 선택한다. 제2 게이팅 회로(1260)는 열 선택 신호(CSEL)에 기초하여 상기 목표 라인에 포함된 상기 목표 열을 선택한다. 예를 들어, 제1 게이팅 회로(1250)는 메모리 셀들을 감지하고 신호를 안정적으로 처리하기 위한 감지 증폭기를 더 포함할 수 있다.The
입출력 데이터 구동 회로(1270)는 상기 목표 열에 입력 데이터(DIN)를 기입하거나 상기 목표 열에 저장된 데이터를 출력 데이터(DOUT)로서 출력한다. 이 때, 데이터 마스크 신호(DMS)에 기초하여 원하지 않는 입력 데이터가 상기 목표 열에 기입되는 것을 방지한다. 예를 들어, 입출력 데이터 구동 회로(1270)는 입력 데이터 구동 회로 및 출력 데이터 구동 회로를 포함할 수 있다.The input/output
상기 목표 열은 라인 선택 신호(LSEL) 및 열 선택 신호(CSEL)에 기초하여 게이팅 회로들(1250, 1260)을 통해 입출력 데이터 구동 회로(1270)와 연결될 수 있다. 데이터 기입 동작에서, 입력 데이터(DIN)는 열 데이터(CDIN) 및 라인 데이터(LDIN) 단위로 게이팅 회로들(1250, 1260)에 제공되고, 상기 목표 열에 저장될 수 있다. 데이터 독출 동작에서, 상기 목표 행에 저장된 페이지 데이터(RD)가 제1 게이팅 회로(1250)에 제공되고, 상기 목표 행에 포함되는 상기 목표 라인 및 상기 목표 열의 데이터가 라인 데이터(LDOUT) 및 열 데이터(CDOUT) 단위로 제2 게이팅 회로(1260) 및 상기 출력 데이터 구동 회로에 제공되며, 출력 데이터(DOUT)로서 출력될 수 있다.The target column may be connected to the input/output
입출력 버퍼(1010)는 도 7의 입출력 버퍼(1010)와 실질적으로 동일할 수 있다. 연산 회로(1000)는 제1 게이팅 회로(1250)와 연결되는 점을 제외하면 도 7의 연산 회로(1000)와 실질적으로 동일할 수 있다.The input/
도 8에서는 게이팅 회로를 2단으로 구성하여 연산 회로(1000)에 공급되는 데이터 사이즈를 열 사이즈 보다 크게 하여 한 번에 더 많은 누적연산기를 구동할 수 있다.In FIG. 8 , by configuring the gating circuit in two stages, the data size supplied to the
도 9를 참조하면, 메모리 장치(1300)는 메모리 셀 어레이(1310), 행 디코더(1320), 다중 열 디코더(1330), 게이팅 회로(1340), 입출력 데이터 구동 회로(1350), 형변환 및 연산 회로(1000), 및 입출력 버퍼(1010)를 포함한다.Referring to FIG. 9 , the
열 디코더(1130)가 다중 열 디코더(1330)로 변경되는 것을 제외하면, 도 9의 메모리 장치(1300)는 도 7의 메모리 장치(1100)와 유사한 구조를 가질 수 있다.The
메모리 셀 어레이(1310) 및 행 디코더(1320)는 도 7의 메모리 셀 어레이(1110) 및 행 디코더(1120)와 각각 실질적으로 동일할 수 있다.The
다중 열 디코더(1330)는 열 어드레스(CADDR) 및 열 선택 정보(CSINF)에 기초하여, 목표 행(TR)에 포함되는 열들 중 상기 목표 메모리 셀을 포함하는 복수의 목표 열들(TC)(빗금 친 부분)을 한 번에 선택하기 위한 다중 열 선택 신호(MCSEL)를 발생한다. 이 때, 열 선택 정보(CSINF)에는 목표 열들(TC)의 주소가 연속이라는 제약이 없다. 다시 말하면, 목표 열들(TC)은(즉, 목표 열들(TC)의 주소는) 연속적이지 않을 수 있다.The
실시예에 따라서, 열 선택 정보(CSINF)는 미리 정의된 열 선택 테이블에 기초하여 설정될 수도 있고, 열 선택 파라미터에 기초하여 설정될 수도 있으며, 열 선택 리스트 또는 열 선택 정보 리스트에 기초하여 설정될 수도 있다.According to an embodiment, the column selection information CSINF may be set based on a predefined column selection table, may be set based on a column selection parameter, or may be set based on a column selection list or a column selection information list. may be
게이팅 회로(1340)는 행 선택 신호(RSEL)에 기초하여 목표 행(TR)과 연결된다. 또한, 게이팅 회로(1340)는 다중 열 선택 신호(MCSEL)에 기초하여 목표 행(TR)에 포함된 복수의 목표 열들(TC)을 선택하여 입출력 데이터 구동 회로(150)에 한 번에 연결한다. 예를 들어, 게이팅 회로(1340)는 메모리 셀들을 감지하고 신호를 안정적으로 처리하기 위한 감지 증폭기를 더 포함할 수 있다.The
입출력 데이터 구동 회로(1350)는 복수의 목표 열들(TC)에 입력 데이터(DIN)를 한 번에 기입하거나 복수의 목표 열들(TC)에 저장된 데이터를 한 번에 출력 데이터(DOUT)로서 출력한다. 이 때, 다중 열 선택 신호(MCSEL) 및 데이터 마스크 신호(DMS)에 기초하여 원하지 않는 입력 데이터가 상기 복수의 목표 열들(TC)에 기입되는 것을 방지한다. 예를 들어, 입출력 데이터 구동 회로(1350)는 입력 데이터 구동 회로 및 출력 데이터 구동 회로를 포함할 수 있다.The input/output
복수의 목표 열들(TC)은 다중 열 선택 신호(MCSEL)에 기초하여 게이팅 회로(1340)를 통해 입출력 데이터 구동 회로(1350)와 연결될 수 있다. 데이터 기입 동작에서, 입력 데이터(DIN)는 열 데이터(CDIN) 단위로 게이팅 회로(1340)에 제공될 수 있고, 복수의 목표 열들(TC)에 저장될 수 있다. 데이터 독출 동작에서, 목표 행(TR)에 저장된 페이지 데이터(또는 행 데이터)(RD)가 게이팅 회로(1340)에 제공될 수 있고, 목표 행(TR)에 포함되는 복수의 목표 열들(TC)의 데이터가 열 데이터(CDOUT) 단위로 상기 출력 데이터 구동 회로에 제공될 수 있으며, 출력 데이터(DOUT)로서 출력될 수 있다.The plurality of target columns TC may be connected to the input/output
일 실시예에서, 입출력 데이터(DIN 또는 DOUT)의 크기는 페이지 데이터(RD)의 크기보다 작거나 같을 수 있다. 예를 들어, 페이지 데이터(RD)의 크기는 P(P는 2 이상의 자연수)비트일 수 있고, 입출력 데이터(DIN 또는 DOUT)의 크기는 K(K는 P 이하의 자연수)비트일 수 있다.In an embodiment, the size of the input/output data DIN or DOUT may be smaller than or equal to the size of the page data RD. For example, the size of the page data RD may be P (P is a natural number greater than or equal to 2) bits, and the size of the input/output data DIN or DOUT may be K (K is a natural number less than or equal to P) bits.
일 실시예에서, 열 데이터(CDIN 또는 CDOUT)의 크기는 입출력 데이터(DIN 또는 DOUT)의 크기보다 작을 수 있다. 예를 들어, 열 데이터(CDIN 또는 CDOUT)의 크기는 C(C는 K보다 작은 자연수)비트일 수 있다. 이 경우, 하나의 입력 데이터(DIN)를 저장하거나 하나의 출력 데이터(DOUT)를 제공하기 위해 복수의 열들(예를 들어, K/C개의 열들)을 선택할 수 있으며, 이에 따라 입출력 데이터(DIN 또는 DOUT)는 하나의 화살표로 도시하고 열 데이터(CDIN 또는 CDOUT)는 복수의 화살표들로 도시하였다.In an embodiment, the size of the column data CDIN or CDOUT may be smaller than the size of the input/output data DIN or DOUT. For example, the size of the column data CDIN or CDOUT may be C (C is a natural number less than K) bits. In this case, a plurality of columns (eg, K/C columns) may be selected to store one input data DIN or provide one output data DOUT, and accordingly, input/output data DIN or DOUT) is indicated by a single arrow, and column data (CDIN or CDOUT) is indicated by a plurality of arrows.
입출력 버퍼(1010)는 도 7의 입출력 버퍼(1010)와 실질적으로 동일할 수 있다. 연산 회로(1000)는 도 7의 연산 회로(1000)와 실질적으로 동일할 수 있다.The input/
도 9에서는 다중 열 디코더(1330)를 사용하여 연산회로(1000)에 공급되는 데이터 선택의 자유도를 높일 수 있다. 또한, 연속적이지 않은 메모리 셀들에 한 번에 액세스할 수 있어 메모리 장치(1300)의 성능 및 전력 효율이 향상될 수 있다.In FIG. 9 , the degree of freedom in selecting data supplied to the
본 발명은 행렬 연산을 수행하는 연산 장치 및 메모리 장치를 포함하는 다양한 장치 및 시스템에 적용될 수 있다. 따라서 본 발명은 휴대폰, 스마트 폰, PDA, PMP, 디지털 카메라, 캠코더, PC, 서버 컴퓨터, 워크스테이션, 노트북, 디지털 TV, 셋-탑 박스, 음악 재생기, 휴대용 게임 콘솔, 네비게이션 기기, 웨어러블 기기, IoT 기기, VR 기기, AR 기기 등과 같은 다양한 전자 기기에 유용하게 이용될 수 있다.The present invention can be applied to various devices and systems including a computing device and a memory device that perform a matrix operation. Accordingly, the present invention is a mobile phone, smart phone, PDA, PMP, digital camera, camcorder, PC, server computer, workstation, notebook, digital TV, set-top box, music player, portable game console, navigation device, wearable device, IoT It may be usefully used in various electronic devices such as devices, VR devices, AR devices, and the like.
상기에서는 본 발명의 바람직한 실시예를 참조하여 설명하였지만, 해당 기술분야의 숙련된 당업자는 하기의 특허청구범위에 기재된 본 발명의 사상 및 영역으로부터 벗어나지 않는 범위 내에서 본 발명을 다양하게 수정 및 변경시킬 수 있음을 이해할 것이다.Although the above has been described with reference to the preferred embodiments of the present invention, those skilled in the art can variously modify and change the present invention without departing from the spirit and scope of the present invention as set forth in the claims below. you will understand that you can
Claims (30)
상기 복수의 누적연산기들 각각은,
상기 제1 입력 단자로부터 수신되는 상기 입력 벡터 성분들 및 상기 제2 입력 단자로부터 수신되는 상기 행렬의 원소들에 대한 제1 연산을 수행하여 상기 제1 연산의 결과를 발생하는 제1 연산기;
상기 제1 연산기로부터 출력되는 상기 제1 연산의 결과 및 누적레지스터로부터 제공되는 누적 결과에 대한 제2 연산을 수행하여 상기 제2 연산의 결과를 발생하는 제2 연산기; 및
상기 제2 연산기로부터 출력되는 상기 제2 연산의 결과를 누적하여 상기 누적 결과를 발생하고, 최종적으로 상기 출력 벡터 성분들 중 하나를 발생하는 상기 누적레지스터를 포함하며,
하나의 상기 연산기그룹에 포함되는 상기 복수의 누적연산기들의 상기 제1 입력 단자는 공통으로 연결되는 연산 장치.each of a first input terminal for receiving input vector components and a second input terminal for receiving elements of a matrix, and performing a cumulative operation on the input vector components and the elements of the matrix to obtain one of the output vector components one or more operator groups including a plurality of accumulators each generating one,
Each of the plurality of accumulators,
a first operator for generating a result of the first operation by performing a first operation on the input vector components received from the first input terminal and elements of the matrix received from the second input terminal;
a second operator for generating a result of the second operation by performing a second operation on the result of the first operation output from the first operator and the accumulation result provided from the accumulation register; and
and the accumulation register generating the accumulation result by accumulating the results of the second operation output from the second operator, and finally generating one of the output vector components,
The first input terminal of the plurality of accumulators included in the one operator group is connected in common.
복수의 상기 연산기그룹들은 복수의 입력 벡터들에 일대일로 대응하여 입력 벡터 성분들을 수신하고 복수의 출력 벡터들에 일대일로 대응하여 출력 벡터 성분들을 발생하며,
서로 다른 상기 연산기그룹에 속하는 복수의 누적연산기들을 포함하는 복수의 교차연산기그룹들을 포함하고,
하나의 상기 교차연산기그룹에 포함되는 상기 복수의 누적연산기들의 상기 제2 입력 단자는 공통으로 연결되는 것을 특징으로 하는 연산 장치.The method of claim 1,
A plurality of the operator groups receive input vector components in one-to-one correspondence with a plurality of input vectors and generate output vector components in one-to-one correspondence with a plurality of output vectors,
a plurality of cross operator groups including a plurality of accumulators belonging to the different operator groups;
The second input terminal of the plurality of accumulators included in one crossover operator group is connected in common.
상기 제1 연산기는 곱셈기이고, 상기 제1 연산은 곱셈이며,
상기 제2 연산기는 가산기이고, 상기 제2 연산은 덧셈이며,
상기 복수의 누적연산기들 각각은 MAC(multiplier-and-accumulator)인 것을 특징으로 하는 연산 장치.The method of claim 1,
The first operator is a multiplier, the first operation is a multiplication,
The second operator is an adder, the second operation is an addition,
Each of the plurality of accumulators is a multiplier-and-accumulator (MAC).
상기 누적레지스터에 의해 발생되는 상기 누적 결과를 임시로 저장하는 적어도 하나의 쉐도우(shadow) 레지스터를 더 포함하는 것을 특징으로 하는 연산 장치.The method of claim 1, wherein each of the plurality of accumulators comprises:
and at least one shadow register for temporarily storing the accumulation result generated by the accumulation register.
보조 입력을 수신하는 보조 입력 단자, 및 상기 입력 벡터 성분들을 수신하는 상기 제1 입력 단자와 연결되고, 선택 신호에 기초하여 상기 보조 입력 및 상기 입력 벡터 성분들 중 하나를 선택하여 상기 제1 연산기에 제공하는 멀티플렉서를 더 포함하는 것을 특징으로 하는 연산 장치.The method of claim 1, wherein each of the plurality of accumulators comprises:
an auxiliary input terminal for receiving an auxiliary input, and the first input terminal for receiving the input vector components, selects one of the auxiliary input and the input vector components based on a selection signal to the first operator Computing device, characterized in that it further comprises a multiplexer to provide.
보조 입력을 수신하는 보조 입력 단자, 및 상기 입력 벡터 성분들을 수신하는 상기 제1 입력 단자와 연결되고, 선택 신호에 기초하여 상기 보조 입력 및 상기 입력 벡터 성분들 중 하나를 선택하여 상기 제1 연산기에 제공하는 멀티플렉서를 더 포함하고,
상기 복수의 누적연산기들 중 상기 제1 누적연산기와 인접하여 배치되는 적어도 하나의 누적연산기는 상기 제1 누적연산기와 상기 멀티플렉서를 공유하는 것을 특징으로 하는 연산 장치.The method of claim 1, wherein a first accumulator among the plurality of accumulators comprises:
an auxiliary input terminal for receiving an auxiliary input, and the first input terminal for receiving the input vector components, selects one of the auxiliary input and the input vector components based on a selection signal to the first operator Further comprising a multiplexer to provide,
and at least one accumulator disposed adjacent to the first accumulator among the plurality of accumulators shares the multiplexer with the first accumulator.
상기 복수의 누적연산기들 각각의 2개의 입력들 중 어느 하나는 0 또는 1의 값을 갖는 이진 값이고,
상기 제1 누적연산기는 상기 이진 값에 따라 0을 출력하거나 다른 하나의 입력을 바이패스 시키는 게이팅 회로로 구현되는 것을 특징으로 하는 연산 장치.The method of claim 1,
Any one of the two inputs of each of the plurality of accumulators is a binary value having a value of 0 or 1,
and the first accumulator is implemented as a gating circuit that outputs 0 or bypasses another input according to the binary value.
상기 복수의 누적연산기들 각각의 2개의 입력들 중 어느 하나는 n진 정수 값(n은 2이상의 자연수)이고 다른 하나는 정수 지수를 갖는 n의 거듭제곱 값이고,
상기 제1 누적연산기는 상기 n진 정수 입력을 상기 정수 지수만큼 쉬프트 시키는 회로로 구현되는 것을 특징으로 하는 연산 장치.The method of claim 1,
One of the two inputs of each of the plurality of accumulators is an n-base integer value (n is a natural number greater than or equal to 2) and the other is a power value of n having an integer exponent,
and the first accumulator is implemented as a circuit for shifting the n-base integer input by the integer exponent.
상기 복수의 누적연산기들 각각의 2개의 입력들 중 어느 하나는 n진 부동소수점 값(n은 2이상의 자연수)이고 다른 하나는 정수 지수를 갖는 n의 거듭제곱 값이고,
상기 제1 누적연산기는 상기 n진 부동소수점 입력의 가수를 바이패스 시키고 상기 두 입력의 지수를 더하는 회로로 구현되는 것을 특징으로 하는 연산 장치.The method of claim 1,
One of the two inputs of each of the plurality of accumulators is an n-base floating-point value (n is a natural number greater than or equal to 2) and the other is a power value of n having an integer exponent,
and the first accumulator is implemented as a circuit for bypassing the mantissa of the n-base floating-point input and adding the exponents of the two inputs.
상기 복수의 누적연산기들 각각의 2개의 입력들 중 어느 하나를 1로 고정하여 상기 제1 연산기를 바이패스시키고, 상기 제2 연산기는 상기 제1 연산기에 의해 바이패스된 값을 상기 누적레지스터의 값과 비교하여 둘 중 큰 값을 출력하는 비교기로 구현되는 것을 특징으로 하는 연산 장치.The method of claim 1,
The first operator is bypassed by fixing any one of two inputs of each of the plurality of accumulators to 1, and the second operator sets the value bypassed by the first operator to the value of the accumulation register. Comparing with and arithmetic device, characterized in that implemented as a comparator that outputs the larger of the two.
상기 행렬은 합성곱 행렬 또는 패킹된 합성곱 행렬이고, 상기 입력 벡터와 상기 출력 벡터는 입력 행렬과 출력 행렬을 각각 벡터로 바꾸어 얻어지는 것을 특징으로 하는 연산 장치.The method of claim 1,
The matrix is a convolution matrix or a packed convolution matrix, and the input vector and the output vector are obtained by converting an input matrix and an output matrix into vectors, respectively.
상기 행렬은 복수의 필터 행렬들에 대응하는 확장된 합성곱 행렬이고, 상기 출력 벡터는 상기 복수의 필터 행렬들에 대응하는 확장된 출력 벡터인 것을 특징으로 하는 연산 장치.The method of claim 1,
wherein the matrix is an extended convolution matrix corresponding to a plurality of filter matrices, and the output vector is an extended output vector corresponding to the plurality of filter matrices.
상기 행렬은 합성곱 행렬 또는 패킹된 합성곱 행렬이고, 상기 복수의 입력 벡터들과 상기 복수의 출력 벡터들은 복수의 입력 행렬들과 복수의 출력 행렬들을 각각 벡터로 바꾸어 얻어지는 것을 특징으로 하는 연산 장치.3. The method of claim 2,
The matrix is a convolution matrix or a packed convolution matrix, and the plurality of input vectors and the plurality of output vectors are obtained by converting a plurality of input matrices and a plurality of output matrices into vectors, respectively.
상기 행렬은 분할된 합성곱 행렬이고, 상기 복수의 입력 벡터들과 상기 복수의 출력 벡터들은 복수의 분할된 입력 행렬들과 복수의 분할된 출력 행렬들을 각각 벡터로 바꾸어 얻어지는 것을 특징으로 하는 연산 장치.3. The method of claim 2,
The matrix is a divided convolution matrix, and the plurality of input vectors and the plurality of output vectors are obtained by changing a plurality of divided input matrices and a plurality of divided output matrices into vectors, respectively.
행 어드레스에 기초하여, 상기 복수의 행들 중 목표 행을 선택하기 위한 행 선택 신호를 발생하는 행 디코더;
열 어드레스에 기초하여, 상기 목표 행에 포함되는 열들 중 목표 열을 선택하기 위한 열 선택 신호를 발생하는 열 디코더;
상기 열 선택 신호에 기초하여 상기 목표 열을 선택하는 게이팅 회로;
상기 게이팅 회로를 통해 상기 목표 열에 입력 데이터를 기입하거나 상기 목표 열에 저장된 데이터를 출력 데이터로서 출력하는 입출력 데이터 구동 회로;
상기 입출력 데이터 구동 회로와 연결되고, 입력 벡터 성분들 및 출력 벡터 성분들을 저장하는 입출력 버퍼; 및
상기 게이팅 회로 및 상기 입출력 버퍼와 연결되고, 복수의 누적연산기들을 포함하는 하나 이상의 연산기그룹을 포함하며, 상기 입출력 버퍼로부터 제공되는 상기 입력 벡터 성분들과 상기 게이팅 회로를 통해 제공되는 상기 행렬의 원소들 또는 상기 게이팅 회로를 통해 제공되는 상기 행렬 생성 정보를 참조하여 생성되는 상기 행렬의 원소들을 상기 복수의 누적연산기들에서 입력 벡터 기준 방식으로 연산하여 상기 출력 벡터 성분들을 획득하고, 상기 출력 벡터 성분들을 상기 입출력 버퍼에 제공하는 연산 회로를 포함하고,
상기 복수의 누적연산기들 각각은, 상기 입력 벡터 성분들을 수신하는 제1 입력 단자, 및 상기 행렬의 원소들을 수신하는 제2 입력 단자를 포함하고, 상기 입력 벡터 성분들과 상기 행렬의 원소들에 대한 누적 연산을 수행하여 상기 출력 벡터 성분들 중 하나를 발생하며,
상기 복수의 누적연산기들 각각은,
상기 제1 입력 단자로부터 수신되는 상기 입력 벡터 성분들 및 상기 제2 입력 단자로부터 수신되는 상기 행렬의 원소들에 대한 제1 연산을 수행하여 상기 제1 연산의 결과를 발생하는 제1 연산기;
상기 제1 연산기로부터 출력되는 상기 제1 연산의 결과 및 누적레지스터로부터 제공되는 누적 결과에 대한 제2 연산을 수행하여 상기 제2 연산의 결과를 발생하는 제2 연산기; 및
상기 제2 연산기로부터 출력되는 상기 제2 연산의 결과를 누적하여 상기 누적 결과를 발생하고, 최종적으로 상기 출력 벡터 성분들 중 하나를 발생하는 상기 누적레지스터를 포함하며,
하나의 상기 연산기그룹에 포함되는 상기 복수의 누적연산기들의 상기 제1 입력 단자는 공통으로 연결되는 메모리 장치.a memory cell array comprising a plurality of memory cells arranged to form a plurality of rows and a plurality of columns, the memory cell array storing elements of a matrix or matrix generation information for generating elements of the matrix;
a row decoder for generating a row selection signal for selecting a target row from among the plurality of rows based on a row address;
a column decoder for generating a column selection signal for selecting a target column from among columns included in the target row, based on a column address;
a gating circuit for selecting the target column based on the column selection signal;
an input/output data driving circuit for writing input data into the target column or outputting data stored in the target column as output data through the gating circuit;
an input/output buffer connected to the input/output data driving circuit and configured to store input vector components and output vector components; and
connected to the gating circuit and the input/output buffer, and including one or more operator groups including a plurality of accumulators, the input vector components provided from the input/output buffer and the elements of the matrix provided through the gating circuit Alternatively, the plurality of accumulators calculate the elements of the matrix generated with reference to the matrix generation information provided through the gating circuit in an input vector reference method to obtain the output vector components, and use the output vector components as the Comprising an arithmetic circuit providing input and output buffers,
Each of the plurality of accumulators includes a first input terminal for receiving the input vector components, and a second input terminal for receiving the elements of the matrix, wherein the input vector components and the elements of the matrix performing an accumulation operation to generate one of the output vector components,
Each of the plurality of accumulators,
a first operator for generating a result of the first operation by performing a first operation on the input vector components received from the first input terminal and elements of the matrix received from the second input terminal;
a second operator for generating a result of the second operation by performing a second operation on the result of the first operation output from the first operator and the accumulation result provided from the accumulation register; and
and the accumulation register generating the accumulation result by accumulating the results of the second operation output from the second operator, and finally generating one of the output vector components,
The first input terminal of the plurality of accumulators included in the one operator group is connected in common.
복수의 상기 연산기그룹들은 복수의 입력 벡터들에 일대일로 대응하여 입력 벡터 성분들을 수신하고 복수의 출력 벡터들에 일대일로 대응하여 출력 벡터 성분들을 발생하며,
서로 다른 상기 연산기그룹에 속하는 복수의 누적연산기들을 포함하는 복수의 교차연산기그룹들을 포함하고,
하나의 상기 교차연산기그룹에 포함되는 상기 복수의 누적연산기들의 상기 제2 입력 단자는 공통으로 연결되는 것을 특징으로 하는 연산 장치.16. The method of claim 15,
A plurality of the operator groups receive input vector components in one-to-one correspondence with a plurality of input vectors and generate output vector components in one-to-one correspondence with a plurality of output vectors,
a plurality of cross operator groups including a plurality of accumulators belonging to the different operator groups;
The second input terminal of the plurality of accumulators included in one crossover operator group is connected in common.
상기 제1 연산기는 곱셈기이고, 상기 제1 연산은 곱셈이며,
상기 제2 연산기는 가산기이고, 상기 제2 연산은 덧셈이며,
상기 복수의 누적연산기들 각각은 MAC(multiplier-and-accumulator)인 것을 특징으로 하는 메모리 장치.16. The method of claim 15,
The first operator is a multiplier, the first operation is a multiplication,
The second operator is an adder, the second operation is an addition,
and each of the plurality of accumulators is a multiplier-and-accumulator (MAC).
상기 누적레지스터에 의해 발생되는 상기 누적 결과를 임시로 저장하는 적어도 하나의 쉐도우(shadow) 레지스터를 더 포함하는 것을 특징으로 하는 메모리 장치.16. The method of claim 15, wherein each of the plurality of accumulators,
and at least one shadow register for temporarily storing the accumulation result generated by the accumulation register.
보조 입력을 수신하는 보조 입력 단자, 및 상기 입력 벡터 성분들을 수신하는 상기 제1 입력 단자와 연결되고, 선택 신호에 기초하여 상기 보조 입력 및 상기 입력 벡터 성분들 중 하나를 선택하여 상기 제1 연산기에 제공하는 멀티플렉서를 더 포함하는 것을 특징으로 하는 메모리 장치.16. The method of claim 15, wherein each of the plurality of accumulators,
an auxiliary input terminal for receiving an auxiliary input, and the first input terminal for receiving the input vector components, selects one of the auxiliary input and the input vector components based on a selection signal to the first operator Memory device, characterized in that it further comprises a multiplexer to provide.
보조 입력을 수신하는 보조 입력 단자, 및 상기 입력 벡터 성분들을 수신하는 상기 제1 입력 단자와 연결되고, 선택 신호에 기초하여 상기 보조 입력 및 상기 입력 벡터 성분들 중 하나를 선택하여 상기 제1 연산기에 제공하는 멀티플렉서를 더 포함하고,
상기 복수의 누적연산기들 중 상기 제1 누적연산기와 인접하여 배치되는 적어도 하나의 누적연산기는 상기 제1 누적연산기와 상기 멀티플렉서를 공유하는 것을 특징으로 하는 메모리 장치.16. The method of claim 15, wherein a first accumulator among the plurality of accumulators comprises:
an auxiliary input terminal for receiving an auxiliary input, and the first input terminal for receiving the input vector components, selects one of the auxiliary input and the input vector components based on a selection signal to the first operator Further comprising a multiplexer to provide,
At least one accumulator disposed adjacent to the first accumulator among the plurality of accumulators shares the multiplexer with the first accumulator.
상기 복수의 누적연산기들 각각의 2개의 입력들 중 어느 하나는 0 또는 1의 값을 갖는 이진 값이고,
상기 제1 누적연산기는 상기 이진 값에 따라 0을 출력하거나 다른 하나의 입력을 바이패스 시키는 게이팅 회로로 구현되는 것을 특징으로 하는 메모리 장치.16. The method of claim 15,
Any one of the two inputs of each of the plurality of accumulators is a binary value having a value of 0 or 1,
and the first accumulator is implemented as a gating circuit that outputs 0 or bypasses another input according to the binary value.
상기 복수의 누적연산기들 각각의 2개의 입력들 중 어느 하나는 n진 정수 값(n은 2이상의 자연수)이고 다른 하나는 정수 지수를 갖는 n의 거듭제곱 값이고,
상기 제1 누적연산기는 상기 n진 정수 입력을 상기 정수 지수만큼 쉬프트 시키는 회로로 구현되는 것을 특징으로 하는 메모리 장치.16. The method of claim 15,
One of the two inputs of each of the plurality of accumulators is an n-base integer value (n is a natural number greater than or equal to 2) and the other is a power value of n having an integer exponent,
and the first accumulator is implemented as a circuit for shifting the n-base integer input by the integer exponent.
상기 복수의 누적연산기들 각각의 2개의 입력들 중 어느 하나는 n진 부동소수점 값(n은 2이상의 자연수)이고 다른 하나는 정수 지수를 갖는 n의 거듭제곱 값이고,
상기 제1 누적연산기는 상기 n진 부동소수점 입력의 가수를 바이패스 시키고 상기 두 입력의 지수를 더하는 회로로 구현되는 것을 특징으로 하는 메모리 장치.16. The method of claim 15,
One of the two inputs of each of the plurality of accumulators is an n-base floating-point value (n is a natural number greater than or equal to 2) and the other is a power value of n having an integer exponent,
and the first accumulator is implemented as a circuit for bypassing the mantissa of the n-base floating-point input and adding the exponents of the two inputs.
상기 복수의 누적연산기들 각각의 2개의 입력들 중 어느 하나를 1로 고정하여 상기 제1 연산기를 바이패스시키고, 상기 제2 연산기는 상기 제1 연산기에 의해 바이패스된 값을 상기 누적레지스터의 값과 비교하여 둘 중 큰 값을 출력하는 비교기로 구현되는 것을 특징으로 하는 메모리 장치.16. The method of claim 15,
The first operator is bypassed by fixing any one of two inputs of each of the plurality of accumulators to 1, and the second operator sets the value bypassed by the first operator to the value of the accumulation register. A memory device, characterized in that it is implemented as a comparator that compares with and outputs the larger of the two values.
상기 행렬은 합성곱 행렬 또는 패킹된 합성곱 행렬이고, 상기 입력 벡터와 상기 출력 벡터는 입력 행렬과 출력 행렬을 각각 벡터로 바꾸어 얻어지는 것을 특징으로 하는 메모리 장치.16. The method of claim 15,
wherein the matrix is a convolution matrix or a packed convolution matrix, and the input vector and the output vector are obtained by converting an input matrix and an output matrix into vectors, respectively.
상기 행렬은 복수의 필터 행렬들에 대응하는 확장된 합성곱 행렬이고, 상기 출력 벡터는 상기 복수의 필터 행렬들에 대응하는 확장된 출력 벡터인 것을 특징으로 하는 연산 장치.16. The method of claim 15,
wherein the matrix is an extended convolution matrix corresponding to a plurality of filter matrices, and the output vector is an extended output vector corresponding to the plurality of filter matrices.
상기 행렬은 합성곱 행렬 또는 패킹된 합성곱 행렬이고, 상기 복수의 입력 벡터들과 상기 복수의 출력 벡터들은 복수의 입력 행렬들과 복수의 출력 행렬들을 각각 벡터로 바꾸어 얻어지는 것을 특징으로 하는 연산 장치.17. The method of claim 16,
The matrix is a convolution matrix or a packed convolution matrix, and the plurality of input vectors and the plurality of output vectors are obtained by converting a plurality of input matrices and a plurality of output matrices into vectors, respectively.
상기 행렬은 분할된 합성곱 행렬이고, 상기 복수의 입력 벡터들과 상기 복수의 출력 벡터들은 복수의 분할된 입력 행렬들과 복수의 분할된 출력 행렬들을 각각 벡터로 바꾸어 얻어지는 것을 특징으로 하는 연산 장치.17. The method of claim 16,
The matrix is a divided convolution matrix, and the plurality of input vectors and the plurality of output vectors are obtained by changing a plurality of divided input matrices and a plurality of divided output matrices into vectors, respectively.
상기 열 어드레스에 기초하여, 상기 목표 행에 포함되고 두 개 이상의 열들을 각각 포함하는 복수의 라인들 중 상기 목표 열을 포함하는 목표 라인을 선택하기 위한 라인 선택 신호를 발생하는 라인 디코더를 더 포함하고,
상기 게이팅 회로는 상기 라인 선택 신호에 기초하여 상기 목표 라인을 선택하는 제1 게이팅 회로와 상기 열 선택 신호에 기초하여 상기 목표 열을 선택하는 제2 게이팅 회로를 포함하고,
상기 입출력 데이터 구동 회로는 상기 제1 및 제2 게이팅 회로들을 통해 상기 목표 열에 상기 입력 데이터를 기입하거나 상기 목표 열에 저장된 데이터를 상기 출력 데이터로서 출력하며,
상기 연산 회로는 상기 제1 게이팅 회로와 연결되는 것을 특징으로 하는 메모리 장치.16. The method of claim 15,
and a line decoder for generating a line selection signal for selecting a target line including the target column from among a plurality of lines included in the target row and each including two or more columns, based on the column address; ,
The gating circuit includes a first gating circuit that selects the target line based on the line selection signal and a second gating circuit that selects the target column based on the column selection signal,
the input/output data driving circuit writes the input data to the target column or outputs data stored in the target column as the output data through the first and second gating circuits;
and the arithmetic circuit is connected to the first gating circuit.
상기 열 디코더는 상기 열 어드레스 및 열 선택 정보에 기초하여, 상기 목표 행에 포함되는 열들 중 복수의 목표 열들을 한 번에 선택하기 위한 다중 열 선택 신호를 발생하는 다중 열 디코더이고,
상기 게이팅 회로는 상기 다중 열 선택 신호에 기초하여 상기 복수의 목표 열들을 한 번에 선택하고,
상기 입출력 데이터 구동 회로는 상기 게이팅 회로를 통해 상기 복수의 목표 열들에 상기 입력 데이터를 한 번에 기입하거나 상기 복수의 목표 열들에 저장된 데이터를 한 번에 상기 출력 데이터로서 출력하며,
상기 목표 행에 포함되는 상기 복수의 목표 열들에 대응하는 상기 열 어드레스는 연속적이지 않은 것을 특징으로 하는 메모리 장치.
16. The method of claim 15,
the column decoder is a multi-column decoder that generates a multi-column selection signal for selecting a plurality of target columns from among columns included in the target row at a time based on the column address and column selection information;
the gating circuit selects the plurality of target columns at once based on the multi-column selection signal,
the input/output data driving circuit writes the input data in the plurality of target columns at a time through the gating circuit or outputs data stored in the plurality of target columns as the output data at a time;
and the column addresses corresponding to the plurality of target columns included in the target row are not contiguous.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020210030067A KR102447445B1 (en) | 2021-03-08 | 2021-03-08 | Calculation device for efficient parallel processing of matrix operation and memory device including the same |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020210030067A KR102447445B1 (en) | 2021-03-08 | 2021-03-08 | Calculation device for efficient parallel processing of matrix operation and memory device including the same |
Publications (2)
Publication Number | Publication Date |
---|---|
KR20220126018A true KR20220126018A (en) | 2022-09-15 |
KR102447445B1 KR102447445B1 (en) | 2022-09-26 |
Family
ID=83281574
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
KR1020210030067A KR102447445B1 (en) | 2021-03-08 | 2021-03-08 | Calculation device for efficient parallel processing of matrix operation and memory device including the same |
Country Status (1)
Country | Link |
---|---|
KR (1) | KR102447445B1 (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080297416A1 (en) * | 2007-05-29 | 2008-12-04 | Honeywell International Inc. | Method and System for Accelerating the Computation of Adaptive Weights Using Matrix Inverse Calculations |
KR20190100632A (en) * | 2018-02-21 | 2019-08-29 | 삼성전자주식회사 | Memory device supporting skip calculation mode and method of operating the same |
JP2019168783A (en) * | 2018-03-22 | 2019-10-03 | 東芝メモリ株式会社 | Semiconductor device |
-
2021
- 2021-03-08 KR KR1020210030067A patent/KR102447445B1/en active IP Right Grant
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080297416A1 (en) * | 2007-05-29 | 2008-12-04 | Honeywell International Inc. | Method and System for Accelerating the Computation of Adaptive Weights Using Matrix Inverse Calculations |
KR20190100632A (en) * | 2018-02-21 | 2019-08-29 | 삼성전자주식회사 | Memory device supporting skip calculation mode and method of operating the same |
JP2019168783A (en) * | 2018-03-22 | 2019-10-03 | 東芝メモリ株式会社 | Semiconductor device |
Also Published As
Publication number | Publication date |
---|---|
KR102447445B1 (en) | 2022-09-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108805266B (en) | Reconfigurable CNN high-concurrency convolution accelerator | |
CN109213962B (en) | Operation accelerator | |
US8051124B2 (en) | High speed and efficient matrix multiplication hardware module | |
JP5840994B2 (en) | Matrix operation unit | |
WO2019205617A1 (en) | Calculation method and apparatus for matrix multiplication | |
US10810281B2 (en) | Outer product multipler system and method | |
WO2023065983A1 (en) | Computing apparatus, neural network processing device, chip, and data processing method | |
CN112434801B (en) | Convolution operation acceleration method for carrying out weight splitting according to bit precision | |
US20230259743A1 (en) | Neural network accelerator with configurable pooling processing unit | |
JP7401513B2 (en) | Sparse matrix multiplication in hardware | |
KR102447445B1 (en) | Calculation device for efficient parallel processing of matrix operation and memory device including the same | |
US11249722B2 (en) | Semiconductor device and method of controlling the semiconductor device | |
WO2021168644A1 (en) | Data processing apparatus, electronic device, and data processing method | |
CN113743046B (en) | Integrated layout structure for memory and calculation and integrated layout structure for data splitting and memory and calculation | |
CN116301727A (en) | Data processing method and acceleration unit | |
KR100235537B1 (en) | Variable tap of digital filter and multiplier circuit thereof | |
CN115600062B (en) | Convolution processing method, circuit, electronic device and computer readable storage medium | |
US20240201952A1 (en) | Artificial intelligence operation system and method thereof | |
EP4102411A1 (en) | Semiconductor device | |
CN118312133A (en) | Karatuba-based ultra-high order binary polynomial multiplier | |
Almiladi | A Novel Methodology for Designing Radix-2 n Serial-Serial Multipliers | |
JP2001160736A (en) | Digital filter circuit | |
CN116755663A (en) | High-level synthesis HLS library | |
CN117077734A (en) | Convolution input conversion method, hardware accelerator and accelerator structure determination method | |
CN115587274A (en) | Polynomial multiplication accelerating method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
GRNT | Written decision to grant |