[Paper Review] A Multi-Stage CUDA Kernel for Floyd-Warshall
This paper presents a multi-stage CUDA kernel for the Floyd-Warshall all-pairs shortest paths algorithm that achieves a 5× speedup over prior GPU implementations by reducing shared memory usage and improving instruction-level latency hiding. The approach uses staged memory loading and register optimization to allow the CUDA scheduler to better hide memory latency, resulting in 73.6 billion tasks per second on the NVIDIA Tesla C1060 for 16,384-vertex graphs.
We present a new implementation of the Floyd-Warshall All-Pairs Shortest Paths algorithm on CUDA. Our algorithm runs approximately 5 times faster than the previously best reported algorithm. In order to achieve this speedup, we applied a new technique to reduce usage of on-chip shared memory and allow the CUDA scheduler to more effectively hide instruction latency.
Motivation & Objective
- To address performance bottlenecks in GPU-accelerated Floyd-Warshall by reducing shared memory pressure and improving instruction-level latency hiding.
- To overcome limitations in prior CUDA implementations that suffered from poor thread scheduling and exposed instruction latency due to high shared memory usage.
- To optimize memory access patterns and reduce redundant operations to improve overall kernel throughput.
- To achieve near-optimal performance on the NVIDIA Tesla C1060 GPU for large-scale all-pairs shortest paths problems.
- To demonstrate that reducing shared memory footprint enables better utilization of GPU execution resources and scheduler efficiency.
Proposed method
- The algorithm uses a blocked approach with 32×32 tiles to reduce global memory bandwidth pressure, similar to Katz and Kider’s method.
- A novel staged load technique is introduced to break data dependencies across blocks, allowing only essential data to be held in shared memory at any time.
- The kernel reorders thread execution within half-warps to ensure conflict-free access to shared memory banks, avoiding bank conflicts during memory transactions.
- The implementation minimizes instruction count and uses more efficient operations, reducing the effective FLOPs per task from ~62.7 to ~12.7.
- On-chip registers are used more efficiently to reduce reliance on shared memory, improving scheduler flexibility and latency hiding.
- The algorithm is structured in multiple stages: data tiling, staged memory loading, and optimized thread mapping to minimize shared memory footprint.
Experimental results
Research questions
- RQ1How can shared memory usage in the Floyd-Warshall algorithm be reduced on GPU without sacrificing data locality?
- RQ2To what extent can instruction-level latency hiding be improved by reducing shared memory pressure in CUDA kernels?
- RQ3Can a staged memory loading strategy eliminate bank conflicts and improve memory access efficiency in blocked GPU kernels?
- RQ4What performance gains are achievable by optimizing instruction count and memory access patterns in GPU-accelerated APSP?
- RQ5How close is the optimized kernel to the theoretical performance limit of the NVIDIA Tesla C1060 for this workload?
Key findings
- The proposed kernel achieves 73.6 billion tasks per second on the NVIDIA Tesla C1060, a 5× speedup over the previously best-reported GPU implementation.
- The implementation solves the all-pairs shortest paths problem for a 16,384-vertex graph in 53.06 seconds, with an implied constant of 1.2×10⁻¹¹ seconds per n³ operation.
- The performance is limited by processing speed rather than memory bandwidth, using approximately 12.7 FLOPs per task, indicating room for further optimization.
- The reduction in shared memory usage enabled a 2.3× improvement in latency hiding, contributing to a 2.1–2.3× speedup from instruction count reduction.
- The staged load technique eliminated bank conflicts in shared memory access, achieving conflict-free access patterns through thread reordering within half-warps.
- The implementation is within 1.5× of the theoretical performance limit of the hardware, suggesting near-optimality for the target architecture.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.