FullPack:通用CPU上子字节量化推理的全矢量利用
FullPack: Full Vector Utilization for Sub-Byte Quantized Inference on General Purpose CPUs
摘要:
尽管现有技术已经证明子字节量化中的精度下降可以忽略不计-其中权重和/或激活由小于8位表示-CPU的流行SIMD指令并不原生地支持这些数据库。虽然最近的方法,如ULPPACK,已经在具有向量单元的通用CPU上使用子字节量化,但它们在存储器和向量寄存器中的子字节值之间保留了几个空位,以避免在操作期间溢出到邻居。这会导致内存占用和带宽使用效率低下以及性能欠佳。在本文中,我们提出了存储的内存布局,以及处理子字节(4位,2位或1位)模型的机制,这些模型利用内存中的所有位以及向量寄存器中的实际数据。我们为不同数据库的权重和激活之间的GEMV(通用矩阵向量乘法)操作的拟议布局提供计算内核(例如,8-位激活和4位权重)。为了进行评估,我们扩展了TFLite包并将我们的方法添加到其中,然后在周期精确的gem 5模拟器上运行模型,以比较每种方法的详细内存和CPU周期。我们与生产中积极使用的其他九种方法进行比较,包括GEMLOWP,Ruy,XNNPack和ULPPACK。此外,我们探讨了深度学习层的不同输入和输出大小对我们提出的方法的性能的影响。实验结果表明,对于小尺寸,加速比为0.96- 2.1倍,对于中到大尺寸,加速比为1.2- 6.7倍。将我们的建议应用于现实世界的语音识别模型Mozilla DeepSpeech,我们证明了与最先进的方法相比,我们的方法实现了1.56- 2.11倍的端到端加速,具体取决于所采用的位宽。
英文摘要:
Although prior art has demonstrated negligible accuracy drop in sub-byte quantization -- where weights and/or activations are represented by less than 8 bits -- popular SIMD instructions of CPUs do not natively support these datatypes. While recent methods, such as ULPPACK, are already using sub-byte quantization on general-purpose CPUs with vector units, they leave out several empty bits between the sub-byte values in memory and in vector registers to avoid overflow to the neighbours during the operations. This results in memory footprint and bandwidth-usage inefficiencies and suboptimal performance. In this paper, we present memory layouts for storing, and mechanisms for processing sub-byte (4-, 2-, or 1-bit) models that utilize all the bits in the memory as well as in the vector registers for the actual data. We provide compute kernels for the proposed layout for the GEMV (GEneral Matrix-Vector multiplication) operations between weights and activations of different datatypes (e.g., 8-bit activations and 4-bit weights). For evaluation, we extended the TFLite package and added our methods to it, then ran the models on the cycle-accurate gem5 simulator to compare detailed memory and CPU cycles of each method. We compare against nine other methods that are actively used in production including GEMLOWP, Ruy, XNNPack, and ULPPACK. Furthermore, we explore the effect of different input and output sizes of deep learning layers on the performance of our proposed method. Experimental results show 0.96-2.1x speedup for small sizes and 1.2-6.7x speedup for mid to large sizes. Applying our proposal to a real-world speech recognition model, Mozilla DeepSpeech, we proved that our method achieves 1.56-2.11x end-to-end speedup compared to the state-of-the-art, depending on the bit-width employed.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。