mit-han-lab / torchsparse

[MICRO'23, MLSys'22] TorchSparse: Efficient Training and Inference Framework for Sparse Convolution on GPUs.
https://torchsparse.mit.edu
MIT License
1.19k stars 138 forks source link

`F.set_kmap_mode()` has no effect #308

Open rfeinman opened 4 months ago

rfeinman commented 4 months ago

Is there an existing issue for this?

Current Behavior

I am using the bleeding-edge TorchSparse library and it seems like F.set_kmap_mode("hashmap") has no effect. My code looks as follows:

from torchsparse.nn import functional as F

F.set_kmap_mode("hashmap")

However, it appears that my convolution ops are still using the "hashmap_on_the_fly" kmap mode. I get an error message saying ValueError: Unsupported kmap_mode: hashmap_on_the_fly for generative convolution (please switch to kmap_mode=hashmap).

The following code snippet does seem to work, but it is slightly more involved (and not clear from the docs):

conv_config = F.conv_config.get_default_conv_config(conv_mode=F.get_conv_mode())
conv_config.kmap_mode = 'hashmap'
F.conv_config.set_global_conv_config(conv_config)

Expected Behavior

I expect that F.set_kmap_mode("hashmap") would change the kmap mode used for convolution.

Environment

- GCC: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
- NVCC: Build cuda_12.2.r12.2/compiler.33191640_0
- PyTorch: 2.2.0
- PyTorch CUDA: 12.1
- TorchSparse: 2.1.0 (installed from source in May, 2024)

Anything else?

No response

Tortoise0Knight commented 3 months ago

Same problem here, thank you for walkaway solution