Skip to content

Commit

Permalink
fix: modify voxel index for better memory access
Browse files Browse the repository at this point in the history
Signed-off-by: Taekjin LEE <[email protected]>
  • Loading branch information
technolojin committed Dec 11, 2024
1 parent 8c79c76 commit 167b69d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ __global__ void generateVoxels_random_kernel(

int voxel_idx = floorf((point.x - min_x_range) / pillar_x_size);
int voxel_idy = floorf((point.y - min_y_range) / pillar_y_size);
unsigned int voxel_index = voxel_idy * grid_x_size + voxel_idx;
unsigned int voxel_index = (grid_x_size - 1 - voxel_idx) * grid_y_size + voxel_idy;

unsigned int point_id = atomicAdd(&(mask[voxel_index]), 1);

Expand Down Expand Up @@ -192,7 +192,7 @@ __global__ void generateBaseFeatures_kernel(
if (voxel_idx_inverted >= grid_x_size || voxel_idy >= grid_y_size) return;
unsigned int voxel_idx = grid_x_size - 1 - voxel_idx_inverted;

unsigned int voxel_index = voxel_idy * grid_x_size + voxel_idx;
unsigned int voxel_index = voxel_idx_inverted * grid_y_size + voxel_idy;
unsigned int count = mask[voxel_index];
if (!(count > 0)) return;
count = count < MAX_POINT_IN_VOXEL_SIZE ? count : MAX_POINT_IN_VOXEL_SIZE;
Expand Down

0 comments on commit 167b69d

Please sign in to comment.