-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
fix c++20 compilation errors in L1Trigger/TrackFindingTracklet #43673
base: master
Are you sure you want to change the base?
fix c++20 compilation errors in L1Trigger/TrackFindingTracklet #43673
Conversation
cms-bot internal usage |
-code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-43673/38340
Code check has found code style and quality issues which could be resolved by applying following patch(s)
|
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-43673/38341
|
A new Pull Request was created by @dan131riley (Dan Riley) for master. It involves the following packages:
@epalencia, @cmsbuild, @aloeliger can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
@@ -901,6 +901,7 @@ void TrackletLUT::initProjectionDiskRadius(int nrbits) { | |||
void TrackletLUT::initBendMatch(unsigned int layerdisk) { | |||
unsigned int nrinv = NRINVBITS; | |||
double rinvhalf = 0.5 * ((1 << nrinv) - 1); | |||
assert(layerdisk < 16); // should be a named constant for this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not urgent from my side, but if we know this is a bit "magic number"-ish, should we just go ahead and make this a constant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am far from being an expert of this code, but that 16
to me looks like the total number of layer/disks in the phase2 layout. I.e. 2 * N_DISK + N_LAYER
:
cmssw/L1Trigger/TrackFindingTracklet/interface/Settings.h
Lines 25 to 26 in c1580c8
constexpr int N_LAYER = 6; // # of barrel layers assumed | |
constexpr int N_DISK = 5; // # of endcap disks assumed |
This PR will be updated to resolve the conflicts with @Dr15Jones #43601. Title and description will be updated. |
Milestone for this pull request has been moved to CMSSW_14_1_X. Please open a backport if it should also go in to CMSSW_14_0_X. |
@dan131riley Any progress on this? |
Milestone for this pull request has been moved to CMSSW_14_2_X. Please open a backport if it should also go in to CMSSW_14_1_X. |
ping (to make bot change milestone) |
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. |
PR description:
In c++20, std::accumulate was changed so that the type of the initial value must be an rvalue and the preferred signature for the binary operation is
Ret fun(const Type1 &a, const Type2 &b);
. In a couple of places in L1Trigger/TrackFindingTracklet, the binary op was modifying the running value argument, which isn't necessary, doesn't conform to the preferred function signature, and breaks in c++20 because it isn't an rvalue. This PR fixes those compilation problems in the CPP20 builds and removes a few C-style casts.In addition, in LTO builds we get a warning
This appears to be a false positive, where the LTO optimizer is concluding that it's possible a -1 could be passed to an unsigned and thus interpreted as a very large value. This PR adds an assertion that this won't happen, which quiets the LTO warning.
PR validation:
Purely technical fix. Compiles, should have no effect on performance. A limited matrix was run to verify that the new assertion doesn't fire in normal workflows.