Skip to content

Commit

Permalink
Merge pull request cms-sw#41730 from dan131riley/vectorization-warnings
Browse files Browse the repository at this point in the history
remove MkFit clang16 vectorization warnings
  • Loading branch information
cmsbuild authored May 24, 2023
2 parents 6d74dd1 + d867318 commit 2c2b494
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
20 changes: 14 additions & 6 deletions RecoTracker/MkFitCore/src/MkFinder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,14 @@ namespace mkfit {
};

if (L.is_barrel()) {
// Pull out the part of the loop that vectorizes
// Pull out the part of the loop that vectorizes with icc and gcc
// In llvm16 clang issues a warning that it can't vectorize
// the loop. Unfortunately, there doesn't seem to be a
// pragma to suppress the warning, so we ifdef it out. This
// should be rechecked if llvm vectorization improves.
#if !defined(__clang__)
#pragma omp simd
#endif
for (int itrack = 0; itrack < NN; ++itrack) {
m_XHitSize[itrack] = 0;

Expand Down Expand Up @@ -339,8 +345,10 @@ namespace mkfit {
//layer half-thikness for dphi spread calculation; only for very restrictive iters
const float layerD = std::abs(L.layer_info()->zmax() - L.layer_info()->zmin()) * 0.5f *
(m_iteration_params->maxConsecHoles == 0 || m_iteration_params->maxHolesPerCand == 0);
// Pull out the part of the loop that vectorizes
// Pull out the part of the loop that vectorizes with icc and gcc
#if !defined(__clang__)
#pragma omp simd
#endif
for (int itrack = 0; itrack < NN; ++itrack) {
m_XHitSize[itrack] = 0;

Expand Down Expand Up @@ -716,7 +724,7 @@ namespace mkfit {

mhp.reset();

#pragma omp simd
//#pragma omp simd doesn't vectorize with current compilers
for (int itrack = 0; itrack < N_proc; ++itrack) {
if (hit_cnt < m_XHitSize[itrack]) {
mhp.addInputAt(itrack, layer_of_hits.refHit(m_XHitArr.At(itrack, hit_cnt, 0)));
Expand Down Expand Up @@ -932,7 +940,7 @@ namespace mkfit {

int charge_pcm[NN];

#pragma omp simd
//#pragma omp simd doesn't vectorize with current compilers
for (int itrack = 0; itrack < N_proc; ++itrack) {
if (hit_cnt < m_XHitSize[itrack]) {
const auto &hit = layer_of_hits.refHit(m_XHitArr.At(itrack, hit_cnt, 0));
Expand Down Expand Up @@ -1179,7 +1187,7 @@ namespace mkfit {

int charge_pcm[NN];

#pragma omp simd
//#pragma omp simd doesn't vectorize with current compilers
for (int itrack = 0; itrack < N_proc; ++itrack) {
if (hit_cnt < m_XHitSize[itrack]) {
const auto &hit = layer_of_hits.refHit(m_XHitArr.At(itrack, hit_cnt, 0));
Expand All @@ -1206,7 +1214,7 @@ namespace mkfit {
m_prop_config->finding_intra_layer_pflags,
m_prop_config->finding_requires_propagation_to_hit_pos);

#pragma omp simd // DOES NOT VECTORIZE AS IT IS NOW
//#pragma omp simd // DOES NOT VECTORIZE AS IT IS NOW
for (int itrack = 0; itrack < N_proc; ++itrack) {
// We can be in failed state from the initial propagation before selectHitIndices
// and there hit_count for track is set to -1 and WSR state to Failed, handled below.
Expand Down
5 changes: 5 additions & 0 deletions RecoTracker/MkFitCore/src/PropagationMPlex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,12 @@ namespace mkfit {
MPlexLL errorPropTmp(0.f); //initialize to zero
MPlexLL errorPropSwap(0.f); //initialize to zero

// loop does not vectorize with llvm16, and it issues a warning
// that apparently can't be suppressed with a pragma. Needs to
// be rechecked if future llvm versions improve vectorization.
#if !defined(__clang__)
#pragma omp simd
#endif
for (int n = 0; n < NN; ++n) {
//initialize erroProp to identity matrix
errorProp(n, 0, 0) = 1.f;
Expand Down

0 comments on commit 2c2b494

Please sign in to comment.