NVIDIA-AI-IOT / CUDA-PointPillars

A project demonstrating how to use CUDA-PointPillars to deal with cloud points data from lidar.
Apache License 2.0
502 stars 148 forks source link

Found two crashes caused by two defects in preprocess_kernels.cu #79

Open arnoldfychen opened 1 year ago

arnoldfychen commented 1 year ago

Hello, we saw sometime crashes happened in our application with CUDA-PointPillars integrated, after investigated and found the causes are in preprocess_kernels.cu.

  1. in 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); our grid_y_size is 320, when (point.y - min_y_range)/pillar_y_size == 319.999998, voxel_idy = floorf(319.999998), the value of voxel_idy is 320 not 319 ! voxel_idy == grid_y_size, this caused invalid out-of-bounding access to mask and voxels, and the memory was then corrupted, so, a crash happened accordingly.

    1. in generateBaseFeatures_kernel(): current_pillarId = atomicAdd(pillar_num, 1); Hereafter no checking is done for current_pillarId, if there are points scattering in a very large range and current_pillarId is greater than MAX_VOXELS(40000), memory will be corrupted by "((float4)voxel_features)[outIndex] = ((float4)voxels)[inIndex];" because of invalid out-of-bounding access to voxel_features.

Did a sample fix here: https://github.com/arnoldfychen/CUDA-PointPillars/commit/2c9c4a15b432e7abee2de13b0b91a4a3a52fb1ce then no crash was seen.