TorchSparse: Efficient Point Cloud Inference Engine

Haotian Tang, Zhijian Liu, Xiuyu Li, Yujun Lin, Song Han · DOI

Abstract

3D point clouds generated by LiDAR and depth sensors are fundamentally sparse and irregular, posing significant challenges for traditional GPU-based deep learning frameworks designed for dense data. TorchSparse is a high-performance inference engine that addresses these challenges through adaptive matrix multiplication grouping and locality-aware memory access. By optimizing both computation and data orchestration, TorchSparse achieves a 1.6× end-to-end speedup over state-of-the-art libraries like MinkowskiEngine and SpConv, enabling real-time processing for autonomous driving and AR/VR applications.

Introduction

Unlike 2D images, which are represented as dense grids of pixels, 3D point clouds are characterized by their sparsity. In typical LiDAR scans for self-driving cars, the vast majority of 3D space is empty; the points of interest are scattered unpredictably. While this sparsity reduces the total number of data points, it introduces significant overhead for standard deep learning hardware. GPUs are optimized for regular, dense mathematical operations. When processing sparse convolutions (SparseConv), existing engines suffer from two primary bottlenecks:

  1. Irregular Computation: Convolutional kernels match a varying number of points across different spatial locations. This results in numerous small, inefficient matrix multiplications that fail to saturate the GPU's parallel processing capabilities.
  2. Heavy Data Movement: Because sparse points are not stored contiguously in memory, systems spend up to 50% of their execution time on "gathering" inputs and "scattering" results. This data orchestration often outweighs the actual computation time.

The TorchSparse Architecture

TorchSparse introduces three primary optimizations designed to bridge the gap between sparse data structures and dense hardware architectures.

Adaptive Matrix Multiplication Grouping

To resolve the issue of irregular computation, TorchSparse employs an adaptive grouping strategy. Rather than launching separate kernels for every small matrix multiplication, the engine groups them into larger, more efficient batches.

This approach embraces a "regularity paradox": performing more total work can actually result in faster execution. By adding a small amount of redundant computation (padding) to make workloads more uniform, TorchSparse can utilize efficient Batched Matrix Multiplication (BMM) kernels. This trade-off—increasing FLOPs to improve hardware utilization—significantly reduces the overhead of managing thousands of tiny tasks. Furthermore, the engine exploits the inherent symmetry in 3D kernels (e.g., symmetric offsets along axes) to group workloads into pairs, providing an immediate baseline speedup.

Fused Locality-Aware Memory Access

To address the memory bottleneck, TorchSparse reorders operations to prioritize data locality. Traditional engines often gather data for each weight separately, which leads to poor cache performance and excessive DRAM traffic. TorchSparse implements "input-stationary" or "output-stationary" reordering. By fetching an input feature once and utilizing it for all relevant weights before moving to the next feature, the engine maximizes cache hits and reduces the time spent on data movement by approximately 2.7×.

Vectorized and Quantized Mapping

TorchSparse further optimizes the data pipeline using FP16 quantization and vectorized memory instructions, effectively doubling the available bandwidth. It also fuses multiple stages of coordinate calculation—such as boundary and modular checks—into a single GPU kernel. This fusion eliminates the need to write intermediate results back to main memory, further streamlining the inference pipeline.

Experimental Results

The performance of TorchSparse was evaluated across seven representative models using three industry-standard datasets: SemanticKITTI (3D semantic segmentation), nuScenes (LiDAR segmentation and object detection), and the Waymo Open Dataset (large-scale object detection).

Performance Benchmarks

  • End-to-End Speedup: TorchSparse achieved a geometric mean speedup of 1.6× over MinkowskiEngine and 1.5× over SpConv across multiple NVIDIA GPU generations, including the GTX 1080Ti, RTX 2080Ti, and RTX 3090.
  • Real-Time Capabilities: On the SemanticKITTI benchmark, TorchSparse ran the MinkUNet model at 36 FPS on an RTX 3090. Crucially, it maintained 13 FPS on the older 1080Ti, comfortably exceeding the 10 FPS real-time requirement for autonomous vehicle LiDAR processing.
  • Component Efficiency: The adaptive grouping mechanism alone provided a 1.4–1.5× speedup for matrix multiplications.

Discussion and Limitations

While TorchSparse represents a significant leap in sparse inference efficiency, several areas for future improvement remain. The "adaptive" grouping requires a one-time offline search (approximately 10 minutes) to optimize parameters for a specific model and hardware pair. Additionally, while FP16 provided significant gains, the authors found that INT8 quantization yielded diminishing returns due to the high-precision requirements of the "scatter" operation and specific CUDA memory alignment constraints.

Finally, while the principles of TorchSparse are broadly applicable, the specific performance gains are sensitive to GPU architecture, particularly cache size and memory bandwidth. Future research may focus on extending these locality-aware optimizations to specialized AI accelerators.

Conclusion

TorchSparse demonstrates that the key to efficient sparse 3D deep learning lies in reconciling irregular data with regular hardware. By prioritizing memory locality and transforming irregular tasks into uniform batches, TorchSparse enables high-performance, real-time 3D perception on commodity GPU hardware.

Summary updated

BibTeX
@inproceedings{tang2022torchsparse,
  author = {Haotian Tang and Zhijian Liu and Xiuyu Li and Yujun Lin and Song Han},
  title = {{TorchSparse: Efficient Point Cloud Inference Engine}},
  booktitle = {MLSys},
  year = {2022},
  url = {https://openreview.net/forum?id=9znLw_us_2},
}
Figure