public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: Sandra Loosemore <sandra@codesourcery.com>, <gcc-patches@gcc.gnu.org>
Cc: Jakub Jelinek <jakub@redhat.com>,
	Tobias Burnus <tobias@codesourcery.com>
Subject: In 'libgomp.c/target-simd-clone-{1,2,3}.c', restrict 'scan-offload-ipa-dump's to 'only_for_offload_target amdgcn-amdhsa' (was: [PATCH v4] OpenMP: Generate SIMD clones for functions with "declare target")
Date: Wed, 29 Nov 2023 15:15:50 +0100	[thread overview]
Message-ID: <87jzq063xl.fsf@euler.schwinge.homeip.net> (raw)
In-Reply-To: <927ad110-065e-9414-1312-bff5a0644e97@siemens.com>

[-- Attachment #1: Type: text/plain, Size: 3011 bytes --]

Hi!

On 2022-11-14T21:46:15-0700, Sandra Loosemore via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> [...] I've added infrastructure to support testing on the offload
> compiler, added new test cases, and reworked the existing test cases to
> scan for interesting things written to the dump file instead of
> examining the .s output.

Thanks!  (..., belatedly.  I think it was me who suggested that.)

Just one minor fix-up:

> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.c/target-simd-clone-1.c
> @@ -0,0 +1,43 @@
> +/* { dg-do link { target { offload_target_amdgcn } } } */

This means, the test case is active if GCN offloading compilation is
enabled.  But, consider the case that nvptx offloading compilation also
is enabled:

> +/* { dg-additional-options "-O2 -foffload-options=-fdump-ipa-simdclone-details" } */

This will produced dump files for both, GCN and nvptx, separately.
However, this isn't applicable for nvptx, thus no dump file produced for
that.

> +[...]
> +/* { dg-final { scan-offload-ipa-dump "Generated local clone _ZGV.*N.*_addit" "simdclone" } } */
> +/* { dg-final { scan-offload-ipa-dump "Generated local clone _ZGV.*M.*_addit" "simdclone" } } */

..., and this will try to scan dump files for both GCN and nvptx.  The
latter don't exist, resulting in UNRESOLVEDs for nvptx.  I've pushed to
master branch commit 4c909c6ee381a43081d68abc1ff8a35ce20d24d9
"In 'libgomp.c/target-simd-clone-{1,2,3}.c', restrict 'scan-offload-ipa-dump's to 'only_for_offload_target amdgcn-amdhsa'",
see attached.

(This obviously depends on
<https://inbox.sourceware.org/87y1ens4hq.fsf@euler.schwinge.homeip.net>
"testsuite: Add 'only_for_offload_target' wrapper for 'scan-offload-tree-dump' etc.",
which I've also just pushed to master branch in
commit 27c79b91f6008a21006d4e7053a98e63f2990bb2.)


Grüße
 Thomas


> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.c/target-simd-clone-2.c
> @@ -0,0 +1,39 @@
> +/* { dg-do link { target { offload_target_amdgcn } } } */
> +/* { dg-additional-options "-foffload-options=-fdump-ipa-simdclone-details -foffload-options=-fno-openmp-target-simd-clone" } */
> +[...]
> +/* { dg-final { scan-offload-ipa-dump-not "Generated .* clone" "simdclone" } } */

> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.c/target-simd-clone-3.c
> @@ -0,0 +1,40 @@
> +/* { dg-do link { target { offload_target_amdgcn } } } */
> +/* { dg-additional-options "-O2 -foffload-options=-fdump-ipa-simdclone-details" } */
> +[...]
> +/* { dg-final { scan-offload-ipa-dump "device doesn't match" "simdclone" { target x86_64-*-* } } } */
> +/* { dg-final { scan-offload-ipa-dump-not "Generated .* clone" "simdclone" { target x86_64-*-* } } } */


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-In-libgomp.c-target-simd-clone-1-2-3-.c-restrict-sca.patch --]
[-- Type: text/x-diff, Size: 4655 bytes --]

From 4c909c6ee381a43081d68abc1ff8a35ce20d24d9 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Tue, 21 Nov 2023 20:20:21 +0100
Subject: [PATCH] In 'libgomp.c/target-simd-clone-{1,2,3}.c', restrict
 'scan-offload-ipa-dump's to 'only_for_offload_target amdgcn-amdhsa'

This gets rid of UNRESOLVEDs if nvptx offloading compilation is enabled in
addition to GCN:

     PASS: libgomp.c/target-simd-clone-1.c (test for excess errors)
     PASS: libgomp.c/target-simd-clone-1.c scan-amdgcn-amdhsa-offload-ipa-dump simdclone "Generated local clone _ZGV.*N.*_addit"
    -UNRESOLVED: libgomp.c/target-simd-clone-1.c scan-nvptx-none-offload-ipa-dump simdclone "Generated local clone _ZGV.*N.*_addit"
     PASS: libgomp.c/target-simd-clone-1.c scan-amdgcn-amdhsa-offload-ipa-dump simdclone "Generated local clone _ZGV.*M.*_addit"
    -UNRESOLVED: libgomp.c/target-simd-clone-1.c scan-nvptx-none-offload-ipa-dump simdclone "Generated local clone _ZGV.*M.*_addit"
     PASS: libgomp.c/target-simd-clone-2.c (test for excess errors)
     PASS: libgomp.c/target-simd-clone-2.c scan-amdgcn-amdhsa-offload-ipa-dump-not simdclone "Generated .* clone"
    -UNRESOLVED: libgomp.c/target-simd-clone-2.c scan-nvptx-none-offload-ipa-dump-not simdclone "Generated .* clone"
     PASS: libgomp.c/target-simd-clone-3.c (test for excess errors)
     PASS: libgomp.c/target-simd-clone-3.c scan-amdgcn-amdhsa-offload-ipa-dump simdclone "device doesn't match"
    -UNRESOLVED: libgomp.c/target-simd-clone-3.c scan-nvptx-none-offload-ipa-dump simdclone "device doesn't match"
     PASS: libgomp.c/target-simd-clone-3.c scan-amdgcn-amdhsa-offload-ipa-dump-not simdclone "Generated .* clone"
    -UNRESOLVED: libgomp.c/target-simd-clone-3.c scan-nvptx-none-offload-ipa-dump-not simdclone "Generated .* clone"

Minor fix-up for commit 309e2d95e3b930c6f15c8a5346b913158404c76d
'OpenMP: Generate SIMD clones for functions with "declare target"'.

	libgomp/
	* testsuite/libgomp.c/target-simd-clone-1.c: Restrict
	'scan-offload-ipa-dump's to
	'only_for_offload_target amdgcn-amdhsa'.
	* testsuite/libgomp.c/target-simd-clone-2.c: Likewise.
	* testsuite/libgomp.c/target-simd-clone-3.c: Likewise.
---
 libgomp/testsuite/libgomp.c/target-simd-clone-1.c | 4 ++--
 libgomp/testsuite/libgomp.c/target-simd-clone-2.c | 2 +-
 libgomp/testsuite/libgomp.c/target-simd-clone-3.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libgomp/testsuite/libgomp.c/target-simd-clone-1.c b/libgomp/testsuite/libgomp.c/target-simd-clone-1.c
index a9defc4cdd6..05e1568128a 100644
--- a/libgomp/testsuite/libgomp.c/target-simd-clone-1.c
+++ b/libgomp/testsuite/libgomp.c/target-simd-clone-1.c
@@ -39,5 +39,5 @@ int main (void)
 /* Although addit has external linkage, we expect clones to be generated as
    for a function with internal linkage.  */
 
-/* { dg-final { scan-offload-ipa-dump "Generated local clone _ZGV.*N.*_addit" "simdclone" } } */
-/* { dg-final { scan-offload-ipa-dump "Generated local clone _ZGV.*M.*_addit" "simdclone" } } */
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-ipa-dump "Generated local clone _ZGV.*N.*_addit" "simdclone" } } */
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-ipa-dump "Generated local clone _ZGV.*M.*_addit" "simdclone" } } */
diff --git a/libgomp/testsuite/libgomp.c/target-simd-clone-2.c b/libgomp/testsuite/libgomp.c/target-simd-clone-2.c
index 05a38ae2bc5..58f9e29332e 100644
--- a/libgomp/testsuite/libgomp.c/target-simd-clone-2.c
+++ b/libgomp/testsuite/libgomp.c/target-simd-clone-2.c
@@ -36,4 +36,4 @@ int main (void)
   return 0;
 }
 
-/* { dg-final { scan-offload-ipa-dump-not "Generated .* clone" "simdclone" } } */
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-ipa-dump-not "Generated .* clone" "simdclone" } } */
diff --git a/libgomp/testsuite/libgomp.c/target-simd-clone-3.c b/libgomp/testsuite/libgomp.c/target-simd-clone-3.c
index bde091e24ba..796a2a23bc3 100644
--- a/libgomp/testsuite/libgomp.c/target-simd-clone-3.c
+++ b/libgomp/testsuite/libgomp.c/target-simd-clone-3.c
@@ -36,5 +36,5 @@ int main (void)
   return 0;
 }
 
-/* { dg-final { scan-offload-ipa-dump "device doesn't match" "simdclone" { target x86_64-*-* } } } */
-/* { dg-final { scan-offload-ipa-dump-not "Generated .* clone" "simdclone" { target x86_64-*-* } } } */
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-ipa-dump "device doesn't match" "simdclone" { target x86_64-*-* } } } */
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-ipa-dump-not "Generated .* clone" "simdclone" { target x86_64-*-* } } } */
-- 
2.34.1


      parent reply	other threads:[~2023-11-29 14:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15  4:46 [PATCH v4] OpenMP: Generate SIMD clones for functions with "declare target" Sandra Loosemore
2022-11-25 11:35 ` Jakub Jelinek
2023-11-29 14:15 ` Thomas Schwinge [this message]

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=87jzq063xl.fsf@euler.schwinge.homeip.net \
    --to=thomas@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --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).