[gomp4] Some progress on #pragma omp simd
Aldy Hernandez
aldyh@redhat.com
Thu Apr 25 08:53:00 GMT 2013
[Balaji, see below].
Ok, this is confusing. While the document in the link you posted (the
ICC manual?) says so, the document I'm following says otherwise.
I'm following this (which, until a few days was a link accessible from
the cilk plus web page, though I no longer see it):
http://software.intel.com/sites/default/files/m/4/e/7/3/1/40297-Intel_Cilk_plus_lang_spec_2.htm
The document above is for version 1.1 of the Cilk Plus language
extension specification, which I was told was the latest. There it
explicitly says that the clauses behave exactly like in OpenMP:
"The syntax and semantics of the various simd-openmp-data-clauses are
detailed in the OpenMP specification.
(http://www.openmp.org/mp-documents/spec30.pdf, Section 2.9.3)."
Balaji, can you verify which is correct? For that matter, which are the
official specs from which we should be basing this work?
Aldy
On 04/24/13 01:40, Jakub Jelinek wrote:
> On Wed, Apr 24, 2013 at 08:25:36AM +0200, Jakub Jelinek wrote:
>> BTW, the semantics of private/firstprivate/lastprivate desribed in
>> http://software.intel.com/sites/products/documentation/studio/composer/en-us/2011Update/compiler_c/cref_cls/common/cppref_pragma_simd.htm
>> doesn't seem to match the semantics of those in #pragma omp simd.
>> private in OpenMP I understand is private to the whole loop (or SIMD lane?;
>
> SIMD lane apparently. Guess that is going to be quite difficult, because
> at the point of omp lowering or expansion we are nowhere close to knowing
> what vectorization factor we are going to choose, all we have is an
> upper bound on that based on the target ISA and safelen clause.
> If say private clause is used with C++ classes with non-trivial ctors/dtors
> that would make a difference. Plus how to represent this in the IL.
>
> struct A { A (); ~A (); A (const A &); int i; };
>
> void
> foo ()
> {
> A a, b;
> #pragma omp simd private (a) lastprivate (b)
> for (int i = 0; i < 10; i++)
> {
> a.i++;
> b.i++;
> }
> }
>
> Right now what gomp4 branch does is that it will just construct private
> vars around the whole loop, as in:
> void
> foo ()
> {
> A a, b;
> {
> A a', b';
> int i;
> for (i = 0; i < 10; i++)
> {
> a'.i++;
> b'.i++;
> if (i == 9)
> b = b';
> }
> }
> }
>
> Jakub
>
More information about the Gcc-patches
mailing list