Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(common_ground_filter): performance tuning #5861

Conversation

taisa1
Copy link
Contributor

@taisa1 taisa1 commented Dec 13, 2023

Description

This PR makes scan_ground_filter (common_ground_filter) faster without changing the logical output.
The tail latency of the scan_ground_filter gets about x1.7 faster with this PR merged.

The main changes are as follows:

  • Minimized the use of trigonometric functions such as std::atan2,
  • Processed the input point cloud without converting it to pcl::PointCloud.

In addition, some small changes are made to improve performance.

Measurement Condition

・Ubuntu22.04 + ROS2 Humble + Autoware Universe rosbag simulation
・Core Isolated
・Core Frequency Fixed (2.3GHz)
・L3 Cache: 24MB

Related links

Tests performed

It has been verified that the content of output topics with the same timestamp is identical before and after the PR.

To reproduce

Download files from https://drive.google.com/drive/folders/1703DlE8MT0rksiQfZGR8A53wwrvMRSEc?usp=drive_link and run python3 validator.py default.csv after.csv for comparing results.

Pre-review checklist for the PR author

The PR author must check the checkboxes below when creating the PR.

In-review checklist for the PR reviewers

The PR reviewers must check the checkboxes below before approval.

  • The PR follows the pull request guidelines.
  • The PR has been properly tested.
  • The PR has been reviewed by the code owners.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

  • There are no open discussions or they are tracked via tickets.
  • The PR is ready for merge.

After all checkboxes are checked, anyone who has write access can merge the PR.

@github-actions github-actions bot added component:perception Advanced sensor data processing and environment understanding. (auto-assigned) component:sensing Data acquisition from sensors, drivers, preprocessing. (auto-assigned) labels Dec 13, 2023
@atsushi421 atsushi421 self-requested a review December 22, 2023 03:56
Signed-off-by: taisa1 <[email protected]>
Signed-off-by: taisa1 <[email protected]>
@taisa1 taisa1 marked this pull request as ready for review December 22, 2023 10:14
@taisa1 taisa1 marked this pull request as draft December 23, 2023 11:55
Copy link
Contributor

@atsushi421 atsushi421 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if this PR was modified to pass CodeScene.

@atsushi421 atsushi421 added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Dec 27, 2023
@atsushi421 atsushi421 self-requested a review December 27, 2023 07:15
atsushi421

This comment was marked as outdated.

@taisa1 taisa1 marked this pull request as ready for review December 27, 2023 07:16
@taisa1 taisa1 changed the title perf(scan_ground_filter): performance tuning perf(common_ground_filter): performance tuning Dec 27, 2023
@atsushi421
Copy link
Contributor

@taisa1
The unit test is failed due to changes in filter(). It is recommended that the unit tests also use faster_filter().
https://github.com/autowarefoundation/autoware.universe/actions/runs/7342510285/job/19991834839?pr=5861

@miursh
Copy link
Contributor

miursh commented Dec 29, 2023

This is the result of TIER IV CI test. TIER IV internal link
image
After running our CI tests, we've observed a significant increase in the number of failure. The number of passing test cases, dropping from 148 to 68. While I haven't confirmed the details yet, it seems that some errors may be occurring.

@taisa1
Copy link
Contributor Author

taisa1 commented Jan 5, 2024

I found that some variables I added have to be updated when corresponding parameter changes, but I hadn't implemented it. This might cause failure so I fixed it.

Copy link

codecov bot commented Jan 8, 2024

Codecov Report

Attention: Patch coverage is 48.12500% with 83 lines in your changes are missing coverage. Please review.

Project coverage is 14.79%. Comparing base (ebb4172) to head (74fc93d).
Report is 2 commits behind head on main.

Files Patch % Lines
...nd_segmentation/src/scan_ground_filter_nodelet.cpp 48.40% 55 Missing and 26 partials ⚠️
...ound_segmentation/test/test_scan_ground_filter.cpp 0.00% 0 Missing and 1 partial ⚠️
sensing/pointcloud_preprocessor/src/filter.cpp 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5861      +/-   ##
==========================================
+ Coverage   14.78%   14.79%   +0.01%     
==========================================
  Files        1917     1917              
  Lines      132046   132109      +63     
  Branches    39228    39252      +24     
==========================================
+ Hits        19523    19548      +25     
- Misses      90734    90766      +32     
- Partials    21789    21795       +6     
Flag Coverage Δ *Carryforward flag
differential 5.52% <48.12%> (?)
total 14.75% <ø> (-0.04%) ⬇️ Carriedforward from ebb4172

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@miursh
Copy link
Contributor

miursh commented Jan 9, 2024

Thanks!
I re-ran the tests, and I can see some changes, but there are still many failures.
https://evaluation.tier4.jp/evaluation/reports/d9fcb22f-095a-5b13-89a2-82b72be71201?project_id=prd_jt
image

@atsushi421
Copy link
Contributor

@miursh
Sorry for the late response. 🙇
I found a variable uninitialized and have fixed it, could you review this again?

@atsushi421 atsushi421 marked this pull request as draft March 4, 2024 04:53
@atsushi421 atsushi421 removed the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Mar 4, 2024
@atsushi421
Copy link
Contributor

@badai-nguyen
Thank you for the other day.
I used the tutorial to observe the state of the point cloud before and after PR and found no particular difference, as shown in the images below. (Used autoware.universe commit ID: ebb4172)
It seems to be working correctly in my environment, could you please review again?

Before After

@atsushi421 atsushi421 marked this pull request as ready for review March 4, 2024 06:56
@atsushi421 atsushi421 added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Mar 4, 2024
Copy link
Contributor

@badai-nguyen badai-nguyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@taisa1 @atsushi421 I deeply appreciate your improvement.

I confirmed by logging_simulator that the obstacle_segmentation/pointcloud as before and the processing time of /perception/obstacle_segmentation/common_ground_filter node is improved.

Before After
image image
image Screenshot from 2024-03-08 00-40-56

CI tested result also shows the acceptable pass rate.

LGTM!

@atsushi421 atsushi421 merged commit efe4e16 into autowarefoundation:main Mar 11, 2024
35 of 36 checks passed
@atsushi421 atsushi421 deleted the performance-tuning-for-scan_ground_filter branch March 11, 2024 08:14
HansRobo pushed a commit that referenced this pull request Mar 12, 2024
* perf(scan_ground_filter): performance tuning

Signed-off-by: taisa1 <[email protected]>

* perf(scan_ground_filter): improved performance

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* refactor: reflect review

Signed-off-by: taisa1 <[email protected]>

* style(pre-commit): autofix

* fix: remove unnecessary comment

Signed-off-by: taisa1 <[email protected]>

* test: change unit test to use faster_filter

Signed-off-by: taisa1 <[email protected]>

* test: fixed compile error

Signed-off-by: taisa1 <[email protected]>

* fix: add lacking parameter callback

Signed-off-by: taisa1 <[email protected]>

* fix: uninitialized valuabe

Signed-off-by: atsushi421 <[email protected]>

---------

Signed-off-by: taisa1 <[email protected]>
Signed-off-by: atsushi421 <[email protected]>
Co-authored-by: taisa1 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: atsushi yano <[email protected]>
Co-authored-by: atsushi421 <[email protected]>
Signed-off-by: Kotaro Yoshimoto <[email protected]>
kaigohirao pushed a commit to kaigohirao/autoware.universe that referenced this pull request Mar 22, 2024
* perf(scan_ground_filter): performance tuning

Signed-off-by: taisa1 <[email protected]>

* perf(scan_ground_filter): improved performance

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* refactor: reflect review

Signed-off-by: taisa1 <[email protected]>

* style(pre-commit): autofix

* fix: remove unnecessary comment

Signed-off-by: taisa1 <[email protected]>

* test: change unit test to use faster_filter

Signed-off-by: taisa1 <[email protected]>

* test: fixed compile error

Signed-off-by: taisa1 <[email protected]>

* fix: add lacking parameter callback

Signed-off-by: taisa1 <[email protected]>

* fix: uninitialized valuabe

Signed-off-by: atsushi421 <[email protected]>

---------

Signed-off-by: taisa1 <[email protected]>
Signed-off-by: atsushi421 <[email protected]>
Co-authored-by: taisa1 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: atsushi yano <[email protected]>
Co-authored-by: atsushi421 <[email protected]>
Signed-off-by: kaigohirao <[email protected]>
@badai-nguyen badai-nguyen added the type:performance Software optimization and system performance. label Mar 29, 2024
badai-nguyen pushed a commit to badai-nguyen/autoware.universe that referenced this pull request Apr 8, 2024
* perf(scan_ground_filter): performance tuning

Signed-off-by: taisa1 <[email protected]>

* perf(scan_ground_filter): improved performance

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* refactor: reflect review

Signed-off-by: taisa1 <[email protected]>

* style(pre-commit): autofix

* fix: remove unnecessary comment

Signed-off-by: taisa1 <[email protected]>

* test: change unit test to use faster_filter

Signed-off-by: taisa1 <[email protected]>

* test: fixed compile error

Signed-off-by: taisa1 <[email protected]>

* fix: add lacking parameter callback

Signed-off-by: taisa1 <[email protected]>

* fix: uninitialized valuabe

Signed-off-by: atsushi421 <[email protected]>

---------

Signed-off-by: taisa1 <[email protected]>
Signed-off-by: atsushi421 <[email protected]>
Co-authored-by: taisa1 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: atsushi yano <[email protected]>
Co-authored-by: atsushi421 <[email protected]>
badai-nguyen pushed a commit to tier4/autoware.universe that referenced this pull request Apr 10, 2024
* perf(scan_ground_filter): performance tuning

Signed-off-by: taisa1 <[email protected]>

* perf(scan_ground_filter): improved performance

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* refactor: reflect review

Signed-off-by: taisa1 <[email protected]>

* style(pre-commit): autofix

* fix: remove unnecessary comment

Signed-off-by: taisa1 <[email protected]>

* test: change unit test to use faster_filter

Signed-off-by: taisa1 <[email protected]>

* test: fixed compile error

Signed-off-by: taisa1 <[email protected]>

* fix: add lacking parameter callback

Signed-off-by: taisa1 <[email protected]>

* fix: uninitialized valuabe

Signed-off-by: atsushi421 <[email protected]>

---------

Signed-off-by: taisa1 <[email protected]>
Signed-off-by: atsushi421 <[email protected]>
Co-authored-by: taisa1 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: atsushi yano <[email protected]>
Co-authored-by: atsushi421 <[email protected]>
badai-nguyen pushed a commit to badai-nguyen/autoware.universe that referenced this pull request Apr 11, 2024
* perf(scan_ground_filter): performance tuning

Signed-off-by: taisa1 <[email protected]>

* perf(scan_ground_filter): improved performance

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* refactor: reflect review

Signed-off-by: taisa1 <[email protected]>

* style(pre-commit): autofix

* fix: remove unnecessary comment

Signed-off-by: taisa1 <[email protected]>

* test: change unit test to use faster_filter

Signed-off-by: taisa1 <[email protected]>

* test: fixed compile error

Signed-off-by: taisa1 <[email protected]>

* fix: add lacking parameter callback

Signed-off-by: taisa1 <[email protected]>

* fix: uninitialized valuabe

Signed-off-by: atsushi421 <[email protected]>

---------

Signed-off-by: taisa1 <[email protected]>
Signed-off-by: atsushi421 <[email protected]>
Co-authored-by: taisa1 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: atsushi yano <[email protected]>
Co-authored-by: atsushi421 <[email protected]>
0x126 pushed a commit to tier4/autoware.universe that referenced this pull request Apr 14, 2024
* perf(scan_ground_filter): performance tuning

Signed-off-by: taisa1 <[email protected]>

* perf(scan_ground_filter): improved performance

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* refactor: reflect review

Signed-off-by: taisa1 <[email protected]>

* style(pre-commit): autofix

* fix: remove unnecessary comment

Signed-off-by: taisa1 <[email protected]>

* test: change unit test to use faster_filter

Signed-off-by: taisa1 <[email protected]>

* test: fixed compile error

Signed-off-by: taisa1 <[email protected]>

* fix: add lacking parameter callback

Signed-off-by: taisa1 <[email protected]>

* fix: uninitialized valuabe

Signed-off-by: atsushi421 <[email protected]>

---------

Signed-off-by: taisa1 <[email protected]>
Signed-off-by: atsushi421 <[email protected]>
Co-authored-by: taisa1 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: atsushi yano <[email protected]>
Co-authored-by: atsushi421 <[email protected]>
0x126 pushed a commit to tier4/autoware.universe that referenced this pull request Apr 16, 2024
* perf(scan_ground_filter): performance tuning

Signed-off-by: taisa1 <[email protected]>

* perf(scan_ground_filter): improved performance

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* refactor: reflect review

Signed-off-by: taisa1 <[email protected]>

* style(pre-commit): autofix

* fix: remove unnecessary comment

Signed-off-by: taisa1 <[email protected]>

* test: change unit test to use faster_filter

Signed-off-by: taisa1 <[email protected]>

* test: fixed compile error

Signed-off-by: taisa1 <[email protected]>

* fix: add lacking parameter callback

Signed-off-by: taisa1 <[email protected]>

* fix: uninitialized valuabe

Signed-off-by: atsushi421 <[email protected]>

---------

Signed-off-by: taisa1 <[email protected]>
Signed-off-by: atsushi421 <[email protected]>
Co-authored-by: taisa1 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: atsushi yano <[email protected]>
Co-authored-by: atsushi421 <[email protected]>
0x126 pushed a commit to tier4/autoware.universe that referenced this pull request Apr 16, 2024
* perf(scan_ground_filter): performance tuning

Signed-off-by: taisa1 <[email protected]>

* perf(scan_ground_filter): improved performance

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* refactor: reflect review

Signed-off-by: taisa1 <[email protected]>

* style(pre-commit): autofix

* fix: remove unnecessary comment

Signed-off-by: taisa1 <[email protected]>

* test: change unit test to use faster_filter

Signed-off-by: taisa1 <[email protected]>

* test: fixed compile error

Signed-off-by: taisa1 <[email protected]>

* fix: add lacking parameter callback

Signed-off-by: taisa1 <[email protected]>

* fix: uninitialized valuabe

Signed-off-by: atsushi421 <[email protected]>

---------

Signed-off-by: taisa1 <[email protected]>
Signed-off-by: atsushi421 <[email protected]>
Co-authored-by: taisa1 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: atsushi yano <[email protected]>
Co-authored-by: atsushi421 <[email protected]>
0x126 pushed a commit to tier4/autoware.universe that referenced this pull request Apr 19, 2024
* perf(scan_ground_filter): performance tuning

Signed-off-by: taisa1 <[email protected]>

* perf(scan_ground_filter): improved performance

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* refactor: reflect review

Signed-off-by: taisa1 <[email protected]>

* style(pre-commit): autofix

* fix: remove unnecessary comment

Signed-off-by: taisa1 <[email protected]>

* test: change unit test to use faster_filter

Signed-off-by: taisa1 <[email protected]>

* test: fixed compile error

Signed-off-by: taisa1 <[email protected]>

* fix: add lacking parameter callback

Signed-off-by: taisa1 <[email protected]>

* fix: uninitialized valuabe

Signed-off-by: atsushi421 <[email protected]>

---------

Signed-off-by: taisa1 <[email protected]>
Signed-off-by: atsushi421 <[email protected]>
Co-authored-by: taisa1 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: atsushi yano <[email protected]>
Co-authored-by: atsushi421 <[email protected]>
badai-nguyen pushed a commit to tier4/autoware.universe that referenced this pull request Apr 22, 2024
* perf(scan_ground_filter): performance tuning

Signed-off-by: taisa1 <[email protected]>

* perf(scan_ground_filter): improved performance

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* refactor: reflect review

Signed-off-by: taisa1 <[email protected]>

* style(pre-commit): autofix

* fix: remove unnecessary comment

Signed-off-by: taisa1 <[email protected]>

* test: change unit test to use faster_filter

Signed-off-by: taisa1 <[email protected]>

* test: fixed compile error

Signed-off-by: taisa1 <[email protected]>

* fix: add lacking parameter callback

Signed-off-by: taisa1 <[email protected]>

* fix: uninitialized valuabe

Signed-off-by: atsushi421 <[email protected]>

---------

Signed-off-by: taisa1 <[email protected]>
Signed-off-by: atsushi421 <[email protected]>
Co-authored-by: taisa1 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: atsushi yano <[email protected]>
Co-authored-by: atsushi421 <[email protected]>
badai-nguyen pushed a commit to tier4/autoware.universe that referenced this pull request Apr 23, 2024
* perf(scan_ground_filter): performance tuning

Signed-off-by: taisa1 <[email protected]>

* perf(scan_ground_filter): improved performance

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* refactor: reflect review

Signed-off-by: taisa1 <[email protected]>

* style(pre-commit): autofix

* fix: remove unnecessary comment

Signed-off-by: taisa1 <[email protected]>

* test: change unit test to use faster_filter

Signed-off-by: taisa1 <[email protected]>

* test: fixed compile error

Signed-off-by: taisa1 <[email protected]>

* fix: add lacking parameter callback

Signed-off-by: taisa1 <[email protected]>

* fix: uninitialized valuabe

Signed-off-by: atsushi421 <[email protected]>

---------

Signed-off-by: taisa1 <[email protected]>
Signed-off-by: atsushi421 <[email protected]>
Co-authored-by: taisa1 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: atsushi yano <[email protected]>
Co-authored-by: atsushi421 <[email protected]>
karishma1911 pushed a commit to Interplai/autoware.universe that referenced this pull request Jun 3, 2024
* perf(scan_ground_filter): performance tuning

Signed-off-by: taisa1 <[email protected]>

* perf(scan_ground_filter): improved performance

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* chore: refactoring

Signed-off-by: taisa1 <[email protected]>

* refactor: reflect review

Signed-off-by: taisa1 <[email protected]>

* style(pre-commit): autofix

* fix: remove unnecessary comment

Signed-off-by: taisa1 <[email protected]>

* test: change unit test to use faster_filter

Signed-off-by: taisa1 <[email protected]>

* test: fixed compile error

Signed-off-by: taisa1 <[email protected]>

* fix: add lacking parameter callback

Signed-off-by: taisa1 <[email protected]>

* fix: uninitialized valuabe

Signed-off-by: atsushi421 <[email protected]>

---------

Signed-off-by: taisa1 <[email protected]>
Signed-off-by: atsushi421 <[email protected]>
Co-authored-by: taisa1 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: atsushi yano <[email protected]>
Co-authored-by: atsushi421 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:perception Advanced sensor data processing and environment understanding. (auto-assigned) component:sensing Data acquisition from sensors, drivers, preprocessing. (auto-assigned) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) type:performance Software optimization and system performance.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants