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

[LLVM Analyzer][DQM] Fix dead assignments #46247

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

iarspider
Copy link
Contributor

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 4, 2024

cms-bot internal usage

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 4, 2024

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 4, 2024

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

It involves the following packages:

  • DQM/BeamMonitor (dqm, db)
  • DQM/DTMonitorClient (dqm)
  • DQM/DTMonitorModule (dqm)
  • DQM/L1TMonitorClient (dqm)
  • DQM/Physics (dqm)
  • DQM/SiPixelMonitorClient (dqm)
  • DQM/SiPixelMonitorCluster (dqm)
  • DQM/SiPixelMonitorDigi (dqm)
  • DQM/SiPixelMonitorRawData (dqm)
  • DQM/SiPixelMonitorTrack (dqm)
  • DQM/SiStripCommissioningAnalysis (dqm)
  • DQM/SiStripCommissioningClients (dqm)
  • DQM/SiStripMonitorSummary (dqm)
  • DQMOffline/Hcal (dqm)
  • DQMOffline/JetMET (dqm)
  • DQMOffline/Muon (dqm)
  • DQMOffline/Trigger (dqm)
  • DQMServices/Components (dqm)
  • DQMServices/Core (dqm)

@antoniovagnerini, @atpathak, @cmsbuild, @consuegs, @francescobrivio, @nothingface0, @perrotta, @rvenditti, @syuvivida, @tjavaid can you please review it and eventually sign? Thanks.
@Fedespring, @HuguesBrun, @JanChyczynski, @PonIlya, @abbiendi, @abdoulline, @ahinzmann, @arossi83, @barvic, @battibass, @bellan, @bsunanda, @calderona, @cericeci, @denizsun, @erikbutz, @fioriNTU, @francescobrivio, @gkasieczka, @idebruyn, @jandrea, @jdamgov, @jdolen, @jhgoh, @mariadalfonso, @missirol, @mmarionncern, @mmusich, @mtosi, @nhanvtran, @ptcox, @rappoccio, @rociovilar, @rsreds, @salimcerci, @schoef, @seemasharmafnal, @sroychow, @threus, @trocino, @venturia, @yuanchao 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

@@ -340,7 +340,6 @@ void QcdPhotonsDQM::analyze(const Event& iEvent, const EventSetup& iSetup) {
float photon_eta = -9.0;
float photon_phi = -9.0;
bool photon_passPhotonID = false;
bool found_lead_pho = false;
Copy link
Contributor Author

@iarspider iarspider Oct 4, 2024

Choose a reason for hiding this comment

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

There are exactly three uses of this variable: declaration here, check on line 392 and setting to true on line 393

@@ -1138,6 +1138,7 @@ void SiPixelDigiSource::buildStructure(const edm::EventSetup& iSetup) {
uint32_t id = detId();
SiPixelDigiModule* theModule = new SiPixelDigiModule(id, ncols, nrows);

/*
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

Agreed.

MonitorElement* NumberOfMatches;
MonitorElement* NumberOfEvents;

//dummy = iBooker.bookFloat("dummy");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I can tell, bookFloat doesn't have any side-effects, so the result of all these calls is unused.

Choose a reason for hiding this comment

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

yes please remove

Copy link
Contributor

Choose a reason for hiding this comment

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

@iarspider , looks like bookFloat calls bookME which has some side-effects on the store. So may be we need these bookFloat calls ... @cms-sw/dqm-l2 should know better though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@iarspider , looks like bookFloat calls bookME which has some side-effects on the store. So may be we need these bookFloat calls ... @cms-sw/dqm-l2 should know better though

Not in this case, I think. The onbooking function defaults to NOOP ("functor to be passed as a default argument that does not do anything."), and the makeobject function that is passed to bookME explicitly returns nullptr. But I agree that DQM L2s should know better.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hello. From my limited understanding, all the bookX methods create instances of MonitorElements inside the DQMStore, and do indeed update the store's state (by updating globalMEs_, localMEs_).

I can see, also, that those MonitorElement pointers are being overwritten later in the code (e.g. here, for RECO_deltaPhi_DiJet), but this is not a guarantee (I think) that those specific MEs which have been booked won't be used later.

If those specific MEs (e.g., RECO_deltaEta_DiJet, RECO_deltaPhi_DiJet) are indeed unused later in this module, booking them doesn't make any sense in the first place, right? In this case, I think it would be safe to remove the bookFloat calls, else, I would expect something to probably break later in the module.

Take this with a grain of salt, as I've by no means looked at the DQM code extensively, yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would help if we had an example python config that uses this module, so that we can test its output and verify that those MonitorElements are, indeed, booked and left empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is one, but it's outdated

@@ -62,25 +62,25 @@ class DQMStoreStatsSubfolder {
++totalHistos_;
totalBins_ += nBins;
totalEmptyBins_ += nEmptyBins;
totalMemory_ += (nBins *= sizeof(float));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nBins is passed by value, makes no sense to modify it

Choose a reason for hiding this comment

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

indeed

@iarspider
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 4, 2024

-1

Failed Tests: Build ClangBuild
Size: This PR adds an extra 188KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-803098/41955/summary.html
COMMIT: 0f39692
CMSSW: CMSSW_14_2_X_2024-10-03-2300/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/46247/41955/install.sh to create a dev area with all the needed externals and cmssw changes.

Build

I found compilation warning when building: See details on the summary page.

Clang Build

I found compilation warning while trying to compile with clang. Command used:

USER_CUDA_FLAGS='--expt-relaxed-constexpr' USER_CXXFLAGS='-Wno-register -fsyntax-only' scram build -k -j 32 COMPILER='llvm compile'

See details on the summary page.

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-46247/42319

@cmsbuild
Copy link
Contributor

Pull request #46247 was updated. @antoniovagnerini, @atpathak, @consuegs, @francescobrivio, @nothingface0, @perrotta, @rvenditti, @syuvivida, @tjavaid can you please check and sign again.

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-46247/42321

@cmsbuild
Copy link
Contributor

Pull request #46247 was updated. @antoniovagnerini, @atpathak, @cmsbuild, @consuegs, @francescobrivio, @nothingface0, @perrotta, @rvenditti, @syuvivida, @tjavaid can you please check and sign again.

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-46247/42324

@cmsbuild
Copy link
Contributor

Pull request #46247 was updated. @antoniovagnerini, @atpathak, @cmsbuild, @consuegs, @francescobrivio, @nothingface0, @perrotta, @rvenditti, @syuvivida, @tjavaid can you please check and sign again.

@cmsbuild
Copy link
Contributor

Milestone for this pull request has been moved to CMSSW_15_0_X. Please open a backport if it should also go in to CMSSW_14_2_X.

@cmsbuild cmsbuild modified the milestones: CMSSW_14_2_X, CMSSW_15_0_X Nov 22, 2024
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.

7 participants