C/C++ and Fortran

Use the SIMD_PEEL directive in XL Fortran for Linux, V15.1.4 to improve performance

By Archive User posted Mon July 04, 2016 04:40 AM

  

Originally posted by: FangLu


Starting from XL Fortran for Linux, V15.1.4, the SIMD_PEEL directive is added to instruct the compiler to peel a SIMDizable loop, which can improve the compilation performance.

 

Usage

There are two forms of specifying this directive:

  • SIMD_PEEL (arry_name)

When you specify array_name for SIMD_PEEL, the compiler peels a loop with respect to the first reference to the array inside the loop. The array references that have the same indexes as the first array reference are aligned. Other array references might be misaligned if they have different indexes than the first array reference.

 

  • SIMD_PEEL(n)

When you specify n for SIMD_PEEL, the compiler peels a loop once for n iterations, where n is a  positive scalar integer constant expression. When n is greater than the iteration number of the loop, the compiler peels all the loop iterations only. Specifying n for SIMD_PEEL is useful especially when the lower bounds of the induction variables of loops are constant.

 

Examples

The following example directs the compiler to peel the innermost loop with respect to the first reference to array a inside that loop.

DO z = zmin, zmax

    DO y = ymin, ymax

        !IBM* SIMD_PEEL(a)

        DO x = xmin, xmax

            a(x,y,z) = b(x,y,z)*3

 

There are multiple references to array a with varying indexes in the following example. The compiler peels the innermost loop with respect to a(x,y,z), which is the first array reference inside that loop. The references to a(x,y,z) are aligned; while the references to a(x+1,y,z) might be misaligned.

 

DO z = zmin, zmax

    DO y = ymin, ymax

        !IBM* SIMD_PEEL(a)

        DO x = xmin, xmax

            b(x,y,z) = a(x,y,z) + a(x+1,y,z)

            c(x,y,z) = a(x+1,y,z) - a(x,y,z)

 

In the following example, the compiler peels the innermost loop once for four iterations.

DO z = 1, zmax

    DO y = 1, ymax

        !IBM* SIMD_PEEL(4)

        DO x = 1, xmax

            a(x,y,z) = b(x,y,z)*3

0 comments
0 views

Permalink