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_cu111-2.0.2-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ef03b093c9e786cce0ba633ddbf7814eee7fec2a5881a98d4b69cbdf9131d92 |
|
MD5 | a320e079d3ab0bde5fdd5fc0089068ee |
|
BLAKE2b-256 | efa32ea8f4fcba82ce635247d2371b261a4ac894fd2ba2ab83c0e34d26b4b0f9 |
Hashes for spconv_cu111-2.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68284f18076a6d03868c30e72531eba844749c1d13b90e8a8856419f1372583b |
|
MD5 | 338e1319707aaf07888201427436480b |
|
BLAKE2b-256 | ec808655cffba8fffb3063b0005370135178927237400a36ed39944a511cb944 |
Hashes for spconv_cu111-2.0.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7f1f63bf83a891fef953b1cec106ede0bbeaee9f5c766b1fc7911259ecfb236 |
|
MD5 | 4434b59e24b175732094cbb9bc0989f9 |
|
BLAKE2b-256 | 0628fe4c79d8ab2cbcf06768b6f5ef7d8eea95fecf37de06a328e953015d4f1b |
Hashes for spconv_cu111-2.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcfad6de064969f9bc8e3f26b0bd979d6719a4a902ab7d49693fce9b32c298a3 |
|
MD5 | c7756c426d748fa598109594bc6f10e9 |
|
BLAKE2b-256 | ded18961414a4c48bdef1cd23fbdee34f50657ef555f9aba2cfcf7a7e5d05899 |
Hashes for spconv_cu111-2.0.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32d7db0b6c8134c0c933dd4da0dc3e5431464116b7d8fe059bd40fff1804c799 |
|
MD5 | 907520dad337f75266d7b66f0327faac |
|
BLAKE2b-256 | 3bdb3f8654d818b089aaa610e795e716688675b6061540a4011600888240f2f4 |
Hashes for spconv_cu111-2.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fb17b9fb8bd0a4ef2560bbfa08b2559ccc5e525e8a672648facaa86c6146beb |
|
MD5 | b975f62309cafc27f79c6c78db7cd79f |
|
BLAKE2b-256 | 877d93036100316efa4eed88dd95402080a65a70b6d1c6587094c4691a66d85c |
Hashes for spconv_cu111-2.0.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53a6f41ac726d5d651046afa0e12d164874857889f5780ad1064524f8d925c33 |
|
MD5 | 86535adf1599bc5aa760244a42012f08 |
|
BLAKE2b-256 | 9073bf9f19b57f3c2dda597ccaba3e986ab52e4530befb6ed1c852fdccd0e9f8 |
Hashes for spconv_cu111-2.0.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 561518a1cc5691bf939b4428b71ff9812dca77a638074987c8642177a7187fb4 |
|
MD5 | 83769e8c4c39db79f72fe1c0330cdd0b |
|
BLAKE2b-256 | ee9540aa5caaf08f9a92d9e9914c96c59817bd20a2389663e5e1abf62ad73239 |