public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sandra Loosemore <sandra@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>
Subject: [OG13 1/6] OpenMP: Handle loop transformation clauses in nested functions
Date: Wed, 14 Jun 2023 16:07:59 -0600	[thread overview]
Message-ID: <20230614220804.917436-2-sandra@codesourcery.com> (raw)
In-Reply-To: <20230614220804.917436-1-sandra@codesourcery.com>

The new internal clauses introduced for loop transformations were missing
from the big switch statements over all clauses in these functions.

gcc/ChangeLog:
	* tree-nested.cc (convert_nonlocal_omp_clauses): Handle loop
	transformation clauses.
	(convert_local_omp_clauses): Likewise.

libgomp/ChangeLog:
	* testsuite/libgomp.fortran/loop-transforms/nested-fn.f90: New test.

Co-Authored-By: Frederik Harwath <frederik@codesourcery.com>
---
 gcc/ChangeLog.omp                             |  7 +++++++
 gcc/tree-nested.cc                            | 14 ++++++++++++++
 libgomp/ChangeLog.omp                         |  5 +++++
 .../loop-transforms/nested-fn.f90             | 19 +++++++++++++++++++
 4 files changed, 45 insertions(+)
 create mode 100644 libgomp/testsuite/libgomp.fortran/loop-transforms/nested-fn.f90

diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index b4ebf6c0dea..d77d01076c2 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,10 @@
+2023-06-13  Sandra Loosemore  <sandra@codesourcery.com>
+	    Frederik Harwath <frederik@codesourcery.com>
+
+	* tree-nested.cc (convert_nonlocal_omp_clauses): Handle loop
+	transformation clauses.
+	(convert_local_omp_clauses): Likewise.
+
 2023-06-12  Tobias Burnus  <tobias@codesourcery.com>
 
 	Backported from mainline:
diff --git a/gcc/tree-nested.cc b/gcc/tree-nested.cc
index 04651d86608..51c69dd3c10 100644
--- a/gcc/tree-nested.cc
+++ b/gcc/tree-nested.cc
@@ -1494,6 +1494,13 @@ convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
 	case OMP_CLAUSE__OMPACC_:
 	  break;
 
+	  /* Clauses related to loop transforms.  */
+	case OMP_CLAUSE_TILE:
+	case OMP_CLAUSE_UNROLL_FULL:
+	case OMP_CLAUSE_UNROLL_PARTIAL:
+	case OMP_CLAUSE_UNROLL_NONE:
+	  break;
+
 	  /* The following clause belongs to the OpenACC cache directive, which
 	     is discarded during gimplification.  */
 	case OMP_CLAUSE__CACHE_:
@@ -2291,6 +2298,13 @@ convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
 	case OMP_CLAUSE__OMPACC_:
 	  break;
 
+	  /* Clauses related to loop transforms.  */
+	case OMP_CLAUSE_TILE:
+	case OMP_CLAUSE_UNROLL_FULL:
+	case OMP_CLAUSE_UNROLL_PARTIAL:
+	case OMP_CLAUSE_UNROLL_NONE:
+	  break;
+
 	  /* The following clause belongs to the OpenACC cache directive, which
 	     is discarded during gimplification.  */
 	case OMP_CLAUSE__CACHE_:
diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 60dc6c1f7c2..5ce5052a8dc 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,3 +1,8 @@
+2023-06-13  Sandra Loosemore  <sandra@codesourcery.com>
+	    Frederik Harwath <frederik@codesourcery.com>
+
+	* testsuite/libgomp.fortran/loop-transforms/nested-fn.f90: New test.
+
 2023-06-14  Tobias Burnus  <tobias@codesourcery.com>
 
 	Backported from mainline:
diff --git a/libgomp/testsuite/libgomp.fortran/loop-transforms/nested-fn.f90 b/libgomp/testsuite/libgomp.fortran/loop-transforms/nested-fn.f90
new file mode 100644
index 00000000000..dc70c9228fd
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/loop-transforms/nested-fn.f90
@@ -0,0 +1,19 @@
+! { dg-do run }
+
+program foo
+  integer :: count
+contains
+
+subroutine s1 ()
+  integer :: i, count
+
+  count = 0
+
+  !$omp target parallel do
+  !$omp unroll partial
+  do i = 1, 100
+  end do
+
+end subroutine
+
+end program
-- 
2.31.1


  reply	other threads:[~2023-06-14 22:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-14 22:07 [OG13 0/6] OpenMP: Support for imperfectly-nested loops Sandra Loosemore
2023-06-14 22:07 ` Sandra Loosemore [this message]
2023-06-14 22:08 ` [OG13 2/6] OpenMP: C support " Sandra Loosemore
2023-06-14 22:08 ` [OG13 3/6] OpenMP: C++ " Sandra Loosemore
2023-06-14 22:08 ` [OG13 4/6] OpenMP: New c/c++ testcases " Sandra Loosemore
2023-06-14 22:08 ` [OG13 5/6] OpenMP: Refactor and tidy Fortran front-end code for loop transformations Sandra Loosemore
2023-06-14 22:08 ` [OG13 6/6] OpenMP: Fortran support for imperfectly nested loops Sandra Loosemore

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=20230614220804.917436-2-sandra@codesourcery.com \
    --to=sandra@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).