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

[RFC] Test clang-tidy --checks misc-definitions-in-headers #33366

Closed

Conversation

makortel
Copy link
Contributor

@makortel makortel commented Apr 7, 2021

PR description:

This PR tests the impact of misc-definitions-in-headers clang-tidy check (that is proposed in #33365). For more information on the check see https://releases.llvm.org/11.1.0/tools/clang/tools/extra/docs/clang-tidy/checks/misc-definitions-in-headers.html.

PR validation:

None.

@cmsbuild
Copy link
Contributor

cmsbuild commented Apr 7, 2021

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-33366/21955

@cmsbuild
Copy link
Contributor

cmsbuild commented Apr 7, 2021

A new Pull Request was created by @makortel (Matti Kortelainen) for master.

It involves the following packages:

CalibCalorimetry/CastorCalib
CalibCalorimetry/HcalAlgos
Calibration/HcalCalibAlgos
CommonTools/RecoAlgos
CondCore/AlignmentPlugins
CondCore/BeamSpotPlugins
CondCore/EcalPlugins
CondCore/HcalPlugins
CondCore/RunInfoPlugins
CondCore/SiPixelPlugins
CondCore/SiStripPlugins
CondFormats/JetMETObjects
CondTools/Hcal
DPGAnalysis/SiStripTools
DQMOffline/CalibCalo
DQMOffline/Trigger
DataFormats/Common
EventFilter/HcalRawToDigi
FastSimulation/TrackingRecHitProducer
GeneratorInterface/Core
GeneratorInterface/CosmicMuonGenerator
GeneratorInterface/HijingInterface
GeneratorInterface/HydjetInterface
GeneratorInterface/PyquenInterface
Geometry/TrackerGeometryBuilder
HLTrigger/JetMET
HLTrigger/Muon
HLTriggerOffline/B2G
JetMETCorrections/MCJet
L1Trigger/L1TCommon
L1Trigger/L1THGCal
L1Trigger/L1TNtuples
L1Trigger/Phase2L1ParticleFlow
PhysicsTools/PatUtils
RecoBTag/FeatureTools
RecoBTag/ImpactParameter
RecoBTag/SecondaryVertex
RecoEgamma/EgammaTools
RecoMuon/MuonIdentification
RecoParticleFlow/PFClusterProducer
RecoPixelVertexing/PixelTriplets
RecoPixelVertexing/PixelVertexFinding
RecoTracker/ConversionSeedGenerators
RecoTracker/DebugTools
RecoVertex/AdaptiveVertexFinder
RecoVertex/BeamSpotProducer
SimCalorimetry/HGCalAssociatorProducers
SimFastTiming/FastTimingCommon
SimTracker/TrackAssociation
SimTracker/TrackerMaterialAnalysis
TopQuarkAnalysis/TopEventProducers
TopQuarkAnalysis/TopKinFitter
TrackingTools/TrackFitters

@SiewYan, @andrius-k, @ggovi, @lveldere, @sbein, @ianna, @kpedro88, @Martin-Grunewald, @rekovic, @tlampen, @alberto-sanchez, @pohsun, @santocch, @cecilecaillol, @perrotta, @civanch, @yuanchao, @makortel, @ErnestaP, @ahmad3213, @cmsbuild, @agrohsje, @fwyzard, @GurpreetSinghChahal, @smuzaffar, @Dr15Jones, @cvuosalo, @mdhildreth, @jfernan2, @slava77, @jpata, @francescobrivio, @malbouis, @ssekmen, @mkirsano, @kmaeshima, @christopheralanwest, @srimanob, @rvenditti can you please review it and eventually sign? Thanks.
@echabert, @emilbols, @gouskos, @mariadalfonso, @jainshilpi, @hatakeyamak, @robervalwalsh, @rappoccio, @apsallid, @argiro, @Martin-Grunewald, @wddgit, @OzAmram, @jbsauvan, @thomreis, @alberto-sanchez, @lgray, @abbiendi, @varuns23, @seemasharmafnal, @venturia, @mmarionncern, @kreczko, @HuguesBrun, @calderona, @ahinzmann, @mtosi, @cbaus, @JanFSchulte, @jhgoh, @dgulhan, @jandrea, @missirol, @sscruz, @cericeci, @hqucms, @felicepantaleo, @ferencek, @dkotlins, @pieterdavid, @rociovilar, @Sam-Harper, @cbernet, @GiacomoSguazzoni, @tocheng, @VinInn, @jdamgov, @dinyar, @nhanvtran, @gkasieczka, @rovere, @threus, @schoef, @ebrondol, @abdoulline, @fabiocos, @clelange, @simonepigazzini, @tvami, @mkirsano, @bellan, @rchatter, @trocino, @vargasa, @Fedespring, @jdolen, @JyothsnaKomaragiri, @sobhatta, @lecriste, @afiqaize, @gpetruc, @matt-komm, @andrzejnovak, @amarini, @mmusich, @ram1123 this is something you requested to watch as well.
@silviodonato, @dpiparo, @qliphy you are the release manager for this.

cms-bot commands are listed here

@makortel
Copy link
Contributor Author

makortel commented Apr 8, 2021

@cmsbuild, please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Apr 8, 2021

-1

Failed Tests: Build
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-63c5a6/14083/summary.html
COMMIT: 870e3c1
CMSSW: CMSSW_11_3_X_2021-04-07-1100/slc7_amd64_gcc900
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/33366/14083/install.sh to create a dev area with all the needed externals and cmssw changes.

Build

I found compilation error when building:

>> Cuda Device Link tmp/slc7_amd64_gcc900/src/RecoPixelVertexing/PixelVertexFinding/plugins/RecoPixelVertexingPixelVertexFindingPlugins/RecoPixelVertexingPixelVertexFindingPlugins_cudadlink.o 
>> Building  edm plugin tmp/slc7_amd64_gcc900/src/RecoPixelVertexing/PixelVertexFinding/plugins/RecoPixelVertexingPixelVertexFindingPlugins/libRecoPixelVertexingPixelVertexFindingPlugins.so
/cvmfs/cms-ib.cern.ch/nweek-02675/slc7_amd64_gcc900/external/gcc/9.3.0/bin/../lib/gcc/x86_64-unknown-linux-gnu/9.3.0/../../../../x86_64-unknown-linux-gnu/bin/ld: tmp/slc7_amd64_gcc900/src/RecoPixelVertexing/PixelVertexFinding/plugins/RecoPixelVertexingPixelVertexFindingPlugins/PixelVertexProducerCUDA.cc.o: in function `PixelVertexProducerCUDA::produceOnCPU(edm::StreamID, edm::Event&, edm::EventSetup const&) const':
PixelVertexProducerCUDA.cc:(.text+0x40): undefined reference to `gpuVertexFinder::Producer::make(TrackSoAHeterogeneousT<32768> const*, float) const'
collect2: error: ld returned 1 exit status
gmake: *** [tmp/slc7_amd64_gcc900/src/RecoPixelVertexing/PixelVertexFinding/plugins/RecoPixelVertexingPixelVertexFindingPlugins/libRecoPixelVertexingPixelVertexFindingPlugins.so] Error 1
Leaving library rule at src/RecoPixelVertexing/PixelVertexFinding/plugins
Entering library rule at RecoPixelVertexing/PixelVertexFinding
>> Compiling  /data/cmsbld/jenkins/workspace/ib-run-pr-tests/CMSSW_11_3_X_2021-04-07-1100/src/RecoPixelVertexing/PixelVertexFinding/src/DivisiveVertexFinder.cc
>> Compiling  /data/cmsbld/jenkins/workspace/ib-run-pr-tests/CMSSW_11_3_X_2021-04-07-1100/src/RecoPixelVertexing/PixelVertexFinding/src/PVClusterComparer.cc


@@ -102,7 +102,7 @@ namespace gpuVertexFinder {
#endif // PIXVERTEX_DEBUG_PRODUCE
ZVertexHeterogeneous vertices(cms::cuda::make_device_unique<ZVertexSoA>(stream));
#else
ZVertexHeterogeneous Producer::make(TkSoA const* tksoa, float ptMin) const {
inline ZVertexHeterogeneous Producer::make(TkSoA const* tksoa, float ptMin) const {
Copy link
Contributor Author

@makortel makortel Apr 8, 2021

Choose a reason for hiding this comment

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

This one should be without the inline because it is effectively a source file, whose compiler is dictated by the file extension by the .cc/.cu files that include this header.

Suggested change
inline ZVertexHeterogeneous Producer::make(TkSoA const* tksoa, float ptMin) const {
ZVertexHeterogeneous Producer::make(TkSoA const* tksoa, float ptMin) const { // NOLINT: prevent clang-tidy from adding inline

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should rename this and similar files from .h to something else ?
And/or, find an other way to compile it multiple times with different compiler and compiler flags ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we should rename this and similar files from .h to something else ?

That would indeed be a simple way forward.

And/or, find an other way to compile it multiple times with different compiler and compiler flags ?

With a portability technology (or at least for Kokkos or Alpaka) we'd need such a solution anyway. Then the question is whether we want to make such an exercise already with CUDA or not (I don't have a clear feeling).

Copy link
Contributor

@fwyzard fwyzard Apr 8, 2021

Choose a reason for hiding this comment

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

With a portability technology (or at least for Kokkos or Alpaka) we'd need such a solution anyway. Then the question is whether we want to make such an exercise already with CUDA or not (I don't have a clear feeling).

I'd say "yes, why now, if we have the time to do it now"... but I don't know if we do 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

do not rename file with extensions LXR or DXR do not understand, please. already .icc or similar are a problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From the core meeting: for now we could rename this kind of header to foo.cc file and then in foo.cu file do #include "foo.cc".

Copy link
Contributor

Choose a reason for hiding this comment

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

anything that CORE proposes is fine with me

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, so we do

git rm -f RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cc
git mv RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinderImpl.h RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cc 
echo '#include "gpuVertexFinder.cc"' > RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cu
git add RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cu

Copy link
Contributor

@fwyzard fwyzard Apr 27, 2021

Choose a reason for hiding this comment

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

Fixed in #33428.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in #33428.

Thanks Andrea!

@fwyzard
Copy link
Contributor

fwyzard commented Apr 8, 2021

What extensions are being considered ?
We have some .icc files that are included from .h files, for example FWCore/MessageLogger/interface/ErrorObj.icc.

@makortel
Copy link
Contributor Author

makortel commented Apr 8, 2021

What extensions are being considered ?

From the docs h,hh,hpp,hxx.

We have some .icc files that are included from .h files

Good point, thanks, I'll add those to the list and extend the exercise.

@slava77
Copy link
Contributor

slava77 commented Apr 26, 2021

@makortel
what is the plan for this PR?

@makortel
Copy link
Contributor Author

We'll discuss on this clang-tidy check in the core software meeting tomorrow.

I tried to include .icc to the list of file extensions for the checker, but I didn't seem to succeed with the time I had for it.

@slava77
Copy link
Contributor

slava77 commented Jun 1, 2021

is this PR still supposed to be open?

@makortel
Copy link
Contributor Author

makortel commented Jun 1, 2021

No, it can be closed at this point.

@makortel makortel closed this Jun 1, 2021
@makortel makortel deleted the testClangTidyMiscDefinitionsInHeaders branch June 4, 2021 17:55
mmusich added a commit to mmusich/cmssw that referenced this pull request Jun 9, 2021
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.

None yet

6 participants