A GPU-resident Memory-Aware Algorithm for Accelerating Bidiagonalization of Banded Matrices
Ringoot, Alomairy, Edelman
The reduction of a banded matrix to a bidiagonal form is a crucial step in the Singular Value Decomposition (SVD), a cornerstone of scientific computing and AI. Despite being a highly parallel algorithm, it was previously believed to be unsuitable for GPU computation because it is memory bandwidth-bound. Recent developments in GPU hardware, including larger L1 memory per Streaming Multiprocessor/Compute Unit, have changed that. We present the first GPU algorithm for reducing a banded matrix to bidiagonal form as part of the NextLA.jl open-source software package. Our algorithm is based on previous CPU-based multicore parallel cache-efficient bulge chasing algorithms and adapted to optimize for GPU throughput. We leverage Julia Language's Array abstractions and KernelAbstractions to implement a single hardware- and data precision-agnostic function on NVIDIA, AMD, Intel, and Apple Metal GPUs for half, single, and double precision, and examine performance optimization across hardware architectures and data precision. We also develop a hardware-aware performance model and identify key hyperparameters, such as inner tilewidth and block concurrency, that govern optimal GPU execution for bandwidth-bound workloads. We demonstrate highly parallel bandwidth-bound algorithm on the GPU can outperform CPU-based implementations: the GPU algorithm outperforms multithreaded CPU High-Performance libraries PLASMA and SLATE as of matrix size 1024 x 1024 and by a factor over 100 for matrices of 32k x 32k. In addition, the performance of the algorithm increases linearly with matrix bandwidth size, making faster reduction of larger matrix bandwidths now also possible. With this work, we break memory bandwidth barriers, as well as matrix bandwidth barriers, resulting in orders-of-magnitude faster algorithms for the reduction of banded matrices to bidiagonal form on the GPU.
本論文は、特異値分解(SVD)における重要なステップである帯状行列から双対角行列への約化を加速するための、初めてのGPU常駐メモリ認識アルゴリズムを提案している。本アルゴリズムは高度な並列性を持つにもかかわらず、メモリ帯域幅制約の特性により、従来はGPU計算に不適切と考えられていた。GPU硬件の進化、特に各ストリームマルチプロセッサ/計算ユニットあたりのL1メモリの拡大により、この状況は変わった。著者らは、先行するCPUマルチコア並列キャッシュ効率的なbulge-chasingアルゴリズムに基づき、GPU スループット用に最適化した。本アルゴリズムは、NVIDIA、AMD、Intel、Apple Metal GPU上で、ハードウェアおよびデータ精度に依存しない単一関数として実装され、半精度、単精度、倍精度計算をサポートしている。実験結果は、本GPU アルゴリズムが1024×1024行列規模からマルチスレッドCPU高性能ライブラリPLASMAおよびSLATEを上回り、32k×32k行列上で100倍以上の性能向上を達成することを示している。
アルゴリズム1: Householder ベクトルを使用した帯状行列から双対角行列への約化
入力: 帯域幅BW、内部タイル幅TW、行列サイズn
1: for 帯域幅約化 i = (BW-1)/TW → 1 do
2: 目標帯域幅 TBW = 1 + i·TW
3: for 並列: 各行 R = 1→n do
4: 行bulge k = R
5: for 各行bulge: j = 0, j+=1 do
6: if 3(R-1) < j and k ≤ n then
7: 第k行のHHベクトルを計算してTW個の要素を消去し、下方行に適用
8: 最左生成列bulgeのHHベクトルを計算し、右側列に適用
9: k値を更新
10: end if
11: end for
12: end for
13: end for
アルゴリズム2: メモリ認識GPUカーネル、ブロックあたりTPB個のスレッド
1: スレッドメモリ: Ai (TW+1)
2: ブロックメモリ: X (TW+1)
3: ブロック内全スレッド協調: X ← A[k,..]
4: スレッド同期
5: ブロック内全スレッド協調: HH(X)
6: ブロック内全スレッド協調: A[k,..]← X
7: スレッド同期
8: for l: 0→(CBW + TW)/TPB - 1 do
9: スレッドi: 行 r = k + l·CPB + i を計算
10: Ai ← A[r, ...]
11: HH(X, Ai)
12: A[r, ...]← Ai
13: end for