Add a namespace to the NNPuppiTau model
PR description:
We have had a recurring issue with hls4ml emulator models that are defined as externals that they sometimes clobber each other's symbols (arrays for weights typically) [1, 2]. This has been fixed by enforcing that new models define a namespace, with the other variables defined within. However we have one model that is defined in CMSSW source, whose development predates the externals setup, whose weights are not in a namespace, so those symbols are in the global namespace. This PR wraps that model in a namespace.
PR validation:
First of all checking symbols. In the release:
$ readelf -Ws /cvmfs/cms.cern.ch/el9_amd64_gcc12/cms/cmssw/CMSSW_15_1_0_pre6/lib/el9_amd
64_gcc12/pluginL1TriggerPhase2L1ParticleFlowAuto.so | grep w17
728: 00000000001794f0 20 OBJECT GLOBAL DEFAULT 25 w17
4466: 00000000001794f0 20 OBJECT GLOBAL DEFAULT 25 w17
In this PR:
$ readelf -Ws ../lib/el9_amd64_gcc12/pluginL1TriggerPhase2L1ParticleFlowAut
o.so | grep w17
1363: 00000000001794f0 20 OBJECT GLOBAL DEFAULT 25 _ZN20hls4ml_nnpuppitau_v03w17E
4300: 00000000001794f0 20 OBJECT GLOBAL DEFAULT 25 _ZN20hls4ml_nnpuppitau_v03w17E
I also checked the behaviour by defining a proxy external library that just defines and prints out some of these problematic symbols, and compiling it and loading it in CMSSW analagously to an hls4ml external. Working with the release, I see that the values are "successfuly" clobbered by the NNPuppiTau weights, while with the fix of this branch they retain their locally defined values. I ran a configuration file defined in FastPUPPI that ntuplizes the NNPuppiTau here just to run the producer in the job. There was no change in the ntuple produced since the model here is the one clobbering the others' weights.
cms-bot internal usage
-code-checks
Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49632/47174
Code check has found code style and quality issues which could be resolved by applying following patch(s)
- code-format:
https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49632/47174/code-format.patch
e.g.
curl -k https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49632/47174/code-format.patch | patch -p1You can also runscram build code-formatto apply code format directly
Thanks for this! Could you run code-format and update the PR?
Milestone for this pull request has been moved to CMSSW_16_1_X. Please open a backport if it should also go in to CMSSW_16_0_X.