public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: Jan Hubicka <hubicka@ucw.cz>, <gcc-patches@gcc.gnu.org>,
	Tobias Burnus <tobias@codesourcery.com>,
	Jakub Jelinek <jakub@redhat.com>
Subject: Adjust 'libgomp.c/declare-variant-{3,4}-[...]' for inter-procedural value range propagation (was: Propagate value ranges of return values)
Date: Wed, 22 Nov 2023 18:16:05 +0100	[thread overview]
Message-ID: <87leapu2sq.fsf@euler.schwinge.homeip.net> (raw)
In-Reply-To: <ZVokRs1zL7NY5cVe@kam.mff.cuni.cz>

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

Hi!

On 2023-11-19T16:05:42+0100, Jan Hubicka <hubicka@ucw.cz> wrote:
> this is updated version which also adds testuiste compensation
> I lost earlier while maintaining the patch in my testing tree.
> There are quite few testcases that use constant return values to hide
> something from optimizer.

One more: commit a53da3a213ee00866d132c228a0e89bd2f61d65c
"Adjust 'libgomp.c/declare-variant-{3,4}-[...]' for inter-procedural value range propagation"
pushed to master branch, see attached.  (Those regressions are only
visible in GCC offloading configurations.)  (And actually, all those test
cases have other issues; will install further patches later on.)

Jakub, Tobias, please let me know if it's not expected that *all* the
"variant" functions have to be tagged '__attribute__ ((noipa))' (as I've
done); just tagging the "dispatcher" function 'f' isn't sufficient.


Grüße
 Thomas


-----------------
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-Adjust-libgomp.c-declare-variant-3-4-.-for-inter-pro.patch --]
[-- Type: text/x-diff, Size: 3257 bytes --]

From a53da3a213ee00866d132c228a0e89bd2f61d65c Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Tue, 21 Nov 2023 22:42:49 +0100
Subject: [PATCH] Adjust 'libgomp.c/declare-variant-{3,4}-[...]' for
 inter-procedural value range propagation

..., that is, commit 53ba8d669550d3a1f809048428b97ca607f95cf5
"inter-procedural value range propagation", after which we see:

    [-PASS:-]{+FAIL:+} libgomp.c/declare-variant-3-sm30.c scan-nvptx-none-offload-tree-dump optimized "= f30 \\(\\);"

Etc.  That's due to:

    @@ -144,13 +144,11 @@
     __attribute__((omp target entrypoint, noclone))
     void main._omp_fn.0 (const struct .omp_data_t.3 & restrict .omp_data_i)
     {
    -  int _3;
       int * _5;

       <bb 2> [local count: 1073741824]:
    -  _3 = f30 ();
       _5 = *.omp_data_i_4(D).v;
    -  *_5 = _3;
    +  *_5 = 30;
       return;

It's nice to see this optimization work here, too, but it does interfere with
how we're currently testing OpenMP 'declare variant'.

	libgomp/
	* testsuite/libgomp.c/declare-variant-3.h (f30, f35, f53, f70)
	(f75, f80, f): Add '__attribute__ ((noipa))'.
	* testsuite/libgomp.c/declare-variant-4.h (gfx803, gfx900, gfx906)
	(gfx908, gfx90a, f): Likewise.
---
 libgomp/testsuite/libgomp.c/declare-variant-3.h | 8 ++++++++
 libgomp/testsuite/libgomp.c/declare-variant-4.h | 7 +++++++
 2 files changed, 15 insertions(+)

diff --git a/libgomp/testsuite/libgomp.c/declare-variant-3.h b/libgomp/testsuite/libgomp.c/declare-variant-3.h
index 772fc20a519..646e15e5311 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-3.h
+++ b/libgomp/testsuite/libgomp.c/declare-variant-3.h
@@ -1,34 +1,41 @@
 #pragma omp declare target
+
+__attribute__ ((noipa))
 int
 f30 (void)
 {
   return 30;
 }
 
+__attribute__ ((noipa))
 int
 f35 (void)
 {
   return 35;
 }
 
+__attribute__ ((noipa))
 int
 f53 (void)
 {
   return 53;
 }
 
+__attribute__ ((noipa))
 int
 f70 (void)
 {
   return 70;
 }
 
+__attribute__ ((noipa))
 int
 f75 (void)
 {
   return 75;
 }
 
+__attribute__ ((noipa))
 int
 f80 (void)
 {
@@ -41,6 +48,7 @@ f80 (void)
 #pragma omp declare variant (f70) match (device={isa("sm_70")})
 #pragma omp declare variant (f75) match (device={isa("sm_75")})
 #pragma omp declare variant (f80) match (device={isa("sm_80")})
+__attribute__ ((noipa))
 int
 f (void)
 {
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4.h b/libgomp/testsuite/libgomp.c/declare-variant-4.h
index 2d7c1ef1a5a..47517b75ee7 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-4.h
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4.h
@@ -1,28 +1,34 @@
 #pragma omp declare target
+
+__attribute__ ((noipa))
 int
 gfx803 (void)
 {
   return 0x803;
 }
 
+__attribute__ ((noipa))
 int
 gfx900 (void)
 {
   return 0x900;
 }
 
+__attribute__ ((noipa))
 int
 gfx906 (void)
 {
   return 0x906;
 }
 
+__attribute__ ((noipa))
 int
 gfx908 (void)
 {
   return 0x908;
 }
 
+__attribute__ ((noipa))
 int
 gfx90a (void)
 {
@@ -38,6 +44,7 @@ gfx90a (void)
 #pragma omp declare variant(gfx906) match(device = {isa("gfx906")})
 #pragma omp declare variant(gfx908) match(device = {isa("gfx908")})
 #pragma omp declare variant(gfx90a) match(device = {isa("gfx90a")})
+__attribute__ ((noipa))
 int
 f (void)
 {
-- 
2.34.1


  parent reply	other threads:[~2023-11-22 17:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-19  1:21 Propagate value ranges of return values Jan Hubicka
2023-11-19 11:30 ` Sam James
2023-11-19 14:31   ` Jan Hubicka
2023-11-19 15:05     ` Jan Hubicka
2023-11-20 16:28       ` Martin Jambor
2023-11-21 11:09       ` Fix 'gcc.dg/tree-ssa/return-value-range-1.c' (was: Propagate value ranges of return values) Thomas Schwinge
2023-11-21 12:18         ` Jan Hubicka
2023-11-21 13:58       ` Propagate value ranges of return values Christophe Lyon
2023-11-21 14:06         ` Jan Hubicka
2023-11-21 21:35           ` Thomas Schwinge
2023-11-23  7:24           ` Andrew Pinski
2023-11-21 21:24       ` Fix 'gcc.dg/tree-ssa/return-value-range-1.c' for 'char' defaulting to 'unsigned' (was: Propagate value ranges of return values) Thomas Schwinge
2023-11-22 10:51         ` Christophe Lyon
2023-11-22 11:05           ` Thomas Schwinge
2023-11-22 17:16       ` Thomas Schwinge [this message]
2023-11-20 14:50 ` Propagate value ranges of return values Andrew MacLeod
2023-11-20 15:34   ` Jan Hubicka

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