Unverified Commit b0c2c4d8 authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

Minor optimization to PME (#5151)

* Minor optimization to PME

* Minor simplification
parent a112fbfc
...@@ -102,17 +102,19 @@ KERNEL void gridSpreadCharge(GLOBAL const real4* RESTRICT posq, ...@@ -102,17 +102,19 @@ KERNEL void gridSpreadCharge(GLOBAL const real4* RESTRICT posq,
ybase = ybase*GRID_SIZE_Z; ybase = ybase*GRID_SIZE_Z;
int index = xbase + ybase + zindex; int index = xbase + ybase + zindex;
real add = dzdx*data[iy].y; real add = dzdx*data[iy].y;
if (fabs(add) > 2.3e-10f) { // Smallest value representable in 64 bit fixed point
#ifdef USE_FIXED_POINT_CHARGE_SPREADING #ifdef USE_FIXED_POINT_CHARGE_SPREADING
ATOMIC_ADD(&pmeGrid[index], (mm_ulong) realToFixedPoint(add)); ATOMIC_ADD(&pmeGrid[index], (mm_ulong) realToFixedPoint(add));
#if defined(__GFX12__) #if defined(__GFX12__)
// Workaround for rare cases when few values of pmeGrid are very large and // Workaround for rare cases when few values of pmeGrid are very large and
// incorrect. The cause is unknown. Why this workaround or other irrelevant // incorrect. The cause is unknown. Why this workaround or other irrelevant
// changes like printf help is also unknown. // changes like printf help is also unknown.
asm volatile("s_wait_storecnt 0x0"); asm volatile("s_wait_storecnt 0x0");
#endif #endif
#else #else
ATOMIC_ADD(&pmeGrid[index], add); ATOMIC_ADD(&pmeGrid[index], add);
#endif #endif
}
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment