KR20240087527A - Apparatus and method for selective sparse matrix multiplication based on density of input matrix - Google Patents

Apparatus and method for selective sparse matrix multiplication based on density of input matrix Download PDF

Info

Publication number
KR20240087527A
KR20240087527A KR1020230131655A KR20230131655A KR20240087527A KR 20240087527 A KR20240087527 A KR 20240087527A KR 1020230131655 A KR1020230131655 A KR 1020230131655A KR 20230131655 A KR20230131655 A KR 20230131655A KR 20240087527 A KR20240087527 A KR 20240087527A
Authority
KR
South Korea
Prior art keywords
multiplication
input matrix
matrix
density
input
Prior art date
Application number
KR1020230131655A
Other languages
Korean (ko)
Inventor
석정희
여준기
이주현
김태훈
유민수
Original Assignee
한국전자통신연구원
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 한국전자통신연구원 filed Critical 한국전자통신연구원
Publication of KR20240087527A publication Critical patent/KR20240087527A/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/16Matrix or vector computation, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods 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/52Multiplying; Dividing
    • G06F7/523Multiplying only
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/30007Arrangements for executing specific machine instructions to perform operations on data operands
    • G06F9/3001Arithmetic instructions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/3005Arrangements for executing specific machine instructions to perform operations for flow control
    • G06F9/30058Conditional branch instructions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30098Register arrangements
    • G06F9/3012Organisation of register space, e.g. banked or distributed register file
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/06Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
    • G06N3/063Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Algebra (AREA)
  • Neurology (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Complex Calculations (AREA)

Abstract

본 개시(disclosure)는 일반적으로 컴퓨팅 기술에 관한 것으로, 보다 구체적으로 입력 행렬의 밀도에 기반하여 선택적 희소 행렬 곱셈을 위한 장치 및 방법에 관한 것이다. 희소 행렬 곱셈을 위한 가속기의 동작 방법은 제1 입력 행렬, 및 제2 입력 행렬에 대한 밀도를 식별하는 과정과, 제1입력 행렬, 및 제2 입력 행렬의 밀도를 비교하여 제1 곱셈 방식, 또는 제2 곱셈 방식 중 하나를 식별하는 과정과, 식별된 제1 곱셈 방식, 또는 제2 곱셈 방식 중 하나에 기반하여 제1 입력 행렬, 및 제2 입력 행렬에 대한 희소 행렬 곱셈을 수행하는 과정을 포함할 수 있다.This disclosure relates generally to computing technology, and more specifically to apparatus and methods for selective sparse matrix multiplication based on the density of an input matrix. The operating method of the accelerator for sparse matrix multiplication includes a process of identifying densities for a first input matrix and a second input matrix, and a first multiplication method by comparing the densities of the first input matrix and the second input matrix, or Identifying one of the second multiplication methods, and performing sparse matrix multiplication on the first input matrix and the second input matrix based on one of the identified first multiplication method or the second multiplication method. can do.

Description

입력 행렬의 밀도에 기반하여 선택적 희소 행렬 곱셈을 위한 장치 및 방법{APPARATUS AND METHOD FOR SELECTIVE SPARSE MATRIX MULTIPLICATION BASED ON DENSITY OF INPUT MATRIX} Apparatus and method for selective sparse matrix multiplication based on density of input matrix {APPARATUS AND METHOD FOR SELECTIVE SPARSE MATRIX MULTIPLICATION BASED ON DENSITY OF INPUT MATRIX}

본 개시(disclosure)는 일반적으로 컴퓨팅 기술에 관한 것으로, 보다 구체적으로 입력 행렬의 밀도에 기반하여 선택적 희소 행렬 곱셈을 위한 장치 및 방법에 관한 것이다.This disclosure relates generally to computing technology, and more specifically to apparatus and methods for selective sparse matrix multiplication based on the density of an input matrix.

최근 컴퓨팅 기술의 획기적인 발전으로 인공 지능과 빅 데이터의 시대가 도래하였다. 빅 데이터는 그 이름에 걸맞게 무수히 많은 수의 데이터들을 다루며, 이 데이터 간에 상관관계는 행렬로 표현될 수 있다. 서로 다른 데이터 간에 상관관계가 없는 경우 원소의 값은 0으로 표현되며, 0의 값을 가지는 원소가 대부분을 차지하는 경우, 희소 행렬(sparse matrix) 이라 불린다. 이와 같은 희소 행렬은 슈퍼컴퓨팅 (HPC, high-performance computing), 머신 러닝, 그래프 분석, 또는 과학적 시뮬레이션과 같이 다양한 분야에서 활용되고 있다.Recent breakthroughs in computing technology have ushered in the era of artificial intelligence and big data. Big data, as its name suggests, deals with countless amounts of data, and the correlation between this data can be expressed as a matrix. If there is no correlation between different data, the value of the element is expressed as 0, and if most elements have a value of 0, it is called a sparse matrix. Such sparse matrices are used in various fields such as supercomputing (high-performance computing), machine learning, graph analysis, or scientific simulation.

상술한 바와 같은 논의를 바탕으로, 본 개시(disclosure)는, 입력 행렬의 밀도에 기반하여 선택적 희소 행렬 곱셈을 위한 장치 및 방법을 제공한다.Based on the above-described discussion, the present disclosure provides an apparatus and method for selective sparse matrix multiplication based on the density of the input matrix.

또한, 본 개시는, 입력 행렬의 밀도를 비교하여 선택적으로 희소 행렬 곱셈 방식을 결정하기 위한 장치 및 방법을 제공한다.Additionally, the present disclosure provides an apparatus and method for selectively determining a sparse matrix multiplication method by comparing densities of input matrices.

또한, 본 개시는, 입력 행렬의 밀도를 비교하여 더 적은 메모리가 요구되는 희소 행렬 곱셈 방식을 결정하기 위한 장치 및 방법을 제공한다.Additionally, the present disclosure provides an apparatus and method for comparing the densities of input matrices to determine a sparse matrix multiplication scheme that requires less memory.

본 개시의 다양한 실시 예들에 따르면, 희소 행렬 곱셈을 위한 가속기의 동작 방법은 제1 입력 행렬, 및 제2 입력 행렬에 대한 밀도를 식별하는 과정과, 제1입력 행렬, 및 제2 입력 행렬의 밀도를 비교하여 제1 곱셈 방식, 또는 제2 곱셈 방식 중 하나를 식별하는 과정과, 식별된 제1 곱셈 방식, 또는 제2 곱셈 방식 중 하나에 기반하여 제1 입력 행렬, 및 제2 입력 행렬에 대한 희소 행렬 곱셈을 수행하는 과정을 포함할 수 있다.According to various embodiments of the present disclosure, a method of operating an accelerator for sparse matrix multiplication includes a process of identifying densities for a first input matrix and a second input matrix, and densities of the first input matrix and the second input matrix. identifying one of the first multiplication method or the second multiplication method by comparing and, based on one of the identified first multiplication method or the second multiplication method, for the first input matrix and the second input matrix. It may include a process of performing sparse matrix multiplication.

본 개시의 다양한 실시 예들에 따르면, 희소 행렬 곱셈을 위한 가속기에 있어서, 메모리와 상기 메모리와 동작 가능하게 연결된 프로세서를 포함하고, 프로세서는, 제1 입력 행렬, 및 제2 입력 행렬에 대한 밀도를 식별하고, 제1입력 행렬, 및 제2 입력 행렬의 밀도를 비교하여 제1 곱셈 방식, 또는 제2 곱셈 방식 중 하나를 식별하고, 식별된 제1 곱셈 방식, 또는 제2 곱셈 방식 중 하나에 기반하여 제1 입력 행렬, 및 제2 입력 행렬에 대한 희소 행렬 곱셈을 수행할 수 있다.According to various embodiments of the present disclosure, an accelerator for sparse matrix multiplication includes a memory and a processor operably connected to the memory, wherein the processor identifies densities for a first input matrix and a second input matrix. and compare the densities of the first input matrix and the second input matrix to identify either the first multiplication method or the second multiplication method, and based on one of the identified first multiplication method or the second multiplication method Sparse matrix multiplication may be performed on the first input matrix and the second input matrix.

본 개시의 다양한 실시 예들에 따르면, 명령어들을 포함하는 하나 이상의 프로그램을 저장하는 비-일시적인 컴퓨터 판독가능 저장 매체(Non-transitory Computer Readable Storage Medium)로서, 명령어들은, 가속기에 의해 실행될 때, 가속기로 하여금, 제1 입력 행렬, 및 제2 입력 행렬에 대한 밀도를 식별하고, 제1입력 행렬, 및 제2 입력 행렬의 밀도를 비교하여 제1 곱셈 방식, 또는 제2 곱셈 방식 중 하나를 식별하고, 식별된 제1 곱셈 방식, 또는 제2 곱셈 방식 중 하나에 기반하여 제1 입력 행렬, 및 제2 입력 행렬에 대한 희소 행렬 곱셈을 수행할 수 있다.According to various embodiments of the present disclosure, a non-transitory computer readable storage medium stores one or more programs including instructions, where the instructions, when executed by an accelerator, cause the accelerator to , identify the densities for the first input matrix, and the second input matrix, compare the densities of the first input matrix, and the second input matrix to identify either the first multiplication scheme or the second multiplication scheme, and identify Sparse matrix multiplication of the first input matrix and the second input matrix may be performed based on one of the first multiplication method or the second multiplication method.

본 개시의 다양한 실시 예들에 따른 장치 및 방법은, 희소 행렬 곱셈에서 더 효율적인 데이터 흐름을 선택함으로써, 희소 행렬의 곱셈 연산 성능을 향상시킬 수 있게 한다.Apparatus and methods according to various embodiments of the present disclosure can improve the performance of sparse matrix multiplication operations by selecting a more efficient data flow in sparse matrix multiplication.

본 개시에서 얻을 수 있는 효과는 이상에서 언급한 효과들로 제한되지 않으며, 언급하지 않은 또 다른 효과들은 아래의 기재로부터 본 개시가 속하는 기술 분야에서 통상의 지식을 가진 자에게 명확하게 이해될 수 있을 것이다.The effects that can be obtained from the present disclosure are not limited to the effects mentioned above, and other effects not mentioned can be clearly understood by those skilled in the art from the description below. will be.

도 1은 본 개시의 다양한 실시 예에 따라, 희소 행렬의 대표적인 저장 방식인 Compressed Sparse Row(CSR)와 Compressed Sparse Column(CSC)를 도시한다.
도 2는 본 개시의 다양한 실시 예에 따라, 희소 행렬의 곱셈에서 활용할 수 있는 데이터 흐름을 도시한다.
도 3은 본 개시의 일 실시 예에 따라, 밀도가 다른 두 행렬의 곱셈 연산의 메모리 접근 과정의 일 예를 도시한다.
도 4는 본 개시의 일 실시 예에 따라, 밀도가 다른 두 행렬의 곱셈 연산의 메모리 접근 수에 대한 그래프를 도시한다.
도 5는 본 개시의 일 실시 예에 따른, 입력 행렬 밀도에 기반한 선택적 희소 행렬 곱셈 방법의 흐름도를 도시한다.
도 6의 본 개시의 일 실시 예에 따른, 희소행렬 곱셈을 위한 가속기의 동작 방법을 도시한다.
도 7은 본 개시의 다양한 실시예에 따른 가속기의 구성을 도시한다.
1 illustrates Compressed Sparse Row (CSR) and Compressed Sparse Column (CSC), which are representative storage methods of sparse matrices, according to various embodiments of the present disclosure.
2 illustrates data flows that can be utilized in multiplication of a sparse matrix, according to various embodiments of the present disclosure.
Figure 3 shows an example of a memory access process of a multiplication operation of two matrices with different densities, according to an embodiment of the present disclosure.
Figure 4 shows a graph of the number of memory accesses of a multiplication operation of two matrices with different densities, according to an embodiment of the present disclosure.
Figure 5 shows a flow diagram of a selective sparse matrix multiplication method based on input matrix density, according to an embodiment of the present disclosure.
FIG. 6 illustrates a method of operating an accelerator for sparse matrix multiplication according to an embodiment of the present disclosure.
7 shows the configuration of an accelerator according to various embodiments of the present disclosure.

본 개시에서 사용되는 용어들은 단지 특정한 실시 예를 설명하기 위해 사용된 것으로, 다른 실시 예의 범위를 한정하려는 의도가 아닐 수 있다. 단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함할 수 있다. 기술적이거나 과학적인 용어를 포함해서 여기서 사용되는 용어들은 본 개시에 기재된 기술 분야에서 통상의 지식을 가진 자에 의해 일반적으로 이해되는 것과 동일한 의미를 가질 수 있다. 본 개시에 사용된 용어들 중 일반적인 사전에 정의된 용어들은, 관련 기술의 문맥상 가지는 의미와 동일 또는 유사한 의미로 해석될 수 있으며, 본 개시에서 명백하게 정의되지 않는 한, 이상적이거나 과도하게 형식적인 의미로 해석되지 않는다. 경우에 따라서, 본 개시에서 정의된 용어일지라도 본 개시의 실시 예들을 배제하도록 해석될 수 없다.Terms used in the present disclosure are merely used to describe specific embodiments and may not be intended to limit the scope of other embodiments. Singular expressions may include plural expressions, unless the context clearly dictates otherwise. Terms used herein, including technical or scientific terms, may have the same meaning as commonly understood by a person of ordinary skill in the technical field described in this disclosure. Among the terms used in this disclosure, terms defined in general dictionaries may be interpreted to have the same or similar meaning as the meaning they have in the context of related technology, and unless clearly defined in this disclosure, have an ideal or excessively formal meaning. It is not interpreted as In some cases, even terms defined in the present disclosure cannot be interpreted to exclude embodiments of the present disclosure.

이하에서 설명되는 본 개시의 다양한 실시 예들에서는 하드웨어적인 접근 방법을 예시로서 설명한다. 하지만, 본 개시의 다양한 실시 예들에서는 하드웨어와 소프트웨어를 모두 사용하는 기술을 포함하고 있으므로, 본 개시의 다양한 실시 예들이 소프트웨어 기반의 접근 방법을 제외하는 것은 아니다.In various embodiments of the present disclosure described below, a hardware approach method is explained as an example. However, since various embodiments of the present disclosure include technology using both hardware and software, the various embodiments of the present disclosure do not exclude software-based approaches.

또한, 본 개시의 상세한 설명 및 청구항에서는 “적어도 하나의 A, B 및 C(at least one of A, B, and C)는, “오직 A”, “오직 B”, “오직 C” 또는 “A, B 및 C의 임의의 모든 조합(any combination of A, B, and C)”를 의미할 수 있다. 또한, “적어도 하나의 A, B 또는 C(at least one of A, B, or C)”나 적어도 하나의 A, B, 및/또는 C(at least one of A, B, and/or C)”는 “적어도 하나의 A, B, 및 C(at least one of A, B, and C)”를 의미할 수 있다.Additionally, in the detailed description and claims of the present disclosure, “at least one of A, B, and C” means “only A,” “only B,” “only C,” or “A.” , any combination of A, B, and C.” Also, “at least one of A, B, or C” or at least one of A, B, and/or C ” may mean “at least one of A, B, and C.”

이하 본 개시는 무선 통신 시스템에서 입력 행렬의 밀도에 기반하여 선택적 희소 행렬 곱셈을 위한 장치 및 방법에 관한 것이다. 구체적으로, 본 개시는 희소 행렬 곱셈에서 더 효율적인 데이터 흐름을 선택함으로써, 희소 행렬의 곱셈 연산 성능을 향상시킬기 위한 기술을 설명한다. 구체적으로, 희소 행렬 곱셈의 과정에서 더 효율적인 데이터 흐름을 선택하여 곱셈을 연산할 수 있는 기법에 관한 것이다.Hereinafter, the present disclosure relates to an apparatus and method for selective sparse matrix multiplication based on the density of an input matrix in a wireless communication system. Specifically, this disclosure describes techniques for improving the performance of sparse matrix multiplication operations by selecting more efficient data flows in sparse matrix multiplication. Specifically, it concerns a technique for calculating multiplication by selecting a more efficient data flow in the process of sparse matrix multiplication.

행렬의 모든 원소를 배열의 형태로 저장하는 밀집 행렬과는 달리, 희소 행렬은 저장 공간 및 연산의 효율성을 위해 0이 아닌 원소만을 압축된 형태로 저장한다.Unlike dense matrices, which store all elements of a matrix in the form of an array, sparse matrices store only non-zero elements in compressed form for storage space and computational efficiency.

도 1은 본 개시의 다양한 실시 예에 따라, 희소 행렬의 대표적인 저장 방식인 Compressed Sparse Row(CSR)와 Compressed Sparse Column(CSC)를 도시한다.1 illustrates Compressed Sparse Row (CSR) and Compressed Sparse Column (CSC), which are representative storage methods of sparse matrices, according to various embodiments of the present disclosure.

도 1을 참조하면, CSR은 3개의 배열을 가지며, 이는 각각 행 오프셋(row offset), 열 인덱스(column index), 그리고 값을 저장하는데 사용된다. 여기서 값을 저장하는 배열은 행 우선 순서(row-major order)로 정렬되어 있으며, 행 오프셋 배열 그리고 열 인덱스 배열은 0이 아닌 값의 위치를 나타내는데 사용된다. CSR 형태로 저장된 행렬의 값을 읽기 위해서는 아래와 같은 순서의 동작이 필요하다.Referring to Figure 1, CSR has three arrays, which are used to store row offset, column index, and value, respectively. Here, the array that stores the values is sorted in row-major order, and the row offset array and column index array are used to indicate the location of non-zero values. To read the value of a matrix stored in CSR format, the following sequence of operations is required.

(동작 1) 행 오프셋 배열에 접근하여 해당 행이 0의 값이 아닌 원소를 얼마나 가지고 있는지 그리고 열 인덱스 배열과 값 배열에서 해당 행에 속하는 원소의 시작 지점이 어디인지를 판단한다. 예를 들어, i번째 행에 대한 정보를 얻기 위해서는, 행 오프셋 배열의 i번째 원소와 i+1번째 원소의 차를 구해 몇 개의 0이 아닌 값이 해당 행에 존재하는지 파악할 수 있으며, 해당 행에 속하는 원소들에 접근하기 위해 행 오프셋 배열의 i번째 원소의 값을 참조하면 열 인덱스 배열과 값 배열에서 해당 행의 시작 인덱스 지점을 파악할 수 있다.(Operation 1) Access the row offset array and determine how many elements the row has that are not 0 and where the starting point of the element belonging to the row is in the column index array and value array. For example, to obtain information about the i-th row, you can find the difference between the i-th element and the i+1-th element of the row offset array to determine how many non-zero values exist in that row. To access the belonging elements, by referring to the value of the ith element of the row offset array, you can determine the starting index point of the row in the column index array and value array.

(동작 2) 위의 과정에서 구한 시작 지점에서 해당 행에 존재하는 0이 아닌 원소의 개수 n만큼 읽어온다.(Action 2) The number n of non-zero elements in the row is read from the starting point obtained in the above process.

CSC는 CSR과 유사하며, 각 배열이 행 우선 순서가 아닌 열 우선 순서(column-major order)로 되어있다는 점이 다르다.CSC is similar to CSR, except that each array is in column-major order rather than row-major order.

이러한 압축된 저장 방식은 희소 행렬에 접근하는 과정에서 불규칙(irregular)하고, 간접적(indirect)인 메모리 접근을 요구하게 된다. 이러한 특징으로 희소 행렬은 일반적으로 메모리-바운드(memory-bound)의 특징을 가지는 것으로 알려져 있으며, 범용 프로세서인 중앙 처리 장치(Central Processing Unit, CPU)와 그래픽 처리 장치(Graphic Processing Unit, GPU)에서 희소 행렬을 활용한 연산을 하는 경우 해당 프로세서가 제공하는 연산 자원을 충분히 활용하지 못하고 낮은 성능을 보여준다. 희소 행렬을 활용하는 다양한 알고리즘 중, 희소 행렬 간의 곱셈은 중요한 연산으로 간주되지만, 상기 언급한 바와 같이 범용 프로세서에서는 충분하지 못한 성능을 가진다. 따라서 희소 행렬 곱셈의 알고리즘적 특성을 고려하여 보다 더 효율적으로 연산을 할 수 있는 가속기에 대한 연구가 진행되어오고 있다.This compressed storage method requires irregular and indirect memory access in the process of accessing the sparse matrix. Due to these characteristics, sparse matrices are generally known to have memory-bound characteristics, and are sparse in general-purpose processors such as the Central Processing Unit (CPU) and Graphic Processing Unit (GPU). When performing calculations using matrices, the computational resources provided by the processor are not fully utilized, resulting in low performance. Among various algorithms that utilize sparse matrices, multiplication between sparse matrices is considered an important operation, but as mentioned above, it has insufficient performance in general-purpose processors. Therefore, research has been conducted on accelerators that can perform more efficient operations by taking into account the algorithmic characteristics of sparse matrix multiplication.

도 2는 본 개시의 다양한 실시 예에 따라, 희소 행렬의 곱셈에서 활용할 수 있는 데이터 흐름을 도시한다.2 illustrates data flows that can be utilized in multiplication of a sparse matrix, according to various embodiments of the present disclosure.

도 2를 참조하면, 기존에 제안된 가속기들은 이 여러 데이터 흐름에서 한 가지를 선택하여 해당 데이터 흐름에 맞추어 효율적인 가속기 구조를 제안하고 있다. 한 가속기 구조가 하나의 데이터 흐름을 선택하기에, 선택하지 않은 다른 데이터 흐름이 가지는 장점은 활용하기 어렵다는 문제점을 가지고 있다.Referring to FIG. 2, previously proposed accelerators select one from these multiple data flows and propose an efficient accelerator structure tailored to that data flow. Since one accelerator structure selects one data flow, it has the problem that it is difficult to utilize the advantages of other data flows that were not selected.

본 개시는 전술한 기존의 가속기 구조가 단순히 하나의 데이터 흐름을 선택한 것과는 다르게, 상황에 따라 두 개의 데이터 흐름 중 하나를 선택하는 기법을 제안한다. 이 기법을 활용해 희소 행렬의 곱셈 연산 과정에서 메모리 접근 수를 감소시킴으로써 연산의 높은 성능을 달성하는데 그 목적이 있다.Unlike the existing accelerator structure described above that simply selects one data flow, this disclosure proposes a technique for selecting one of two data flows depending on the situation. The purpose of this technique is to achieve high performance by reducing the number of memory accesses during the multiplication operation of a sparse matrix.

도 2를 참조하면, 여러 데이터 흐름 중 row-wise product와 column-wise product은 굉장히 유사한 방식과 특징을 가지고 있다. 두 방식의 차이점으로는, row-wise product는 두 입력 행렬 중 첫 번째 입력 행렬(행렬 A)을 기준으로, 해당 행이 가지는 0이 아닌 값을 가지는 원소의 열 인덱스를 활용하여 두 번째 입력 행렬(행렬 B)의 행에 접근하여 곱셈을 진행하며, column-wise product는 행렬 B를 기준으로 해당 열이 가지는 0이 아닌 값을 가지는 원소의 행 인덱스를 활용하여 행렬 A의 열에 접근하여 곱셈을 진행한다.Referring to Figure 2, among various data flows, row-wise product and column-wise product have very similar methods and characteristics. The difference between the two methods is that the row-wise product uses the column index of the element with a non-zero value in the row based on the first input matrix (matrix A) of the two input matrices to create the second input matrix (matrix A). Multiplication is performed by accessing the row of matrix B, and the column-wise product is multiplied by accessing the column of matrix A using the row index of the element with a non-zero value in the corresponding column based on matrix B. .

본 개시는 전술한 두 개의 다른 곱셈의 방식이 서로 다른 입력 행렬을 기준으로 한다는 점에 주목한다. 즉, 서로 다른 희소 행렬을 곱하는 경우, 두 행렬은 서로 다른 밀도를 가지고 있을 확률이 높다. 두 희소 행렬의 밀도가 다른 경우, 하나의 희소 행렬은 상대적으로 낮은 밀도를 가지며, 이는 해당 행렬이 갖는 0이 아닌 값을 가진 원소의 절대적인 수가 적음을 의미한다. Row-wise product 및 column-wise product에 기반한 데이터 흐름을 고려할 때, 기준으로 삼는 입력 행렬에서 0이 아닌 값을 갖는 원소의 수가 적을 수록 더 적은 메모리 접근을 요구하게 된다. 예를 들어, row-wise product 데이터 흐름을 활용해 연산을 진행하는 경우, 행렬 A의 0이 아닌 값의 수만큼 행렬 B의 행에 접근을 요구한다.The present disclosure notes that the two different multiplication methods described above are based on different input matrices. In other words, when multiplying different sparse matrices, there is a high probability that the two matrices have different densities. When two sparse matrices have different densities, one sparse matrix has a relatively lower density, which means that the absolute number of elements with non-zero values in that matrix is smaller. Considering data flow based on row-wise product and column-wise product, the fewer the number of elements with non-zero values in the reference input matrix, the less memory access is required. For example, when performing an operation using the row-wise product data flow, access to the number of rows of matrix B equal to the number of non-zero values in matrix A is required.

도 3은 본 개시의 일 실시 예에 따라, 밀도가 다른 두 행렬의 곱셈 연산의 메모리 접근 과정의 일 예를 도시한다.Figure 3 shows an example of a memory access process of a multiplication operation of two matrices with different densities, according to an embodiment of the present disclosure.

도 3을 참조하면, 도 3의 (a)의 경우 행렬 A의 밀도가 행렬 B의 밀도보다 낮은 경우에 대한 경우로, 행렬 A의 존재하는 0이 아닌 값의 수가 행렬 B에 존재하는 0이 아닌 값의 수보다 적으므로, 이는 row-wise product가 column-wise product보다 적은 메모리 접근을 요구함을 알 수 있다.Referring to Figure 3, (a) of Figure 3 is a case where the density of matrix A is lower than the density of matrix B, and the number of non-zero values present in matrix A is greater than the number of non-zero values present in matrix B. Since it is less than the number of values, it can be seen that the row-wise product requires less memory access than the column-wise product.

도 3의 (b)의 경우 행렬 A의 밀도가 행렬 B의 밀도보다 높은 경우로, 위와 반대의 이유로 column-wise product를 활용하는 것이 더 적은 메모리 접근을 필요로 함을 알 수 있다.In the case of Figure 3(b), the density of matrix A is higher than that of matrix B, and for the opposite reason as above, it can be seen that using the column-wise product requires less memory access.

도 4는 본 개시의 일 실시 예에 따라, 밀도가 다른 두 행렬의 곱셈 연산의 메모리 접근 수에 대한 그래프를 도시한다.Figure 4 shows a graph of the number of memory accesses of a multiplication operation of two matrices with different densities, according to an embodiment of the present disclosure.

도 4를 참조하면, 밀도가 서로 다른 3개의 희소 행렬 중 서로 다른 두 개의 행렬을 곱하는 과정에서 필요한 메모리 접근 수를 실험을 통해 구한 결과이다. 도 4에서 Sparse, Moderate, 그리고 Dense의 용어는 각 희소 행렬의 상대적인 밀도 차이를 나타내기 위해 사용하였다. 상기 언급한 바와 같이, 행렬 A의 밀도가 행렬 B의 밀도보다 낮은 경우, row-wise product가 더 적은 메모리 접근을 요구함을 확인할 수 있으며, 행렬 A의 밀도가 행렬 B의 밀도보다 높은 경우, column-wise product가 더 적은 메모리 접근을 요구함을 확인할 수 있다.Referring to Figure 4, this is the result of experimentally determining the number of memory accesses required in the process of multiplying two different matrices among three sparse matrices with different densities. In Figure 4, the terms Sparse, Moderate, and Dense are used to indicate the relative density difference of each sparse matrix. As mentioned above, when the density of matrix A is lower than the density of matrix B, it can be seen that the row-wise product requires fewer memory accesses, and when the density of matrix A is higher than the density of matrix B, the row-wise product can be confirmed to require fewer memory accesses. It can be seen that the wise product requires less memory access.

도 5는 본 개시의 일 실시 예에 따른, 입력 행렬 밀도에 기반한 선택적 희소 행렬 곱셈 방법의 흐름도를 도시한다.Figure 5 shows a flow diagram of a selective sparse matrix multiplication method based on input matrix density, according to an embodiment of the present disclosure.

도 5를 참조하면, 전술한 row-wise product와 column-wise product의 동작 방식을 도 5와 같이 정리할 수 있으며, 이 두 개의 데이터 흐름은 사실상 동일한 순서로 동작하므로 동일한 가속기 구조를 활용할 수 있음을 알 수 있다. 추가적으로 고려할 부분은 row-wise product를 활용하는 경우 희소 행렬의 표현 방식을 CSR과 같은 행 우선 순서로 정렬된 표현 방식을 활용해야 하며, column-wise product를 활용하는 경우 CSC와 같은 열 우선 순서로 정렬된 표현 방식을 활용하는 것이 효율적이다. 또한 두개의 데이터 흐름이 기준으로 하는 행렬이 다르므로, 가속기에 행렬 정보를 입력할 때 적절한 조절이 필요하다.Referring to FIG. 5, the operation methods of the row-wise product and column-wise product described above can be summarized as shown in FIG. 5, and it can be seen that these two data flows operate in virtually the same order, so the same accelerator structure can be utilized. You can. An additional consideration is that when using a row-wise product, the sparse matrix must be expressed in a row-first order such as CSR, and when using a column-wise product, the sparse matrix must be expressed in a column-first order such as CSC. It is efficient to use the established expression method. Additionally, since the matrices on which the two data flows are based are different, appropriate adjustments are required when inputting matrix information to the accelerator.

정리하면, 본 발명은 row-wise product와 column-wise product의 데이터 흐름이 사실상 동일한 순서로 연산이 진행되기에, 같은 가속기 구조에서 두 입력 행렬의 밀도에 따라 메모리 접근 수를 적게 요구하는 데이터 흐름을 활용하여 메모리-바운드(memory-bound)인 희소 행렬 곱셈을 가속시킬 수 있는 방안을 제시한다.In summary, the present invention provides a data flow that requires a small number of memory accesses depending on the density of the two input matrices in the same accelerator structure because the data flows of the row-wise product and the column-wise product are operated in virtually the same order. We propose a method to accelerate memory-bound sparse matrix multiplication.

본 개시는 행렬의 밀도 정보를 가지고 상황에 따라 두 가지 데이터 흐름 중 하나의 데이터 흐름을 활용해 메모리 접근 수를 줄이는 기법을 제시하였다. 이는 기존의 가속기 구조가 단 하나의 데이터 흐름만을 사용하는 점과는 다르게 구조를 바꾸지 않고 메모리 접근 수가 적은 데이터 흐름을 선택적으로 활용함으로써, 희소 행렬의 곱셈 연산 성능을 향상시킬 수 있는 장점이 있다.This disclosure presents a technique to reduce the number of memory accesses by using one of two data flows depending on the situation with matrix density information. This has the advantage of improving the multiplication operation performance of sparse matrices by selectively using data flows with a small number of memory accesses without changing the structure, unlike the existing accelerator structure that uses only one data flow.

도 6의 본 개시의 일 실시 예에 따른, 희소행렬 곱셈을 위한 가속기의 동작 방법을 도시한다.FIG. 6 illustrates a method of operating an accelerator for sparse matrix multiplication according to an embodiment of the present disclosure.

도 6을 참조하면, 가속기는 제1 입력 행렬, 및 제2 입력 행렬에 대한 밀도를 식별할 수 있다(601).Referring to FIG. 6, the accelerator may identify densities for the first input matrix and the second input matrix (601).

가속기는 제1 입력 행렬, 및 제2 입력 행렬에 대한 밀도를 비교하여 곱셈 방식을 식별할 수 있다(603). 일 실시 예에 따라, 행렬의 밀도는 상기 행렬이 갖는 0이 아닌 값을 가진 원소의 절대적 수에 기반하여 결정될 수 있다.The accelerator may identify the multiplication method by comparing densities for the first input matrix and the second input matrix (603). According to one embodiment, the density of a matrix may be determined based on the absolute number of elements with a non-zero value in the matrix.

가속기는 동작(603)에서 식별된 곱셈 방식에 기반하여 제1 입력 행렬, 및 제2 입력 행렬에 대한 희소 행렬 곱셈을 수행할 수 있다(605). 구체적으로, 제1 입력 행렬의 밀도가 제2 입력 행렬의 밀도보다 낮은 경우, 제1 곱셈 방식에 의하여 곱셈을 수행할 수 있다. 즉, 제1 곱셈 방식이 더 적은 수의 메모리를 요구하므로 제1 곱셈 방식에 의하여 희소 행렬 곱셈을 수행할 수 있다.The accelerator may perform sparse matrix multiplication on the first input matrix and the second input matrix based on the multiplication scheme identified in operation 603 (605). Specifically, when the density of the first input matrix is lower than the density of the second input matrix, multiplication may be performed using the first multiplication method. That is, since the first multiplication method requires less memory, sparse matrix multiplication can be performed using the first multiplication method.

일 실시 예에 따라, 제1 곱셈 방식은 제1 입력 행렬의 행(row)가 가지는 0이 아닌 값을 가지는 원소의 열 인덱스에 기반하여 제2 입력 행렬의 행에 대하여 곱셈을 수행하는 방식일 수 있다.According to one embodiment, the first multiplication method may be a method of performing multiplication on the row of the second input matrix based on the column index of the element having a non-zero value in the row of the first input matrix. there is.

일 실시 예에 따라, 제1 곱셈 방식은 row-wise product일 수 있다.According to one embodiment, the first multiplication method may be a row-wise product.

일 실시 예에 따라, 제1 입력 행렬의 밀도가 제2 입력 행렬의 밀도보다 높은 경우, 제2 곱셈 방식에 의하여 곱셈을 수행할 수 있다.According to one embodiment, when the density of the first input matrix is higher than the density of the second input matrix, multiplication may be performed using a second multiplication method.

일 실시 예에 따라, 제2 곱셈 방식은 제2 입력 행렬의 열(column)가 가지는 0이 아닌 값을 가지는 원소의 행 인덱스에 기반하여 제1 입력 행렬의 행에 대하여 곱셈을 수행할 수 있다. 즉, 제2 곱셈 방식이 더 적은 수의 메모리를 요구하므로 제1 곱셈 방식에 의하여 희소 행렬 곱셈을 수행할 수 있다.According to one embodiment, the second multiplication method may perform multiplication on the row of the first input matrix based on the row index of the element having a non-zero value in the column of the second input matrix. That is, since the second multiplication method requires less memory, sparse matrix multiplication can be performed using the first multiplication method.

일 실시 예에 따라, 제2 곱셈 방식은 column-wise product일 수 있다.According to one embodiment, the second multiplication method may be a column-wise product.

도 7은 본 개시의 다양한 실시예에 따른 가속기의 구성을 도시한다.7 shows the configuration of an accelerator according to various embodiments of the present disclosure.

도 7를 참조하면, 가속기(700)는 적어도 하나의 프로세서(710), 메모리(720) 및 통신을 수행하는 송수신 장치(730)를 포함할 수 있다. 또한, 가속기(700)는 입력 인터페이스 장치(740), 출력 인터페이스 장치(750), 저장 장치(760) 등을 더 포함할 수 있다. 가속기(700)에 포함된 각각의 구성 요소들은 버스(bus)(770)에 의해 연결되어 서로 통신을 수행할 수 있다.Referring to FIG. 7, the accelerator 700 may include at least one processor 710, a memory 720, and a transceiver 730 that performs communication. Additionally, the accelerator 700 may further include an input interface device 740, an output interface device 750, a storage device 760, etc. Each component included in the accelerator 700 is connected by a bus 770 and can communicate with each other.

다만, 가속기(700)에 포함된 각각의 구성요소들은 공통 버스(770)가 아니라, 프로세서(710)를 중심으로 개별 인터페이스 또는 개별 버스를 통하여 연결될 수도 있다. 예를 들어, 프로세서(710)는 메모리(720), 송수신 장치(730), 입력 인터페이스 장치(740), 출력 인터페이스 장치(750) 및 저장 장치(760) 중에서 적어도 하나와 전용 인터페이스를 통하여 연결될 수도 있다.However, each component included in the accelerator 700 may be connected through an individual interface or individual bus centered on the processor 710, rather than through the common bus 770. For example, the processor 710 may be connected to at least one of the memory 720, the transmission/reception device 730, the input interface device 740, the output interface device 750, and the storage device 760 through a dedicated interface. .

프로세서(710)는 메모리(720) 및 저장 장치(760) 중에서 적어도 하나에 저장된 프로그램 명령(program command)을 실행할 수 있다. 프로세서(710)는 중앙 처리 장치(central processing unit, CPU), 그래픽 처리 장치(graphics processing unit, GPU), 또는 본 발명의 실시예들에 따른 방법들이 수행되는 전용의 프로세서를 의미할 수 있다. 메모리(720) 및 저장 장치(760) 각각은 휘발성 저장 매체 및 비휘발성 저장매체 중에서 적어도 하나로 구성될 수 있다.The processor 710 may execute a program command stored in at least one of the memory 720 and the storage device 760. The processor 710 may refer to a central processing unit (CPU), a graphics processing unit (GPU), or a dedicated processor on which methods according to embodiments of the present invention are performed. Each of the memory 720 and the storage device 760 may be comprised of at least one of a volatile storage medium and a non-volatile storage medium.

프로세서(710)은 본 개시의 다양한 실시 예에 따른 도 1 내지 6에 포함된 모든 동작을 수행하기 위한 명령을 실행할 수 있다.The processor 710 may execute instructions to perform all operations included in FIGS. 1 to 6 according to various embodiments of the present disclosure.

본 개시의 청구항 또는 명세서에 기재된 실시 예들에 따른 방법들은 하드웨어, 소프트웨어, 또는 하드웨어와 소프트웨어의 조합의 형태로 구현될(implemented) 수 있다.Methods according to embodiments described in the claims or specification of the present disclosure may be implemented in the form of hardware, software, or a combination of hardware and software.

소프트웨어로 구현하는 경우, 하나 이상의 프로그램(소프트웨어 모듈)을 저장하는 컴퓨터 판독 가능 저장 매체가 제공될 수 있다. 컴퓨터 판독 가능 저장 매체에 저장되는 하나 이상의 프로그램은, 전자 장치(device) 내의 하나 이상의 프로세서에 의해 실행 가능하도록 구성된다(configured for execution). 하나 이상의 프로그램은, 전자 장치로 하여금 본 개시의 청구항 또는 명세서에 기재된 실시 예들에 따른 방법들을 실행하게 하는 명령어(instructions)를 포함한다.When implemented as software, a computer-readable storage medium that stores one or more programs (software modules) may be provided. One or more programs stored in a computer-readable storage medium are configured to be executable by one or more processors in an electronic device (configured for execution). One or more programs include instructions that cause the electronic device to execute methods according to embodiments described in the claims or specification of the present disclosure.

이러한 프로그램(소프트웨어 모듈, 소프트웨어)은 랜덤 액세스 메모리 (random access memory), 플래시(flash) 메모리를 포함하는 불휘발성(non-volatile) 메모리, 롬(read only memory, ROM), 전기적 삭제가능 프로그램가능 롬(electrically erasable programmable read only memory, EEPROM), 자기 디스크 저장 장치(magnetic disc storage device), 컴팩트 디스크 롬(compact disc-ROM, CD-ROM), 디지털 다목적 디스크(digital versatile discs, DVDs) 또는 다른 형태의 광학 저장 장치, 마그네틱 카세트(magnetic cassette)에 저장될 수 있다. 또는, 이들의 일부 또는 전부의 조합으로 구성된 메모리에 저장될 수 있다. 또한, 각각의 구성 메모리는 다수 개 포함될 수도 있다.These programs (software modules, software) may include random access memory, non-volatile memory, including flash memory, read only memory (ROM), and electrically erasable programmable ROM. (electrically erasable programmable read only memory, EEPROM), magnetic disc storage device, compact disc-ROM (CD-ROM), digital versatile discs (DVDs), or other types of disk storage. It can be stored in an optical storage device or magnetic cassette. Alternatively, it may be stored in a memory consisting of a combination of some or all of these. Additionally, multiple configuration memories may be included.

또한, 프로그램은 인터넷(Internet), 인트라넷(Intranet), LAN(local area network), WAN(wide area network), 또는 SAN(storage area network)과 같은 통신 네트워크, 또는 이들의 조합으로 구성된 통신 네트워크를 통하여 접근(access)할 수 있는 부착 가능한(attachable) 저장 장치(storage device)에 저장될 수 있다. 이러한 저장 장치는 외부 포트를 통하여 본 개시의 실시 예를 수행하는 장치에 접속할 수 있다. 또한, 통신 네트워크상의 별도의 저장장치가 본 개시의 실시 예를 수행하는 장치에 접속할 수도 있다.In addition, the program may be distributed through a communication network such as the Internet, an intranet, a local area network (LAN), a wide area network (WAN), or a storage area network (SAN), or a combination thereof. It may be stored on an attachable storage device that is accessible. This storage device can be connected to a device performing an embodiment of the present disclosure through an external port. Additionally, a separate storage device on a communication network may be connected to the device performing an embodiment of the present disclosure.

상술한 본 개시의 구체적인 실시 예들에서, 개시에 포함되는 구성 요소는 제시된 구체적인 실시 예에 따라 단수 또는 복수로 표현되었다. 그러나, 단수 또는 복수의 표현은 설명의 편의를 위해 제시한 상황에 적합하게 선택된 것으로서, 본 개시가 단수 또는 복수의 구성 요소에 제한되는 것은 아니며, 복수로 표현된 구성 요소라 하더라도 단수로 구성되거나, 단수로 표현된 구성 요소라 하더라도 복수로 구성될 수 있다.In the specific embodiments of the present disclosure described above, elements included in the disclosure are expressed in singular or plural numbers depending on the specific embodiment presented. However, the singular or plural expressions are selected to suit the presented situation for convenience of explanation, and the present disclosure is not limited to singular or plural components, and even components expressed in plural may be composed of singular or singular. Even expressed components may be composed of plural elements.

한편 본 개시의 상세한 설명에서는 구체적인 실시 예에 관해 설명하였으나, 본 개시의 범위에서 벗어나지 않는 한도 내에서 여러 가지 변형이 가능함은 물론이다. 그러므로 본 개시의 범위는 설명된 실시 예에 국한되어 정해져서는 아니 되며 후술하는 특허청구의 범위뿐만 아니라 이 특허청구의 범위와 균등한 것들에 의해 정해져야 한다.본 개시에서 사용되는 용어들은 단지 특정한 실시 예를 설명하기 위해 사용된 것으로, 다른 실시 예의 범위를 한정하려는 의도가 아닐 수 있다. 단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함할 수 있다. 기술적이거나 과학적인 용어를 포함해서 여기서 사용되는 용어들은 본 개시에 기재된 기술 분야에서 통상의 지식을 가진 자에 의해 일반적으로 이해되는 것과 동일한 의미를 가질 수 있다. 본 개시에 사용된 용어들 중 일반적인 사전에 정의된 용어들은, 관련 기술의 문맥상 가지는 의미와 동일 또는 유사한 의미로 해석될 수 있으며, 본 개시에서 명백하게 정의되지 않는 한, 이상적이거나 과도하게 형식적인 의미로 해석되지 않는다. 경우에 따라서, 본 개시에서 정의된 용어일지라도 본 개시의 실시 예들을 배제하도록 해석될 수 없다.Meanwhile, in the detailed description of the present disclosure, specific embodiments have been described, but of course, various modifications are possible without departing from the scope of the present disclosure. Therefore, the scope of the present disclosure should not be limited to the described embodiments, but should be determined by the scope of the patent claims described below as well as equivalents to the scope of the claims. The terms used in the present disclosure are only used for specific embodiments. It is used to explain examples and may not be intended to limit the scope of other embodiments. Singular expressions may include plural expressions, unless the context clearly dictates otherwise. Terms used herein, including technical or scientific terms, may have the same meaning as commonly understood by a person of ordinary skill in the technical field described in this disclosure. Among the terms used in this disclosure, terms defined in general dictionaries may be interpreted to have the same or similar meaning as the meaning they have in the context of related technology, and unless clearly defined in this disclosure, have an ideal or excessively formal meaning. It is not interpreted as In some cases, even terms defined in the present disclosure cannot be interpreted to exclude embodiments of the present disclosure.

이하에서 설명되는 본 개시의 다양한 실시 예들에서는 하드웨어적인 접근 방법을 예시로서 설명한다. 하지만, 본 개시의 다양한 실시 예들에서는 하드웨어와 소프트웨어를 모두 사용하는 기술을 포함하고 있으므로, 본 개시의 다양한 실시 예들이 소프트웨어 기반의 접근 방법을 제외하는 것은 아니다.In various embodiments of the present disclosure described below, a hardware approach method is explained as an example. However, since various embodiments of the present disclosure include technology using both hardware and software, the various embodiments of the present disclosure do not exclude software-based approaches.

또한, 본 개시의 상세한 설명 및 청구항에서는 “적어도 하나의 A, B 및 C(at least one of A, B, and C)는, “오직 A”, “오직 B”, “오직 C” 또는 “A, B 및 C의 임의의 모든 조합(any combination of A, B, and C)”를 의미할 수 있다. 또한, “적어도 하나의 A, B 또는 C(at least one of A, B, or C)”나 적어도 하나의 A, B, 및/또는 C(at least one of A, B, and/or C)”는 “적어도 하나의 A, B, 및 C(at least one of A, B, and C)”를 의미할 수 있다.Additionally, in the detailed description and claims of the present disclosure, “at least one of A, B, and C” means “only A,” “only B,” “only C,” or “A.” , any combination of A, B, and C.” Also, “at least one of A, B, or C” or at least one of A, B, and/or C ” may mean “at least one of A, B, and C.”

이하 본 개시는 무선 통신 시스템에서 입력 행렬의 밀도에 기반하여 선택적 희소 행렬 곱셈을 위한 장치 및 방법에 관한 것이다. 구체적으로, 본 개시는 희소 행렬 곱셈에서 더 효율적인 데이터 흐름을 선택함으로써, 희소 행렬의 곱셈 연산 성능을 향상시킬기 위한 기술을 설명한다. 구체적으로, 희소 행렬 곱셈의 과정에서 더 효율적인 데이터 흐름을 선택하여 곱셈을 연산할 수 있는 기법에 관한 것이다.Hereinafter, the present disclosure relates to an apparatus and method for selective sparse matrix multiplication based on the density of an input matrix in a wireless communication system. Specifically, this disclosure describes techniques for improving the performance of sparse matrix multiplication operations by selecting more efficient data flows in sparse matrix multiplication. Specifically, it concerns a technique for calculating multiplication by selecting a more efficient data flow in the process of sparse matrix multiplication.

행렬의 모든 원소를 배열의 형태로 저장하는 밀집 행렬과는 달리, 희소 행렬은 저장 공간 및 연산의 효율성을 위해 0이 아닌 원소만을 압축된 형태로 저장한다.Unlike dense matrices, which store all elements of a matrix in the form of an array, sparse matrices store only non-zero elements in compressed form for storage space and computational efficiency.

710: 프로세서
720: 메모리
730: 송수신 장치
740: 입력 인터페이스 장치
750: 출력 인터페이스 장치
760: 저장 장치
710: Processor
720: Memory
730: Transmitting and receiving device
740: Input interface device
750: Output interface device
760: storage device

Claims (20)

희소 행렬 곱셈을 위한 가속기의 동작 방법에 있어서,
제1 입력 행렬, 및 제2 입력 행렬에 대한 밀도를 식별하는 과정과,
상기 제1입력 행렬, 및 상기 제2 입력 행렬의 밀도를 비교하여 제1 곱셈 방식, 또는 제2 곱셈 방식 중 하나를 식별하는 과정과,
상기 식별된 제1 곱셈 방식, 또는 상기 제2 곱셈 방식 중 하나에 기반하여 상기 제1 입력 행렬, 및 제2 입력 행렬에 대한 희소 행렬 곱셈을 수행하는 과정을 포함하는 방법.
In a method of operating an accelerator for sparse matrix multiplication,
identifying densities for a first input matrix and a second input matrix;
Comparing densities of the first input matrix and the second input matrix to identify either a first multiplication method or a second multiplication method;
A method comprising performing sparse matrix multiplication on the first input matrix and the second input matrix based on one of the identified first multiplication method or the second multiplication method.
청구항 1에 있어서, 상기 제1 곱셈 방식, 또는 제2 곱셈 방식 중 하나를 식별하는 과정은,
상기 제1 입력 행렬의 밀도가 제2 입력 행렬의 밀도보다 낮은 경우, 제1 곱셈 방식에 의하여 곱셈을 수행하는 과정을 포함하는, 방법
The method of claim 1, wherein the process of identifying one of the first multiplication method or the second multiplication method comprises:
When the density of the first input matrix is lower than the density of the second input matrix, the method includes performing multiplication by a first multiplication method.
청구항 1에 있어서, 상기 제1 곱셈 방식, 또는 제2 곱셈 방식 중 하나를 식별하는 과정은,
상기 제1 입력 행렬의 밀도가 제2 입력 행렬의 밀도보다 높은 경우, 제2 곱셈 방식에 의하여 곱셈을 수행하는 과정을 포함하는, 방법
The method of claim 1, wherein the process of identifying one of the first multiplication method or the second multiplication method comprises:
When the density of the first input matrix is higher than the density of the second input matrix, the method includes performing multiplication by a second multiplication method.
청구항 1에 있어서, 상기 제1 곱셈 방식은 제1 입력 행렬의 행(row)가 가지는 0이 아닌 값을 가지는 원소의 열 인덱스에 기반하여 제2 입력 행렬의 행에 대하여 곱셈을 수행하는 방식인, 방법The method of claim 1, wherein the first multiplication method is a method of performing multiplication on the rows of the second input matrix based on the column index of the element having a non-zero value in the row of the first input matrix. method 청구항 1에 있어서, 상기 제2 곱셈 방식은 제2 입력 행렬의 열(column)가 가지는 0이 아닌 값을 가지는 원소의 행 인덱스에 기반하여 제1 입력 행렬의 행에 대하여 곱셈을 수행하는 방식인, 방법The method of claim 1, wherein the second multiplication method is a method of performing multiplication on the rows of the first input matrix based on the row index of the element having a non-zero value in the column of the second input matrix. method 청구항 1에 있어서, 상기 행렬의 밀도는 상기 행렬이 갖는 0이 아닌 값을 가진 원소의 절대적 수에 기반하여 결정되는, 방법The method of claim 1, wherein the density of the matrix is determined based on the absolute number of elements with non-zero values in the matrix. 청구항 2에 있어서, 상기 제1 입력 행렬의 밀도가 제2 입력 행렬의 밀도보다 낮은 경우, 제1 곱셈 방식에 의하여 곱셈을 수행하는 경우, 제1 곱셈 방식이 제2 곱셈 방식에 비하여 적은 메모리 수를 요구하는, 방법The method of claim 2, when the density of the first input matrix is lower than the density of the second input matrix, and when multiplication is performed by the first multiplication method, the first multiplication method has a smaller number of memories than the second multiplication method. asking how 청구항 3에 있어서, 상기 제1 입력 행렬의 밀도가 제2 입력 행렬의 밀도보다 높은 경우, 제2 곱셈 방식에 의하여 곱셈을 수행하는 경우, 제2 곱셈 방식이 제1 곱셈 방식에 비하여 적은 메모리 수를 요구하는, 방법The method of claim 3, when the density of the first input matrix is higher than the density of the second input matrix, and when multiplication is performed by the second multiplication method, the second multiplication method has a smaller number of memories than the first multiplication method. asking how 희소 행렬 곱셈을 위한 가속기에 있어서,
메모리와
상기 메모리와 동작 가능하게 연결된 프로세서를 포함하고,
상기 프로세서는,
제1 입력 행렬, 및 제2 입력 행렬에 대한 밀도를 식별하고,
상기 제1입력 행렬, 및 상기 제2 입력 행렬의 밀도를 비교하여 제1 곱셈 방식, 또는 제2 곱셈 방식 중 하나를 식별하고,
상기 식별된 제1 곱셈 방식, 또는 상기 제2 곱셈 방식 중 하나에 기반하여 상기 제1 입력 행렬, 및 제2 입력 행렬에 대한 희소 행렬 곱셈을 수행하는, 장치
In an accelerator for sparse matrix multiplication,
memory and
Comprising a processor operably connected to the memory,
The processor,
Identify densities for a first input matrix and a second input matrix,
Compare densities of the first input matrix and the second input matrix to identify either a first multiplication method or a second multiplication method,
Apparatus for performing sparse matrix multiplication on the first input matrix and the second input matrix based on one of the identified first multiplication scheme or the second multiplication scheme.
청구항 9에 있어서, 상기 프로세서는, 상기 제1 곱셈 방식, 또는 제2 곱셈 방식 중 하나를 식별하기 위하여, 상기 제1 입력 행렬의 밀도가 제2 입력 행렬의 밀도보다 낮은 경우, 제1 곱셈 방식에 의하여 곱셈을 수행하는, 장치The method of claim 9, wherein, to identify one of the first multiplication method or the second multiplication method, the processor determines whether the density of the first input matrix is lower than the density of the second input matrix, to the first multiplication method. device that performs multiplication 청구항 9에 있어서, 상기 프로세서는, 상기 제1 곱셈 방식, 또는 제2 곱셈 방식 중 하나를 식별하기 위하여, 상기 제1 입력 행렬의 밀도가 제2 입력 행렬의 밀도보다 높은 경우, 제2 곱셈 방식에 의하여 곱셈을 수행하는, 장치The method of claim 9, wherein, in order to identify one of the first multiplication method or the second multiplication method, the processor, when the density of the first input matrix is higher than the density of the second input matrix, applies to the second multiplication method. device that performs multiplication 청구항 9에 있어서, 상기 제1 곱셈 방식은 제1 입력 행렬의 행(row)가 가지는 0이 아닌 값을 가지는 원소의 열 인덱스에 기반하여 제2 입력 행렬의 행에 대하여 곱셈을 수행하는 방식인, 장치The method of claim 9, wherein the first multiplication method is a method of performing multiplication on the rows of the second input matrix based on the column index of the element having a non-zero value in the row of the first input matrix. Device 청구항 9에 있어서, 상기 제2 곱셈 방식은 제2 입력 행렬의 열(column)가 가지는 0이 아닌 값을 가지는 원소의 행 인덱스에 기반하여 제1 입력 행렬의 행에 대하여 곱셈을 수행하는 방식인, 장치The method of claim 9, wherein the second multiplication method is a method of performing multiplication on the rows of the first input matrix based on the row index of the element having a non-zero value in the column of the second input matrix. Device 청구항 9에 있어서, 상기 행렬의 밀도는 상기 행렬이 갖는 0이 아닌 값을 가진 원소의 절대적 수에 기반하여 결정되는, 장치The device of claim 9, wherein the density of the matrix is determined based on the absolute number of elements with non-zero values in the matrix. 청구항 10에 있어서, 상기 제1 입력 행렬의 밀도가 제2 입력 행렬의 밀도보다 낮은 경우, 제1 곱셈 방식에 의하여 곱셈을 수행하는 경우, 제1 곱셈 방식이 제2 곱셈 방식에 비하여 적은 메모리 수를 요구하는, 장치The method of claim 10, when the density of the first input matrix is lower than the density of the second input matrix, and when multiplication is performed by the first multiplication method, the first multiplication method has a smaller number of memories than the second multiplication method. requesting device 청구항 11에 있어서, 상기 제1 입력 행렬의 밀도가 제2 입력 행렬의 밀도보다 높은 경우, 제2 곱셈 방식에 의하여 곱셈을 수행하는 경우, 제2 곱셈 방식이 제1 곱셈 방식에 비하여 적은 메모리 수를 요구하는, 장치The method of claim 11, when the density of the first input matrix is higher than the density of the second input matrix, and when multiplication is performed by the second multiplication method, the second multiplication method requires a smaller number of memories than the first multiplication method. requesting device 명령어들을 포함하는 하나 이상의 프로그램을 저장하는 비-일시적인 컴퓨터 판독가능 저장 매체(Non-transitory Computer Readable Storage Medium)로서,
상기 명령어들은, 가속기에 의해 실행될 때, 상기 가속기로 하여금,
제1 입력 행렬, 및 제2 입력 행렬에 대한 밀도를 식별하고,
상기 제1입력 행렬, 및 상기 제2 입력 행렬의 밀도를 비교하여 제1 곱셈 방식, 또는 제2 곱셈 방식 중 하나를 식별하고,
상기 식별된 제1 곱셈 방식, 또는 상기 제2 곱셈 방식 중 하나에 기반하여 상기 제1 입력 행렬, 및 제2 입력 행렬에 대한 희소 행렬 곱셈을 수행하는, 컴퓨터 판독가능 저장 매체
A non-transitory computer readable storage medium that stores one or more programs containing instructions,
The instructions, when executed by the accelerator, cause the accelerator to:
Identify densities for a first input matrix and a second input matrix,
Compare densities of the first input matrix and the second input matrix to identify either a first multiplication method or a second multiplication method,
A computer-readable storage medium that performs sparse matrix multiplication on the first input matrix and the second input matrix based on one of the identified first multiplication scheme or the second multiplication scheme.
청구항 17에 있어서, 상기 명령어들은, 가속기에 의해 실행될 때, 상기 가속기로 하여금, 상기 제1 곱셈 방식, 또는 제2 곱셈 방식 중 하나를 식별하기 위하여, 상기 제1 입력 행렬의 밀도가 제2 입력 행렬의 밀도보다 낮은 경우, 제1 곱셈 방식에 의하여 곱셈을 수행하는, 컴퓨터 판독가능 저장 매체The method of claim 17, wherein the instructions, when executed by an accelerator, cause the accelerator to determine whether the density of the first input matrix is equal to the second input matrix to identify one of the first multiplication scheme or the second multiplication scheme. A computer-readable storage medium that performs multiplication by a first multiplication method when the density is lower than 청구항 17에 있어서, 상기 명령어들은, 가속기에 의해 실행될 때, 상기 가속기로 하여금, 상기 제1 곱셈 방식, 또는 제2 곱셈 방식 중 하나를 식별하기 위하여, 상기 제1 입력 행렬의 밀도가 제2 입력 행렬의 밀도보다 높은 경우, 제2 곱셈 방식에 의하여 곱셈을 수행하는, 컴퓨터 판독가능 저장 매체The method of claim 17, wherein the instructions, when executed by an accelerator, cause the accelerator to determine whether the density of the first input matrix is equal to the second input matrix to identify one of the first multiplication scheme or the second multiplication scheme. A computer-readable storage medium that performs multiplication by a second multiplication method when the density is higher than 청구항 9에 있어서, 상기 제1 곱셈 방식은 제1 입력 행렬의 행(row)가 가지는 0이 아닌 값을 가지는 원소의 열 인덱스에 기반하여 제2 입력 행렬의 행에 대하여 곱셈을 수행하는 방식인, 컴퓨터 판독가능 저장 매체
The method of claim 9, wherein the first multiplication method is a method of performing multiplication on the rows of the second input matrix based on the column index of the element having a non-zero value in the row of the first input matrix. computer-readable storage media
KR1020230131655A 2022-12-09 2023-10-04 Apparatus and method for selective sparse matrix multiplication based on density of input matrix KR20240087527A (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
KR20220171398 2022-12-09
KR1020220171398 2022-12-09

Publications (1)

Publication Number Publication Date
KR20240087527A true KR20240087527A (en) 2024-06-19

Family

ID=91712759

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020230131655A KR20240087527A (en) 2022-12-09 2023-10-04 Apparatus and method for selective sparse matrix multiplication based on density of input matrix

Country Status (1)

Country Link
KR (1) KR20240087527A (en)

Similar Documents

Publication Publication Date Title
CN109919311B (en) Method for generating instruction sequence, method and device for executing neural network operation
Dong et al. LU factorization of small matrices: Accelerating batched DGETRF on the GPU
US9760538B2 (en) Computer-implemented system and method for efficient sparse matrix representation and processing
US9569454B2 (en) Selective compression of objects in a storage compute device
US11275741B2 (en) Merge join system and method
KR20190053262A (en) Utilizing the scarcity of the input data in the neural network computation unit
US9632729B2 (en) Storage compute device with tiered memory processing
US20170024466A1 (en) System and method for natural language processing using synthetic text
US11126690B2 (en) Machine learning architecture support for block sparsity
US11074214B2 (en) Data processing
US11899744B2 (en) Apparatus and method of performing matrix multiplication operation of neural network
CN109993293B (en) Deep learning accelerator suitable for heap hourglass network
US9965343B2 (en) System and method for determining concurrency factors for dispatch size of parallel processor kernels
US20220391471A1 (en) Method, circuit, and soc for performing matrix multiplication operation
CN113469354A (en) Memory-constrained neural network training
KR20230081697A (en) Method and apparatus for accelerating dilatational convolution calculation
US11636569B1 (en) Matrix transpose hardware acceleration
US20200117449A1 (en) Accelerated Access to Computations Results Generated from Data Stored in Memory Devices
KR20240087527A (en) Apparatus and method for selective sparse matrix multiplication based on density of input matrix
CN112200310A (en) Intelligent processor, data processing method and storage medium
KR20240007582A (en) System, pim device, and cuckoo hash querying method based on pim device
CN110766133B (en) Data processing method, device, equipment and storage medium in embedded equipment
KR102582079B1 (en) Matrix index information generation metohd, matrix process method and device using matrix index information
KR102543413B1 (en) Method for formatting weight matrix, accelerator using the formatted weight matrix and system including the same
CN116860564B (en) Cloud server data management method and data management device thereof