> BTW, omp workshare is implemented the same as omp single and this is the
> first time I see somebody actually using that construct anywhere. I don't
> have plans to implement omp workshare more efficiently, at least in the
> foreseeable future. So ATM !$omp parallel workshare is just a fancy
> way to say something is not parallelized. It is standard conforming, but
> not going beyond that.
Seemingly it becomes more requested. The quote above comes from:
and it was requested also in
This is not middle-end thing, all that is needed is change fortran FE to lower
(some forms of ) !$omp workshare constructs into some other standard worksharing construct than single, particularly into OMP_FOR or perhaps sometimes OMP_SECTIONS or OMP_SINGLE just for one or a couple of lines rather than the whole !$omp workshare.
I don't plan to work on this myself, but any of the numerous Fortran FE maintainers could do this, I can help with advice if needed.
Either code to expand the implicit loops in expressions will need to be duplicated, or tweaked (e.g. add a flag to them, which would result in OMP_FOR
loops being created rather than normal loops).
First patch: http://gcc.gnu.org/ml/fortran/2008-06/msg00281.html
Patch v1.1: http://gcc.gnu.org/ml/fortran/2008-08/msg00032.html
Has the second patch been reviewed? Has Vasilis completed his copyright assignment?
Subject: Bug 35423
Date: Mon Apr 20 10:59:59 2009
New Revision: 146397
* trans.h (OMPWS_WORKSHARE_FLAG, OMPWS_CURR_SINGLEUNIT,
OMPWS_SCALARIZER_WS, OMPWS_NOWAIT): Define.
(ompws_flags): New extern decl.
* trans-array.c (gfc_trans_scalarized_loop_end): Build OMP_FOR
for the outer dimension if ompws_flags allow it.
* trans.c (gfc_generate_code): Clear ompws_flags.
* trans-expr.c (gfc_trans_assignment_1): Allow worksharing
array assignments inside of !$omp workshare.
* trans-stmt.c (gfc_trans_where_3): Similarly for where statements
* trans-openmp.c (ompws_flags): New variable.
* testsuite/libgomp.fortran/workshare2.f90: New test.
Items left to do:
* worksharing of other stuff (say FORALL)
[I have not check the patch, but possibly assignments in WHERE blocks could also profit from more work]
* dependency analysis ("the goal of dependency checking is to avoid unnecessary
barriers by inserting NOWAIT clauses when safe. Hopefully the functionality provided in dependency.c will be useful here")
This PR is more than five years old and seems (mostly) fixed. Any reason to keep it open?