9
9
#include " DataFormats/EcalDigi/interface/EcalDigiCollections.h"
10
10
#include " DataFormats/Math/interface/approx_exp.h"
11
11
#include " DataFormats/Math/interface/approx_log.h"
12
+ #include " FWCore/Utilities/interface/CMSUnrollLoop.h"
12
13
13
14
#include " AmplitudeComputationCommonKernels.h"
14
15
#include " AmplitudeComputationKernels.h"
@@ -24,7 +25,7 @@ namespace ecal {
24
25
constexpr int nsamples = SampleVector::RowsAtCompileTime;
25
26
constexpr int npulses = BXVectorType::RowsAtCompileTime;
26
27
27
- # pragma unroll
28
+ CMS_UNROLL_LOOP
28
29
for (unsigned int ipulse = 0 ; ipulse < npulses; ipulse++) {
29
30
auto const amplitude = amplitudes.coeff (ipulse);
30
31
if (amplitude == 0 )
@@ -116,12 +117,12 @@ namespace ecal {
116
117
int npassive = 0 ;
117
118
118
119
calo::multifit::ColumnVector<NPULSES, int > pulseOffsets;
119
- # pragma unroll
120
+ CMS_UNROLL_LOOP
120
121
for (int i = 0 ; i < NPULSES; ++i)
121
122
pulseOffsets (i) = i;
122
123
123
124
calo::multifit::ColumnVector<NPULSES, DataType> resultAmplitudes;
124
- # pragma unroll
125
+ CMS_UNROLL_LOOP
125
126
for (int counter = 0 ; counter < NPULSES; counter++)
126
127
resultAmplitudes (counter) = 0 ;
127
128
@@ -141,12 +142,12 @@ namespace ecal {
141
142
DataType* covMatrixStorage = shrMatrixLForFnnlsStorage;
142
143
calo::multifit::MapSymM<DataType, NSAMPLES> covMatrix{covMatrixStorage};
143
144
int counter = 0 ;
144
- # pragma unroll
145
- for (int col = 0 ; col < NSAMPLES; col++)
146
- # pragma unroll
145
+ CMS_UNROLL_LOOP
146
+ for (int col = 0 ; col < NSAMPLES; col++) {
147
+ CMS_UNROLL_LOOP
147
148
for (int row = col; row < NSAMPLES; row++)
148
149
covMatrixStorage[counter++] = __ldg (&noisecov[idx].coeffRef (row, col));
149
-
150
+ }
150
151
update_covariance (pulse_covariance[hashedId], covMatrix, resultAmplitudes);
151
152
152
153
// compute actual covariance decomposition
@@ -169,36 +170,36 @@ namespace ecal {
169
170
calo::multifit::MapSymM<DataType, NPULSES> AtA{shrAtAStorage};
170
171
// SampleMatrix AtA;
171
172
SampleVector Atb;
172
- # pragma unroll
173
+ CMS_UNROLL_LOOP
173
174
for (int icol = 0 ; icol < NPULSES; icol++) {
174
175
float reg_ai[NSAMPLES];
175
176
176
- // load column icol
177
- # pragma unroll
177
+ // load column icol
178
+ CMS_UNROLL_LOOP
178
179
for (int counter = 0 ; counter < NSAMPLES; counter++)
179
180
reg_ai[counter] = A (counter, icol);
180
181
181
182
// compute diagoanl
182
183
float sum = 0 .f ;
183
- # pragma unroll
184
+ CMS_UNROLL_LOOP
184
185
for (int counter = 0 ; counter < NSAMPLES; counter++)
185
186
sum += reg_ai[counter] * reg_ai[counter];
186
187
187
188
// store
188
189
AtA (icol, icol) = sum;
189
190
190
- // go thru the other columns
191
- # pragma unroll
191
+ // go thru the other columns
192
+ CMS_UNROLL_LOOP
192
193
for (int j = icol + 1 ; j < NPULSES; j++) {
193
194
// load column j
194
195
float reg_aj[NSAMPLES];
195
- # pragma unroll
196
+ CMS_UNROLL_LOOP
196
197
for (int counter = 0 ; counter < NSAMPLES; counter++)
197
198
reg_aj[counter] = A (counter, j);
198
199
199
200
// accum
200
201
float sum = 0 .f ;
201
- # pragma unroll
202
+ CMS_UNROLL_LOOP
202
203
for (int counter = 0 ; counter < NSAMPLES; counter++)
203
204
sum += reg_aj[counter] * reg_ai[counter];
204
205
@@ -209,7 +210,7 @@ namespace ecal {
209
210
210
211
// Atb accum
211
212
float sum_atb = 0 .f ;
212
- # pragma unroll
213
+ CMS_UNROLL_LOOP
213
214
for (int counter = 0 ; counter < NSAMPLES; counter++)
214
215
sum_atb += reg_ai[counter] * reg_b[counter];
215
216
@@ -251,7 +252,7 @@ namespace ecal {
251
252
chi2s[inputCh] = chi2;
252
253
energies[inputCh] = resultAmplitudes (5 );
253
254
254
- # pragma unroll
255
+ CMS_UNROLL_LOOP
255
256
for (int counter = 0 ; counter < NPULSES; counter++)
256
257
amplitudes[inputCh](counter) = resultAmplitudes (counter);
257
258
}
0 commit comments