public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Sandra Loosemore <sandra@codesourcery.com>,
	Tobias Burnus <tobias@codesourcery.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH V2 5/5] OpenMP: Fortran support for imperfectly-nested loops
Date: Tue, 22 Aug 2023 15:37:54 +0200	[thread overview]
Message-ID: <ZOS6Mj4JfdsQVd2s@tucnak> (raw)
In-Reply-To: <20230723221521.3739463-6-sandra@codesourcery.com>

On Sun, Jul 23, 2023 at 04:15:21PM -0600, Sandra Loosemore wrote:
> OpenMP 5.0 removed the restriction that multiple collapsed loops must
> be perfectly nested, allowing "intervening code" (including nested
> BLOCKs) before or after each nested loop.  In GCC this code is moved
> into the inner loop body by the respective front ends.
> 
> In the Fortran front end, most of the semantic processing happens during
> the translation phase, so the parse phase just collects the intervening
> statements, checks them for errors, and splices them around the loop body.
> 
> gcc/fortran/ChangeLog
> 	* gfortran.h (struct gfc_namespace): Add omp_structured_block bit.
> 	* openmp.cc: Include omp-api.h.
> 	(resolve_omp_clauses): Consolidate inscan reduction clause conflict
> 	checking here.
> 	(find_nested_loop_in_chain): New.
> 	(find_nested_loop_in_block): New.
> 	(gfc_resolve_omp_do_blocks): Set omp_current_do_collapse properly.
> 	Handle imperfectly-nested loops when looking for nested omp scan.
> 	Refactor to move inscan reduction clause conflict checking to
> 	resolve_omp_clauses.
> 	(gfc_resolve_do_iterator): Handle imperfectly-nested loops.
> 	(struct icode_error_state): New.
> 	(icode_code_error_callback): New.
> 	(icode_expr_error_callback): New.
> 	(diagnose_intervening_code_errors_1): New.
> 	(diagnose_intervening_code_errors): New.
> 	(make_structured_block): New.
> 	(restructure_intervening_code): New.
> 	(is_outer_iteration_variable): Do not assume loops are perfectly
> 	nested.
> 	(check_nested_loop_in_chain): New.
> 	(check_nested_loop_in_block_state): New.
> 	(check_nested_loop_in_block_symbol): New.
> 	(check_nested_loop_in_block): New.
> 	(expr_uses_intervening_var): New.
> 	(is_intervening_var): New.
> 	(expr_is_invariant): Do not assume loops are perfectly nested.
> 	(resolve_omp_do): Handle imperfectly-nested loops.
> 	* trans-stmt.cc (gfc_trans_block_construct): Generate
> 	OMP_STRUCTURED_BLOCK if magic bit is set on block namespace.
> 
> gcc/testsuite/ChangeLog
> 	* gfortran.dg/gomp/collapse1.f90: Adjust expected errors.
> 	* gfortran.dg/gomp/collapse2.f90: Likewise.
> 	* gfortran.dg/gomp/imperfect-gotos.f90: New.
> 	* gfortran.dg/gomp/imperfect-invalid-scope.f90: New.
> 	* gfortran.dg/gomp/imperfect1.f90: New.
> 	* gfortran.dg/gomp/imperfect2.f90: New.
> 	* gfortran.dg/gomp/imperfect3.f90: New.
> 	* gfortran.dg/gomp/imperfect4.f90: New.
> 	* gfortran.dg/gomp/imperfect5.f90: New.
> 
> libgomp/ChangeLog
> 	* testsuite/libgomp.fortran/imperfect-destructor.f90: New.
> 	* testsuite/libgomp.fortran/imperfect1.f90: New.
> 	* testsuite/libgomp.fortran/imperfect2.f90: New.
> 	* testsuite/libgomp.fortran/imperfect3.f90: New.
> 	* testsuite/libgomp.fortran/imperfect4.f90: New.
> 	* testsuite/libgomp.fortran/target-imperfect1.f90: New.
> 	* testsuite/libgomp.fortran/target-imperfect2.f90: New.
> 	* testsuite/libgomp.fortran/target-imperfect3.f90: New.
> 	* testsuite/libgomp.fortran/target-imperfect4.f90: New.

LGTM, but please let Tobias have a second look unless he has done so
already.

	Jakub


  reply	other threads:[~2023-08-22 13:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-23 22:15 [PATCH V2 0/5] OpenMP: " Sandra Loosemore
2023-07-23 22:15 ` [PATCH V2 1/5] OpenMP: Add OMP_STRUCTURED_BLOCK and GIMPLE_OMP_STRUCTURED_BLOCK Sandra Loosemore
2023-08-22 13:01   ` Jakub Jelinek
2023-07-23 22:15 ` [PATCH V2 2/5] OpenMP: C front end support for imperfectly-nested loops Sandra Loosemore
2023-08-22 13:23   ` Jakub Jelinek
2023-08-22 18:53     ` Sandra Loosemore
2023-08-24 11:49       ` Jakub Jelinek
2023-07-23 22:15 ` [PATCH V2 3/5] OpenMP: C++ " Sandra Loosemore
2023-08-22 13:31   ` Jakub Jelinek
2023-07-23 22:15 ` [PATCH V2 4/5] OpenMP: New C/C++ testcases for imperfectly nested loops Sandra Loosemore
2023-08-22 13:34   ` Jakub Jelinek
2023-07-23 22:15 ` [PATCH V2 5/5] OpenMP: Fortran support for imperfectly-nested loops Sandra Loosemore
2023-08-22 13:37   ` Jakub Jelinek [this message]
2023-08-24 16:36     ` Tobias Burnus
2023-08-22 12:56 ` [PATCH V2 0/5] OpenMP: " Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZOS6Mj4JfdsQVd2s@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=sandra@codesourcery.com \
    --cc=tobias@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).