Skip to content

add indice key to basicblock sparse encoder#3145

Open
GregorioFornetti wants to merge 1 commit into
open-mmlab:mainfrom
GregorioFornetti:GregorioFornetti/add_indice_key_to_basicblock_sparse_encoder
Open

add indice key to basicblock sparse encoder#3145
GregorioFornetti wants to merge 1 commit into
open-mmlab:mainfrom
GregorioFornetti:GregorioFornetti/add_indice_key_to_basicblock_sparse_encoder

Conversation

@GregorioFornetti
Copy link
Copy Markdown

@GregorioFornetti GregorioFornetti commented Jun 4, 2026

Motivation

I found that when setting block_type="basicblock", the encoder was not passing the indice_key into the SparseBasicBlock generation loop.

This creates a significant computational overhead when using the spconv library. Because the keys default to None, the backend is forced to completely regenerate the spatial index mapping for every single SubMConv3d layer during each forward pass, instead of reusing the maps already created by previous layers in the same stage.

With this modification, I obtained a small performance gain in CenterPoint-Voxel for nuScenes. The FPS in a P100 GPU went from 12.27 to 13.05.

Modification

To fix this problem, I made the following changes:

  1. Propagated the Key: Added the indice_key=f'subm_{i + 1}' argument to the SparseBasicBlock constructor inside the encoder layer loop so that each downsampling stage receives its own unique identifier.
  2. Isolated the Configurations: Modified the SparseBasicBlock construction logic to create a shallow copy (conv_cfg.copy()) of the received configuration dictionary before updating it. This breaks Python's mutable dictionary reference chain, ensuring that key assignments from earlier stages do not overwrite or pollute subsequent, downsampled stages.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jun 4, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants