Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

Suggestion for Fortran SIMD optimization

Black Belt

On one of the other threads on this forum a user is experiencing an optimization issue relating to vectorization. The jist of the situation is the algorithm uses a temporary array that enables the compiler to determine that SIMD instructions can be used. No issue here, however, the values of the temporary array are not used outside the scope of a small section of code. The user could create an external function or subroutine that is attributed as a vector function/subroutine, and if the routine is inlined, it would likely attain the desired effect. IOW not actually use an array, but rather use a SIMD register as if it were a window into the array, then discard no longer required. That is to say the "array" is declared but never written to RAM (even though the source statements appear to write to the array).

*** HYPOTHETICAL extension ***

real :: tempArray(nX,nY)

Or SIMD_TEMP, other meaningful attribute name

The effect of the attribute, with respect to optimization, is the values of the array that appear to be written, and can be vectorized, have a live time that exists for the current SIMD iteration of the loop. As such, the declared array is never updated. The SIMD values (section of the array) can reside in a SIMD register, or if necessary, written to a temp location on the stack and fetched later.

Jim Dempsey

0 Kudos
0 Replies