spatial sparse convolution
Project description
SpConv: PyTorch Spatially Sparse Convolution Library
!!!!!!!!!!
If you are using spconv < 2.0.2, update after spconv 2.0.2 build success or check this issue to fix a serious bug, I'm so sorry for this stupid bug.
Breaking changes in Spconv 2.x
-
spconv.xxx
move tospconv.pytorch.xxx
, change allimport spconv
toimport spconv.pytorch as spconv
andfrom spconv.xxx import
tofrom spconv.pytorch.xxx import
. -
use_hash
in Sparse Convolution is removed, we only use hash table in 2.x. -
x.features = F.relu(x)
now raise error. usex = x.replace_feature(F.relu(x.features))
instead. -
weight layout has been changed to RSKC (native algorithm) or KRSC (implicit gemm), no longer RSCK (spconv 1.x). RS is kernel size, C is input channel, K is output channel.
-
all util ops are removed (pillar scatter/nms/...)
-
VoxelGenerator has been replaced by Point2VoxelGPU[1-4]d/Point2VoxelCPU[1-4]d.
-
spconv 2.x don't support CPU for now
-
test spconv 1.x model in spconv 2.x: set environment variable before run program. Linux:
export SPCONV_FILTER_HWIO="1"
, Windows powershell:$Env:SPCONV_FILTER_HWIO = "1"
Upcoming release Spconv 2.1.0 (10.31.2021):
- implicit gemm algorithm, greatly faster than native algorithm when using float16 (tested in RTX 3080 Laptop).
- simple CPU support and CPU-only build
- bug fix
News in Spconv 2.0.0
- training/inference speed is increased (+50~80% for float32)
- support int8/tensor core
- doesn't depend on pytorch binary.
- since spconv 2.x doesn't depend on pytorch binary (never in future), it's impossible to support torch.jit/libtorch inference.
Spconv 2.1.0 vs 1.x speed:
1080Ti Spconv 1.x F32 | 1080Ti Spconv 2.0 F32 | 3080M* Spconv 2.1 F16 | |
---|---|---|---|
27x128x128 Fwd | 11ms | 5.4ms | 1.4ms |
* 3080M (Laptop) ~= 3070 Desktop
Usage
Firstly you need to use import spconv.pytorch as spconv
in spconv 2.x.
Then see docs/USAGE.md.
Install
You need to install python >= 3.7 first to use spconv 2.x.
You need to install CUDA toolkit first before using prebuilt binaries or build from source.
You need at least CUDA 10.2 to build and run spconv 2.x. We won't offer any support for CUDA < 10.2.
Prebuilt
We offer python 3.7-3.10 and 11.1/11.4 prebuilt binaries for linux (manylinux) and windows 10/11.
CUDA 10.2 support will be added in version 2.0.2.
We will offer prebuilts for CUDA versions supported by latest pytorch release. For example, pytorch 1.9 support cuda 10.2 and 11.1, so we support them too.
For Linux users, you need to install pip >= 20.3 first to install prebuilt.
pip install spconv-cu111
for CUDA 11.1
pip install spconv-cu114
for CUDA 11.4
NOTE It's safe to have different minor cuda version between system and conda (pytorch). for example, you can use spconv-cu114 with anaconda version of pytorch cuda 11.1 in a OS with CUDA 11.2 installed.
Build from source
You need to rebuild cumm
first if you are build along a CUDA version that not provided in prebuilts.
Linux
- install build-essential, install CUDA
- run
export SPCONV_DISABLE_JIT="1"
- run
python setup.py bdist_wheel
+pip install dists/xxx.whl
Windows 10/11
- install visual studio 2019 or newer. make sure C++ development package is installed. install CUDA
- set powershell script execution policy
- start a new powershell, run
tools/msvc_setup.ps1
- run
$Env:SPCONV_DISABLE_JIT = "1"
- run
python setup.py bdist_wheel
+pip install dists/xxx.whl
TODO in Spconv 2.x
- Ampere (A100 / RTX 3000 series) feature support (work in progress)
- torch QAT support (work in progress)
- TensorRT (torch.fx based)
- Build C++ only package
- JIT compilation for CUDA kernels
- Document (low priority)
- CPU support (low priority)
Note
The work is done when the author is an employee at Tusimple.
LICENSE
Apache 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for spconv_cu114-2.0.2-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b97e51db8d2359510cae95bf9a58cb71588c50a5f1b92101bc18d96ee078f2a8 |
|
MD5 | 5360f84ed9b031652ce6a21b59a4231d |
|
BLAKE2b-256 | 31704ac97fb128f951b49c9d2e19f5bd0717b4577de508e9c527cc9ae2d1d127 |
Hashes for spconv_cu114-2.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46f3e870553a274adbb1d5811d06c50a4dd4dd9f40c67762a85d47b89476c666 |
|
MD5 | 66ccd8c1f98b93c4f355e124df0a18f6 |
|
BLAKE2b-256 | f6dbf1bc9e9f000ed63821cfef57b5b3658b278ae1f30485ce6662a8fd571365 |
Hashes for spconv_cu114-2.0.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e355feeef6a15097b5ba7f3054c94e3731a10434f3ad7e5cebd9915f1508c37 |
|
MD5 | e4593ea190d9c8f46360a8073093e7af |
|
BLAKE2b-256 | 642517dcc46e5cb74c7c074cdaa02d12d1172134f84435cc604d1857271594ca |
Hashes for spconv_cu114-2.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab7faf3caac135e76090a98f04508176c2c2ebf7bc390cba89960a4b93598fd4 |
|
MD5 | ce8eafc884112425bd1376592982dfc1 |
|
BLAKE2b-256 | 12cf6407090544f19979df5ed4da9ebaaba481581b5eb91d941c18b0308fe213 |
Hashes for spconv_cu114-2.0.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63b4efa7cd63664abee4ee3bbce7f080c95279a4e5f98eb80a25e9866432d2a6 |
|
MD5 | 4d12197189fd468ac94630a4b137c1bb |
|
BLAKE2b-256 | 3543cf5682f41f65f2723fa6784ea79e469d4bcfda21043343032205f51d614c |
Hashes for spconv_cu114-2.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eead16e27ba1e4d5ab74baf6eb4fc59f59808a56384a576509d7b2cc3aa70e17 |
|
MD5 | b7316aca17d04e0c58b5c8bf3bc509e5 |
|
BLAKE2b-256 | 577610406b5a45dde77a669dd17d5281efaaffe57623810febc941b043e7c483 |
Hashes for spconv_cu114-2.0.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e8f18b4cb589897574a75440a859c9255705f54e6d73466a9c61b07021fba32 |
|
MD5 | 07c0bb9afe14fb4dcffc6a2b07e0b5b1 |
|
BLAKE2b-256 | aa016f308e2e64a561bd5872eda81d0132fa9a5d718946062cfabb73a5317e82 |
Hashes for spconv_cu114-2.0.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8edb7abffb0b3a83c2f0a4917ba02caaac385c7c204a10d01174e3e03b2925c4 |
|
MD5 | e2ac0af2b661613e638e3e6a04f2e438 |
|
BLAKE2b-256 | c90f08c29e35c7af091c070be0331130bd34ebf89dbd8c8eea8b5b38f34c32c0 |