WO2023195658A1 - 트랜스포머 기반 언어 서비스 가속화를 위한 저비용 다중 fpga 가속 시스템 - Google Patents

트랜스포머 기반 언어 서비스 가속화를 위한 저비용 다중 fpga 가속 시스템 Download PDF

Info

Publication number
WO2023195658A1
WO2023195658A1 PCT/KR2023/003620 KR2023003620W WO2023195658A1 WO 2023195658 A1 WO2023195658 A1 WO 2023195658A1 KR 2023003620 W KR2023003620 W KR 2023003620W WO 2023195658 A1 WO2023195658 A1 WO 2023195658A1
Authority
WO
WIPO (PCT)
Prior art keywords
unit
vector
matrix
fpga
function unit
Prior art date
Application number
PCT/KR2023/003620
Other languages
English (en)
French (fr)
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 WO2023195658A1 publication Critical patent/WO2023195658A1/ko

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/76Architectures of general purpose stored program computers
    • G06F15/78Architectures of general purpose stored program computers comprising a single central processing unit
    • G06F15/7867Architectures of general purpose stored program computers comprising a single central processing unit with reconfigurable architecture
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/76Architectures of general purpose stored program computers
    • G06F15/78Architectures of general purpose stored program computers comprising a single central processing unit
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/76Architectures of general purpose stored program computers
    • G06F15/78Architectures of general purpose stored program computers comprising a single central processing unit
    • G06F15/7807System on chip, i.e. computer system on a single chip; System in package, i.e. computer system on one or more chips in a single package
    • G06F15/781On-chip cache; Off-chip memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • 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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating

Definitions

  • This disclosure relates to a low-cost multi-FPGA acceleration system for accelerating transformer-based language services. Specifically, it relates to devices and systems that can accelerate input context processing of transformer-based language services through model parallel processing and efficient networks. .
  • the transformer model is a deep learning model that uses an attention mechanism that assigns different weights to each part of the input data.
  • NLP Natural Language Processing
  • the GPT (Generative Pre-Trained Transformer) language model is especially widely used in data centers. Because the GPT language model is pre-trained, it can be easily applied to a variety of applications with minor modifications. These advantages make the GPT language model an attractive solution for cloud data centers that must meet the growing demand for language services. At the same time, the GPT language model is increasing its model size to improve both application performance and coverage. For example, the latest GPT language model increases the parameter size to 8.3 billion. The trend toward increasing parameter sizes requires significant improvements in both memory capacity and computing performance. Therefore, in order to efficiently run large-scale GPT language models in data centers, a new hardware platform beyond the existing platform is needed.
  • transformer-based language service acceleration device and a multi-FPGA acceleration system.
  • the present disclosure may be implemented in a variety of ways, including as a device or system.
  • a transformer-based language service acceleration device includes a matrix processing unit forming a first data path and a vector processing unit forming a second data path.
  • the first data path is associated with matrix-related instructions
  • the second data path is associated with vector-related instructions. Additionally, the first data path and the second data path are processed in parallel.
  • a multi-FPGA acceleration system for transformer-based language service acceleration includes a first host CPU and a first FPGA cluster connected to the host CPU.
  • each FPGA includes two compute cores.
  • Each compute core includes a matrix processing unit forming a first data path and a vector processing unit forming a second data path.
  • the first data path is associated with matrix-related instructions
  • the second data path is associated with vector-related instructions. The first data path and the second data path are processed in parallel.
  • model parallelization and efficient networks can be applied to a multi-FPGA acceleration system by partitioning model parameters without dependencies to maximize parallel computation in each compute core within the multi-FPGA acceleration system.
  • end-to-end acceleration of a GPT language model can be provided using instruction-based programmable compute cores with custom instructions that can maximize hardware reuse.
  • a multi-FPGA acceleration system can process transformer-based language services with high throughput and low latency by leveraging efficient data flow, quantization, and other hardware optimizations.
  • a multi-FPGA acceleration system can reduce the cost of a data center without reducing performance by implementing multiple FPGAs with low initial and operating costs.
  • Figure 1 is a diagram showing the structure of an artificial neural network model including a token embedding layer, a decoder layer, and an LM (Language Model) head according to an embodiment of the present disclosure.
  • LM Lianguage Model
  • Figure 2 is a diagram showing a graph showing the ratio of layer normalization, self-attention, residual, and feedforward network operations in the GPU and the waiting time ratio of each operation required to perform these operations.
  • Figure 3 is a diagram showing the detailed configuration of a multi-FPGA acceleration system according to an embodiment of the present disclosure.
  • Figure 4 is a diagram showing the detailed structure of a compute core according to an embodiment of the present disclosure.
  • Figure 5 is a diagram showing a tiling system included in a multi-FPGA acceleration system.
  • Figure 6 is a diagram showing a lightweight router of each acceleration device in a multi-FPGA acceleration system.
  • Figure 7 is a diagram showing a matrix processing unit of each acceleration device in a multi-FPGA acceleration system.
  • Figure 8 is a diagram showing the vector processing unit of each acceleration device in the multi-FPGA acceleration system.
  • FIG. 9 is a diagram illustrating a graph illustrating token generation throughput and speedup in various GPT language models when comparing the multi-FPGA acceleration system of the present disclosure to a GPU appliance.
  • Figure 10 shows a graph comparing the energy efficiency of the multi-FPGA acceleration system of the present disclosure and the GPU appliance.
  • FIG. 11 shows a graph illustrating the scalability of the multi-FPGA acceleration system and GPU appliance of the present disclosure.
  • 'unit' or 'module' refers to a software or hardware component, and the 'unit' or 'module' performs certain roles.
  • 'unit' or 'module' is not limited to software or hardware.
  • a 'unit' or 'module' may be configured to reside on an addressable storage medium and may be configured to reproduce on one or more processors.
  • a 'unit' or 'module' refers to components such as software components, object-oriented software components, class components and task components, processes, functions and properties. , procedures, subroutines, segments of program code, drivers, firmware, microcode, circuits, data, databases, data structures, tables, arrays, or variables.
  • Components and 'units' or 'modules' may be combined into smaller components and 'units' or 'modules' or may be divided into additional components and 'units' or 'modules'.
  • a 'unit' or 'module' may be implemented with a processor and memory.
  • 'Processor' should be interpreted broadly to include general-purpose processors, central processing units (CPUs), microprocessors, digital signal processors (DSPs), controllers, microcontrollers, state machines, etc.
  • 'processor' may refer to an application-specific integrated circuit (ASIC), programmable logic device (PLD), field programmable gate array (FPGA), etc.
  • ASIC application-specific integrated circuit
  • PLD programmable logic device
  • FPGA field programmable gate array
  • 'Processor' refers to a combination of processing devices, for example, a combination of a DSP and a microprocessor, a combination of a plurality of microprocessors, a combination of one or more microprocessors in combination with a DSP core, or any other such combination of configurations. You may. Additionally, 'memory' should be interpreted broadly to include any electronic component capable of storing electronic information.
  • RAM random access memory
  • ROM read-only memory
  • NVRAM non-volatile random access memory
  • PROM programmable read-only memory
  • EPROM erasable-programmable read-only memory
  • a memory is said to be in electronic communication with a processor if the processor can read information from and/or write information to the memory.
  • the memory integrated into the processor is in electronic communication with the processor.
  • 'system' may include at least one of a server device and a cloud device, but is not limited thereto.
  • a system may consist of one or more server devices.
  • a system may consist of one or more cloud devices.
  • the system may be operated with a server device and a cloud device configured together.
  • Transformer is a deep learning language model widely used in Natural Language Processing (NLP) applications in data centers.
  • Transformer models targeting text generation such as Generative Pre-trained Transformer (GPT)
  • GPT Generative Pre-trained Transformer
  • Existing hardware platforms such as Graphics Processing Units (GPUs)
  • GPUs Graphics Processing Units
  • data centers require scalable hardware platforms to handle exponential increases in transformer model sizes, but scaling these devices is expensive due to high initial and operating costs.
  • the summarization phase of a GPT language model may be compute bound because it must process multiple tokens, and the hardware may not have enough logic to handle large-scale computations.
  • the generation phase may be memory bound as the system must process a single token and cannot read large amounts of weights from memory to utilize all available logic. Text generation workloads focus on producing long output tokens, so addressing memory bounds may be a priority.
  • fixedly parallel hardware, such as a GPU may not be suitable for handling dependencies between a given output token and subsequent output tokens of text. Therefore, an optimized tiling scheme is needed that mitigates the impact of memory bottlenecks and executes both summary and generation stages with high throughput.
  • GPT language models require computation with large model parameters, which may require parallelization methods that divide the large model into multiple workers for parallel computation.
  • a single device may not be sufficient because it lacks both memory bandwidth and capacity to perform the necessary calculations. Therefore, in order to maximize the amount of parallel computation with minimal synchronization overhead, an acceleration system/device that applies model parallel processing and an efficient network is needed.
  • the present disclosure is a low-cost multi-FPGA acceleration system (hereinafter referred to as 'multi-FPGA acceleration system') that executes end-to-end transformer model inference with high throughput and low latency in both the summary and generation stages.
  • Multi-FPGA acceleration systems can use model parallelism with lightweight routers to distribute equal workloads across devices through fast peer-to-peer (P2P) communication.
  • Compute cores within the multi-FPGA acceleration system according to the present disclosure can operate on customized instructions and an optimized tiling scheme for efficient data flow.
  • the hardware according to the present disclosure can be implemented on four FPGAs and utilize all channels and maximum hardware resources of high bandwidth memory (HBM) for high hardware efficiency.
  • HBM high bandwidth memory
  • the multi-FPGA acceleration system can achieve 3.78x speedup and 3.99x energy efficiency compared to using four state-of-the-art GPUs for a state-of-the-art GPT language model, while maintaining acceptable accuracy for transformer-based language services. . Additionally, multi-FPGA accelerated systems can be 8.21 times more cost-effective than GPU-based appliances.
  • This disclosure provides a multi-FPGA acceleration system that can be used in data centers.
  • a multi-FPGA acceleration system can use an optimized tiling scheme.
  • multi-FPGA acceleration systems can use efficient data flow based on the properties of language service-related artificial neural network models (e.g., GPT language models) to use the maximum bandwidth of high-bandwidth memory (HBM).
  • HBM high-bandwidth memory
  • Multi-FPGA acceleration systems can operate according to user-specified instructions using instruction-based programmable compute cores to solve computational bottlenecks and increase hardware reuse.
  • model parallelism is a method to achieve low latency by splitting model parameters across multiple workers and processing model parameters simultaneously.
  • model parallelism can be advantageous because the size of the model assigned to each worker becomes smaller.
  • all workers must have the entire matrix before starting a layer, so synchronization may be required at least at the end of each layer.
  • FPGAs can be leveraged as transformer-based models continue to be modified and expanded for a variety of language services in the data center.
  • Using FPGAs in acceleration systems can provide fully reprogrammable hardware to support new tasks and larger dimensions of evolving transformers with minimal redesign costs compared to ASIC-based accelerators.
  • FPGA a representative semiconductor accelerator
  • FPGA a representative semiconductor accelerator
  • FIG. 1 is a diagram showing the structure of an artificial neural network model 100 including a token embedding layer, a decoder layer, and an LM (Language Model) head according to an embodiment of the present disclosure.
  • the artificial neural network model 100 may be a GPT language model.
  • the artificial neural network model 100 may include a summarization step 110 and a creation step 120.
  • the summarization step 110 may sequentially include a token embedding layer 112, a plurality of decoder layers 114_1 to 114_N, and an LM head 116.
  • the decoder layer includes a first layer normalization layer, a self-attention layer, a first residual layer, a second layer normalization layer, a feed-forward network layer, and a first layer. 2 Residual layers can be included sequentially.
  • the LM head 116 may sequentially include a layer normalization layer, a Fully Connected (FC) layer, and a SoftMax layer.
  • the generation step 120 may sequentially include a token embedding layer 122, a plurality of decoder layers 124_1 to 124_N, and an LM head 126.
  • the detailed configuration of the token embedding layer 122, the plurality of decoder layers 124_1 to 124_N, and the LM head 126 may be the same as the summarizing step 110.
  • the generation step 120 may further include one or more structures of a token embedding layer 122, a plurality of decoder layers 124_1 to 124_N, and an LM head 126.
  • the GPT language model shown is based on the Transformer model, which achieves the highest accuracy in NLP. Early transformer models had encoders and decoders to process input and output sequences respectively. However, because the GPT language model focuses on generating tokens (i.e. generating the next word sequence) based on the given context, it can only include a decoder. According to one embodiment, a GPT language model can eliminate encoders using an alternative method called token embedding, a process that uses pre-trained matrices instead of an encoding process. Additionally, the model size of the GPT language model and decoder layer can be continuously increased with more parameters and operations to achieve better accuracy and sophistication in token generation. The decoder layer may be responsible for the main calculations of the decoder.
  • the token embedding layer 112 at the beginning of the decoder can convert the input word into an embedding vector.
  • the entered word can be converted into a numeric token ID based on the dictionary.
  • the pre-trained matrices Word Token Embedding (WTE) and Word Position Embedding (WPE) can be indexed by token ID to obtain the corresponding vector.
  • WTE may include token-related encoding
  • WPE may include location-related encoding.
  • the embedding vector can be obtained by adding the two vectors obtained by indexing WTE and WPE by token ID.
  • the LM head 116 located at the end of the decoder can convert the embedding vector output from the last decoder layer 114_N into a token ID.
  • the LM head 116 requires transpose of WTE and matrix multiplication in this process, and can select the token ID with the highest probability value by applying the SoftMax function.
  • the selected token ID represents the generated word.
  • N decoder layers (114_1 to 114_N) are disposed between the token embedding layer 112 and the LM head 116, and N may be determined by the model size.
  • One decoder layer can be divided into four operations: self-attention, feed-forward network, layer normalization, and residual.
  • the self-attention layer 130 can generate Query, Key, and Value matrices to obtain an attention matrix. Query is related to the currently given word, and Key and Value represent the flow of the entire context.
  • the GPT language model can use a multi-head structure, which is a method of dividing attention weights in H columns to execute H independent matrix operations in parallel.
  • H represents the number of attention heads.
  • H the number of hyperparameters, can increase depending on the model size.
  • the feedforward network layer 140 may be composed of two fully connected (FC) layers and a Gaussian Error Linear Unit (GELU) activation function.
  • the first FC layer can create a vector four times the column width and send it to the GELU function for higher resolution.
  • the second FC layer can restore the vector's dimension to its original size.
  • the layer normalization layer and residual layer in the decoder layers 114_1 to 114_N may be placed around the self-attention layer and the feedforward network layer 140 to fine-tune the large model.
  • the GPT language model may include a summarization step 110 and a creation step 120. Since the summarization step 110 uses the entire context as input, the input dimension of the decoder placed after the token embedding layer 112 can be n ⁇ emb. Here, n is the context length of the token, and emb is the length of the embedding vector.
  • an output matrix of the same dimension can be generated. Only the last row of the output matrix may be processed in LM head 116 and the first subsequent token may be generated. Key and Value matrices representing the context may also be generated in the summarization step 110.
  • the generation step 120 previously generated tokens enter the decoder, so the input dimension can be 1 ⁇ emb. Since the generated token is determined by the previous context, in the creation step 120, the Key and Value matrices can be updated by adding each new input context as a row.
  • the time required for each step may vary depending on the workload.
  • the GPT language model can generate words or sentences from the input context. Therefore, the GPT language model can be suitable for many workloads related to text generation.
  • Text generation workloads can include chatbots and article writing applications.
  • the ratio of creation to context may vary.
  • a chatbot service may take an average input token request of length 50 and generate output tokens of length 50 with a ratio of 1:1.
  • an article writing application allows users to enter up to 50 tokens and generate up to 150 tokens with ratios varying from 50:1 to 1:150.
  • the input context can take much longer to generate a few-word answer.
  • the GPT language model can be applied to language services that require more output tokens from the creation stage (120) than input tokens from the summary stage (110).
  • GPT language models may include additional processes such as token embedding, layer normalization, residuals, and LM heads.
  • the multi-FPGA acceleration system provides an acceleration system that supports all decoder layers of the GPT language model along with token embedding and LM head. The detailed configuration of the multi-FPGA acceleration system will be described later with reference to FIGS. 3 to 8.
  • FIG. 2 is a diagram illustrating a graph 200 showing the ratio of layer normalization, self-attention, residual, and feedforward network operations in a GPU and the ratio of waiting times for each operation required to perform these operations.
  • LayerNorm layer normalization
  • FIG. 2 shows that the low-level operations of performing layer normalization and residuals are inefficient on GPUs. Therefore, a multi-FPGA acceleration system according to the present disclosure optimized for all GPT language models is provided.
  • FIG. 3 is a diagram showing the detailed configuration of a multi-FPGA acceleration system 300 according to an embodiment of the present disclosure.
  • the multi-FPGA acceleration system 300 may include two CPUs (Central Processing Units) (310_1, 310_2), a first FPGA cluster (320_1), and a second FPGA cluster (320_2). there is.
  • the first CPU 310_1 may be connected to the first FPGA cluster 320_1, and the second CPU 310_2 may be connected to the second FPGA cluster 320_2.
  • the first CPU 310_1 and the second CPU 310_2 may be connected to each other through a QuickPath Interconnect (QPI) 350.
  • the multi-FPGA acceleration system 300 may be a server appliance system composed of a dual socket CPU and multiple FPGAs.
  • the first FPGA cluster 320_1 connected to the first CPU 310_1 may include four FPGAs 322, 324, 326, and 328.
  • the first FPGA cluster 320_1 may form a system that calculates an independent workload.
  • each FPGA may function as an acceleration device 360.
  • Each FPGA (or acceleration device 360) may include two compute cores (e.g., 362_1, 362_2). That is, the first FPGA cluster 320_1 may include a total of 8 compute cores.
  • the first FPGA cluster 320_1 may be connected to the first CPU 310_1, which is a host, through a PCIe Gen 3 subsystem 330_1 that transmits data at a rate of 16 GB/s.
  • the second FPGA cluster 320_2 may be connected to the second CPU 310_2 as a host through the PCIe Gen 3 subsystem 330_2.
  • Communication between FPGAs can be enabled by a Quad Small Form Factor Pluggable (QSFP) transceiver 340 that transmits data at a rate of 100 Gb/s at the physical layer. Since each FPGA has two QSFP ports, the FPGA cluster (320_2 through 320_2) can use a ring network instead of other network topologies that require more connections between nodes. A ring network can minimize the data synchronization and transmission required between the FPGA at the decoder layer.
  • QSFP Quad Small Form Factor Pluggable
  • Communication between the two cores 362_1 and 362_2 within the acceleration device 360 depends on available resources and may therefore be unrestricted. Inside the acceleration device 360, the router is efficiently balanced so that the communication speed between the two compute cores is the same as the communication speed between the FPGAs.
  • FIG. 3 four FPGAs are shown arranged in one FPGA cluster, but the present invention is not limited to this, and the number of FPGAs may be changed as needed.
  • the multi-FPGA acceleration system 300 can use model parallelism to efficiently process large language models.
  • the model parameters or weight matrices 390 are the same as the number of cores (e.g. For example, it can be divided into 8) column directions.
  • Each compute core can be assigned to process each partition. Partitions can be stored in the memory of the FPGA with allocated compute cores. And each compute core in each FPGA can perform the same task using the partitioned model parameters.
  • the model parameters or weight matrix is divided into a plurality of parts in the column direction, and each of the plurality of parts is distributed to each compute core. can be entered.
  • each compute core can process the same operation for the input portion.
  • Model parameters for the remaining tasks are stored globally on each compute core and can be performed on each compute core.
  • each FPGA executes the same task on the same hardware, executing the GPT language model end-to-end, allowing four FPGAs to form a cluster. According to this configuration, the FPGA can utilize the maximum bandwidth of both HBM and DDR memory.
  • partitioned model parameters can be stored in HBM.
  • WTE and WPE can be stored in DDR memory because they access data only once per entire decoder stage and therefore have a negligible impact on overall performance.
  • the multi-FPGA acceleration system 300 utilizes two identical compute cores or dual compute cores within one FPGA that can implement optimized instruction and data flow to balance placement and routing issues and synchronization overhead. It can be included.
  • the multi-FPGA acceleration system 300 may include a flexible and optimized Instruction Set Architecture (ISA) that supports end-to-end processing for GPT language models, compared to existing NLP accelerators designed only for attention.
  • the command set may include compute commands, dma commands, and router commands.
  • the compute instruction can execute the main processing unit and has a format (type, src1, src1, src2, dst).
  • Each instruction can be executed via instruction chaining, where sequences of dependent instructions can operate with minimal delay. Meanwhile, instructions without dependencies can operate in parallel. For example, compute commands can process data, dma commands can fetch data, and router commands can simultaneously fill buffers with data from peer devices. Combining instruction chaining and parallel execution allows for continuous use of memory and communication bandwidth.
  • Compute instructions can include matrix instructions and vector instructions that control major processing units.
  • the pseudocode of the GPT language model decoder layer using the compute instruction can be expressed as Table 1.
  • Matrix instructions can perform matrix-vector multiplication and additional functions such as GELU and reduce max. Matrices can be loaded into tiles, and vectors can also be loaded partially. Matrix-matrix multiplication can be performed by a sequence of matrix-vector multiplications. Matrix instructions may include Conv1D, Masked Matrix Multiplication (MaskedMM), and Matrix Multiplication (MM).
  • MaskedMM Masked Matrix Multiplication
  • MM Matrix Multiplication
  • the Conv1D command is an essential matrix command written with the equation Ax+b and can be used for Query, Key and Value matrix creation and feedforward networks.
  • the Conv1D instruction may include a weight matrix A, an input vector x, and a bias vector b. Conv1D can perform operations through a sliding window like convolution if the input is longer than the maximum input size.
  • the MaskedMM instruction may include the equation Ax.
  • MaskedMM can calculate Query ⁇ Key T , called the Score matrix.
  • Query matrices can be loaded as vectors.
  • the masking operation can place a - ⁇ 8 mask on the upper diagonal elements of the Score matrix to indicate that the current token is not affected by future context.
  • the MaskedMM command can be combined with the vector command Softmax to create a lower triangular matrix and obtain the maximum value of each row.
  • the MM instruction may be identical to the MaskedMM instruction without masking.
  • the MM instruction can be used in the LM head to calculate logit, which is the intermediate value output when converting the output embedding vector to a token ID, and in the attention layer to calculate Score ⁇ Value. Additionally, the MM instruction can also include a prefix unit to multiply Value.
  • Vector instructions can perform low-level vector-vector and vector-scalar operations along with load and store.
  • Vector instructions may include add, sub, mul, accum, recip_sqrt, recip, and exp. Therefore, vector instructions can effectively implement high-level operations (e.g., layer normalization operations and softmax operations).
  • the layer normalization operation may include Equation 1 below, where ⁇ and ⁇ are the mean and standard deviation, and ⁇ and are the weight and bias vectors, respectively.
  • Equation 1 can be performed by the sub, mul, and add commands. Parameters can be loaded from the register file through the load command.
  • the softmax operation may include Equation 2 below.
  • j represents the number of row elements.
  • Equation 2 can be performed with basic vector instructions such as exp, add, and accum. Summing can be similar to calculating the average in a layer normalization operation. Division can be replaced by the recip and mul commands.
  • the multi-FPGA acceleration system 300 converts model parameters from half-precision floating point (16-bit) to a smaller 8-bit minifloat. It can be quantized with (minifloat). This quantization method can double the data transmission with HBM and double the number of calculations per cycle. 8-bit miniplot data can include 1-bit sign, 4-bit exponent, and 3-bit mantissa, which can be determined according to the range required when inferring the GPT language model. . Because NLP models have processes such as layer normalization that require large dynamic range, the use of fixed point for higher precision is not considered in the multi-FPGA acceleration system 300. Because of the significant accuracy loss that occurs with high compression, integer quantization with higher quantization ratios is not considered in the multi-FPGA acceleration system 300.
  • the values are converted to standard half-precision floating point within the compute cores of the multi-FPGA acceleration system 300. ) can be dequantized. With this configuration, the 16-bit floating point processing unit and on-chip memory prevent truncation or rounding, thereby preventing further loss of accuracy.
  • FIG. 4 is a diagram showing the detailed structure of the compute core 400 according to an embodiment of the present disclosure.
  • the transformer-based language service acceleration device is one of a plurality of FPGAs in a multi-FPGA acceleration system, and one FPGA may include two compute cores 400.
  • the compute core 400 includes a matrix processing unit (MPU) 410, a vector processing unit (VPU) 420, a control unit (control unit) 430, It may include a DMA 440, a router 450, and a register file manager 460.
  • MPU matrix processing unit
  • VPU vector processing unit
  • control unit control unit
  • It may include a DMA 440, a router 450, and a register file manager 460.
  • the solid line represents data flow
  • the dotted line represents control.
  • the control unit 430 may control the operation of components within the compute core 400.
  • the compute core 400 may include a matrix processing unit 410 and a vector processing unit 420 that perform various mathematical operations required for end-to-end acceleration of the artificial neural network model. As shown, the matrix processing unit 410 and the vector processing unit 420 are separated and each performs operations under the control of the control unit 430, thereby solving problems caused by different characteristics of matrix operations and vector operations. there is. For example, on a GPU, matrix operations are fast, but vector operations are slow. Bottlenecks that occur in layers (Residual, LayerNorm) related to vector operations of the GPT language model can be resolved by separating the matrix processing unit 410 and the vector processing unit 420. You can.
  • the matrix processing unit 410 may include a matrix function unit (MFU) 412 and a first special function unit (SFU) 414.
  • Matrix processing unit 410 may configure a first data path.
  • Matrix function unit 412 may be configured to receive the output of register file manager 460 and compute matrix-vector products.
  • the first special function unit 414 may be connected to the matrix function unit 412. In one embodiment, the first special function unit 414 may receive the output of the matrix function unit 412 to process a non-linear function in an artificial neural network. Specifically, the first special function unit 414 may perform an operation following matrix-vector multiplication required by a matrix instruction. For example, the first special function unit 414 may be configured to process an activation operation such as a Gaussian Error Linear Unit (GELU).
  • GELU Gaussian Error Linear Unit
  • the vector processing unit 420 may include a vector function unit (VFU) 422 and a second special function unit (SFU) 424.
  • Vector processing unit 420 may configure a first data path.
  • the first data path of the matrix processing unit 410 and the second data path of the vector processing unit 420 are different from each other and may be processed in parallel.
  • the vector function unit 422 may receive the output of the register file manager 460 and perform vector operations.
  • the second special function unit 424 may be connected to the vector function unit 422.
  • the second special function unit 424 may receive the output of the vector function unit 422 to process non-linear functions in the artificial neural network.
  • the second special function unit 424 may perform operations subsequent to the vector operation required by the vector instruction.
  • the matrix processing unit 410 and vector processing unit 420 can fully utilize parallel computing and hardware resources for the GPT language model. Additionally, matrix function unit 412 and vector function unit 422 can include deep and diverse pipelines for maximum throughput and can utilize bypass at each sub-computation to execute instructions asynchronously at low latency. there is.
  • the control unit 430 tracks the status of each of the matrix processing unit 410, vector processing unit 420, DMA 440, router 450, and register file manager 460 and adjusts the module to be executed, thereby controlling the overall data It can contain logic that controls the flow. As shown, the control unit 430 may include a controller 432, an instruction buffer 434, a scheduler 436, and a score board 438. there is.
  • the controller 432 may receive a start signal and system configuration information from the host CPU through the Advanced eXtensible Interface (AXI)-Lite protocol, decode the information, and transmit it to the scheduler 436.
  • the system configuration information may include a core ID, the number of compute cores in the multi-FPGA acceleration system, and the number of decoder layers and tokens required to run the system. These parameters can determine the behavior of each core. Core ID and number of cores can be used to specify specific cores to apply model weights to and peer devices to receive and transmit.
  • the number of decoder layers may determine when single token processing is completed, and the number of input/output tokens may determine when the entire service is completed.
  • Controller 432 may track the current layer number and token number that a given core is processing. Since a different part of the HBM must be accessed for each layer, the layer number can specify the address to which the DMA 440 must access. The token number can be used to figure out where to mask, especially during the execution of the MaskedMM command. Additionally, the controller 432 may return a completion signal back to the host CPU when the entire GPT language model task is completed.
  • Command buffer 434 may receive commands from controller 432 and/or host CPU. Additionally, the command buffer 434 may transfer commands to the scheduler 436.
  • the scheduler 436 may receive decoded system configuration information from the controller 432 and receive commands from the command buffer 434.
  • the scheduler 436 checks the status of the matrix processing unit 410, vector processing unit 420, DMA 440, router 450, and register file manager 460 and determines whether to execute the command or wait according to each command. You can decide.
  • the scheduler 436 may transmit the determined command to the scoreboard 438 for final dependency checking with the executing command.
  • the scoreboard 438 can monitor the source and destination addresses to prevent data hazards caused by a series of commands. there is. Scoreboard 438 may use RAM to represent address space. Additionally, the scoreboard 438 may display the address of the current instruction as a stale bit when executing, and as a valid bit during writeback. If the origin and destination addresses overlap or other risks occur, the scoreboard 438 may delay the next command until the current calculation is completed. Therefore, instructions that pass the scoreboard 438 are eventually executed.
  • DMA 440 may be configured to read and write data from high bandwidth memory and DDR memory.
  • DMA 440 may include read and write interfaces and plays an important role in distributing data transmitted at high bandwidth.
  • the DMA 440 includes an embed buffer unit, a load buffer unit, a weight buffer unit, a dequantizer unit, a bias buffer unit, and a transpose. It may include a (transpose) unit, an arbiter unit, and a store buffer unit.
  • the read interface of DMA 440 which reads data from HBM, can be connected to all 16 HBM channels per compute core. Since the maximum single channel data bit width of each channel is 256-bit, the DMA (440) can read 16 ⁇ 256 bits at a time.
  • DMA 440 may use a load buffer unit to read input transferred to a register file within register file manager 460 for reuse. Since the weights and biases cannot be reused in matrix multiplication due to their single placement, DMA 440 can calculate the weights and biases directly in the processing unit with preloaded inputs via a weight buffer unit and a bias buffer unit. In particular, because the weights are imported from HBM as an 8-bit minifloat, the dequantization unit can convert the weights back to 16-bit floating point.
  • the read interface is also connected to the DDR and can read tokens from WTE and WPE with built-in buffers for token embedding and LM heads. Since these tokens are small compared to their weight, one DDR channel can be used for data transmission.
  • the write interface of the DMA 440 can record the key, value, and generated token in the storage buffer unit to HBM. This process occurs rarely, so only four HBM channels can be connected. Using fewer write channels can reduce hardware overhead without compromising performance. Additionally, since output values must be transposed when they are written in the data flow, the DMA 440 may include a buffer unit. Since the transposition must occur in dimensions smaller than the channel bitwidth, the AXI write strobe can be used to write data bytes to the channel.
  • Router 450 may enable multiple FPGA networks to communicate with other acceleration devices and with other compute cores within the same acceleration device.
  • Each compute core 400 within a multi-FPGA acceleration system may use router 450 to synchronize data in the register file with other FPGA clusters within the multi-FPGA acceleration system and with other acceleration devices (i.e., FPGAs) in the ring network.
  • the router 450 may include a transmit buffer (TX buffer) unit, a receive buffer (RX buffer) unit, and an arbiter unit.
  • Register file manager 460 may be configured to receive data through DMA 440 and router 450 and generate instructions for matrix processing unit 410 and vector processing unit 420 based on the received data. You can. Register file manager 460 may include an on-chip memory structure or register file for storing multiple 16-bit floating point (FP16) data before and after calculations in matrix processing unit 410 and vector processing unit 420. there is. Register file manager 460 may include vector register files and scalar register files. The register file communicates with the memory interface through DMA 440 and with the network through router 450 to read and write data to the host CPU and peer acceleration devices in an organized manner.
  • FP16 16-bit floating point
  • the register file manager 460 includes a matrix operand collector that generates and collects instructions for the matrix processing unit 410 and vector processing unit 420, and determines register file data to access based on the instructions. May contain a vector operand collector.
  • Vector register files and scalar register files can store some of the weights and intermediate results required for the computation of the GPT language model. Because on-chip memory capacity is limited, register file manager 460 can store only those portions of data that maximize reuse in the register file.
  • Vector register files and scalar register files may contain bit widths of 2 ⁇ 64 ⁇ 16 bits and 2 ⁇ 16 bits, respectively.
  • Vector register files and scalar register files can include two banks and a depth of 2,048. Two banks in each register file can be activated simultaneously, allowing two data sets to be read by matrix processing unit 410 and vector processing unit 420 per cycle. Because two sources are required per command, two sets of data can be sent for maximum throughput. The depth can be determined based on the maximum number of data that the register file should hold at any point during the processing of the GPT language model, which occurs in the LM head after processing the matrix multiplication with the transpose of the WTE.
  • the matrix operand collector may generate matrix instructions during runtime and retain such instructions until a ready signal is provided in the scoreboard 438 of control unit 430. Runtime generation of instructions can reduce the amount of instructions passed from the host CPU.
  • the matrix operand collector may pass instructions and operands, such as input vectors, weight matrices, and bias vectors, to matrix processing unit 410 for execution.
  • the matrix operand collector may read a single input vector from a vector register file while retrieving weights and biases from the weight and bias buffer units of DMA 440, respectively. Additionally, the tiling order may be calculated and the corresponding inputs and weights may be assigned to the matrix processing unit 410. The same input vector may be distributed in vector lanes, and different weights and biases may be distributed in each vector lane. And the matrix operand collector uses a lightweight double buffer for all operands to reduce latency and achieve high throughput.
  • the vector operand collector can generate signals and control the vector processing unit 420 to execute vector instructions. Because the vector processing unit 420 requires a variety of operand types, the vector operand collector can read both vector register files and scalar register files. The vector operand collector may access the receive buffer (RX buffer) unit of the DMA 440 and the router 450 to perform DMA or network commands (eg, load, store, and synchronization commands). Additionally, vector operand collectors can contain double buffers, and vector-related instructions can be generated during runtime to reduce latency and achieve high throughput.
  • RX buffer receive buffer
  • network commands eg, load, store, and synchronization commands
  • Figure 5 is a diagram showing a tiling system included in a multi-FPGA acceleration system.
  • the vector 510 from the register file can be multiplied by the matrix 520 from HBM to produce the output vector 530.
  • the multi-FPGA acceleration system of the present disclosure can use the optimized tiling scheme shown to maximize the number of computations and throughput in the memory bound generation phase while maintaining reasonable performance in the summary phase of the artificial neural network model.
  • d may refer to the dimension of the tile
  • l may refer to the number of lanes
  • BW data may refer to the bit width of the data. Since the bit width of the weight is 8-bit, 512 weights can be loaded into the DMA.
  • the tiling scheme of the multi-FPGA acceleration system can determine the optimal d, l, and direction of matrix-vector calculations.
  • a horizontal orientation maximizes input reuse, but when inputs of length d are repeated across the entire width of the weight matrix, a significant amount of buffer may be required to store the partial sums being computed.
  • the buffer consists of on-chip memory, and due to deep pipelining of the core and other buffer requirements, it may not be possible for DMA to load weights in the horizontal direction due to lack of on-chip memory.
  • DMA loading weights vertically reduces the number of buffers to 1, but may not reuse inputs. Not being able to reuse input can increase the amount of register file accesses, reducing throughput. Therefore, as shown, the tiling scheme in which the DMA loads weights in the zigzag direction 540 can achieve maximum performance by maintaining a balance between hardware resources and data reuse.
  • FIG. 6 is a diagram showing a lightweight router 600 of each acceleration device (i.e., FPGA) in a multi-FPGA acceleration system.
  • the router 600 may represent the detailed configuration of the router 450 of the compute core 400 shown in FIG. 4.
  • the router 600 may be configured to transmit and receive 64 ⁇ 16 bit data.
  • the router 600 may transmit and receive output vectors with processing units (e.g., 410 and 420 in FIG. 4).
  • router 600 communicates with other compute cores (intra-device) within the same acceleration device (i.e., FPGA) and/or communicates (peer-to-peer) with compute cores (inter-device) within another acceleration device. communication) is possible.
  • the router 600 includes a control unit 610 that represents the compute core of the FPGA (or acceleration device) to be connected to the network, and a reorder unit 620 that configures data addresses to be the same in all compute cores using a core ID. ) and a local interface unit 630 including a buffer for storing transmitted and received vectors. Additionally, the router 600 may include an arbiter unit 640 that can mediate communication from the left interface unit 650 to the right interface unit 660 and vice versa. The arbiter unit 640 may receive a signal from the local interface unit 630 to mediate communication, and may transmit a signal to the reordering unit 620. Therefore, each compute core can use router 600 to synchronize data in the register file with other compute cores within the FPGA and with other FPGAs in the ring network.
  • Model parallelism may cause each compute core to compute only a portion of the rows of the output matrix, and subsequent operations such as layer normalization and residuals may require all rows. Therefore, synchronization may be required after executing Conv1D instructions in self-attention and feedforward networks.
  • Peer-to-peer communication on the network can be enabled using two methods: Kernel-to-kernel streaming (K2K) and Aurora 64b/66b IP.
  • K2K can perform streaming between two compute cores using the AXI-Stream interface, and the communication overhead can be negligible.
  • Aurora IP can implement a lightweight link layer protocol for high-speed serial communication between two FPGAs. The protocol uses 64b/66b encoding, so transmission overhead is only 3%, resulting in low resource costs. Accordingly, the router 600 can reduce data communication latency by providing a lightweight communication interface between supported FPGAs.
  • Figure 7 is a diagram showing the matrix processing unit 700 of each acceleration device in the multi-FPGA acceleration system.
  • the matrix processing unit 700 can execute various mathematical operations required for end-to-end acceleration of an artificial neural network model (eg, a GPT model) with high hardware efficiency.
  • an artificial neural network model eg, a GPT model
  • matrix processing unit 700 may include a matrix function unit 710 and a first special function unit 720.
  • Matrix function unit 710 may receive vectors as input and process them in parallel.
  • the first special function unit 720 may receive the output of the matrix function unit 710 and process a non-linear function in the artificial neural network model.
  • Matrix function unit 710 may execute matrix instructions.
  • the main workload of matrix function unit 710 is matrix-vector multiplication.
  • the matrix functional unit 710 receives as input a vector of d dimensions (e.g., 64 dimensions) and includes a plurality of tree-based multiplier-accumulators (MACs) configured to process matrix-vector multiplication in parallel. 712). Additionally, matrix functional unit 710 may include l lanes (eg, 8 lanes). This means that l tree-based MAC hardware is connected in parallel. Multiplicands from different columns of the weight matrix of the artificial neural network associated with the language service may be transmitted to each of the plurality of tree-based MACs.
  • MACs multiplier-accumulators
  • the input to matrix function unit 710 remains constant across lanes, but l different multiplicands from different columns of the weight matrix may be passed to each lane. That is, d ⁇ l matrix-vector multiplication is performed in parallel in the matrix function unit 710, which is the same as the optimized tiling scheme described above in FIG. 5.
  • the product of each lane can then be passed to a parallel adder tree of depth log2(d) to compute the partial sum.
  • deep pipelining allows new subtotals to be calculated every cycle.
  • Buffer 714 of matrix functional unit 710 may store subtotals, load and add new subtotals, and repeat the operation until the total sum is calculated.
  • the FP16 multiplier and adder can be mapped to a Digital Signal Processing (DSP) slice, taking 6 and 11 cycles respectively. Tiles can be optimized to use the maximum number of MAC 712 hardware, i.e. the maximum number of DSPs. Therefore, the tree-based MAC 712 can use a total of 2 ⁇ d ⁇ l - 1 DSPs.
  • the FP16 multiplier can use d ⁇ l DSPs, and the FP16 adder can use d ⁇ l - 1 DSPs.
  • the matrix function unit 710 may additionally use l DSPs to add scalars.
  • d and l can be set to 64 and 8, respectively. Because the GPT language model is memory-dependent, performance can increase linearly as the number of DSPs used increases.
  • the first special function unit 720 may process non-linear functions of the GPT language model.
  • the output of the matrix function unit 710 may be passed to the first special function unit 720. Additionally, the first special function unit 720 may use a combination of DSP, combinational logic, and lookup table methods for optimal hardware utilization.
  • the first special function unit 720 may perform an operation after matrix-vector multiplication required for a matrix command.
  • the first special function unit 414 may be configured to process an activation operation such as a Gaussian Error Linear Unit (GELU).
  • GELU Gaussian Error Linear Unit
  • the first special function unit 720 includes a GELU unit 722, a masking unit 724, a vectorizer unit 728, and a reduce max unit 730, and a bypass path It may include (726).
  • the masking unit 724 may use tile information of the current calculation to generate a lower triangular matrix in which elements on the diagonal of the output matrix are masked with representable values closest to - ⁇ .
  • the masked value eventually becomes 0 after the softmax operation.
  • a multiplier For division necessary to divide the result by the constant number of attention heads, a multiplier can be used.
  • the GELU unit 722 may support a GELU activation function such as Equation 3. For this purpose, a look-up table method can be used together with linear approximation.
  • the first special function unit 720 may use the bypass path 726 to allow tasks within the data flow that do not require specific hardware to skip the hardware without incurring a cycle penalty.
  • the first special function unit 720 may include a bypass path 726 whose input is directly connected to the input port of the vectorizer unit 728. By using the bypass path 726, the input of the first special function unit 720 can be directly transmitted to the vectorizer unit 728 without passing through the GELU unit 722 and/or the masking unit 724 without cycle penalty. there is.
  • Vectorizer unit 728 can concatenate input values to match the tiling using an asymmetric buffer.
  • Vectorizer unit 728 is located after GELU unit 722 and masking unit 724 to keep throughput high and reduce the number of hardware resources required.
  • the reduce max unit 730 may be configured to find the maximum value or argmax value of a given vector. Additionally, the reduce max unit 730 may be implemented using a parallel tree of comparators.
  • Figure 8 is a diagram showing the vector processing unit 800 of each acceleration device in the multi-FPGA acceleration system.
  • the vector processing unit 800 can execute various mathematical operations required for end-to-end acceleration of an artificial neural network model (e.g., a GPT model) with high hardware efficiency.
  • an artificial neural network model e.g., a GPT model
  • the vector processing unit 800 may include a vector function unit 810 and a second special function unit 820.
  • the vector function unit 810 may receive the output of the register file manager and perform vector operations.
  • the second special function unit 820 may be connected to the vector function unit 810. Specifically, the second special function unit 820 may perform a nonlinear operation following the vector operation required by the vector instruction.
  • Vector function unit 810 can execute vector instructions.
  • the vector function unit 810 may be a floating-point Arithmetic Logic Unit (ALU) that supports element-wise vector operations. Specifically, the vector function unit 810 can operate addition, subtraction, and multiplication of two vectors of d dimension.
  • ALU Arithmetic Logic Unit
  • the DSP can be used for all vector functional units 810 operations.
  • the adder, subtractor, multiplier, and exponential of the vector function unit 810 may use 11 cycles, 11 cycles, 6 cycles, and 4 cycles, respectively.
  • the exponent can use two DSPs, and the adder, subtractor, and multiplier can each use one DSP. Because no instruction requires more than one ALU operation, all instructions can be completed in the shortest possible cycle without synchronization.
  • Vector functional unit 810 may include a bypass path 812 to reduce unnecessary computation cycles. For example, load and store instructions do not require computation, allowing data to skip execution steps.
  • the vector function unit 810 includes a bypass path 812 that directly connects the input and output ports, so load and store instructions take only one cycle. Data hazards arising from this asynchronous data flow may be handled in a scoreboard (e.g., 428 in FIG. 4).
  • the second special function unit 820 may process non-linear functions of the GPT language model.
  • the output of the vector function unit 810 may be transmitted to the second special function unit 820. Additionally, the second special function unit 820 may use a combination of DSP, combinational logic, and lookup table methods for optimal hardware utilization.
  • the second special function unit 820 may perform operations subsequent to the vector operation of the vector function unit 810 required for the vector instruction.
  • the second special function unit 820 includes an adder tree unit 822, an accumulator unit, a reciprocal unit, a multiplier unit, a scalar adder unit, and a reciprocal square root. square root) unit and multiplexer unit. Because the vector function unit 810 supports instructions that require only vector output, the adder tree unit 822 may be placed in the second special function unit 820 instead of the vector function unit 810. The remaining functionality can be provided by a floating point DSP. Similar to the first special function unit (e.g., 720 in FIG. 7), the second special function unit 820 may use a multiplier instead of a divider to divide the constant value of the embedding size.
  • the second special function unit 820 may use the bypass paths 824 and 826 to allow tasks within the data flow that do not require specific hardware to skip the hardware without incurring a cycle penalty.
  • the second special function unit 820 may include a first bypass path 824 directly connecting the input port and the output port.
  • the second special function unit 820 may include a second bypass path 826 for directly transferring the output of the adder tree unit to the multiplexer unit without passing through the reciprocal unit and the inverse square root unit. That is, the output of the adder tree unit 822 in the second special function unit 820 can be directly transmitted to the multiplexer unit without going through a pipeline stage that matches the waiting time of the adjacent reciprocal unit and inverse square root unit.
  • This asynchronous data flow is likely to cause data hazards, so a scoreboard (e.g., 428 in FIG. 4) is needed. Because the scoreboard is needed to handle other data hazards in the unique instruction sequences of the GPT language model, negligible control overhead is added to support bypass paths 824, 826.
  • the operation order in the GPT language model alternates between the use of matrix instructions and vector instructions, thereby minimizing conflicts, which can be advantageous in increasing the speed of sequential creation of GPT.
  • the first graph 910 shows the results of comparing the performance of a single FPGA acceleration system and an acceleration system consisting of one GPU.
  • the second graph 920 shows the results of comparing the performance of a dual FPGA acceleration system and an acceleration system consisting of two GPUs.
  • the third graph 930 shows the results of comparing the performance of a quadruple FPGA acceleration system and an acceleration system composed of four GPUs.
  • a single FPGA acceleration system is confirmed to have an average speed improvement of 2.22 times compared to an acceleration system consisting of one GPU.
  • the dual FPGA acceleration system is confirmed to have an average speed improvement of 2.95 times compared to the acceleration system consisting of two GPUs.
  • the quad FPGA acceleration system is confirmed to have an average speed improvement of 3.78 times compared to the acceleration system consisting of four GPUs.
  • the throughput of the quad FPGA acceleration system is 10.03 times higher than that of the acceleration system consisting of four GPUs.
  • the speedup of a multi-FPGA acceleration system can be larger and there is theoretically no upper limit to smaller input and larger output sizes.
  • the ratio of input and output lengths is less than 4:1, as is the case for text generation workloads, multi-FPGA acceleration systems outperform GPU appliances.
  • Figure 10 shows a graph 1000 comparing the energy efficiency of the multi-FPGA acceleration system of the present disclosure and the GPU appliance. Specifically, when comparing a quadruple FPGA acceleration system and an acceleration system consisting of four GPUs, the energy efficiency of the quadruple FPGA acceleration system is 3.99 times better on average.
  • FIG. 11 shows a graph 1100 illustrating the scalability of the multi-FPGA acceleration system and GPU appliance of the present disclosure.
  • 93.09 tokens per second are achieved for one FPGA, and 207.56 tokens per second are achieved for four FPGAs.
  • the GPU appliance achieves 27.09 tokens per second for 1 GPU and 29.14 tokens per second for 4 GPUs. That is, in a multi-FPGA acceleration system, the performance of the FPGA increases linearly at a rate of 1.5 depending on the number of FPGAs.
  • GPU appliances have limited scalability due to more synchronization.
  • the more FPGAs i.e., more memory bandwidth
  • the better because model parallelism, optimized tiling schemes, and low synchronization overhead maximize the utilization of the processing units (accelerators or compute courts). Allows for more parallel computation of model parameters.
  • GPUs have a structure that does not effectively utilize hardware for GPT language model work in a single device, so the more GPUs there are, the lower the utilization is and the worse the performance. Therefore, multi-FPGA acceleration systems can scale to effectively handle increasing model sizes in GPT, unlike traditional GPU appliances.
  • Table 2 below shows the accuracy comparison results between the multi-FPGA acceleration system and the GPU appliance.
  • multi-FPGA accelerated systems can achieve accuracy loss within 2.00% on Children's Book Common Noun (CBT-CN) and Children's Book Named Entities (CBT-NE) datasets.
  • CBT-CN Children's Book Common Noun
  • CBT-NE Children's Book Named Entities
  • the multi-FPGA accelerated system shows an accuracy loss of 1.02% on the CBT-CN dataset and a 2% accuracy loss on the CBT-NE dataset compared to the GPU appliance.
  • the multi-FPGA acceleration system shows a 2.33% improvement in accuracy on the Winograd Schema Challenge (WSC) dataset compared to the GPU appliance.
  • WSC Winograd Schema Challenge
  • an accuracy loss of less than 2% is acceptable because language services are mostly based on text generation. Since text generation is about generating a reasonable set of words that fit a given context rather than a specific word, precise accuracy is not as important as artificial neural networks for classification. Accuracy loss can be significant for some workloads, such as Q&A, but a loss of less than 2% is acceptable for general public use.
  • Table 3 below shows the cost analysis of multi-FPGA acceleration systems and GPU appliances.
  • the quad FPGA acceleration system has a lower initial cost of $14,652 than the acceleration system consisting of four GPUs.
  • Performance i.e. throughput
  • initial cost i.e. retail price
  • Table 3 shows the cost analysis of multi-FPGA acceleration systems and GPU appliances.
  • the quad FPGA acceleration system has a lower initial cost of $14,652 than the acceleration system consisting of four GPUs.
  • Performance i.e. throughput
  • initial cost i.e. retail price
  • GPU appliance Multi-FPGA acceleration system CPUs 2 x Intel Xeon Gold 14-Core @2.2 GHz 2 x Intel Xeon Gold 16-Core @2.9 GHz Memory 384 GB DDR4 512 GB DDR4 Storage 12TB NVMe 4TB NVMe accelerator NVIDIA Tesla V100 32 GB HBM2 XILINX Alveo U280 8 GB HBM2 Performance 13.01 tokens/sec (x4 GPU) 72.68 tokens/sec (x4 FPGA) expense $45,832 ($11,458 per GPU) $31,180 ($7,795 per FPGA) Performance per cost 283.86 tokens/sec/million$ 2330.98 tokens/sec/million$
  • Multi-FPGA acceleration systems can provide high throughput, low latency, end-to-end acceleration, and parallel computing at the data center level.
  • the quad FPGA acceleration system improves performance, energy efficiency, and cost-effectiveness by 3.78 times, 3.99 times, and 8.21 times, respectively, compared to the existing four GPU acceleration system.
  • the processing units used to perform the techniques include one or more ASICs, DSPs, digital signal processing devices (DSPDs), or programmable logic devices (PLDs). , field programmable gate arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, electronic devices, and other electronic units designed to perform the functions described in this disclosure, It may be implemented within a computer, or a combination thereof.
  • the various illustrative logical blocks, modules, and circuits described in connection with this disclosure may be general-purpose processors, DSPs, ASICs, FPGAs or other programmable logic devices, discrete gate or transistor logic, discrete hardware components, or It may be implemented or performed as any combination of those designed to perform the functions described in.
  • a general-purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine.
  • a processor may also be implemented as a combination of computing devices, such as a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP core, or any other configuration.
  • RAM random access memory
  • ROM read-only memory
  • NVRAM non-volatile random access memory
  • PROM on computer-readable media such as programmable read-only memory (EPROM), electrically erasable PROM (EEPROM), flash memory, compact disc (CD), magnetic or optical data storage devices, etc. It may also be implemented as stored instructions. Instructions may be executable by one or more processors and may cause the processor(s) to perform certain aspects of the functionality described in this disclosure.
  • Computer-readable media includes both computer storage media and communication media, including any medium that facilitates transfer of a computer program from one place to another.
  • Storage media may be any available media that can be accessed by a computer.
  • such computer readable media may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or the desired program code in the form of instructions or data structures. It can be used to transfer or store data and can include any other media that can be accessed by a computer. Any connection is also properly termed a computer-readable medium.
  • disk and disk include CD, laser disk, optical disk, digital versatile disc (DVD), floppy disk, and Blu-ray disk, where disks are usually magnetic. It reproduces data optically, while discs reproduce data optically using lasers. Combinations of the above should also be included within the scope of computer-readable media.
  • a software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known.
  • An exemplary storage medium may be coupled to the processor such that the processor may read information from or write information to the storage medium. Alternatively, the storage medium may be integrated into the processor.
  • the processor and storage medium may reside within an ASIC. ASIC may exist within the user terminal. Alternatively, the processor and storage medium may exist as separate components in the user terminal.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Computational Linguistics (AREA)
  • Computing Systems (AREA)
  • Microelectronics & Electronic Packaging (AREA)
  • Devices For Executing Special Programs (AREA)
  • Advance Control (AREA)

Abstract

본 개시는 트랜스포머 기반 언어 서비스 가속화 장치에 관한 것이다. 가속화 장치는 제1 데이터 패스를 구성하는 행렬 처리 유닛 및 제2 데이터 패스를 구성하는 벡터 처리 유닛을 포함한다. 제1 데이터 패스는 행렬 관련 명령과 연관되고, 제2 데이터 패스는 벡터 관련 명령과 연관된다. 제1 데이터 패스와 제2 데이터 패스는 병렬적으로 처리된다.

Description

트랜스포머 기반 언어 서비스 가속화를 위한 저비용 다중 FPGA 가속 시스템
본 개시는 트랜스포머 기반 언어 서비스 가속화를 위한 저비용 다중 FPGA 가속 시스템에 관한 것으로, 구체적으로, 모델 병렬 처리와 효율적인 네트워크를 통하여 트랜스포머 기반의 언어 서비스의 입력 컨텍스트 처리를 가속할 수 있는 장치 및 시스템에 관한 것이다.
트랜스포머(transformer) 모델은 입력 데이터의 각 부분에 다른 가중치를 부여하는 어텐션(attention) 메커니즘을 사용하는 딥 러닝 모델이다. 순환 신경망(Recurrent Neural Network; RNN) 및 장단기 메모리(Long Short-Term Memory; LSTM)의 재귀(recursion) 및 전역 종속성 문제를 해결함으로써 트랜스포머는 자연어 처리(Natural Language Processing; NLP) 응용 프로그램의 사실상 표준이 되고 있다.
트랜스포머 모델 중 GPT(Generative Pre-Trained Transformer) 언어 모델은 특히 데이터센터에서 널리 사용된다. GPT 언어 모델은 미리 훈련되어 있기 때문에 약간의 수정으로 다양한 애플리케이션에 쉽게 적용할 수 있다. 이러한 이점으로 인해 GPT 언어 모델은 언어 서비스에 대한 증가하는 수요를 충족해야 하는 클라우드 데이터센터에 매력적인 솔루션이다. 동시에 GPT 언어 모델은 애플리케이션 성능과 적용 범위 모두의 개선을 위해 모델 크기를 늘리고 있는 추세이다. 예를 들어, 최신 GPT 언어 모델은 매개변수 크기를 83억개의 사이즈로 늘렸다. 매개변수 크기를 늘리는 추세는 메모리 용량과 컴퓨팅 성능 모두에서 상당한 개선을 요구한다. 따라서 데이터센터에서 대규모 GPT 언어 모델을 효율적으로 실행하기 위해서는 기존 플랫폼을 넘어선 새로운 하드웨어 플랫폼이 필요하다.
최근에 트랜스포머를 가속하는 여러 연구가 제안되고 있으나, 이들은 트랜스포머 프로세스의 일부만 가속화하는데 초점을 맞추기 때문에 데이터센터에 적용하기는 적합하지 않다. 특히, 어텐션 과정은 주로 계산 집약적이지만 가속화하기 쉬운 행렬 곱셈으로 구성되어 있기 때문에, 최근 연구들은 어텐션 과정을 가속화하는데 초점을 맞추고 있다. 또한, 기존 가속 시스템의 아키텍처는 각 작업에 대해 전용 컴퓨트 코어를 배치하는 가속기를 설계하기 때문에, GPT 언어 모델의 종단 간(end-to-end) 가속을 지원하는데 최적화되어 있지 않다. 기존 시스템의 아키텍처에서 가속기는 전체 작업을 처리하기 위해 스트림에 추가 컴퓨트 코어를 추가하므로, 큰 영역에서 오버헤드가 발생한다.
상기와 같은 문제를 해결하기 위한 트랜스포머 기반 언어 서비스 가속화 장치 및 다중 FPGA 가속 시스템을 제공한다.
본 개시는 장치 또는 시스템을 포함한 다양한 방식으로 구현될 수 있다.
본 개시의 일 실시예에 따른 트랜스포머 기반 언어 서비스 가속화 장치는, 제1 데이터 패스를 구성하는 행렬 처리 유닛(matrix processing unit) 및 제2 데이터 패스를 구성하는 벡터 처리 유닛(vector processing unit)을 포함한다. 여기서, 제1 데이터 패스는 행렬 관련 명령과 연관되고, 제2 데이터 패스는 벡터 관련 명령과 연관된다. 또한, 제1 데이터 패스와 제2 데이터 패스는 병렬적으로 처리된다.
본 개시의 일 실시예에 따른 트랜스포머 기반 언어 서비스 가속화를 위한 다중 FPGA 가속 시스템은, 제1 호스트 CPU 및 호스트 CPU와 연결된 제1 FPGA 클러스터를 포함한다. 여기서, 각 FPGA는 2개의 컴퓨트 코어(compute core)를 포함한다. 각 컴퓨트 코어는, 제1 데이터 패스를 구성하는 행렬 처리 유닛(matrix processing unit) 및 제2 데이터 패스를 구성하는 벡터 처리 유닛(vector processing unit)을 포함한다. 여기서, 제1 데이터 패스는 행렬 관련 명령과 연관되고, 제2 데이터 패스는 벡터 관련 명령과 연관된다. 제1 데이터 패스와 제2 데이터 패스는 병렬적으로 처리된다.
본 개시의 다양한 실시예에 따르면, 다중 FPGA 가속 시스템 내의 각 컴퓨트 코어에서 병렬 연산을 최대화하기 위해 종속성이 없는 모델 매개변수를 분할함으로써, 다중 FPGA 가속 시스템에 모델 병렬화 및 효율적인 네트워크를 적용할 수 있다.
본 개시의 다양한 실시예에 따르면, 하드웨어 재사용을 최대화할 수 있는 맞춤형 명령과 함께 명령 기반 프로그래밍 가능한 컴퓨트 코어를 사용하여 GPT 언어 모델의 종단 간 가속을 제공할 수 있다.
본 개시의 다양한 실시예에 따르면, 다중 FPGA 가속 시스템은 효율적인 데이터 흐름, 양자화 및 기타 하드웨어 최적화를 활용함으로써, 높은 처리량과 낮은 대기 시간으로 트랜스포머 기반의 언어 서비스를 처리할 수 있다.
본 개시의 다양한 실시예에 따르면, 다중 FPGA 가속 시스템은 초기 비용과 운영 비용이 낮은 다중 FPGA를 구현하여 성능 저하 없이 데이터센터의 비용을 줄일 수 있다.
본 개시의 다양한 실시예에 따르면, 기존 하드웨어 플랫폼보다 향상된 성능과 에너지 효율성을 달성할 수 있는 트랜스포머 기반 언어 서비스를 가속화하기 위한 새로운 하드웨어 플랫폼을 제공할 수 있다.
본 개시의 효과는 이상에서 언급한 효과로 제한되지 않으며, 언급되지 않은 다른 효과들은 청구범위의 기재로부터 본 개시가 속하는 기술분야에서 통상의 지식을 가진 자("통상의 기술자"라 함)에게 명확하게 이해될 수 있을 것이다.
본 개시의 실시예들은, 이하 설명하는 첨부 도면들을 참조하여 설명될 것이며, 여기서 유사한 참조 번호는 유사한 요소들을 나타내지만, 이에 한정되지는 않는다.
도 1은 본 개시의 일 실시예에 따른 토큰 임베딩 레이어, 디코더 레이어 및 LM(Language Model) 헤드를 포함하는 인공 신경망 모델의 구조를 나타내는 도면이다.
도 2는 GPU에서 레이어 정규화, 셀프 어텐션, 레지듀얼 및 피드포워드 네트워크 연산의 비율과 이러한 연산을 수행하는데 소요되는 각 연산의 대기 시간 비율을 도시한 그래프를 나타내는 도면이다.
도 3은 본 개시의 일 실시예에 따른 다중 FPGA 가속 시스템의 상세 구성을 나타내는 도면이다.
도 4는 본 개시의 일 실시예에 따른 컴퓨트 코어의 상세 구조를 나타내는 도면이다.
도 5는 다중 FPGA 가속 시스템이 포함하는 타일링 체계를 나타내는 도면이다.
도 6은 다중 FPGA 가속 시스템 내의 각 가속화 장치의 경량 라우터(lightweight router)를 나타내는 도면이다.
도 7은 다중 FPGA 가속 시스템 내의 각 가속화 장치의 행렬 처리 유닛을 나타내는 도면이다.
도 8은 다중 FPGA 가속 시스템 내의 각 가속화 장치의 벡터 처리 유닛을 나타내는 도면이다.
도 9는 본 개시의 다중 FPGA 가속 시스템을 GPU 어플라이언스와 비교할 때, 다양한 GPT 언어 모델에서의 토큰 생성 처리량 및 속도 향상을 도시한 그래프를 나타내는 도면이다.
도 10은 본 개시의 다중 FPGA 가속 시스템과 GPU 어플라이언스의 에너지 효율을 비교한 그래프를 나타낸다.
도 11은 본 개시의 다중 FPGA 가속 시스템과 GPU 어플라이언스의 확장성을 도시한 그래프를 나타낸다.
이하, 본 개시의 실시를 위한 구체적인 내용을 첨부된 도면을 참조하여 상세히 설명한다. 다만, 이하의 설명에서는 본 개시의 요지를 불필요하게 흐릴 우려가 있는 경우, 널리 알려진 기능이나 구성에 관한 구체적 설명은 생략하기로 한다.
첨부된 도면에서, 동일하거나 대응하는 구성요소에는 동일한 참조부호가 부여되어 있다. 또한, 이하의 실시예들의 설명에 있어서, 동일하거나 대응되는 구성요소를 중복하여 기술하는 것이 생략될 수 있다. 그러나, 구성요소에 관한 기술이 생략되어도, 그러한 구성요소가 어떤 실시예에 포함되지 않는 것으로 의도되지는 않는다.
개시된 실시예의 이점 및 특징, 그리고 그것들을 달성하는 방법은 첨부되는 도면과 함께 후술되어 있는 실시예들을 참조하면 명확해질 것이다. 그러나, 본 개시는 이하에서 개시되는 실시예들에 한정되는 것이 아니라 서로 다른 다양한 형태로 구현될 수 있으며, 단지 본 실시예들은 본 개시가 완전하도록 하고, 본 개시가 통상의 기술자에게 발명의 범주를 완전하게 알려주기 위해 제공되는 것일 뿐이다.
본 명세서에서 사용되는 용어에 대해 간략히 설명하고, 개시된 실시예에 대해 구체적으로 설명하기로 한다. 본 명세서에서 사용되는 용어는 본 개시에서의 기능을 고려하면서 가능한 현재 널리 사용되는 일반적인 용어들을 선택하였으나, 이는 관련 분야에 종사하는 기술자의 의도 또는 판례, 새로운 기술의 출현 등에 따라 달라질 수 있다. 또한, 특정한 경우는 출원인이 임의로 선정한 용어도 있으며, 이 경우 해당되는 발명의 설명 부분에서 상세히 그 의미를 기재할 것이다. 따라서, 본 개시에서 사용되는 용어는 단순한 용어의 명칭이 아닌, 그 용어가 가지는 의미와 본 개시의 전반에 걸친 내용을 토대로 정의되어야 한다.
본 명세서에서의 단수의 표현은 문맥상 명백하게 단수인 것으로 특정하지 않는 한, 복수의 표현을 포함한다. 또한, 복수의 표현은 문맥상 명백하게 복수인 것으로 특정하지 않는 한, 단수의 표현을 포함한다. 명세서 전체에서 어떤 부분이 어떤 구성요소를 포함한다고 할 때, 이는 특별히 반대되는 기재가 없는 한 다른 구성요소를 제외하는 것이 아니라 다른 구성요소를 더 포함할 수 있음을 의미한다.
또한, 명세서에서 사용되는 '유닛' 또는 '모듈'이라는 용어는 소프트웨어 또는 하드웨어 구성요소를 의미하며, '유닛' 또는 '모듈'은 어떤 역할들을 수행한다. 그렇지만, '유닛' 또는 '모듈'은 소프트웨어 또는 하드웨어에 한정되는 의미는 아니다. '유닛' 또는 '모듈'은 어드레싱할 수 있는 저장 매체에 있도록 구성될 수도 있고 하나 또는 그 이상의 프로세서들을 재생시키도록 구성될 수도 있다. 따라서, 일 예로서, '유닛' 또는 '모듈'은 소프트웨어 구성요소들, 객체지향 소프트웨어 구성요소들, 클래스 구성요소들 및 태스크 구성요소들과 같은 구성요소들과, 프로세스들, 함수들, 속성들, 프로시저들, 서브루틴들, 프로그램 코드의 세그먼트들, 드라이버들, 펌웨어, 마이크로 코드, 회로, 데이터, 데이터베이스, 데이터 구조들, 테이블들, 어레이들 또는 변수들 중 적어도 하나를 포함할 수 있다. 구성요소들과 '유닛' 또는 '모듈'들은 안에서 제공되는 기능은 더 작은 수의 구성요소들 및 '유닛' 또는 '모듈'들로 결합되거나 추가적인 구성요소들과 '유닛' 또는 '모듈'들로 더 분리될 수 있다.
본 개시의 일 실시예에 따르면, '유닛' 또는 '모듈'은 프로세서 및 메모리로 구현될 수 있다. '프로세서'는 범용 프로세서, 중앙 처리 장치(CPU), 마이크로프로세서, 디지털 신호 프로세서(DSP), 제어기, 마이크로제어기, 상태 머신 등을 포함하도록 넓게 해석되어야 한다. 몇몇 환경에서, '프로세서'는 주문형 반도체(ASIC), 프로그램가능 로직 디바이스(PLD), 필드 프로그램가능 게이트 어레이(FPGA) 등을 지칭할 수도 있다. '프로세서'는, 예를 들어, DSP와 마이크로프로세서의 조합, 복수의 마이크로프로세서들의 조합, DSP 코어와 결합한 하나 이상의 마이크로프로세서들의 조합, 또는 임의의 다른 그러한 구성들의 조합과 같은 처리 디바이스들의 조합을 지칭할 수도 있다. 또한, '메모리'는 전자 정보를 저장 가능한 임의의 전자 컴포넌트를 포함하도록 넓게 해석되어야 한다. '메모리'는 임의 액세스 메모리(RAM), 판독-전용 메모리(ROM), 비-휘발성 임의 액세스 메모리(NVRAM), 프로그램가능 판독-전용 메모리(PROM), 소거-프로그램가능 판독 전용 메모리(EPROM), 전기적으로 소거가능 PROM(EEPROM), 플래쉬 메모리, 자기 또는 광학 데이터 저장장치, 레지스터들 등과 같은 프로세서-판독가능 매체의 다양한 유형들을 지칭할 수도 있다. 프로세서가 메모리로부터 정보를 판독하고/하거나 메모리에 정보를 기록할 수 있다면 메모리는 프로세서와 전자 통신 상태에 있다고 불린다. 프로세서에 집적된 메모리는 프로세서와 전자 통신 상태에 있다.
본 개시에서, '시스템'은 서버 장치와 클라우드 장치 중 적어도 하나의 장치를 포함할 수 있으나, 이에 한정되는 것은 아니다. 예를 들어, 시스템은 하나 이상의 서버 장치로 구성될 수 있다. 다른 예로서, 시스템은 하나 이상의 클라우드 장치로 구성될 수 있다. 또 다른 예로서, 시스템은 서버 장치와 클라우드 장치가 함께 구성되어 동작될 수 있다.
트랜스포머 모델(Transformer)은 데이터센터의 자연어 처리(Natural Language Processing; NLP) 애플리케이션에 널리 사용되는 딥 러닝 언어 모델이다. GPT(Generative Pre-trained Transformer)와 같은 텍스트 생성을 대상으로 하는 트랜스포머 모델은 요약 단계(summarization stage)에서 대규모 입력 컨텍스트(context)를 효율적으로 처리한 후 생성 단계(generation stage)에서 순차적인 단일 입력을 요구한다. GPU(Graphic Processing Unit)와 같은 기존 하드웨어 플랫폼은 요약 단계에서 대용량 입력의 병렬 처리에 특화되어 있지만 생성 단계에서는 성능이 크게 저하된다. 더욱이 데이터센터는 트랜스포머 모델 크기의 기하급수적인 증가를 처리하기 위해 확장 가능한 하드웨어 플랫폼이 필요하지만 이러한 장치를 확장하는 것은 높은 초기 비용과 운영 비용으로 인해 많은 비용이 든다.
GPT 언어 모델의 요약 단계에서 여러 토큰을 처리해야 하고, 하드웨어에 대규모 계산을 처리하기에 충분한 로직(logic)이 없을 수 있기 때문에 요약 단계는 컴퓨트 바운드(compute bound)일 수 있다. 생성 단계는 시스템이 단일 토큰을 처리해야 하고 사용 가능한 모든 로직을 활용하기 위해 메모리에서 많은 양의 가중치를 읽을 수 없어 메모리 바운드(memory bound)일 수 있다. 텍스트 생성 워크로드는 긴 출력 토큰을 만드는데 중점을 두고 있으므로 메모리 바운드를 해결하는 것이 우선일 수 있다. 게다가 GPU와 같은 고정된 병렬 하드웨어는 주어진 출력 토큰과 텍스트의 후속 출력 토큰 사이의 종속성을 처리하는데 적합하지 않을 수 있다. 따라서 메모리 병목 현상의 영향을 완화하고 높은 처리량으로 요약 단계 및 생성 단계를 모두 실행하는 최적화된 타일링 체계가 필요하다.
애플리케이션 레벨에서 데이터센터가 다른 사용자의 입력을 일괄 처리하는 경우, 다른 사용자로부터 입력을 수집하는데 소요되는 시간으로 인해 배치 크기에 따라 대기 시간이 증가할 수 있다. 데이터센터에서 입력을 수집하지 않고 배치 크기가 큰 모델을 실행하는 경우, 이용률(utilization)은 지정된 배치에서 부족한 입력 수에 따라 선형적으로 감소할 수 있다. 따라서 짧은 대기 시간으로 단일 입력 토큰을 실행할 수 있는 최적화된 데이터 경로가 필요하다.
GPT 언어 모델은 대규모 모델 매개변수를 사용한 계산이 필요하며, 이는 병렬 계산을 위해 대형 모델을 여러 작업자로 나누는 병렬화 방식이 필요할 수 있다. GPT 언어 모델의 크기가 커질수록 필요한 계산을 수행할 수 있는 메모리 대역폭과 용량이 모두 부족하기 때문에 단일 장치로는 충분하지 않을 수 있다. 따라서 최소한의 동기화 오버헤드로 병렬 계산의 양을 최대화하기 위해서는 모델 병렬 처리와 효율적인 네트워크를 적용한 가속 시스템/장치가 필요하다.
데이터센터는 언어 서비스를 실행하기 위해 서버 솔루션을 설치하는 경우, 하드웨어를 구입하는 초기 비용과 하드웨어를 실행하는 운영 비용으로 인해 총 소유 비용이 높을 수 있다. 따라서 제품 비용이 저렴하고 에너지 효율이 높으면서도 성능이 떨어지지 않는 서버 어플라이언스가 필요하다.
본 개시는 요약 및 생성 단계 모두에서 높은 처리량과 낮은 대기 시간(latency)으로 종단 간(end-to-end) 트랜스포머 모델 추론을 실행하는 저가형 다중 FPGA 가속 시스템(이하 '다중 FPGA 가속 시스템'이라 지칭함)을 제공한다. 다중 FPGA 가속 시스템은 빠른 P2P(peer-to-peer) 통신을 통해 장치 간에 동일한 워크로드(workload) 분산을 위해 경량 라우터(Router)와 함께 모델 병렬 처리(model parallelism)를 사용할 수 있다. 본 개시에 따른 다중 FPGA 가속 시스템 내의 컴퓨트 코어는 효율적인 데이터 흐름을 위해 맞춤형 명령과 최적화된 타일링 체계(tiling scheme)에서 작동할 수 있다. 본 개시에 따른 하드웨어를 4개의 FPGA에 구현하고 높은 하드웨어 효율성을 위해 고대역폭 메모리(High Bandwidth Memory; HBM)의 모든 채널과 최대 하드웨어 리소스를 활용할 수 있다. 다중 FPGA 가속 시스템은 최신 GPT 언어 모델에 대해 4개의 최신 GPU를 사용하는 경우와 비교하여 3.78배의 속도 향상 및 3.99배의 에너지 효율성을 달성하는 동시에 트랜스포머 기반 언어 서비스에 대해 허용 가능한 정확도를 유지할 수 있다. 또한, 다중 FPGA 가속 시스템은 GPU 기반 어플라이언스보다 8.21배 더 비용 효율적일 수 있다.
본 개시는 데이터센터에서 사용될 수 있는 다중 FPGA 가속 시스템을 제공한다. 언어 서비스와 관련된 인공 신경망 모델(예를 들어, GPT 언어 모델)에서 나타나는 메모리 병목 현상을 해결하기 위해, 다중 FPGA 가속 시스템은 최적화된 타일링 체계를 사용할 수 있다. 또한, 다중 FPGA 가속 시스템은 고대역폭 메모리(HBM)의 최대 대역폭을 사용하기 위해 언어 서비스 관련 인공 신경망 모델(예를 들어, GPT 언어 모델)의 특성을 기반으로 효율적인 데이터 흐름을 사용할 수 있다. 본 개시에 따르면, 기본 양자화(basic quantization)를 사용하여 메모리로 및 메모리로부터 데이터 이동 속도를 더욱 향상시킬 수 있다. 다중 FPGA 가속 시스템은 계산 병목 현상을 해결하고, 하드웨어 재사용을 늘리기 위해 명령 기반 프로그래밍 가능한 컴퓨트 코어를 사용하여 사용자 지정 명령에 따라 작동할 수 있다.
그리고, 다중 FPGA 가속 시스템에서 모델 병렬 처리를 사용함으로써, 각 FPGA 장치에 전체 워크로드를 균등하게 할당하면서 병렬로 작동하는 컴퓨트 코어의 물리적인 수를 늘릴 수 있다. 여기서, 모델 병렬 처리는 여러 작업자에 걸쳐 모델 매개변수(model parameters)를 분할하고 동시에 모델 매개변수를 처리하여 짧은 대기 시간을 달성하기 위한 방식이다. 대형 인공 신경망 모델(예를 들어, GPT 언어 모델)에서는 각 작업자에게 할당되는 모델의 크기가 작아지기 때문에 모델 병렬화가 유리할 수 있다. 모델 병렬 처리의 경우, 모든 작업자는 계층을 시작하기 전에 전체 행렬을 가지고 있어야 하므로 적어도 각 계층의 끝에서 동기화(synchronization)가 필요할 수 있다.
또한, 트랜스포머 기반 모델이 데이터센터의 다양한 언어 서비스에 대해 계속 수정 및 확장되기 때문에 FPGA를 활용할 수 있다. 가속 시스템에 FPGA를 사용하는 경우, ASIC 기반 가속기와 비교할 때, 최소의 재설계 비용으로 새로운 작업과 진화하는 트랜스포머의 더 큰 디멘션을 지원하기 위해 완전히 재프로그래밍 가능한 하드웨어를 제공할 수 있다.
본 개시에서는 대표적인 반도체 가속기인 FPGA를 구체적인 실시예로써 설명하고 있으나 이에 한정되지는 않으며, 프로그램 가능한 반도체 내지는 반도체 가속기에 동일한 방법을 적용할 수 있을 것이다.
도 1은 본 개시의 일 실시예에 따른 토큰 임베딩 레이어, 디코더 레이어 및 LM(Language Model) 헤드를 포함하는 인공 신경망 모델(100)의 구조를 나타내는 도면이다. 여기서, 인공 신경망 모델(100)은 GPT 언어 모델일 수 있다. 도시된 바와 같이, 인공 신경망 모델(100)은 요약 단계(110) 및 생성 단계(120)를 포함할 수 있다.
일 실시예에서, 요약 단계(110)는 토큰 임베딩 레이어(112), 복수의 디코더 레이어(114_1 내지 114_N) 및 LM 헤드(116)를 순차적으로 포함할 수 있다. 디코더 레이어는 제1 레이어 정규화(layer normalization) 레이어, 셀프-어텐션(self-attention) 레이어, 제1 레지듀얼(residual) 레이어, 제2 레이어 정규화 레이어, 피드포워드 네트워크(feed-forward network) 레이어 및 제2 레지듀얼 레이어를 순차적으로 포함할 수 있다. LM 헤드(116)는 레이어 정규화(layer normalization) 레이어, FC(Fully Connected) 레이어 및 소프트맥스(SoftMax) 레이어를 순차적으로 포함할 수 있다.
일 실시예에서, 생성 단계(120)는 토큰 임베딩 레이어(122), 복수의 디코더 레이어(124_1 내지 124_N) 및 LM 헤드(126)를 순차적으로 포함할 수 있다. 토큰 임베딩 레이어(122), 복수의 디코더 레이어(124_1 내지 124_N) 및 LM 헤드(126)의 상세 구성은 요약 단계(110)와 동일할 수 있다. 도시된 것과 같이, 생성 단계(120)는 토큰 임베딩 레이어(122), 복수의 디코더 레이어(124_1 내지 124_N) 및 LM 헤드(126)의 구조를 하나 또는 그 이상 더 포함할 수 있다.
도시된 GPT 언어 모델은 NLP에서 최고의 정확도를 달성하는 트랜스포머 모델을 기반으로 한다. 초기의 트랜스포머 모델에는 입력 및 출력 시퀀스를 각각 처리하기 위해 인코더와 디코더가 있었다. 그러나 GPT 언어 모델은 주어진 컨텍스트에 기초하여 토큰을 생성(즉, 다음 단어 시퀀스 생성)하는 것에 초점을 맞추기 때문에, 디코더만 포함할 수 있다. 일 실시예에 따르면, GPT 언어 모델은 인코딩 프로세스 대신 사전 훈련된 행렬을 사용하는 프로세스인 토큰 임베딩이라는 대체 방법을 사용하여 인코더를 제거할 수 있다. 또한 GPT 언어 모델 및 디코더 레이어의 모델 크기는 토큰 생성에서 더 나은 정확도와 정교함을 얻기 위해 더 많은 매개변수와 작업으로 지속적으로 증가할 수 있다. 디코더 레이어는 디코더의 주요 계산을 담당할 수 있다.
디코더의 시작 부분에 있는 토큰 임베딩 레이어(112)는 입력 단어를 임베딩 벡터로 변환할 수 있다. 입력된 단어는 사전을 기반으로 숫자 토큰 ID로 변환될 수 있다. 그런 다음 사전 훈련된 행렬인 단어 토큰 임베딩(Word Token Embedding; WTE) 및 단어 위치 임베딩(Word Position Embedding; WPE)을 토큰 ID로 인덱싱하여 해당 벡터를 얻을 수 있다. WTE에는 토큰 관련 인코딩이 포함될 수 있고, WPE에는 위치 관련 인코딩이 포함될 수 있다. WTE 및 WPE를 토큰 ID로 인덱싱하여 얻은 두 벡터를 추가하여 임베딩 벡터를 얻을 수 있다.
디코더 끝에 위치한 LM 헤드(116)는 마지막 디코더 레이어(114_N)로부터 출력된 임베딩 벡터를 토큰 ID로 변환할 수 있다. LM 헤드(116)는 이 과정에서 WTE의 전치(transpose)와 행렬 곱셈(matrix multiplication)을 필요로 하며 소프트맥스(SoftMax) 함수를 적용하여 가장 높은 확률 값을 가진 토큰 ID를 선택할 수 있다. 선택된 토큰 ID는 생성된 단어를 나타낸다.
토큰 임베딩 레이어(112)와 LM 헤드(116) 사이에 N개의 디코더 레이어(114_1 내지 114_N)가 배치되고, N은 모델 크기에 의해 결정될 수 있다. 하나의 디코더 레이어는 셀프 어텐션(self-attention), 피드포워드 네트워크(feed-forward network), 레이어 정규화(layer normalization), 레지듀얼(residual)의 네 가지 동작으로 나눌 수 있다. 셀프 어텐션 레이어(130)는 어텐션 행렬(attention matrix)을 얻기 위해 Query, Key 및 Value 행렬을 생성할 수 있다. Query는 현재 주어진 단어와 관련이 있으며, Key 및 Value는 전체 컨텍스트의 흐름을 나타낸다.
GPT 언어 모델은 H개의 독립 행렬 연산을 병렬적으로 실행하기 위해 H개의 열에서 어텐션 가중치를 나누는 방법인 다중 헤드(muti-head) 구조를 사용할 수 있다. 여기서, H는 어텐션 헤드의 수를 나타낸다. 하이퍼파라미터(Hyperparameter)의 개수인 H는 모델 크기에 따라 증가할 수 있다.
디코더 레이어(114_1 내지 114_N)에서의 또 다른 작업은 피드포워드 네트워크이다. 피드포워드 네트워크 레이어(140)는 두 개의 FC(Fully Connected) 레이어와 GELU(Gaussian Error Linear Unit) 활성화 함수로 구성될 수 있다. 첫 번째 FC 레이어는 더 높은 해상도를 위해 열 너비의 4배인 벡터를 만들어 GELU 함수로 전송할 수 있다. 두 번째 FC 레이어는 벡터의 차원을 원래 크기로 복원할 수 있다. 디코더 레이어(114_1 내지 114_N)에서의 레이어 정규화 레이어 및 레지듀얼 레이어는 큰 모델을 미세 조정하기 위해 셀프 어텐션 레이어 및 피드포워드 네트워크 레이어(140) 주위에 배치될 수 있다.
주어진 컨텍스트로 토큰을 생성하기 위해 GPT 언어 모델은 요약 단계(110) 및 생성 단계(120)를 포함할 수 있다. 요약 단계(110)는 전체 컨텍스트를 입력으로 사용하므로 토큰 임베딩 레이어(112) 뒤에 배치된 디코더의 입력 디멘션은 nХemb가 될 수 있다. 여기서 n은 토큰의 컨텍스트 길이이고, emb는 임베딩 벡터의 길이다. 디코더를 실행한 후 동일한 디멘션의 출력 행렬이 생성될 수 있다. 출력 행렬의 마지막 행만 LM 헤드(116)에서 처리되고 첫 번째 후속 토큰이 생성될 수 있다. 컨텍스트를 나타내는 Key 및 Value 행렬도 요약 단계(110)에서 생성될 수 있다. 생성 단계(120)에서 이전에 생성된 토큰은 디코더에 들어가므로 입력 차원은 1Хemb가 될 수 있다. 생성된 토큰은 이전 컨텍스트에 의해 결정되므로, 생성 단계(120)에서는 각각의 새로운 입력 컨텍스트를 행으로 추가함으로써 Key 및 Value 행렬을 업데이트할 수 있다.
예를 들어, "Hello, my name"이 입력 토큰 길이가 4인 컨텍스트인 경우, 4Хemb Key 및 Value 행렬이 형성될 수 있고, 요약 단계(110)에서 단어 "is"를 나타내는 첫 번째 토큰이 생성될 수 있다. 구두점은 토큰으로 간주될 수 있다. "Bob" 및 "."를 나타내는 다음 토큰을 생성하려면 Key 및 Value 행렬은 생성 단계(120)에서의 각 반복(iteration) 후에 행 디멘션을 1씩 증가시킨다. 마지막으로 생성된 토큰을 모두 해독하여 "Hello, my name is Bob."이라는 문장을 생성할 수 있다.
주어진 컨텍스트의 길이와 출력 단어의 길이는 각각 요약 단계(110) 및 생성 단계(120)의 계산량에 영향을 미치므로, 각 단계에서 소요되는 시간은 워크로드에 따라 상이할 수 있다. 위의 프로세스를 완료하면, GPT 언어 모델은 입력 컨텍스트에서 단어나 문장을 생성할 수 있다. 따라서 GPT 언어 모델은 텍스트 생성과 관련된 많은 워크로드에 적합할 수 있다.
텍스트 생성 워크로드에는 챗봇(Chatbot) 및 기사 작성 애플리케이션이 포함될 수 있다. 워크로드에 따라 컨텍스트 대비 생성의 비율이 다를 수 있다. 예를 들어, 챗봇 서비스는 길이 50의 평균 입력 토큰 요청을 가지고 1:1의 비율을 갖는 길이 50의 출력 토큰을 생성할 수 있다. 이에 반해, 기사 작성 애플리케이션은 사용자가 최대 50개의 토큰을 입력할 수 있도록 허용하고, 50:1에서 1:150까지 다양한 비율을 가지는 최대 150개의 토큰을 생성할 수 있다. 질문 및 답변과 같이 널리 사용되지 않는 다른 GPT 언어 모델의 응용 프로그램에서는 입력 컨텍스트가 몇 단어 답변을 생성하는데 훨씬 더 오래 걸릴 수 있다. 데이터센터에서 GPT 언어 모델은 요약 단계(110)의 입력 토큰보다 더 많은 생성 단계(120)의 출력 토큰이 필요한 언어 서비스에 적용될 수 있다.
도시된 바와 같이, 기존의 NLP 관련 언어 모델과 비교할 때, GPT 언어 모델은 토큰 임베딩, 레이어 정규화, 레지듀얼 및 LM 헤드와 같은 추가 프로세스를 포함할 수 있다. 본 개시에 따른 다중 FPGA 가속 시스템은 토큰 임베딩 및 LM 헤드와 함께 GPT 언어 모델의 모든 디코더 레이어를 지원하는 가속 시스템을 제공한다. 다중 FPGA 가속 시스템의 상세 구성에 대해서는 도 3 내지 도 8을 참조하여 후술한다.
도 2는 GPU에서 레이어 정규화, 셀프 어텐션, 레지듀얼 및 피드포워드 네트워크 연산의 비율과 이러한 연산을 수행하는데 소요되는 각 연산의 대기 시간 비율을 도시한 그래프(200)를 나타내는 도면이다. 도시된 바와 같이, GPU 기반 가속기의 경우, 레이어 정규화(LayerNorm) 및 레지듀얼과 같은 수학 연산의 수가 전체 연산의 0.11%로 극히 적은 비율을 차지함에도 불구하고, 레이어 정규화 및 레지듀얼을 계산하는데 소요되는 대기 시간이 전체 대기 시간의 22.8%이다. 이러한 결과는 레이어 정규화 및 레지듀얼을 수행하는 낮은 수준의 작업이 GPU에서 비효율적임을 나타낸다. 따라서 모든 GPT 언어 모델에 최적화된 본 개시에 따른 다중 FPGA 가속 시스템을 제공한다.
도 3은 본 개시의 일 실시예에 따른 다중 FPGA 가속 시스템(300)의 상세 구성을 나타내는 도면이다. 도시된 바와 같이, 다중 FPGA 가속 시스템(300)은 2개의 CPU(Central Processing Unit; 중앙처리장치)(310_1, 310_2), 제1 FPGA 클러스터(320_1), 제2 FPGA 클러스터(320_2)를 포함할 수 있다. 제1 CPU(310_1)는 제1 FPGA 클러스터(320_1)와 연결되고, 제2 CPU(310_2)는 제2 FPGA 클러스터(320_2)와 연결될 수 있다. 제1 CPU(310_1)와 제2 CPU(310_2)는 QPI(QuickPath Interconnect)(350)를 통해 서로 연결될 수 있다. 예를 들어, 다중 FPGA 가속 시스템(300)은 듀얼 소켓 CPU와 다중 FPGA로 구성된 서버 어플라이언스 시스템일 수 있다.
일 실시예에 따르면, 제1 CPU(310_1)와 연결된 제1 FPGA 클러스터(320_1)는 4개의 FPGA(322, 324, 326 및 328)를 포함할 수 있다. 제1 FPGA 클러스터(320_1)는 독립적인 워크로드를 계산하는 시스템을 형성할 수 있다. 또한, 각 FPGA는 가속화 장치(360)로서 기능할 수 있다. 각 FPGA(또는 가속화 장치(360))는 2개의 컴퓨트 코어(예를 들어, 362_1, 362_2)를 포함할 수 있다. 즉, 제1 FPGA 클러스터(320_1)는 총 8개의 컴퓨트 코어를 포함할 수 있다.
제1 FPGA 클러스터(320_1)는 16 GB/s의 속도로 데이터를 전송하는 PCIe Gen 3 하위 시스템(330_1)을 통해 호스트인 제1 CPU(310_1)에 연결될 수 있다. 유사하게, 제2 FPGA 클러스터(320_2)는 PCIe Gen 3 하위 시스템(330_2)을 통해 호스트인 제2 CPU(310_2)에 연결될 수 있다. FPGA 사이의 통신은 물리 계층에서 100 Gb/s의 속도로 데이터를 전송하는 QSFP(Quad Small Form Factor Pluggable) 트랜시버(340)에 의해 활성화될 수 있다. 각 FPGA에는 2개의 QSFP 포트가 있으므로 FPGA 클러스터(320_2 내지 320_2)는 더 많은 노드 간 연결이 필요한 다른 네트워크 토폴로지 대신 링 네트워크를 사용할 수 있다. 링 네트워크는 디코더 레이어에서 FPGA 사이에 필요한 데이터 동기화 및 전송을 최소화할 수 있다.
가속화 장치(360) 내부에서 2개의 코어(362_1, 362_2) 사이의 통신은 사용 가능한 리소스에 따라 달라지므로 제한이 없을 수 있다. 가속화 장치(360) 내부에서 2개의 컴퓨트 코어 사이의 통신 속도가 FPGA 사이의 통신 속도와 같도록 라우터를 효율적으로 벨런싱한다. 도 3에는 하나의 FPGA 클러스터 내에 4개의 FPGA가 배치되는 것으로 도시되었으나, 이에 한정되지 않으며, FPGA의 수는 필요에 따라 변경될 수 있다.
다중 FPGA 가속 시스템(300)은 대규모 언어 모델을 효율적으로 처리하기 위해 모델 병렬 처리를 사용할 수 있다. 언어 서비스와 관련된 인공 신경망 모델(예를 들어, GPT 언어 모델)에 포함된 셀프 어텐션(370) 및 피드포워드 네트워크(380)에서 모델 매개변수 또는 가중치 행렬(390)은 코어 수와 동일한 수(예를 들어, 8개)로 열 방향으로 분할될 수 있다. 각 컴퓨트 코어는 각 분할된 부분을 처리하도록 할당될 수 있다. 할당된 컴퓨트 코어가 있는 FPGA의 메모리에 분할된 부분이 저장될 수 있다. 그리고 각 FPGA의 각 컴퓨트 코어는 분할된 모델 매개변수를 사용하여 동일한 작업을 수행할 수 있다. 즉, 언어 서비스와 연관된 인공 신경망에 포함된 셀프 어텐션(370) 및 피드포워드 네트워크(380)에서 모델 매개변수 또는 가중치 행렬이 열 방향으로 복수의 부분으로 분할되고, 복수의 부분 각각이 각 컴퓨트 코어에 입력될 수 있다. 이 경우, 각 컴퓨트 코어는 입력된 부분에 대해 동일한 연산을 처리할 수 있다. 나머지 작업에 대한 모델 매개변수는 각 컴퓨트 코어에 전체적으로 저장되고, 각 컴퓨트 코어에서 수행될 수 있다.
모델 매개변수가 분할되는 경우, 이러한 연산들은 계산적으로 비용이 적기 때문에 동기화는 계산보다 시간이 오래 걸릴 수 있다. 전반적으로 각 FPGA는 동일한 하드웨어에서 동일한 작업을 실행하여 GPT 언어 모델을 종단 간으로 실행하므로 4개의 FPGA가 하나의 클러스터를 형성할 수 있다. 이와 같은 구성에 따르면, FPGA는 HBM과 DDR 메모리의 최대 대역폭을 모두 활용할 수 있다.
GPT 언어 모델은 분할된 모델 매개변수를 자주, 그리고 많은 양으로 필요로 하기 때문에 메모리 대역폭은 전체 성능에 상당한 영향을 미칠 수 있다. 따라서 분할된 모델 매개변수는 HBM에 저장될 수 있다. 반면에 WTE 및 WPE는 전체 디코더 단계당 한 번만 데이터에 액세스하므로 전체 성능에 미미한 영향을 미치기 때문에 DDR 메모리에 저장될 수 있다.
FPGA 내에 2개가 아닌 다른 수의 컴퓨트 코어를 배치하는 경우, 각 컴퓨트 코어는 성능 저하를 겪는다. FPGA 내에 하나의 컴퓨트 코어를 배치하는 경우, 컴퓨트 코어가 커져 배치 및 라우팅의 혼잡 문제가 발생하고 작동 주파수가 감소할 수 있다. FPGA 내에 3개 이상의 컴퓨트 코어를 배치하는 경우, 각 컴퓨트 코어는 작아지지만 동기화 오버헤드는 선형적으로 증가하고 상당한 양의 스톨(stall)이 발생할 수 있다. 따라서 다중 FPGA 가속 시스템(300)은 배치 및 라우팅 문제와 동기화 오버헤드의 균형을 유지하기 위해 최적화된 명령과 데이터 흐름을 구현할 수 있는, 하나의 FPGA 내에 2개의 동일한 컴퓨트 코어 또는 듀얼 컴퓨트 코어를 포함할 수 있다.
다중 FPGA 가속 시스템(300)은 어텐션만을 위해 설계된 기존의 NLP 가속기와 비교할 때, GPT 언어 모델에 대한 종단 간 처리를 지원하는 유연하고 최적화된 명령 세트(Instruction Set Architecture; ISA)를 포함할 수 있다. 여기서, 명령 세트는 compute 명령, dma 명령 및 router 명령을 포함할 수 있다. compute 명령은 주 처리 장치를 실행할 수 있고, 소스 또는 대상 위치가 오프칩 메모리(off-chip memory)인지 온칩 레지스터 파일(on-chip register file)인지 결정하기 위한 추가 비트가 있는 포맷(type, src1, src2, dst)을 포함할 수 있다. dma 명령 및 router 명령은 DMA(Direct Memory Access) 및 네트워크 라우터를 제어하여 주어진 전송 크기의 데이터를 컴퓨트 코어로 또는 컴퓨트 코어로부터 이동할 수 있고, type, src, dst, xfer_size와 같은 포맷을 가질 수 있다.
각 명령은 명령 체이닝(instruction chaining)을 통해 실행될 수 있고, 여기서 종속 명령 시퀀스는 최소 지연으로 작동할 수 있다. 한편 종속성이 없는 명령은 병렬로 작동할 수 있다. 예를 들어, compute 명령은 데이터를 처리하고, dma 명령은 데이터를 가져오고, router 명령은 동시에 피어 장치의 데이터로 버퍼를 채울 수 있다. 명령 체이닝과 병렬 실행을 결합하면 메모리와 통신 대역폭을 지속적으로 사용할 수 있다.
compute 명령은 주요 처리 단위를 제어하는 행렬 명령 및 벡터 명령을 포함할 수 있다. 예를 들어, compute 명령을 사용하는 GPT 언어 모델 디코더 레이어의 수도코드(pseudocode)는 표 1과 같이 표현될 수 있다.
Input: in emb, input embedding vector
Output: out emb, output embedding vector
Parameter: H, number of attention head
1: lnorm1 = LayerNorm(in emb, γi,
Figure PCTKR2023003620-appb-img-000001
i)
2: /* Self-Attention */
3: query = Conv1D(lnorm1, Wq, bq)
4: key = Conv1D(lnorm1, Wk, bk)
5: value = Conv1D(lnorm1, Wv, bv)
6: for h = 0 to H do
7: mat = MaskedMM(query[h], keyT [h])
8: redu max = ReduMax(mat)
9: score = Softmax(mat -redu max)
10: attn[h] = MM(score, value[h])
11: end for
12: attn = attn + in emb
13: lnorm2 = LayerNorm(attn, γp,
Figure PCTKR2023003620-appb-img-000002
p)
14: /* Feed-Forward Network */
15: ffn1 = GELU(Conv1D(lnorm2, Wffn1, bffn1))
16: ffn2 = Conv1D(ffn1, Wffn2, bffn2)
17: out emb = ffn2 + attn
행렬 명령(matrix instruction)은 행렬-벡터 곱셈과 GELU 및 리듀스 맥스(reduce max)와 같은 추가 기능을 수행할 수 있다. 행렬은 타일에 로드될 수 있고, 벡터도 부분적으로 로드될 수 있다. 행렬-행렬 곱셈은 행렬-벡터 곱셈의 시퀀스에 의해 수행될 수 있다. 행렬 명령은 Conv1D, MaskedMM(Masked Matrix Multiplication) 및 MM(Matrix Multiplication)을 포함할 수 있다.
Conv1D 명령은 방정식 Ax+b로 작성된 필수 행렬 명령으로서 Query, Key 및 Value 행렬 생성과 피드포워드 네트워크에 사용될 수 있다. Conv1D 명령은 가중치 행렬 A, 입력 벡터 x 및 편향 벡터(bias vector) b를 포함할 수 있다. Conv1D는 입력이 최대 입력 크기보다 길면, 합성곱(convolution)과 같이 슬라이딩 윈도우(sliding window)를 통해 연산을 수행할 수 있다.
MaskedMM 명령은 방정식 Ax를 포함할 수 있다. MaskedMM은 Score 행렬이라고 하는 QueryХKeyT를 계산할 수 있다. Query 행렬은 벡터로 로드될 수 있다. 마스킹 작업은 현재 토큰이 미래 컨텍스트의 영향을 받지 않음을 나타내기 위해 Score 행렬의 위쪽 대각선 요소에 -∞8 마스크를 배치할 수 있다. MaskedMM 명령은 벡터 명령인 소프트맥스와 결합하여 하삼각 행렬(lower triangular matrix)을 생성하고 각 행의 최대값을 얻을 수 있다.
MM 명령은 마스킹 없는 MaskedMM 명령과 동일할 수 있다. MM 명령은 출력 임베딩 벡터를 토큰 ID로 변환할 때 출력되는 중간 값인 로짓(logit)을 계산하기 위한 LM 헤드와 Score Х Value를 계산하기 위한 어텐션 레이어에서 사용될 수 있다. 또한, MM 명령은 Value를 곱하기 위해 전치 유닛도 포함할 수 있다.
벡터 명령(vector instruction)은 로드(load) 및 저장(store)과 함께 로우레벨 벡터-벡터 및 벡터-스칼라 연산을 실행할 수 있다. 벡터 명령은 add, sub, mul, accum, recip_sqrt, recip, exp를 포함할 수 있다. 따라서 벡터 명령은 하이레벨 연산(예를 들어, 레이어 정규화 연산 및 소프트맥스 연산)을 효과적으로 구현할 수 있다.
레이어 정규화 연산은 아래와 같은 수학식 1을 포함할 수 있고, 여기서 μ와 σ는 평균 및 표준 편차이고, γ 및
Figure PCTKR2023003620-appb-img-000003
는 각각 가중치 및 편향 벡터이다.
Figure PCTKR2023003620-appb-img-000004
평균을 계산하기 위해 accum 및 mul 명령이 필요하고, 표준 편차를 계산하기 위해 recip_sqrt 명령이 추가로 필요하다. 그 후, 수학식 1은 sub, mul 및 add 명령에 의해 수행될 수 있다. 로드 명령을 통해 레지스터 파일로부터 매개변수를 불러올 수 있다.
소프트맥스 연산은 아래와 같은 수학식 2를 포함할 수 있다. 여기서 j는 행 요소의 수를 나타낸다.
Figure PCTKR2023003620-appb-img-000005
수학식 2는 exp, add, accum과 같은 기본 벡터 명령으로 수행될 수 있다. 합산은 레이어 정규화 연산에서 평균을 계산하는 것과 유사할 수 있다. 나누기는 recip 및 mul 명령으로 대체될 수 있다.
다중 FPGA 가속 시스템(300)은 GPT 언어 모델의 추론에서 메모리 병목 현상을 해결하기 위해 모델 매개변수를 반정밀도 부동 소수점(half-precision floating point; 16-bit)에서 더 작은 8-bit로 이루어진 미니플로트(minifloat)로 양자화할 수 있다. 이러한 양자화 방식은 HBM과의 데이터 전송을 2배로 증가시켜 주기당 계산 횟수를 2배로 늘릴 수 있다. 8-bit 미니플로트 데이터는 1-bit 부호(sign), 4-bit 지수(exponent) 및 3-bit 가수(mantissa)를 포함할 수 있으며, 이는 GPT 언어 모델의 추론 시 필요한 범위에 따라 결정할 수 있다. NLP 모델에는 큰 동적 범위를 필요로 하는 레이어 정규화와 같은 프로세스가 있기 때문에, 다중 FPGA 가속 시스템(300)에서 고정 소수점(fixed point)을 더 높은 정밀도로 사용하는 것을 고려하지 않는다. 높은 압축에서 발생하는 상당한 정확도 손실 때문에, 다중 FPGA 가속 시스템(300)에서 더 높은 양자화 비율을 가진 정수 양자화(integer quantization)를 고려하지 않는다.
두 배의 계산을 제공하는 두 배의 로직 수에서도 계산상의 병목 현상이 발생하지 않기 때문에, 다중 FPGA 가속 시스템(300)의 컴퓨트 코어 내에서 값을 표준 반정밀도 부동 소수점(standard half-precision floating point)으로 역양자화(dequantize)할 수 있다. 이러한 구성에 의해, 16-bit 부동 소수점 처리 장치와 온칩 메모리는 버림이나 반올림을 방지하기 때문에 정확도가 더 떨어지는 것을 방지할 수 있다.
도 4는 본 개시의 일 실시예에 따른 컴퓨트 코어(400)의 상세 구조를 나타내는 도면이다. 트랜스포머 기반 언어 서비스 가속화 장치는 다중 FPGA 가속 시스템 내의 복수의 FPGA 중 하나이고, 하나의 FPGA는 2개의 컴퓨트 코어(400)를 포함할 수 있다. 도시된 바와 같이, 컴퓨트 코어(400)는 행렬 처리 유닛(Matrix Processing Unit; MPU)(410), 벡터 처리 유닛(Vector Processing Unit; VPU)(420), 제어 유닛(control unit)(430), DMA(440), 라우터(450) 및 레지스터 파일 매니저(register file manager)(460)를 포함할 수 있다. 도 4에서 별도 표기가 있는 선을 제외하고, 실선은 데이터 흐름을 나타내고, 점선을 컨트롤을 의미한다.
제어 유닛(430)은 컴퓨트 코어(400) 내의 구성 요소들의 동작을 제어할 수 있다. 컴퓨트 코어(400)는 인공 신경망 모델의 종단 간 가속을 위해 필요한 다양한 수학적 연산을 수행하는 행렬 처리 유닛(410) 및 벡터 처리 유닛(420)을 포함할 수 있다. 도시된 바와 같이, 행렬 처리 유닛(410)과 벡터 처리 유닛(420)이 분리되어 각각 제어 유닛(430)의 제어에 따라 연산을 수행함으로써, 행렬 연산과 벡터 연산의 특징이 달라서 생기는 문제를 해결할 수 있다. 예를 들어, GPU에서 행렬 연산은 빠른데 벡터 연산은 느려 GPT 언어 모델의 벡터 연산과 관련된 레이어(Residual, LayerNorm)에서 일어나는 병목 현상을 행렬 처리 유닛(410)과 벡터 처리 유닛(420)을 분리하여 해결할 수 있다.
행렬 처리 유닛(410)은 행렬 기능 유닛(Matrix Function Unit; MFU)(412) 및 제1 특수 기능 유닛(Special Function Unit; SFU)(414)을 포함할 수 있다. 행렬 처리 유닛(410)은 제1 데이터 패스를 구성할 수 있다. 행렬 기능 유닛(412)은 레지스터 파일 매니저(460)의 출력을 수신하여 행렬-벡터 곱을 연산하도록 구성될 수 있다.
제1 특수 기능 유닛(414)은 행렬 기능 유닛(412)과 연결될 수 있다. 일 실시예에서, 제1 특수 기능 유닛(414)은 행렬 기능 유닛(412)의 출력을 수신하여 인공 신경망에서의 비선형 함수를 처리할 수 있다. 구체적으로, 제1 특수 기능 유닛(414)은 행렬 명령에서 요구되는 행렬-벡터 곱 이후의 연산을 수행할 수 있다. 예를 들어, 제1 특수 기능 유닛(414)은 GELU(Gaussian Error Linear Unit)와 같은 활성화 연산을 처리하도록 구성될 수 있다.
벡터 처리 유닛(420)은 벡터 기능 유닛(Vector Function Unit; VFU)(422) 및 제2 특수 기능 유닛(SFU)(424)을 포함할 수 있다. 벡터 처리 유닛(420)은 제1 데이터 패스를 구성할 수 있다. 행렬 처리 유닛(410)의 제1 데이터 패스와 벡터 처리 유닛(420)의 제2 데이터 패스는 서로 상이하고, 병렬적으로 처리될 수 있다. 벡터 기능 유닛(422)은 레지스터 파일 매니저(460)의 출력을 수신하여 벡터 연산을 수행할 수 있다.
제2 특수 기능 유닛(424)은 벡터 기능 유닛(422)과 연결될 수 있다. 일 실시예에서, 제2 특수 기능 유닛(424)은 벡터 기능 유닛(422)의 출력을 수신하여, 인공 신경망에서의 비선형 함수를 처리할 수 있다. 구체적으로, 제2 특수 기능 유닛(424)은 벡터 명령에서 요구되는 벡터 연산 이후의 연산을 수행할 수 있다.
행렬 처리 유닛(410)과 벡터 처리 유닛(420)은 GPT 언어 모델에 대한 병렬 컴퓨팅 및 하드웨어 리소스를 완전히 활용할 수 있다. 또한, 행렬 기능 유닛(412) 및 벡터 기능 유닛(422)은 최대 처리량을 위해 깊고 다양한 파이프라인을 포함할 수 있고, 각 하위 계산에서 바이패스를 활용하여 짧은 대기 시간에 명령을 비동기적으로 실행할 수 있다.
제어 유닛(430)은 행렬 처리 유닛(410), 벡터 처리 유닛(420), DMA(440), 라우터(450) 및 레지스터 파일 매니저(460) 각각의 상태를 추적하고 실행할 모듈을 조정하여, 전체 데이터 흐름을 제어하는 *?*로직을 포함할 수 있다. 도시된 바와 같이, 제어 유닛(430)은 컨트롤러(controller)(432), 명령 버퍼 (instruction buffer)(434), 스케줄러(scheduler)(436) 및 스코어보드(score board)(438)를 포함할 수 있다.
컨트롤러(432)는 AXI(Advanced eXtensible Interface)-Lite 프로토콜을 통해 호스트 CPU로부터 시작 신호와 시스템 구성 정보를 수신하고 디코딩하여 스케줄러(436)로 전달할 수 있다. 여기서, 시스템 구성 정보는 코어 ID, 다중 FPGA 가속 시스템 내의 컴퓨트 코어의 수, 시스템을 실행하는데 필요한 디코더 레이어와 토큰의 수를 포함할 수 있다. 이러한 매개변수는 각 코어의 동작을 결정할 수 있다. 코어 ID와 코어 수는 모델 가중치를 적용할 특정 코어와 수신 및 전송할 피어 장치를 지정하는데 이용될 수 있다. 디코더 레이어의 수에 따라 단일 토큰 처리가 완료되는 시점이 결정될 수 있고, 입출력 토큰의 수에 따라 전체 서비스가 완료되는 시점이 결정될 수 있다.
컨트롤러(432)는 주어진 코어가 처리하고 있는 현재 레이어 번호와 토큰 번호를 추적할 수 있다. 각 레이어에 대해 HBM의 다른 부분에 액세스해야 하므로 레이어 번호는 DMA(440)가 액세스해야 하는 주소를 지정할 수 있다. 토큰 번호는 특히 MaskedMM 명령이 실행되는 동안 마스킹할 위치를 파악하는데 사용될 수 있다. 또한, 컨트롤러(432)는 전체 GPT 언어 모델 작업이 완료되면 완료 신호를 호스트 CPU로 다시 반환할 수 있다.
명령 버퍼(434)는 컨트롤러(432) 및/또는 호스트 CPU로부터 명령을 수신할 수 있다. 또한, 명령 버퍼(434)는 명령을 스케줄러(436)로 전달할 수 있다.
스케줄러(436)는 컨트롤러(432)에서 디코딩된 시스템 구성 정보를 수신하고 명령 버퍼(434)로부터 명령을 수신할 수 있다. 스케줄러(436)는 행렬 처리 유닛(410), 벡터 처리 유닛(420), DMA(440), 라우터(450) 및 레지스터 파일 매니저(460)의 상태를 확인하여 각 명령에 따라 명령을 실행할지 대기할지 결정할 수 있다. 스케줄러(436)는 실행 중인 명령과의 마지막 종속성 검사를 위해 결정된 명령을 스코어보드(438)로 전송할 수 있다.
레지스터 파일 매니저(460) 내의 레지스터 파일은 체이닝 방식(chaining method)을 기반으로 하므로, 스코어보드(438)는 일련의 명령으로 인한 데이터 해저드(data hazard)를 방지하기 위해 출발지 및 목적지 주소를 모니터링할 수 있다. 스코어보드(438)는 RAM을 사용하여 주소 공간을 표시할 수 있다. 또한, 스코어보드(438)는 현재 명령의 주소를 실행 중일 때는 stale 비트로 표시하고, 라이트백(writeback)에서는 valid 비트로 표시할 수 있다. 출발지와 목적지 주소가 겹치거나 다른 위험이 발생하면, 스코어보드(438)는 다음 명령을 현재 계산이 끝날 때까지 지연시킬 수 있다. 따라서 스코어보드(438)를 통과한 명령은 결국 실행된다.
DMA(440)는 고대역폭 메모리(High Bandwidth Memory) 및 DDR 메모리로부터 데이터를 읽고 쓰도록 구성될 수 있다. DMA(440)는 읽기 및 쓰기 인터페이스를 포함할 수 있고, 고대역폭으로 전송되는 데이터를 배포하는데 중요한 역할을 한다. 도시된 바와 같이, DMA(440)는 임베드 버퍼(embed buffer) 유닛, 로드 버퍼(load buffer) 유닛, 가중치 버퍼(weight buffer) 유닛, 역양자화(dequantizer) 유닛, 편향 버퍼(bias buffer) 유닛, 전치(transpose) 유닛, 아비터(arbiter) 유닛 및 저장 버퍼(store buffer) 유닛을 포함할 수 있다. 대역폭을 최대화하기 위해 HBM에서 데이터를 읽는 DMA(440)의 읽기 인터페이스는 컴퓨트 코어당 모든 16개 HBM 채널에 연결될 수 있다. 각 채널의 최대 단일 채널 데이터 비트폭은 256-bit이므로 DMA(440)는 한 번에 16 Х 256 bit를 읽을 수 있다.
DMA(440)는 로드 버퍼 유닛을 이용하여 재사용을 위해 레지스터 파일 매니저(460) 내의 레지스터 파일로 전송되는 입력을 읽을 수 있다. 가중치와 편향은 단일 배치로 인해 행렬 곱셈에서 재사용할 수 없으므로, DMA(440)는 가중치 버퍼 유닛 및 편향 버퍼 유닛을 거쳐 사전 로드된 입력이 있는 처리 장치에서 가중치와 편향을 직접 계산할 수 있다. 특히 가중치는 HBM에서 8-bit 미니플로트(minifoat)로 가져오기 때문에 역양자화 유닛은 가중치를 다시 16-bit 부동 소수점으로 변환할 수 있다. 읽기 인터페이스도 DDR에 연결되어 토큰 임베딩 및 LM 헤드를 위한 내장 버퍼를 통해 WTE 및 WPE에서 토큰을 읽을 수 있다. 이러한 토큰은 가중치에 비해 작기 때문에 하나의 DDR 채널이 데이터 전송에 사용될 수 있다.
DMA(440)의 쓰기 인터페이스는 저장 버퍼 유닛 내의 Key, Value 및 생성된 토큰을 HBM에 기록할 수 있다. 이 프로세스는 드물게 발생하므로 4개의 HBM 채널만 연결될 수 있다. 더 적은 수의 쓰기 채널을 사용하면 성능 저하 없이 하드웨어 오버헤드를 줄일 수 있다. 또한 데이터 흐름에서 출력 값이 기록될 때 출력 값이 전치되어야 하므로 DMA(440)는 버퍼 유닛을 포함할 수 있다. 전치는 채널 비트폭보다 작은 차원에서 발생해야 하므로, AXI 쓰기 스트로브(strobe)는 채널에 데이터 바이트를 쓰는데 사용될 수 있다.
라우터(450)는 다른 가속화 장치 및 동일 가속화 장치 내의 다른 컴퓨트 코어와 통신하기 위해 다중 FPGA 네트워크를 활성화할 수 있다. 다중 FPGA 가속 시스템 내의 각 컴퓨트 코어(400)는 라우터(450)를 사용하여 레지스터 파일의 데이터를 다중 FPGA 가속 시스템 내의 다른 FPGA 클러스터 및 링 네트워크의 다른 가속화 장치(즉, FPGA)와 동기화할 수 있다. 또한, 라우터(450)는 송신 버퍼(TX buffer) 유닛, 수신 버퍼(RX buffer) 유닛 및 아비터 유닛을 포함할 수 있다.
레지스터 파일 매니저(460)는 DMA(440) 및 라우터(450)를 통해 데이터를 수신하고, 수신된 데이터에 기초하여 행렬 처리 유닛(410) 및 벡터 처리 유닛(420)을 위한 명령을 생성하도록 구성될 수 있다. 레지스터 파일 매니저(460)는 행렬 처리 유닛(410) 및 벡터 처리 유닛(420)에서의 계산 전후에 다수의 16-bit 부동 소수점(FP16) 데이터를 저장하기 위한 온칩 메모리 구조 또는 레지스터 파일을 포함할 수 있다. 레지스터 파일 매니저(460)는 벡터 레지스터 파일 및 스칼라 레지스터 파일을 포함할 수 있다. 레지스터 파일은 DMA(440)를 통해 메모리 인터페이스와 통신하고 라우터(450)를 통해 네트워크와 통신하여 조직화된 방식으로 호스트 CPU 및 피어 가속화 장치에서 데이터를 읽고 쓸 수 있다.
레지스터 파일 매니저(460)에는 행렬 처리 유닛(410) 및 벡터 처리 유닛(420)을 위한 명령을 생성 및 수집하고, 명령을 기반으로 액세스할 레지스터 파일 데이터를 결정하는 행렬 피연산자 콜렉터(matrix operand collector) 및 벡터 피연산자 콜렉터(vector operand collector)를 포함할 수 있다.
벡터 레지스터 파일 및 스칼라 레지스터 파일은 GPT 언어 모델의 계산에 필요한 가중치 및 중간 결과의 일부를 저장할 수 있다. 온칩 메모리 용량은 제한되어 있기 때문에 레지스터 파일 매니저(460)는 재사용을 최대화하는 데이터 부분만 레지스터 파일에 저장할 수 있다.
벡터 레지스터 파일 및 스칼라 레지스터 파일은 각각 2 Х 64 Х 16 bit 및 2 Х 16 bit의 비트폭을 포함할 수 있다. 벡터 레지스터 파일 및 스칼라 레지스터 파일은 2개의 뱅크와 2,048의 깊이(depth)를 포함할 수 있다. 각 레지스터 파일에서 2개의 뱅크가 동시에 활성화되어 사이클당 행렬 처리 유닛(410) 및 벡터 처리 유닛(420)으로 2개의 데이터 세트를 읽을 수 있다. 하나의 명령마다 2개의 소스가 필요하기 때문에 최대 처리량을 위해서는 2개의 데이터 세트를 보낼 수 있다. 깊이는 WTE의 전치로 행렬 곱셈을 처리한 후 LM 헤드에서 발생하는 GPT 언어 모델의 프로세스가 수행하는 중에 임의의 지점에서 레지스터 파일이 보유해야 하는 최대 데이터 수를 기반으로 결정될 수 있다.
행렬 피연산자 콜렉터는 런타임 동안 행렬 명령을 생성할 수 있고, 제어 유닛(430)의 스코어보드(438)에서 준비 신호가 제공될 때까지 이러한 명령을 유지할 수 있다. 명령의 런타임 생성은 호스트 CPU에서 전달되는 명령의 양을 줄일 수 있다. 행렬 피연산자 콜렉터는 입력 벡터, 가중치 행렬 및 편향 벡터와 같은 명령 및 피연산자의 실행을 위해, 명령 및 피연산자를 행렬 처리 유닛(410)으로 전달할 수 있다.
행렬 피연산자 콜렉터는 DMA(440)의 가중치 버퍼 유닛과 편향 버퍼 유닛에서 각각 가중치와 편향을 가져오는 동안 벡터 레지스터 파일에서 단일 입력 벡터를 읽을 수 있다. 또한, 타일링 순서를 계산하고 해당 입력과 가중치를 행렬 처리 유닛(410)에 할당할 수 있다. 벡터 레인(vector lane)에는 동일한 입력 벡터가 분포되고 각 벡터 레인에는 서로 다른 가중치와 편향이 분포될 수 있다. 그리고 행렬 피연산자 콜렉터는 모든 피연산자에 경량 이중 버퍼(lightweight double buffer)를 사용하여 대기 시간을 줄이고 높은 처리량을 얻을 수 있다.
벡터 피연산자 콜렉터는 행렬 피연산자 콜렉터와 유사하게 신호를 생성하고 벡터 처리 유닛(420)을 제어하여 벡터 명령을 실행할 수 있다. 벡터 처리 유닛(420)에는 다양한 피연산자 유형이 필요하므로 벡터 피연산자 콜렉터는 벡터 레지스터 파일 및 스칼라 레지스터 파일을 모두 읽을 수 있다. 벡터 피연산자 콜렉터는 DMA(440) 및 라우터(450)의 수신 버퍼(RX buffer) 유닛에 액세스하여 DMA 또는 네트워크 명령(예를 들어, 로드, 저장 및 동기화 명령)을 수행할 수 있다. 또한 벡터 피연산자 콜렉터는 이중 버퍼를 포함할 수 있고, 런타임 중에 벡터 관련 명령을 생성하여 대기 시간을 줄이고 높은 처리량을 얻을 수 있다.
도 5는 다중 FPGA 가속 시스템이 포함하는 타일링 체계를 나타내는 도면이다. 도시된 것과 같이, 레지스터 파일로부터의 벡터(510)와 HBM으로부터의 행렬(520)을 곱하여 출력 벡터(530)를 생성할 수 있다. 이 과정에서, 본 개시의 다중 FPGA 가속 시스템은 인공 신경망 모델의 요약 단계에서 합리적인 성능을 유지하면서 메모리 바운드 생성 단계에서 계산 수와 처리량을 최대화하기 위해 도시된 최적화된 타일링 체계를 사용할 수 있다.
인공 신경망 모델의 생성 단계에서 단일 토큰을 처리하려면 행렬 곱셈을 위해 HBM에서 많은 양의 가중치를 읽어야하므로, 가중치는 HBM에서 타일링되고 DMA는 16Х256 bit의 최대 읽기 대역폭에서 타일링된 가중치를 읽을 수 있다. 이와 같은 차원은 d Х l Х BWdata 가중치 비트로 재배열될 수 있다. 여기서 d는 타일의 차원, l은 레인(lane)의 수, BWdata는 데이터의 비트폭을 지칭할 수 있다. 가중치의 비트폭은 8-bit이므로 DMA에 512개의 가중치를 로드할 수 있다. 다중 FPGA 가속 시스템의 타일링 체계는 최적의 d, l 및 행렬-벡터 계산의 방향을 결정할 수 있다.
d가 크면 d 차원의 큰 입력 벡터를 레지스터 파일에서 로드해야 하므로 큰 레지스터 파일 대역폭이 필요할 수 있다. 레지스터 파일 포트의 비트 폭은 제한되어 있기 때문에 d가 이 비트 폭보다 크면 입력 벡터를 로드하는데 많은 사이클이 필요하고 지연이 발생할 수 있다. 또한, d가 작으면 계산 횟수를 유지하기 위해 레인 수가 이와 비례하여 증가할 수 있다. 추가로, d가 작으면 출력 벡터 차원이 증가하고 중간 데이터(즉, 부분합)의 수가 증가할 수 있다. 이 경우, 중간 데이터를 저장하기 위해 버퍼의 양이 증가하지만 그 양은 미미할 수 있다. 따라서 하드웨어 자원과 모델 크기를 고려하여 d = 64로 결정할 수 있다. 최대 읽기 대역폭을 활용하기 위해 l = 8로 결정될 수 있다.
DMA는 지그재그 방향(540)으로 512개(d*l=512)의 가중치를 로드할 수 있다. 수평 방향은 입력 재사용을 최대화하지만 길이 d의 입력이 가중치 행렬의 전체 너비에 걸쳐 반복될 때, 계산되는 부분 합을 저장하기 위해 상당한 양의 버퍼가 필요할 수 있다. 버퍼는 온칩 메모리로 구성되며, 코어의 딥 파이프라이닝(deep pipelining) 및 기타 버퍼 요구사항으로 인해 온칩 메모리가 부족하므로 DMA가 수평 방향으로 가중치를 로드하는 것은 불가능할 수 있다.
DMA가 수직 방향으로 가중치를 로드하는 것은 버퍼 수를 1로 줄이지만 입력을 재사용하지 못할 수 있다. 입력을 재사용할 수 없으면 레지스터 파일 액세스 양이 증가하여 처리량이 감소할 수 있다. 따라서 도시된 바와 같이, DMA가 지그재그 방향(540)으로 가중치를 로드하는 타일링 체계는 하드웨어 리소스와 데이터 재사용의 균형을 유지하여 최대 성능을 발휘할 수 있다.
도 6은 다중 FPGA 가속 시스템 내의 각 가속화 장치(즉, FPGA)의 경량 라우터(lightweight router)(600)를 나타내는 도면이다. 여기서 라우터(600)는 도 4에 도시된 컴퓨트 코어(400)의 라우터(450)의 상세 구성을 나타낼 수 있다. 예를 들어, 라우터(600)는 64 Х 16 bit 데이터를 송수신하도록 구성될 수 있다. 구체적으로, 라우터(600)는 처리 유닛(예를 들어, 도 4의 410, 420)과 출력 벡터를 송수신할 수 있다. 일 실시예에서, 라우터(600)는 동일 가속화 장치(즉, FPGA) 내의 다른 컴퓨트 코어(intra-device)와 통신하고/통신하거나 다른 가속화 장치 내의 컴퓨트 코어(inter-device)와 통신(P2P 통신)할 수 있다.
라우터(600)에는 네트워크에 연결할 FPGA(또는 가속화 장치)의 컴퓨트 코어를 나타내는 컨트롤 유닛(610), 코어 ID를 사용하여 모든 컴퓨트 코어에서 데이터 주소를 동일하게 구성하는 재정렬(reorder) 유닛(620) 및 송신과 수신된 벡터를 보관하는 버퍼를 포함하는 로컬 인터페이스 유닛(630)을 포함할 수 있다. 또한, 라우터(600)는 왼쪽 인터페이스 유닛(650)에서 오른쪽 인터페이스 유닛(660)으로 및 그 반대 방향으로의 통신을 중재할 수 있는 아비터 유닛(640)을 포함할 수 있다. 아비터 유닛(640)은 로컬 인터페이스 유닛(630)으로부터 신호를 수신하여 통신을 중재할 수 있고, 재정렬 유닛(620)에 신호를 송신할 수 있다. 따라서 각 컴퓨트 코어는 라우터(600)를 사용하여 레지스터 파일의 데이터를 FPGA 내의 다른 컴퓨트 코어 및 링 네트워크의 다른 FPGA와 동기화할 수 있다.
모델 병렬 처리로 인해 각 컴퓨트 코어가 출력 행렬의 행 일부만 계산하고 레이어 정규화 및 레지듀얼과 같은 후속 작업이 전체 행을 필요로 할 수 있다. 따라서 셀프 어텐션 및 피드포워드 네트워크에서 Conv1D 명령을 실행한 후 동기화가 필요할 수 있다.
네트워크의 P2P 통신은 커널 간 스트리밍(K2K)과 Aurora 64b/66b IP의 두 가지 방식을 사용하여 활성화될 수 있다. K2K는 AXI-Stream 인터페이스를 사용하여 두 컴퓨트 코어 사이의 스트리밍을 수행할 수 있고, 통신 오버헤드는 무시할 수 있는 정도 일 수 있다. Aurora IP는 두 FPGA 사이의 고속 직렬 통신을 위한 경량 링크 레이어 프로토콜을 구현할 수 있다. 프로토콜은 64b/66b 인코딩을 사용하므로 전송 오버헤드가 3%에 불과하여 리소스 비용이 저렴하다. 따라서, 라우터(600)는 지원되는 FPGA 사이의 가벼운 통신 인터페이스를 제공하여 데이터 통신 대기 시간을 줄일 수 있다.
도 7은 다중 FPGA 가속 시스템 내의 각 가속화 장치의 행렬 처리 유닛(700)을 나타내는 도면이다. 행렬 처리 유닛(700)은 인공 신경망 모델(예를 들어, GPT 모델)의 종단 간 가속에 필요한 다양한 수학적 연산을 높은 하드웨어 효율성으로 실행할 수 있다.
도시된 것과 같이, 행렬 처리 유닛(700)은 행렬 기능 유닛(710) 및 제1 특수 기능 유닛(720)을 포함할 수 있다. 행렬 기능 유닛(710)은 입력으로 벡터들을 수신하고 병렬적으로 처리할 수 있다. 제1 특수 기능 유닛(720)은 행렬 기능 유닛(710)의 출력을 수신하여 인공 신경망 모델에서의 비선형 함수를 처리할 수 있다.
행렬 기능 유닛(710)은 행렬 명령을 실행할 수 있다. 행렬 기능 유닛(710)의 주요 워크로드는 행렬-벡터 곱셈이다. 행렬 기능 유닛(710)은 입력으로 d 차원(예를 들어, 64 차원)의 벡터를 수신하고, 행렬-벡터 곱셈(multiplication)을 병렬적으로 처리하도록 구성된 복수의 트리 기반 MAC(multiplier-accumulators)(712)을 포함할 수 있다. 또한 행렬 기능 유닛(710)은 l개의 레인(예를 들어, 8개의 레인)을 포함할 수 있다. 이는 l개의 트리 기반 MAC 하드웨어가 병렬로 연결되어 있음을 의미한다. 복수의 트리 기반 MAC 각각에 언어 서비스와 연관된 인공 신경망의 가중치 행렬의 서로 다른 열에서의 승수(multiplicand)가 전달될 수 있다.
행렬 기능 유닛(710)의 입력은 레인 전체에서 일정하게 유지되지만, 가중치 행렬의 서로 다른 열에서의 l개의 서로 다른 승수(multiplicand)가 각 레인으로 전달될 수 있다. 즉, 행렬 기능 유닛(710)에서 dХl 행렬-벡터 곱셈이 병렬로 수행되며 이는 도 5에서 전술한 최적화된 타일링 체계와 동일하다.
그런 다음 각 레인의 곱은 부분합을 계산하기 위해 깊이가 log2(d)의 병렬 가산기 트리(parallel adder tree)로 전달될 수 있다. 이 과정에서 깊은 파이프라이닝으로 인해 새로운 부분합이 매 사이클마다 계산될 수 있다. 행렬 기능 유닛(710)의 버퍼(714)는 부분합을 저장할 수 있고, 새로운 부분합을 로드 및 추가하며 총 합이 계산될 때까지 연산을 반복할 수 있다.
FP16 곱셈기와 가산기는 각각 6 사이클과 11 사이클이 걸리는 DSP(Digital Signal Processing) 슬라이스에 매핑될 수 있다. 타일은 최대 MAC(712) 하드웨어 수, 즉 최대 DSP 수를 사용하도록 최적화될 수 있다. 따라서, 트리 기반 MAC(712)은 총 2 Х d Х l - 1 개의 DSP를 사용할 수 있다. FP16 곱셈기는 d Х l 개의 DSP를 사용할 수 있고, FP16 가산기는 d Х l - 1 개의 DSP를 사용할 수 있다.
행렬 기능 유닛(710)은 스칼라를 추가하기 위해 l개 DSP를 추가로 사용할 수 있다. 예를 들어, d와 l은 각각 64와 8로 설정될 수 있다. GPT 언어 모델은 메모리에 종속되기 때문에, 사용되는 DSP의 수가 증가하는 경우 성능이 선형적으로 증가할 수 있다.
제1 특수 기능 유닛(720)은 GPT 언어 모델의 비선형 함수를 처리할 수 있다. 행렬 기능 유닛(710)의 출력은 제1 특수 기능 유닛(720)으로 전달될 수 있다. 또한, 제1 특수 기능 유닛(720)은 최적의 하드웨어 활용을 위해 DSP, 조합 논리(combinational logic) 및 룩업 테이블(lookup table) 방식의 조합을 사용할 수 있다.
제1 특수 기능 유닛(720)은 행렬 명령에 필요한 행렬-벡터 곱셈 이후의 연산을 수행할 수 있다. 예를 들어, 제1 특수 기능 유닛(414)은 GELU(Gaussian Error Linear Unit)와 같은 활성화 연산을 처리하도록 구성될 수 있다. 도시된 것과 같이, 제1 특수 기능 유닛(720)은 GELU 유닛(722), 마스킹 유닛(724), 벡터라이저(vectorizer) 유닛(728) 및 리듀스 맥스 유닛(730)을 포함하고, 바이패스 경로(726)를 포함할 수 있다.
마스킹 유닛(724)은 현재 계산의 타일 정보를 사용하여 출력 행렬의 대각선 위 요소들이 -∞에 가장 가까운 표현 가능한 값으로 마스킹된 하삼각 행렬(lower triangular matrix)을 생성할 수 있다. 마스킹 된 값은 결국 소프트맥스 연산 이후에 0이 된다. 그 결과를 상수인 어텐션 헤드의 수로 나누는데 필요한 나눗셈의 경우 멀티플라이어(multiplier)를 사용할 수 있다.
GELU 유닛(722)은 수학식 3과 같은 GELU 활성화 함수를 지원할 수 있다. 이를 위해, 룩업 테이블 방식이 선형 근사법(linear approximation)과 함께 사용될 수 있다.
Figure PCTKR2023003620-appb-img-000006
일 실시예에서, 반정밀도 부동 소수점에서 평균 제곱 오차 0을 달성하는 2,048개의 입력을 샘플링하고, [-8, 8]의 범위를 설정할 수 있다. 이는 이 범위에서 기울기가 양쪽에서 수렴하기 때문이다. 선형 근사법은 구간적 선형 특성을 갖는 GELU 활성화 함수에 사용하기에 충분하고, GELU 활성화 함수에서 복잡한 수학 연산을 지원하는 하드웨어 오버헤드를 줄일 수 있다.
제1 특수 기능 유닛(720)은 바이패스 경로(726)를 사용함으로써, 데이터 흐름 내에서 특정 하드웨어를 필요로 하지 않는 작업이 사이클 패널티 없이 하드웨어를 건너 뛰도록 할 수 있다. 구체적으로, 제1 특수 기능 유닛(720)은 입력이 벡터라이저 유닛(728)의 입력 포트로 직접 연결되는 바이패스 경로(726)를 포함할 수 있다. 바이패스 경로(726)를 사용함으로써, 제1 특수 기능 유닛(720)의 입력을 GELU 유닛(722) 및/또는 마스킹 유닛(724)을 거치지 않고 벡터라이저 유닛(728)에 사이클 패널티 없이 바로 전달할 수 있다.
벡터라이저 유닛(728)은 비대칭 버퍼(asymmetric buffer)를 사용하여 타일링과 일치하도록 입력값을 연결할 수 있다. 벡터라이저 유닛(728)은 처리량을 높게 유지하고 필요한 하드웨어 리소스 수를 줄이기 위해 GELU 유닛(722)과 마스킹 유닛(724) 뒤에 위치한다.
리듀스 맥스 유닛(730)은 주어진 벡터의 최대값 또는 argmax 값을 찾도록 구성될 수 있다. 또한, 리듀스 맥스 유닛(730)은 비교기(comparator)의 병렬 트리를 이용하여 구현될 수 있다.
도 8은 다중 FPGA 가속 시스템 내의 각 가속화 장치의 벡터 처리 유닛(800)을 나타내는 도면이다. 벡터 처리 유닛(800)은 인공 신경망 모델(예를 들어, GPT 모델)의 종단 간 가속에 필요한 다양한 수학적 연산을 높은 하드웨어 효율성으로 실행할 수 있다.
도시된 것과 같이, 벡터 처리 유닛(800)은 벡터 기능 유닛(810) 및 제2 특수 기능 유닛(820)을 포함할 수 있다. 벡터 기능 유닛(810)은 레지스터 파일 매니저의 출력을 수신하여 벡터 연산을 수행할 수 있다. 제2 특수 기능 유닛(820)은 벡터 기능 유닛(810)과 연결될 수 있다. 구체적으로, 제2 특수 기능 유닛(820)은 벡터 명령에서 요구되는 벡터 연산 이후의 비선형 연산을 수행할 수 있다.
벡터 기능 유닛(810)은 벡터 명령을 실행할 수 있다. 벡터 기능 유닛(810)은 요소별(element-wise) 벡터 연산을 지원하는 부동 소수점 산술 논리 유닛(Arithmetic Logic Unit; ALU)일 수 있다. 구체적으로, 벡터 기능 유닛(810)은 d 차원의 두 벡터의 덧셈, 뺄셈 및 곱셈을 연산할 수 있다.
행렬 기능 유닛(MFU)과 유사하게, DSP는 모든 벡터 기능 유닛(810)의 작업에 사용될 수 있다. 벡터 기능 유닛(810)의 덧셈기(adder), 뺄셈기(subtractor), 곱셈기(multiplier) 및 지수기(exponential)는 각각 11 사이클, 11 사이클, 6 사이클 및 4 사이클을 사용할 수 있다. 지수기는 2개의 DSP를 사용하고 덧셈기, 뺄셈기 및 곱셈기는 각각 1개의 DSP를 사용할 수 있다. 모든 명령은 둘 이상의 ALU 작업을 요구하지 않으므로, 모든 명령은 동기화 없이 가능한 가장 짧은 사이클로 완료될 수 있다.
벡터 기능 유닛(810)은 불필요한 계산 사이클을 줄이기 위해 바이패스 경로(812)를 포함할 수 있다. 예를 들어, 로드 및 저장 명령은 계산이 필요하지 않으므로, 데이터가 실행 단계를 건너뛸 수 있다. 벡터 기능 유닛(810)은 입력 포트 및 출력 포트를 직접 연결하는 바이패스 경로(812)를 포함하므로, 로드 및 저장 명령은 한 사이클만 소요된다. 이러한 비동기식 데이터 흐름에서 발생하는 데이터 해저드는 스코어보드(예를 들어, 도 4의 428)에서 처리될 수 있다.
제2 특수 기능 유닛(820)은 GPT 언어 모델의 비선형 함수를 처리할 수 있다. 벡터 기능 유닛(810)의 출력은 제2 특수 기능 유닛(820)으로 전달될 수 있다. 또한, 제2 특수 기능 유닛(820)은 최적의 하드웨어 활용을 위해 DSP, 조합 논리(combinational logic) 및 룩업 테이블(lookup table) 방식의 조합을 사용할 수 있다.
제2 특수 기능 유닛(820)은 벡터 명령에 필요한 벡터 기능 유닛(810)의 벡터 연산 이후의 연산을 수행할 수 있다. 제2 특수 기능 유닛(820)은 가산기 트리(adder tree) 유닛(822), 누산기(accumulator) 유닛, 역수(reciprocal) 유닛, 승수(multiplier) 유닛, 스칼라 가산기(scalar adder) 유닛, 역제곱근(reciprocal square root) 유닛 및 멀티플렉서 유닛을 포함할 수 있다. 벡터 기능 유닛(810)은 벡터 출력만 필요한 명령을 지원하기 때문에 가산기 트리 유닛(822)은 벡터 기능 유닛(810) 대신 제2 특수 기능 유닛(820)에 배치될 수 있다. 나머지 기능은 부동 소수점 DSP에 의해 제공될 수 있다. 제1 특수 기능 유닛(예를 들어, 도 7의 720)과 유사하게 제2 특수 기능 유닛(820)은 임베딩 크기의 상수 값을 나누기 위해 디바이더(divider) 대신 멀티플라이어를 사용할 수 있다.
제2 특수 기능 유닛(820)은 바이패스 경로(824, 826)를 사용함으로써, 데이터 흐름 내에서 특정 하드웨어를 필요로 하지 않는 작업이 사이클 패널티 없이 하드웨어를 건너 뛰도록 할 수 있다. 예를 들어, 제2 특수 기능 유닛(820)은 입력 포트와 출력 포트를 바로 연결하는 제1 바이패스 경로(824)를 포함할 수 있다. 또한, 제2 특수 기능 유닛(820)은 가산기 트리 유닛의 출력을 역수 유닛과 역제곱근 유닛을 거치지 않고 멀티플레서 유닛으로 바로 전달하기 위한 제2 바이패스 경로(826)를 포함할 수 있다. 즉, 제2 특수 기능 유닛(820)에서 가산기 트리 유닛(822)의 출력이 인접한 역수 유닛 및 역제곱근 유닛의 대기 시간과 일치하는 파이프라인 단계를 거치지 않고, 멀티플렉서 유닛로 직접 전송될 수 있다.
이러한 비동기식 데이터 흐름은 데이터 해저드를 유발할 가능성이 높으므로 스코어보드(예를 들어, 도 4의 428)가 필요하다. 스코어보드는 GPT 언어 모델의 고유 명령 시퀀스에서 다른 데이터 해저드를 처리하기 위해 필요하므로, 바이패스 경로(824, 826)를 지원하기 위해 무시할 수 있는 제어 오버헤드(control overhead)가 추가될 뿐이다. GPT 언어 모델에서의 연산 순서는 행렬 명령과 벡터 명령의 사용을 번갈아 사용하므로 충돌(conflict)이 최소화되며, 이에 따라 GPT의 순차적인 생성 속도를 높이는데 유리할 수 있다.
도 9는 본 개시의 다중 FPGA 가속 시스템을 GPU 어플라이언스와 비교할 때, 다양한 GPT 언어 모델에서의 토큰 생성 처리량 및 속도 향상을 도시한 그래프(900)를 나타내는 도면이다. 제1 그래프(910)는 단일 FPGA 가속 시스템과 1개의 GPU로 구성된 가속 시스템의 성능을 비교한 결과를 나타낸다. 제2 그래프(920)는 이중 FPGA 가속 시스템과 2개의 GPU로 구성된 가속 시스템의 성능을 비교한 결과를 나타낸다. 제3 그래프(930)는 4중 FPGA 가속 시스템과 4개의 GPU로 구성된 가속 시스템의 성능을 비교한 결과를 나타낸다.
제1 그래프(910)에 따르면 단일 FPGA 가속 시스템은 1개의 GPU로 구성된 가속 시스템에 비해 평균 2.22배의 속도 향상이 확인된다. 또한, 제2 그래프(920)에 따르면 이중 FPGA 가속 시스템은 2개의 GPU로 구성된 가속 시스템에 비해 평균 2.95배의 속도 향상이 확인된다. 추가로, 제3 그래프(930)에 따르면, 4중 FPGA 가속 시스템은 4개의 GPU로 구성된 가속 시스템에 비해 평균 3.78배의 속도 향상이 확인된다. 32:256과 같이 입력 토큰에 비해 출력 토큰이 훨씬 더 많은 워크로드의 경우, 4중 FPGA 가속 시스템의 처리량은 4개의 GPU로 구성된 가속 시스템보다 10.03배 더 높다.
다중 FPGA 가속 시스템의 속도 향상은 더 클 수 있으며 이론적으로 더 작은 입력 및 더 큰 출력 크기에 대한 상한선이 없다. 텍스트 생성 워크로드의 경우와 같이 입력 및 출력 길이의 비율이 4:1 미만이라면, 다중 FPGA 가속 시스템은 GPU 어플라이언스보다 성능이 우수하다.
도 10은 본 개시의 다중 FPGA 가속 시스템과 GPU 어플라이언스의 에너지 효율을 비교한 그래프(1000)를 나타낸다. 구체적으로, 4중 FPGA 가속 시스템과 4개의 GPU로 구성된 가속 시스템을 비교할 때, 4중 FPGA 가속 시스템의 에너지 효율이 평균 3.99배 더 우수하다.
도 11은 본 개시의 다중 FPGA 가속 시스템과 GPU 어플라이언스의 확장성을 도시한 그래프(1100)를 나타낸다. 구체적으로, 다중 FPGA 가속 시스템에서 1개의 FPGA에 대해 초당 93.09토큰을 달성하고, 4개의 FPGA에 대해 초당 207.56토큰을 달성한다. 반면에, GPU 어플라이언스는 1개의 GPU에 대해 초당 27.09토큰, 4개의 GPU에 대해 초당 29.14토큰을 달성한다. 즉, 다중 FPGA 가속 시스템에서 FPGA의 성능은 FPGA의 수에 따라 1.5의 비율로 선형적으로 증가한다.
GPU 어플라이언스는 더 많은 동기화로 인해 확장성이 제한된다. 다중 FPGA 가속 시스템에서 모델 병렬 처리, 최적화된 타일링 방식 및 낮은 동기화 오버헤드가 처리 장치(가속화 장치 또는 컴퓨트 코트)의 활용도를 최대화하기 때문에, 더 많은 FPGA(즉, 더 많은 메모리 대역폭)를 사용할수록 모델 매개변수의 더 많은 병렬 계산을 할 수 있다. 반면, GPU는 단일 장치에서 GPT 언어 모델 작업을 위한 하드웨어를 효과적으로 활용하지 못하는 구조를 가지고 있으므로, GPU가 많을수록 활용도가 낮아져 성능이 악화된다. 따라서 다중 FPGA 가속 시스템은 기존 GPU 어플라이언스와 달리 GPT의 증가하는 모델 크기를 효과적으로 처리하도록 확장될 수 있다.
아래의 표 2는 다중 FPGA 가속 시스템과 GPU 어플라이언스 사이의 정확도 비교한 결과를 나타낸다. 다중 FPGA 가속 시스템은 GPU 어플라이언스와 비교하여 CBT-CN(Childrens' Book Common Noun)과 CBT-NE(Children's Book Named Entities) 데이터 세트에서 2.00% 이내의 정확도 손실(accuracy loss)을 달성할 수 있다. 구체적으로, 다중 FPGA 가속 시스템은 GPU 어플라이언스와 비교하여 CBT-CN 데이터 세트에서 1.02%의 정확도 손실을 보이고, CBT-NE 데이터 세트에서 2%의 정확도 손실을 보인다. 또한, 다중 FPGA 가속 시스템은 GPU 어플라이언스와 비교하여 WSC(Winograd Schema Challenge) 데이터 세트에서 2.33% 향상된 정확도를 보인다.
WSC CBT-CN CBT-NE
GPU 어플라이언스 58.02% 87.28% 69.00%
다중 FPGA 가속 시스템 60.35% 86.26% 67.00%
정확도 손실 -2.33% 1.02% 2.00%
언어 서비스가 대부분 텍스트 생성을 기반으로 하기 때문에 GPT에서 제공하는 언어 서비스의 경우, 2% 미만의 정확도 손실이 허용된다. 텍스트 생성은 특정 단어가 아닌 주어진 컨텍스트에 맞는 합리적인 단어 세트를 생성하는 것이므로, 정밀한 정확도는 분류를 위한 인공 신경망만큼 중요한 것은 아니다. 정확도 손실은 질문과 답변과 같은 몇 가지 워크로드에서 중요할 수 있지만, 일반 대중이 사용하는 경우에는 2% 미만의 손실이 허용된다.
아래의 표 3은 다중 FPGA 가속 시스템 및 GPU 어플라이언스의 비용 분석을 나타낸다. 4중 FPGA 가속 시스템은 4개의 GPU로 구성된 가속 시스템 보다 $14,652만큼 더 낮은 초기 비용을 가진다. 전반적인 비용 효율성(cost-effectiveness)을 측정하기 위해 성능(즉, 처리량)과 초기 비용(즉, 소매 가격)이 고려될 수 있다. 여기서, 비용당 성능(performance per cost)을 측정하기 위해 입력 대 출력 토큰 비율이 64:64인 4중 FPGA 가속 시스템과 4개의 GPU로 구성된 가속 시스템을 비교한다. 그 결과, 4중 FPGA 가속 시스템은 4개의 GPU로 구성된 가속 시스템보다 8.21배 더 비용 효율적이다.
GPU 어플라이언스 다중 FPGA 가속 시스템
CPUs 2 x Intel Xeon Gold
14-Core @2.2 GHz
2 x Intel Xeon Gold
16-Core @2.9 GHz
메모리 384 GB DDR4 512 GB DDR4
저장소(Storage) 12 TB NVMe 4 TB NVMe
가속기 NVIDIA Tesla V100
32 GB HBM2
XILINX Alveo U280
8 GB HBM2
성능 13.01 tokens/sec (x4 GPU) 72.68 tokens/sec (x4 FPGA)
비용 $45,832 ($11,458 per GPU) $31,180 ($7,795 per FPGA)
비용당 성능 283.86 tokens/sec/million$ 2330.98 tokens/sec/million$
본 개시는 트랜스포머 기반 텍스트 생성 모델을 가속화하기 위한 저가형 다중 FPGA 가속 시스템 및 장치를 제공한다. 다중 FPGA 가속 시스템은 데이터센터 레벨에서 높은 처리량과 짧은 대기 시간, 종단 간 가속 및 병렬 연산을 제공할 수 있다. 4중 FPGA 가속 시스템은 기존 4개의 GPU로 구성된 가속 시스템에 비해 성능, 에너지 효율성 및 비용 효율성에서 각각 3.78배, 3.99배 및 8.21배 개선된다.
본 개시의 동작 또는 기법들은 다양한 수단에 의해 구현될 수도 있다. 예를 들어, 이러한 기법들은 하드웨어, 펌웨어, 소프트웨어, 또는 이들의 조합으로 구현될 수도 있다. 본원의 개시와 연계하여 설명된 다양한 예시적인 논리적 블록들, 모듈들, 회로들, 및 알고리즘 단계들은 전자 하드웨어, 컴퓨터 소프트웨어, 또는 양자의 조합들로 구현될 수도 있음을 통상의 기술자들은 이해할 것이다. 하드웨어 및 소프트웨어의 이러한 상호 대체를 명확하게 설명하기 위해, 다양한 예시적인 구성요소들, 블록들, 모듈들, 회로들, 및 단계들이 그들의 기능적 관점에서 일반적으로 위에서 설명되었다. 그러한 기능이 하드웨어로서 구현되는지 또는 소프트웨어로서 구현되는 지의 여부는, 특정 애플리케이션 및 전체 시스템에 부과되는 설계 요구사항들에 따라 달라진다. 통상의 기술자들은 각각의 특정 애플리케이션을 위해 다양한 방식들로 설명된 기능을 구현할 수도 있으나, 그러한 구현들은 본 개시의 범위로부터 벗어나게 하는 것으로 해석되어서는 안된다.
하드웨어 구현에서, 기법들을 수행하는데 이용되는 프로세싱 유닛들은, 하나 이상의 ASIC들, DSP들, 디지털 신호 프로세싱 디바이스들(digital signal processing devices; DSPD들), 프로그램가능 논리 디바이스들(programmable logic devices; PLD들), 필드 프로그램가능 게이트 어레이들(field programmable gate arrays; FPGA들), 프로세서들, 제어기들, 마이크로제어기들, 마이크로프로세서들, 전자 디바이스들, 본 개시에 설명된 기능들을 수행하도록 설계된 다른 전자 유닛들, 컴퓨터, 또는 이들의 조합 내에서 구현될 수도 있다.
따라서, 본 개시와 연계하여 설명된 다양한 예시적인 논리 블록들, 모듈들, 및 회로들은 범용 프로세서, DSP, ASIC, FPGA나 다른 프로그램 가능 논리 디바이스, 이산 게이트나 트랜지스터 로직, 이산 하드웨어 컴포넌트들, 또는 본원에 설명된 기능들을 수행하도록 설계된 것들의 임의의 조합으로 구현되거나 수행될 수도 있다. 범용 프로세서는 마이크로프로세서일 수도 있지만, 대안으로, 프로세서는 임의의 종래의 프로세서, 제어기, 마이크로제어기, 또는 상태 머신일 수도 있다. 프로세서는 또한, 컴퓨팅 디바이스들의 조합, 예를 들면, DSP와 마이크로프로세서, 복수의 마이크로프로세서들, DSP 코어와 연계한 하나 이상의 마이크로프로세서들, 또는 임의의 다른 구성의 조합으로서 구현될 수도 있다.
펌웨어 및/또는 소프트웨어 구현에 있어서, 기법들은 랜덤 액세스 메모리(random access memory; RAM), 판독 전용 메모리(read-only memory; ROM), 비휘발성 RAM(non-volatile random access memory; NVRAM), PROM(programmable read-only memory), EPROM(erasable programmable read-only memory), EEPROM(electrically erasable PROM), 플래시 메모리, 컴팩트 디스크(compact disc; CD), 자기 또는 광학 데이터 스토리지 디바이스 등과 같은 컴퓨터 판독가능 매체 상에 저장된 명령들로서 구현될 수도 있다. 명령들은 하나 이상의 프로세서들에 의해 실행 가능할 수도 있고, 프로세서(들)로 하여금 본 개시에 설명된 기능의 특정 양태들을 수행하게 할 수도 있다.
소프트웨어로 구현되는 경우, 상기 기법들은 하나 이상의 명령들 또는 코드로서 컴퓨터 판독 가능한 매체 상에 저장되거나 또는 컴퓨터 판독 가능한 매체를 통해 전송될 수도 있다. 컴퓨터 판독가능 매체들은 한 장소에서 다른 장소로 컴퓨터 프로그램의 전송을 용이하게 하는 임의의 매체를 포함하여 컴퓨터 저장 매체들 및 통신 매체들 양자를 포함한다. 저장 매체들은 컴퓨터에 의해 액세스될 수 있는 임의의 이용 가능한 매체들일 수도 있다. 비제한적인 예로서, 이러한 컴퓨터 판독가능 매체는 RAM, ROM, EEPROM, CD-ROM 또는 다른 광학 디스크 스토리지, 자기 디스크 스토리지 또는 다른 자기 스토리지 디바이스들, 또는 소망의 프로그램 코드를 명령들 또는 데이터 구조들의 형태로 이송 또는 저장하기 위해 사용될 수 있으며 컴퓨터에 의해 액세스될 수 있는 임의의 다른 매체를 포함할 수 있다. 또한, 임의의 접속이 컴퓨터 판독가능 매체로 적절히 칭해진다.
예를 들어, 소프트웨어가 동축 케이블, 광섬유 케이블, 연선, 디지털 가입자 회선 (DSL), 또는 적외선, 무선, 및 마이크로파와 같은 무선 기술들을 사용하여 웹사이트, 서버, 또는 다른 원격 소스로부터 전송되면, 동축 케이블, 광섬유 케이블, 연선, 디지털 가입자 회선, 또는 적외선, 무선, 및 마이크로파와 같은 무선 기술들은 매체의 정의 내에 포함된다. 본원에서 사용된 디스크(disk) 와 디스크(disc)는, CD, 레이저 디스크, 광 디스크, DVD(digital versatile disc), 플로피디스크, 및 블루레이 디스크를 포함하며, 여기서 디스크들(disks)은 보통 자기적으로 데이터를 재생하고, 반면 디스크들(discs) 은 레이저를 이용하여 광학적으로 데이터를 재생한다. 위의 조합들도 컴퓨터 판독가능 매체들의 범위 내에 포함되어야 한다.
소프트웨어 모듈은, RAM 메모리, 플래시 메모리, ROM 메모리, EPROM 메모리, EEPROM 메모리, 레지스터들, 하드 디스크, 이동식 디스크, CD-ROM, 또는 공지된 임의의 다른 형태의 저장 매체 내에 상주할 수도 있다. 예시적인 저장 매체는, 프로세가 저장 매체로부터 정보를 판독하거나 저장 매체에 정보를 기록할 수 있도록, 프로세서에 연결될 수 있다. 대안으로, 저장 매체는 프로세서에 통합될 수도 있다. 프로세서와 저장 매체는 ASIC 내에 존재할 수도 있다. ASIC은 유저 단말 내에 존재할 수도 있다. 대안으로, 프로세서와 저장 매체는 유저 단말에서 개별 구성요소들로서 존재할 수도 있다.
이상 설명된 실시예들이 하나 이상의 독립형 컴퓨터 시스템에서 현재 개시된 주제의 양태들을 활용하는 것으로 기술되었으나, 본 개시는 이에 한정되지 않고, 네트워크나 분산 컴퓨팅 환경과 같은 임의의 컴퓨팅 환경과 연계하여 구현될 수도 있다. 또 나아가, 본 개시에서 주제의 양상들은 복수의 프로세싱 칩들이나 장치들에서 구현될 수도 있고, 스토리지는 복수의 장치들에 걸쳐 유사하게 영향을 받게 될 수도 있다. 이러한 장치들은 PC들, 네트워크 서버들, 및 휴대용 장치들을 포함할 수도 있다.
본 명세서에서는 본 개시가 일부 실시예들과 관련하여 설명되었지만, 본 개시의 발명이 속하는 기술분야의 통상의 기술자가 이해할 수 있는 본 개시의 범위를 벗어나지 않는 범위에서 다양한 변형 및 변경이 이루어질 수 있다. 또한, 그러한 변형 및 변경은 본 명세서에 첨부된 특허청구의 범위 내에 속하는 것으로 생각되어야 한다.

Claims (18)

  1. 트랜스포머 기반 언어 서비스 가속화 장치로서,
    제1 데이터 패스를 구성하는 행렬 처리 유닛(matrix processing unit); 및
    제2 데이터 패스를 구성하는 벡터 처리 유닛(vector processing unit)
    을 포함하고,
    상기 제1 데이터 패스는 행렬 관련 명령과 연관되고,
    상기 제2 데이터 패스는 벡터 관련 명령과 연관되고,
    상기 제1 데이터 패스와 상기 제2 데이터 패스는 병렬적으로 처리되는, 가속화 장치.
  2. 제1항에 있어서,
    상기 행렬 처리 유닛은,
    행렬 관련 명령을 처리하는 행렬 기능 유닛(matrix function unit); 및
    상기 행렬 기능 유닛과 연결된 제1 특수 기능 유닛(special function unit)
    을 포함하는, 가속화 장치.
  3. 제2항에 있어서,
    상기 행렬 기능 유닛은 입력으로 벡터를 수신하고, 행렬-벡터 곱셈(multiplication)을 병렬적으로 처리하도록 구성된 복수의 트리 기반 MAC(Multiplier-Accumulator)를 포함하고,
    상기 복수의 트리 기반 MAC 각각에 상기 언어 서비스와 연관된 인공 신경망의 가중치 행렬의 서로 다른 열에서의 승수(multiplicand)가 전달되는, 가속화 장치.
  4. 제2항에 있어서,
    상기 행렬 기능 유닛의 출력이 상기 제1 특수 기능 유닛으로 입력되고,
    상기 제1 특수 기능 유닛은 상기 언어 서비스와 연관된 인공 신경망의 비선형 함수를 처리하는, 가속화 장치.
  5. 제2항에 있어서,
    상기 제1 특수 기능 유닛은 활성화(activation) 연산을 처리하는, 가속화 장치.
  6. 제2항에 있어서,
    상기 제1 특수 기능 유닛은,
    하삼각 행렬(lower triangular matrix)을 생성하도록 구성된 마스킹 유닛;
    GELU(Gaussian Error Linear Unit) 활성화 함수를 지원하도록 구성된 GELU 유닛;
    비대칭 버퍼를 이용하여 입력값을 연결하도록 구성된 벡터라이저(vectorizer) 유닛; 및
    벡터의 최대값 또는 argmax 값을 찾도록 구성된 리듀스 맥스(reduce max) 유닛
    을 포함하는, 가속화 장치.
  7. 제6항에 있어서,
    상기 제1 특수 기능 유닛은 입력을 GELU 유닛 및 마스킹 유닛을 거치지 않고, 벡터라이저(vectorizer) 유닛으로 사이클 패널티 없이 바로 전달하기 위한 바이패스 경로를 포함하는, 가속화 장치.
  8. 제1항에 있어서,
    상기 벡터 처리 유닛은,
    벡터 관련 명령을 처리하는 벡터 기능 유닛(vector function unit); 및
    상기 벡터 기능 유닛과 연결된 제2 특수 기능 유닛(special function unit)
    을 포함하는, 가속화 장치.
  9. 제8항에 있어서,
    상기 벡터 기능 유닛은 요소별(element-wise) 벡터 연산을 지원하는 부동 소수점 산술 논리 유닛(Arithmetic Logic Unit)인, 가속화 장치.
  10. 제8항에 있어서,
    상기 벡터 기능 유닛은 불필요한 계산 사이클을 줄이기 위해 입력 포트와 출력 포트를 바로 연결하는 바이패스 경로를 포함하는, 가속화 장치.
  11. 제8항에 있어서,
    상기 벡터 기능 유닛의 출력이 상기 제2 특수 기능 유닛으로 입력되고,
    상기 제2 특수 기능 유닛은 상기 언어 서비스와 연관된 인공 신경망의 비선형 함수를 처리하는, 가속화 장치.
  12. 제8항에 있어서,
    상기 벡터 기능 유닛의 출력이 상기 제2 특수 기능 유닛으로 입력되고,
    상기 제2 특수 기능 유닛은 가산기 트리(adder tree) 유닛, 역수(reciprocal) 유닛, 역제곱근(reciprocal square root) 유닛 및 멀티플렉서 유닛을 포함하고,
    상기 제2 특수 기능 유닛은, 입력 포트와 출력 포트를 바로 연결하는 제1 바이패스 경로, 그리고 상기 가산기 트리 유닛의 출력을 상기 역수 유닛과 상기 역제곱근 유닛을 거치지 않고 멀티플레서 유닛으로 바로 전달하기 위한 제2 바이패스 경로를 포함하는, 가속화 장치.
  13. 제1항에 있어서,
    고대역폭 메모리(High Bandwidth Memory) 및 DDR 메모리로부터 데이터를 읽고 쓰기 위한 DMA(Direct Memory Access);
    다른 가속화 장치와 통신하기 위한 라우터;
    상기 DMA 및 상기 라우터를 통해 데이터를 수신하고, 수신된 데이터에 기초하여 상기 행렬 처리 유닛 및 상기 벡터 처리 유닛을 위한 명령을 생성하도록 구성된 레지스터 파일 매니저(Register File Manager); 및
    상기 행렬 처리 유닛, 상기 벡터 처리 유닛, 상기 DMA, 상기 라우터 및 상기 레지스터 파일 매니저의 상태를 추적하고 제어함으로써, 전체 데이터 흐름을 제어하도록 구성된 제어 유닛
    을 더 포함하는, 가속화 장치.
  14. 트랜스포머 기반 언어 서비스 가속화를 위한 다중 FPGA 가속 시스템으로서,
    제1 호스트 CPU(Central Processing Unit); 및
    상기 제1 호스트 CPU와 연결된 제1 FPGA(Field Programmable Gate Arrary) 클러스터
    를 포함하고,
    각 FPGA는 2개의 컴퓨트 코어(computer core)를 포함하고,
    각 컴퓨트 코어는,
    제1 데이터 패스를 구성하는 행렬 처리 유닛(matrix processing unit); 및
    제2 데이터 패스를 구성하는 벡터 처리 유닛(vector processing unit)
    을 포함하고,
    상기 제1 데이터 패스는 행렬 관련 명령과 연관되고,
    상기 제2 데이터 패스는 벡터 관련 명령과 연관되고,
    상기 제1 데이터 패스와 상기 제2 데이터 패스는 병렬적으로 처리되는, 다중 FPGA 가속 시스템.
  15. 제14항에 있어서,
    상기 제1 FPGA 클러스터 내의 FPGA들은 QSFP(Quad Small Form Factor Pluggable) 트랜스시버를 이용하여 서로 연결되어 링 네트워크를 형성하는, 다중 FPGA 가속 시스템.
  16. 제14항에 있어서,
    상기 언어 서비스와 연관된 인공 신경망에 포함된 셀프 어텐션(Self-attention) 및 피드포워드 네트워크에서 모델 매개변수 또는 가중치 행렬이 열 방향으로 복수의 부분으로 분할되고, 상기 복수의 부분 각각이 각 컴퓨트 코어에 입력되고,
    각 컴퓨트 코어는 입력된 부분에 대해 동일한 연산을 처리하는, 다중 FPGA 가속 시스템.
  17. 제14항에 있어서,
    각 FPGA 내의 2개의 컴퓨트 코어 사이의 통신 속도와 각 FPGA 사이의 통신 속도가 동일하도록 밸런싱되는, 다중 FPGA 가속 시스템.
  18. 제14항에 있어서,
    제2 호스트 CPU; 및
    상기 제2 호스트 CPU와 연결된 제2 FPGA 클러스터
    를 더 포함하고,
    상기 제1 호스트 CPU는 QPI(QuickPath Interconnect)를 통해 상기 제2 호스트 CPU와 연결되는, 다중 FPGA 가속 시스템.
PCT/KR2023/003620 2022-04-08 2023-03-17 트랜스포머 기반 언어 서비스 가속화를 위한 저비용 다중 fpga 가속 시스템 WO2023195658A1 (ko)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
KR10-2022-0044184 2022-04-08
KR1020220044184A KR20230144891A (ko) 2022-04-08 2022-04-08 트랜스포머 기반 언어 서비스 가속화를 위한 저비용 다중 fpga 가속 시스템

Publications (1)

Publication Number Publication Date
WO2023195658A1 true WO2023195658A1 (ko) 2023-10-12

Family

ID=88243041

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/KR2023/003620 WO2023195658A1 (ko) 2022-04-08 2023-03-17 트랜스포머 기반 언어 서비스 가속화를 위한 저비용 다중 fpga 가속 시스템

Country Status (2)

Country Link
KR (1) KR20230144891A (ko)
WO (1) WO2023195658A1 (ko)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200073830A1 (en) * 2018-08-29 2020-03-05 Qualcomm Incorporated Method, apparatus, and system for an architecture for machine learning acceleration
KR20200139525A (ko) * 2019-06-04 2020-12-14 삼성전자주식회사 Fpga를 포함하는 전자 시스템 및 이의 동작 방법
KR102287499B1 (ko) * 2020-09-15 2021-08-09 주식회사 에이아이더뉴트리진 음소 단위 운율을 반영한 음성 합성 방법 및 장치
US20220044107A1 (en) * 2020-08-06 2022-02-10 Micron Technology, Inc. Optimized sensor fusion in deep learning accelerator with integrated random access memory
US20220044102A1 (en) * 2020-08-06 2022-02-10 Micron Technology, Inc. Fault tolerant artificial neural network computation in deep learning accelerator having integrated random access memory

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200073830A1 (en) * 2018-08-29 2020-03-05 Qualcomm Incorporated Method, apparatus, and system for an architecture for machine learning acceleration
KR20200139525A (ko) * 2019-06-04 2020-12-14 삼성전자주식회사 Fpga를 포함하는 전자 시스템 및 이의 동작 방법
US20220044107A1 (en) * 2020-08-06 2022-02-10 Micron Technology, Inc. Optimized sensor fusion in deep learning accelerator with integrated random access memory
US20220044102A1 (en) * 2020-08-06 2022-02-10 Micron Technology, Inc. Fault tolerant artificial neural network computation in deep learning accelerator having integrated random access memory
KR102287499B1 (ko) * 2020-09-15 2021-08-09 주식회사 에이아이더뉴트리진 음소 단위 운율을 반영한 음성 합성 방법 및 장치

Also Published As

Publication number Publication date
KR20230144891A (ko) 2023-10-17

Similar Documents

Publication Publication Date Title
JP7312879B2 (ja) ハードウェアにおける行列乗算の実行
US10402725B2 (en) Apparatus and method for compression coding for artificial neural network
CN109219821B (zh) 运算装置和方法
US8954943B2 (en) Analyze and reduce number of data reordering operations in SIMD code
US10311127B2 (en) Sparse matrix vector multiplication
Lu et al. Evaluations on deep neural networks training using posit number system
Hong et al. DFX: A low-latency multi-FPGA appliance for accelerating transformer-based text generation
KR20100090751A (ko) 곱셈 기능을 수행하기 위한 방법 및 장치
WO2021044244A1 (en) Machine learning hardware having reduced precision parameter components for efficient parameter update
US11734216B2 (en) Cascade communications between FPGA tiles
US8423979B2 (en) Code generation for complex arithmetic reduction for architectures lacking cross data-path support
Pham‐Quoc et al. A high‐performance fpga‐based bwa‐mem dna sequence alignment
WO2017117806A1 (zh) 网络信息的搜词方法及系统
WO2022068328A1 (zh) 数据迁移的方法、装置、处理器和计算设备
WO2023195658A1 (ko) 트랜스포머 기반 언어 서비스 가속화를 위한 저비용 다중 fpga 가속 시스템
Hamilton et al. Optimal routing in multihop packet radio networks
CN108255463B (zh) 一种数字逻辑运算方法、电路和fpga芯片
KR20200064880A (ko) 한국어 워드넷 기반 지식 주도 심층학습을 이용한 워드 임베딩 장치 및 방법
Gonçalves et al. Exploring data size to run convolutional neural networks in low density fpgas
US11068458B2 (en) Mechanism for distributed-system-aware difference encoding/decoding in graph analytics
US11537859B2 (en) Flexible precision neural inference processing unit
CN114003198A (zh) 内积处理部件、任意精度计算设备、方法及可读存储介质
Lei et al. FPGA implementation of an exact dot product and its application in variable-precision floating-point arithmetic
CN113570053A (zh) 一种神经网络模型的训练方法、装置以及计算设备
Haghi et al. O⁴-DNN: A Hybrid DSP-LUT-Based Processing Unit With Operation Packing and Out-of-Order Execution for Efficient Realization of Convolutional Neural Networks on FPGA Devices

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23784886

Country of ref document: EP

Kind code of ref document: A1