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

Improve BDT in L1Trigger/L1TMuonEndCap #47599

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

- 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
@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

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
3 participants