[Installation] <title>Can this be applied to 5090?
Is there an existing issue for this?
- [x] I have searched the existing issues
Have you followed all the steps in the FAQ?
- [x] I have tried the steps in the FAQ.
Current Behavior
I tried to apply Torchsparse to 5090, in cuda12.8 and PyTorch Nightly. But there is always the problem of illegal memory access. I wanna know how to solve this.
Error Line
File "/root/autodl-tmp/.conda-stuff/envs/pointcept/lib/python3.10/site-packages/torchsparse-2.1.0-py3.10-linux-x86_64.egg/torchsparse/nn/functional/conv/kmap/func/hashmap_on_the_fly.py", line 185, in build_kmap_Fetch_on_Demand_hashmap_on_the_fly
results = torch.t(kmap["out_in_map"]).contiguous()
torch.AcceleratorError: CUDA error: an illegal memory access was encountered
Search for cudaErrorIllegalAddress' in https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html for more information. Compile with TORCH_USE_CUDA_DSA` to enable device-side assertions.
Environment
- GCC:13.2
- NVCC:13.2
- PyTorch:2.91
- PyTorch CUDA:12.8
Full Error Log
Error Log
[PUT YOUR ERROR LOG HERE]
hi, did you manage to solve this? @lh06-x
Oh right. I have received all of your messages. I haven't find a way to solve this problem. I just changed my gpu from 5090 to 4090. The reason behind the problem is that the Torchsparse hasn't update for cuda 12.8 and above. But 5090 requires the cuda12.8 or above. So if you can find a way to make the Torchsparse compile well in cuda12.8 or if you can find a way to use lower-version cuda(such as cuda12.4) on 5090, maybe this problem can be solved. If you have any new findings, please let me know. Thank'u very much. @prakashknaikade
Thanks to claude code, I fixed it. Now, I can run on Blackwell GPU! (RTX5090)
Python: 3.9 torch: 2.8.0
pip install torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cu128
(I'm trying to use torchsparse==1.4.0 for specific reason)
git clone --branch v1.4.0 --depth 1 https://github.com/mit-han-lab/torchsparse.git cd torchsparse
Patch: .type() → .scalar_type() (PyTorch 2.x compatibility)
sed -i 's/.type(), "/.scalar_type(), "/g' torchsparse/backend/convolution/convolution_cuda.cu torchsparse/backend/devoxelize/devoxelize_cuda.cu torchsparse/backend/voxelize/voxelize_cuda.cu
pip install .
python -c "import torchsparse; print('torchsparse', torchsparse.version)" [Out] torchsparse 1.4.0
I also managed to install but it does not really work>
File "/home/miniconda3/envs/scenescript/lib/python3.9/site-packages/torchsparse/nn/modules/norm.py", line 24, in forward batch_size = torch.max(coords[:, 0]).item() + 1 torch.AcceleratorError: CUDA error: an illegal memory access was encountered CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect. For debugging consider passing CUDA_LAUNCH_BLOCKING=1 Compile withTORCH_USE_CUDA_DSAto enable device-side assertions.
But have you managed to perform any operation using it? @MinChoi0129
I'm using torchsparse to run the MF-MOS network as described in the SCNU-RISLAB GitHub (https://github.com/SCNU-RISLAB/MF-MOS). I’ve tested it in inference mode, and it works perfectly—no errors or warnings so far. Unfortunately, I'm not an expert in fixing complex CUDA errors, so if you're trying to figure out what's happening under the hood, I’d suggest using the Claude VS Code extension. It might help you identify any potential issues quite faster.
which gcc, python and nvcc version did use? @MinChoi0129
Here it is.
(mfmos) root@7a3b8b5ae17e:/workspace# nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2025 NVIDIA Corporation Built on Wed_Jan_15_19:20:09_PST_2025 Cuda compilation tools, release 12.8, V12.8.61 Build cuda_12.8.r12.8/compiler.35404655_0
(mfmos) root@7a3b8b5ae17e:/workspace# gcc --version gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
(mfmos) root@7a3b8b5ae17e:/workspace# python --version Python 3.9.23
@MinChoi0129 Thanks for your sharing, I'll try to use cluade code to fix this.
@MinChoi0129 Could you share with us the modified torchsparse that you made
@MinChoi0129 Could you share with us the modified torchsparse that you made
=========== Now, you can find torch sparse whl from here.
https://data.pyg.org/whl/torch-2.7.1%2Bcu128.html
(superset link : https://data.pyg.org/whl/)
you can change torch version or cuda version. (current link : torch2.7.1 / cuda 12.8) but, you need to use python >= 3.10 i guess.
@MinChoi0129 The link you sent me is for torch_sparse, but it's not the same as torchsparse.
@robot-wljywp
Oh, sorry! I made a mistake. It has been long time I built it so I almost forgot how I did.
The CUDA compile issues, especially when upgrading version majors can be a major pain. Its one of the reasons I wrote an spconv drop-in in Triton. Its not torchsparse, but might fit your case. Its still in development -> spconv-Triton