This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

*PING* Re: [Patch, Fortran] Use ANNOTATE_EXPR annot_expr_ivdep_kind for DO CONCURRENT

Two weeks ago I submitted the patch, available at: ; while the ME patch is not yet approved, the C FE was approved (latest C/ME patch:

Additionally, I'd like to early ping for:


PS: Actually, safelen (i.e. "GCC ivdep", "omp simd", Cilk's "simd") does not require that the result is independent of the loop-waking order. Just (quoting from my C patch for GCC ivdep): "With this pragma, the programmer asserts that there are no loop-carried dependencies which would prevent that consecutive iterations of the following loop can be executed concurrently with SIMD (single instruction multiple data) instructions." Fortran's do concurrent requires more: "The DO CONCURRENT construct provides a means for the program to specify that individual loop iterations have no interdependencies." (F2008, Introduction). Still, in terms of optimizing "do concurrent", setting safelen gives the ME all required information.

On Oct 08, 2013, Tobias Burnus wrote:
This patch requires my pending ME and C FE patch:

Using C/C++'s #pragma ivdep or â with the attached Fortran patch â "do concurrent", the loop condition is annotated such that later the loop's vectorization safelen is set to infinity (well, INT_MAX). The main purpose is to tell the compiler that the result is independent of the order in which the loop is walked. The typical case is pointer aliasing, in which the compiler either doesn't vectorize or adds a run-time aliasing check (loop versioning). With the annotation, the compiler simply assumes that there is no aliasing and avoids the versioning. â Contrary to C++ which does not even have the "restrict" qualifier (gcc and others do support __restrict) and cases where C/C++'s __restrict qualifier isn't sufficient/applicable, the effect on typical Fortran code should be smaller as most variables cannot alias. Still, in some cases it can help. (See test case for an example.)

There is an alternative to ivdep, which is more lower level [1]: OpenMPv4's "omp simd" (with safelen=) for C/C++/Fortran and â for C/C++ â Cilk Plus's #pragma simd.

Build and regtested on x86-64-gnu-linux.
OK for the trunk?


PS: I think the same annotation could be also used with FORALL and implied loops with whole-array/array-section assignments, when the FE knows that there is no aliasing between the LHS and RHS side. (In some cases, the FE knows this while the ME doesn't.)

PPS: My personal motivation is my long-standing wish to pass this information to the middle end for DO CONCURRENT but also to use the pragma for a specific C++ code.

[1] The OpenMPv4 support for C/C++ will be merged soon, for Fortran it will take a while (maybe still in 4.9, maybe only later). See / The relevant Cilk Plus patch has been posted at

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]