public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: Bernd Schmidt <bernds@codesourcery.com>,
	Jakub Jelinek <jakub@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Option overriding in the offloading code path (was: [nvptx] -freorder-blocks-and-partition, -freorder-functions)
Date: Wed, 25 Feb 2015 10:54:00 -0000	[thread overview]
Message-ID: <87mw429tfn.fsf@kepler.schwinge.homeip.net> (raw)
In-Reply-To: <87a90klcyb.fsf@kepler.schwinge.homeip.net>

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

Hi!

On Wed, 11 Feb 2015 15:50:20 +0100, I wrote:
> On Wed, 11 Feb 2015 15:44:26 +0100, I wrote:
> > If -freorder-blocks-and-partition is active, this results in PTX code
> > such as: [...]

> Such partitioning might not make a lot of sense for the virtual ISA that
> PTX is, but disabling it in nvptx.c:nvptx_option_override does not work.
> (Because that is not invoked in the offloading code path?)  I see x86 has
> a ix86_option_override_internal (but I don't know how that options
> processing works) -- is something like that needed for nvptx, too, and
> how to interconnect that with the offloading code path?  Sounds a bit
> like what Jakub suggests in <https://gcc.gnu.org/PR64374#c8>?

Am I on the right track with my assumption that it is correct that
nvptx.c:nvptx_option_override is not invoked in the offloading code path,
so we'd need a new target hook (?) to consolidate/override the options in
this scenario?


Using this to forcefully disable -fvar-tracking (as done in
nvptx_option_override), should then allow me to drop the following
beautiful specimen of a patch (which I didn't commit anywhere, so far):

commit ab5a010357f4c7347dd892f3666cdeecd08cc083
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Mon Feb 16 13:57:08 2015 +0100

    libgomp Fortran testing: for -g torture testing, disable variable tracking.
    
    Otherwise, the nvptx-none offloading compiler will run into issues such as:
    
        source-gcc/libgomp/testsuite/libgomp.fortran/examples-4/e.50.1.f90: In function '__e_50_1_mod_MOD_vec_mult._omp_fn.1':
        source-gcc/libgomp/testsuite/libgomp.fortran/examples-4/e.50.1.f90:31:0: internal compiler error: in use_type, at var-tracking.c:5442
                 p(i) = v1(i) * v2(i)
         ^
        0xc4dc72 use_type
                source-gcc/gcc/var-tracking.c:5442
        0xc504b3 add_stores
                source-gcc/gcc/var-tracking.c:5869
        0xc4cd28 add_with_sets
                source-gcc/gcc/var-tracking.c:6553
        0x5e9b7d cselib_record_sets
                source-gcc/gcc/cselib.c:2574
        0x5ea8a7 cselib_process_insn(rtx_insn*)
                source-gcc/gcc/cselib.c:2686
        0xc586a3 vt_initialize
                source-gcc/gcc/var-tracking.c:10126
        0xc65a8e variable_tracking_main_1
                source-gcc/gcc/var-tracking.c:10322
        0xc65a8e variable_tracking_main
                source-gcc/gcc/var-tracking.c:10375
        0xc65a8e execute
                source-gcc/gcc/var-tracking.c:10412
        Please submit a full bug report,
        with preprocessed source if appropriate.
        Please include the complete backtrace with any bug report.
        See <http://gcc.gnu.org/bugs.html> for instructions.
        mkoffload: fatal error: install/offload-nvptx-none/bin//x86_64-unknown-linux-gnu-accel-nvptx-none-gcc returned 1 exit status
---
 libgomp/testsuite/libgomp.fortran/fortran.exp      |    3 +++
 libgomp/testsuite/libgomp.oacc-fortran/fortran.exp |    3 +++
 2 files changed, 6 insertions(+)

diff --git libgomp/testsuite/libgomp.fortran/fortran.exp libgomp/testsuite/libgomp.fortran/fortran.exp
index 9e6b643..0b597e6 100644
--- libgomp/testsuite/libgomp.fortran/fortran.exp
+++ libgomp/testsuite/libgomp.fortran/fortran.exp
@@ -21,6 +21,9 @@ dg-init
 # Turn on OpenMP.
 lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
 
+# TODO: for -g torture testing, disable variable tracking.
+regsub -all -- { -g[^ ]*} $DG_TORTURE_OPTIONS {& -fno-var-tracking} DG_TORTURE_OPTIONS
+
 if { $blddir != "" } {
     set lang_source_re {^.*\.[fF](|90|95|03|08)$}
     set lang_include_flags "-fintrinsic-modules-path=${blddir}"
diff --git libgomp/testsuite/libgomp.oacc-fortran/fortran.exp libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
index a8f62e8..080a7b9 100644
--- libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
+++ libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
@@ -23,6 +23,9 @@ dg-init
 # Turn on OpenACC.
 lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
 
+# TODO: for -g torture testing, disable variable tracking.
+regsub -all -- { -g[^ ]*} $DG_TORTURE_OPTIONS {& -fno-var-tracking} DG_TORTURE_OPTIONS
+
 if { $blddir != "" } {
     set lang_source_re {^.*\.[fF](|90|95|03|08)$}
     set lang_include_flags "-fintrinsic-modules-path=${blddir}"


Grüße,
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

  reply	other threads:[~2015-02-25 10:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-01 12:11 nvptx offloading patches [4/n] Bernd Schmidt
2015-01-28 18:03 ` Thomas Schwinge
2015-01-28 18:16   ` Ilya Verbin
2015-02-11 14:20     ` Thomas Schwinge
2015-02-11 14:19   ` Thomas Schwinge
2015-02-11 14:20   ` Thomas Schwinge
2015-02-11 14:44 ` Thomas Schwinge
2015-02-11 14:50   ` [nvptx] -freorder-blocks-and-partition, -freorder-functions (was: nvptx offloading patches [4/n]) Thomas Schwinge
2015-02-25 10:54     ` Thomas Schwinge [this message]
2015-02-25 13:23       ` Option overriding in the offloading code path Bernd Schmidt
2015-02-25 17:15       ` Option overriding in the offloading code path (was: [nvptx] -freorder-blocks-and-partition, -freorder-functions) Jakub Jelinek
2015-02-26 10:42         ` var-tracking vs. pseudo registers (was: Option overriding in the offloading code path) Thomas Schwinge
2015-02-26 10:53           ` Jakub Jelinek
2015-03-26 11:00             ` [PATCH] Don't run var-tracking for targetm.no_register_allocation targets Jakub Jelinek
2015-03-26 11:20               ` Richard Biener
2015-04-27 16:44               ` var-tracking vs. pseudo registers (was: Option overriding in the offloading code path) Thomas Schwinge
2015-03-13  9:07       ` Option overriding in the offloading code path Thomas Schwinge
2015-02-11 15:21   ` nvptx offloading patches [4/n] Bernd Schmidt
2015-02-17 18:14     ` Thomas Schwinge
2015-02-18  8:26 ` nvptx mkoffload: For non-installed testing, look in all COMPILER_PATHs for GCC_INSTALL_NAME (was: nvptx offloading patches [4/n]) Thomas Schwinge

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