TorchSparse++: Efficient Training and Inference Framework for Sparse Convolution on GPUs

Haotian Tang, Shang Yang, Zhijian Liu, Ke Hong, Zhongming Yu, Xiuyu Li, Guohao Dai, Yu Wang, Song Han · DOI

Abstract

Sparse convolution is the foundational operation for 3D perception tasks, such as LiDAR-based autonomous driving and 3D object detection. However, existing sparse convolution libraries often force a trade-off between engineering simplicity and computational performance. TorchSparse++ resolves this "developer's dilemma" by introducing a high-performance GPU framework that achieves state-of-the-art speeds with significantly reduced manual code. By leveraging a Sparse Kernel Generator and an automated tuning system, TorchSparse++ delivers up to 3.3× faster inference and 1.3× faster training compared to existing systems like SpConv v2.

1. Introduction

Processing 3D point clouds or large-scale graphs presents a unique challenge for deep learning: the data is inherently sparse. In a typical LiDAR scan, over 99% of the spatial grid is empty. While standard dense convolutions are highly optimized for GPUs, applying them to sparse data results in massive computational waste. Sparse convolution addresses this by only performing calculations on non-zero elements.

Despite its necessity, developing efficient sparse convolution kernels is notoriously difficult. Current solutions fall into two categories: simple dataflows (like Gather-GEMM-Scatter) that are easy to implement but suffer from memory bottlenecks, and complex dataflows (like Implicit GEMM) that offer high performance but require tens of thousands of lines of intricate CUDA metaprogramming. TorchSparse++ bridges this gap, providing a system that is both highly performant and maintainable.

2. Methodology

TorchSparse++ introduces two primary innovations to optimize sparse workloads without the engineering overhead of manual kernel writing.

2.1 Sparse Kernel Generator

Rather than manually writing thousands of lines of custom CUDA code, TorchSparse++ utilizes a Sparse Kernel Generator. This system "tricks" existing dense tensor compilers (such as TVM) into processing sparse data. By implementing a thin layer of indirect addressing—mapping sparse coordinates to dense buffers—the framework can generate highly optimized kernels using only a few hundred lines of template code. This approach allows the framework to inherit the optimization capabilities of mature dense compilers while specializing them for sparse data structures.

2.2 Sparse Autotuner

Performance in sparse convolution is highly sensitive to layer-specific parameters and hardware characteristics. The Sparse Autotuner explores a massive design space to find the optimal configuration for every layer in a neural network. It introduces two key techniques:

  • Mask Splitting: This technique breaks down computations into parallel chunks, significantly increasing GPU utilization.
  • Unsorted Implicit GEMM: Traditional methods often sort sparse data to improve memory access patterns. However, TorchSparse++ identifies that on modern high-end GPUs (like the NVIDIA A100), the overhead of sorting often exceeds the computational savings. The autotuner can opt for unsorted dataflows when the hardware's parallel capacity is sufficient to handle the resulting redundancy.

3. Evaluation and Results

The framework was evaluated across seven representative models using major 3D benchmarks, including SemanticKITTI, nuScenes, and the Waymo Open Dataset. It was also tested on relational graph convolution (R-GCN) using multiple heterogeneous graph datasets.

3.1 Performance Benchmarks

TorchSparse++ demonstrates significant performance leads over previous state-of-the-art (SOTA) libraries:

  • Inference Speed: On an NVIDIA A100, TorchSparse++ achieved end-to-end speedups of 2.9× over MinkowskiEngine and 1.7× over SpConv v2.
  • Training Speed: In mixed-precision training scenarios, the framework is 1.2–1.3× faster than SpConv v2.
  • Graph Neural Networks: When applied to GNNs, it outperformed dedicated libraries like DGL and PyG by 2.6–7.6×.

3.2 Engineering Efficiency

One of the most significant contributions of TorchSparse++ is its efficiency. It achieves these performance gains with less than 1/10th the engineering cost (measured in lines of code) compared to SpConv v2, making it far more accessible for community modification and research extension.

4. Key Insights

The development of TorchSparse++ revealed several critical insights into sparse computation:

  • The Sorting Fallacy: The assumption that sparse data must always be sorted for efficiency is outdated for modern GPUs. The time spent on "bookkeeping" (sorting and mapping) can occupy up to 50% of total runtime, making unsorted flows a viable alternative.
  • Mapping as a Bottleneck: Optimizing the mapping process—identifying neighbor relationships in 3D space—is just as vital as optimizing the General Matrix Multiplication (GEMM) itself.
  • Tiling Superiority: By carefully tuning tiling sizes (how data is partitioned for GPU memory), the generated kernels in TorchSparse++ can actually outperform industry-standard libraries like cuBLAS even on equivalent dense problems.

5. Limitations and Future Work

While TorchSparse++ sets a new standard for NVIDIA GPUs, its current reliance on CUDA and PTX assembly limits its portability to other hardware like AMD GPUs or TPUs. Additionally, while mapping overhead has been reduced, it remains a significant portion of the execution time. Future work may involve integrating specialized hardware accelerators or extending the sparse-aware approach to other architectures, such as Sparse Transformers and Masked Autoencoders.

6. Conclusion

TorchSparse++ provides a scalable, efficient, and maintainable framework for sparse convolution. By automating kernel generation and tuning, it removes the heavy engineering burden previously required to achieve high performance, paving the way for more efficient 3D perception in autonomous systems and beyond.

Summary updated

BibTeX
@inproceedings{tang2023torchsparse,
  author = {Haotian Tang and Shang Yang and Zhijian Liu and Ke Hong and Zhongming Yu and Xiuyu Li and Guohao Dai and Yu Wang and Song Han},
  title = {{TorchSparse++: Efficient Training and Inference Framework for Sparse Convolution on GPUs}},
  booktitle = {MICRO},
  year = {2023},
  doi = {10.1145/3613424.3614303},
}
Figure