Skip to content

Improve BDT in L1Trigger/L1TMuonEndCap #47599

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

Merged
merged 1 commit into from
Mar 22, 2025

Conversation

Dr15Jones
Copy link
Contributor

@Dr15Jones Dr15Jones commented Mar 14, 2025

PR description:

  • fixed memory corruption problems which could lead to double deletes or deletion of random memory locations
  • memory handling now done via std::unique_ptr
  • improved const correctness

This deletion of memory coming from an uninitialized pointer was found by gcc 14.

PR validation:

Code compiles and local tests pass.

resolves cms-sw/framework-team#1307

@cmsbuild
Copy link
Contributor

cmsbuild commented Mar 14, 2025

cms-bot internal usage

@Dr15Jones
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-47599/44099

Code check has found code style and quality issues which could be resolved by applying following patch(s)


Node::~Node() {
// Recursively delete all nodes in the tree.
if (leftDaughter)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NOTE: using the defaultly made Node(Node&&) with this implementation of a destructor leads to double delete of leftDaughter and rightDaughter as the default Node(Node&&) will not reset the pointers to nullptr.

@@ -135,24 +121,14 @@ void Tree::findLeafs(Node* local_root, std::list<Node*>& tn) {
findLeafs(local_root->getRightDaughter(), tn);
}

Tree::Tree(Tree&& tree) {
if (rootNode)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the problem spotted by gcc 14. rootNode is uninitialized at this point so the following line deletes some random address.

@Dr15Jones
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-47599/44100

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @Dr15Jones for master.

It involves the following packages:

  • L1Trigger/L1TMuonEndCap (l1)

@aloeliger, @epalencia can you please review it and eventually sign? Thanks.
@Martin-Grunewald, @dinyar, @eyigitba, @missirol, @mmusich, @thomreis this is something you requested to watch as well.
@antoniovilela, @mandrenguyen, @rappoccio, @sextonkennedy you are the release manager for this.

cms-bot commands are listed here

@makortel
Copy link
Contributor

(just to remind, the code improved in this PR is uses substantial amount of memory as reported in #42526)

@cmsbuild
Copy link
Contributor

+1

Size: This PR adds an extra 36KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-c88bb7/44981/summary.html
COMMIT: 96be2a4
CMSSW: CMSSW_15_1_X_2025-03-14-1100/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/47599/44981/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • You potentially added 1 lines to the logs
  • Reco comparison results: 8 differences found in the comparisons
  • DQMHistoTests: Total files compared: 50
  • DQMHistoTests: Total histograms compared: 3927607
  • DQMHistoTests: Total failures: 24
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3927563
  • DQMHistoTests: Total skipped: 20
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 49 files compared)
  • Checked 215 log files, 184 edm output root files, 50 DQM output files
  • TriggerResults: no differences found

@BenjaminRS
Copy link
Contributor

Hello @Dr15Jones -- @quinnanm and I are starting to take over from @aloeliger as L1T OffSW coordinators. Are you planning on rebasing this PR to resolve the conflicts? I talked to @eyigitba who said the EMTF team would test custom BDT loading with your modifications.
Thanks,
Benjamin

@Dr15Jones
Copy link
Contributor Author

I can rebase

- fixed memory corruption problems which could lead to double
 deletes or deletion of random memory locations
- memory handling now done via std::unique_ptr
- improved const correctness
@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

Pull request #47599 was updated. @BenjaminRS, @cmsbuild, @quinnanm can you please check and sign again.

@Dr15Jones
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

+1

Size: This PR adds an extra 20KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-c88bb7/45075/summary.html
COMMIT: 759c430
CMSSW: CMSSW_15_1_X_2025-03-19-1100/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/47599/45075/install.sh to create a dev area with all the needed externals and cmssw changes.

The following merge commits were also included on top of IB + this PR after doing git cms-merge-topic:

You can see more details here:
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-c88bb7/45075/git-recent-commits.json
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-c88bb7/45075/git-merge-result

Comparison Summary

Summary:

  • You potentially removed 1 lines from the logs
  • Reco comparison results: 2 differences found in the comparisons
  • DQMHistoTests: Total files compared: 50
  • DQMHistoTests: Total histograms compared: 3928069
  • DQMHistoTests: Total failures: 64
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3927985
  • DQMHistoTests: Total skipped: 20
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 49 files compared)
  • Checked 215 log files, 184 edm output root files, 50 DQM output files
  • TriggerResults: no differences found

@BenjaminRS
Copy link
Contributor

+l1
EMTF team have done a test with custom BDT loading before and after this fix: everything looks ok.

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @sextonkennedy, @rappoccio, @mandrenguyen, @antoniovilela (and backports should be raised in the release meeting by the corresponding L2)

@mandrenguyen
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit 7bfefad into cms-sw:master Mar 22, 2025
11 checks passed
@Dr15Jones Dr15Jones deleted the fixL1TMuonEndCapBDT branch April 4, 2025 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fixed memory problem in L1Trigger/L1TMuonEndCap BDT
5 participants