NeuPIMs: 面向批量大语言模型推理的NPU-PIM异构加速
NeuPIMs: NPU-PIM Heterogeneous Acceleration for Batched LLM Inferencing
AI总结:
针对批量LLM推理中GEMM与GEMV运算适配不同硬件的特性,提出融合NPU与PIM的NeuPIMs异构加速系统,通过双行缓冲区与子批次交错技术实现并发,吞吐量较现有方案最高提升3倍。
摘要:
现代基于Transformer的大语言模型(LLM)由一系列解码器模块构成,每个模块包含三个核心组件:(1) QKV生成、(2) 多头注意力、(3) 前馈网络。在批量处理中,QKV生成与前馈网络涉及计算密集型的矩阵-矩阵乘法(GEMM),而多头注意力则需要带宽密集型的矩阵-向量乘法(GEMV)。TPU或NPU等机器学习加速器擅长处理GEMM,但在GEMV计算上效率较低。反之,存内计算(Processing-in-Memory, PIM)技术专为高效GEMV计算设计,但缺乏有效处理GEMM的计算能力。受此启发,我们提出NeuPIMs——一种联合利用传统聚焦GEMM的NPU与GEMV优化的PIM器件的异构加速系统。高效集成NPU与PIM的主要挑战在于实现两个平台的并发运算,且各自处理特定的内核类型。首先,现有PIM通常以“阻塞”模式运行,任意时刻仅允许NPU或PIM其中之一处于激活状态。其次,LLM中GEMM与GEMV之间固有的依赖关系限制了二者的并行处理。为应对这些挑战,NeuPIMs在每个存储体中配备双行缓冲区,便于同时管理内存读写操作与PIM命令。此外,NeuPIMs采用运行时子批次交错技术,利用批次并行性让两个独立子批次在单个NeuPIMs器件内流水线化,最大化并发执行效率。我们的评估表明,与仅用GPU、仅用NPU以及朴素的NPU+PIM集成加速方案相比,NeuPIMs分别实现了3倍、2.4倍和1.6倍的吞吐量提升。
英文摘要:
Modern transformer-based Large Language Models (LLMs) are constructed with a series of decoder blocks. Each block comprises three key components: (1) QKV generation, (2) multi-head attention, and (3) feed-forward networks. In batched processing, QKV generation and feed-forward networks involve compute-intensive matrix-matrix multiplications (GEMM), while multi-head attention requires bandwidth-heavy matrix-vector multiplications (GEMV). Machine learning accelerators like TPUs or NPUs are proficient in handling GEMM but are less efficient for GEMV computations. Conversely, Processing-in-Memory (PIM) technology is tailored for efficient GEMV computation, while it lacks the computational power to handle GEMM effectively. Inspired by this insight, we propose NeuPIMs, a heterogeneous acceleration system that jointly exploits a conventional GEMM-focused NPU and GEMV-optimized PIM devices. The main challenge in efficiently integrating NPU and PIM lies in enabling concurrent operations on both platforms, each addressing a specific kernel type. First, existing PIMs typically operate in a "blocked" mode, allowing only either NPU or PIM to be active at any given time. Second, the inherent dependencies between GEMM and GEMV in LLMs restrict their parallel processing. To tackle these challenges, NeuPIMs is equipped with dual row buffers in each bank, facilitating the simultaneous management of memory read/write operations and PIM commands. Further, NeuPIMs employs a runtime sub-batch interleaving technique to maximize concurrent execution, leveraging batch parallelism to allow two independent sub-batches to be pipelined within a single NeuPIMs device. Our evaluation demonstrates that compared to GPU-only, NPU-only, and a naïve NPU+PIM integrated acceleration approaches, NeuPIMs achieves 3$\times$, 2.4$\times$ and 1.6$\times$ throughput improvement, respectively.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。