scatter_cuda.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /******************************************************************************
  2. * Copyright 2020 The Apollo Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *****************************************************************************/
  16. /*
  17. * Copyright 2018-2019 Autoware Foundation. All rights reserved.
  18. *
  19. * Licensed under the Apache License, Version 2.0 (the "License");
  20. * you may not use this file except in compliance with the License.
  21. * You may obtain a copy of the License at
  22. *
  23. * http://www.apache.org/licenses/LICENSE-2.0
  24. *
  25. * Unless required by applicable law or agreed to in writing, software
  26. * distributed under the License is distributed on an "AS IS" BASIS,
  27. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  28. * See the License for the specific language governing permissions and
  29. * limitations under the License.
  30. */
  31. /**
  32. * @file scatter_cuda.h
  33. * @brief CUDA code for scatter operation
  34. * @author Kosuke Murakami
  35. * @date 2019/02/26
  36. */
  37. #pragma once
  38. namespace apollo {
  39. namespace perception {
  40. namespace lidar {
  41. class ScatterCuda {
  42. private:
  43. const int num_threads_;
  44. // const int max_num_pillars_;
  45. const int grid_x_size_;
  46. const int grid_y_size_;
  47. public:
  48. /**
  49. * @brief Constructor
  50. * @param[in] num_threads The number of threads to launch cuda kernel
  51. * @param[in] max_num_pillars Maximum number of pillars
  52. * @param[in] grid_x_size Number of pillars in x-coordinate
  53. * @param[in] grid_y_size Number of pillars in y-coordinate
  54. * @details Captital variables never change after the compile
  55. */
  56. ScatterCuda(const int num_threads, const int grid_x_size,
  57. const int grid_y_size);
  58. /**
  59. * @brief Call scatter cuda kernel
  60. * @param[in] pillar_count The valid number of pillars
  61. * @param[in] x_coors X-coordinate indexes for corresponding pillars
  62. * @param[in] y_coors Y-coordinate indexes for corresponding pillars
  63. * @param[in] pfe_output Output from Pillar Feature Extractor
  64. * @param[out] scattered_feature Gridmap representation for pillars' feature
  65. * @details Allocate pillars in gridmap based on index(coordinates)
  66. * information
  67. */
  68. void DoScatterCuda(const int pillar_count, int* x_coors, int* y_coors,
  69. float* pfe_output, float* scattered_feature);
  70. };
  71. } // namespace lidar
  72. } // namespace perception
  73. } // namespace apollo