This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Forwarding -foffload=[...] from the driver (compile-time) to libgomp (run-time)
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Nathan Sidwell <nathan at acm dot org>
- Cc: Thomas Schwinge <thomas at codesourcery dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 24 Aug 2015 17:54:40 +0000
- Subject: Re: Forwarding -foffload=[...] from the driver (compile-time) to libgomp (run-time)
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 11 dot 1410151612470 dot 20733 at zhemvz dot fhfr dot qr> <20141020111935 dot GA9362 at msticlxl57 dot ims dot intel dot com> <20141024141601 dot GA62562 at msticlxl57 dot ims dot intel dot com> <20141024142028 dot GD10376 at tucnak dot redhat dot com> <20141028193047 dot GA17865 at msticlxl57 dot ims dot intel dot com> <20141103092447 dot GO5026 at tucnak dot redhat dot com> <20141105124655 dot GA42356 at msticlxl57 dot ims dot intel dot com> <87egjopgh0 dot fsf at kepler dot schwinge dot homeip dot net> <20150731142007 dot GA64740 at msticlxl57 dot ims dot intel dot com> <CAFiYyc3NJjund2BbEQ0HxtGiaM-Z9bmX4UPaQtYguYjHQs0-Gg at mail dot gmail dot com> <20150805150904 dot GA3211 at msticlxl57 dot ims dot intel dot com> <87bneatd5q dot fsf at schwinge dot name> <alpine dot DEB dot 2 dot 10 dot 1508141655200 dot 16651 at digraph dot polyomino dot org dot uk> <87lhddsfs4 dot fsf at schwinge dot name> <alpine dot DEB dot 2 dot 10 dot 1508142255410 dot 28860 at digraph dot polyomino dot org dot uk> <87oai4r2ok dot fsf at schwinge dot name> <alpine dot DEB dot 2 dot 10 dot 1508202251220 dot 2630 at digraph dot polyomino dot org dot uk> <55D74C69 dot 6040005 at acm dot org> <alpine dot DEB dot 2 dot 10 dot 1508211619410 dot 2039 at digraph dot polyomino dot org dot uk>
On Fri, 21 Aug 2015, Joseph Myers wrote:
> On Fri, 21 Aug 2015, Nathan Sidwell wrote:
>
> > this appears to cause an ICE in add_omp_infile_spec_func at;
> > gcc_assert (offload_targets != NULL);
> >
> > when you use something like -foffload='-save-temps -v -fdump-rtl-all
> > -fdump-tree-all -fno-verbose-asm'
> >
> > Is that use ill-formed?
>
> I'll need to reverse-engineer the question of what's a well-formed
> -foffload= option (bug 67300 filed yesterday for the lack of any
> documentation of that option).
Although there is no documentation for the -foffload options in the
manual, I found something at <https://gcc.gnu.org/wiki/Offloading>
that I hope is current.
It turns out the problem wasn't in the assertion, but in how a default
-foffload option was generated. Generating it via specs meant that if
the only -foffload option specified options without specifying a
target (i.e., options applicable to all the configured offload
targets), then the offload_targets variable was never set and so the
assertion failure resulted (as well as OFFLOAD_TARGET_NAMES not being
exported). Rather than trying to make the specs produce something if
no -foffload=* options other than -foffload=-* options were passed,
I'm testing this patch to default the offload targets after the
original command line is processed (and before extra options from
these specs are processed, so before the assertion is executed), and
will commit it if tests are OK.
2015-08-24 Joseph Myers <joseph@codesourcery.com>
* gcc.c (driver_self_specs) [ENABLE_OFFLOADING]: Don't generate a
-foffload option.
(process_command): Call handle_foffload_option (OFFLOAD_TARGETS)
if no offload target specified.
Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c (revision 227045)
+++ gcc/gcc.c (working copy)
@@ -1064,9 +1064,6 @@ static const char *const multilib_defaults_raw[] =
static const char *const driver_self_specs[] = {
"%{fdump-final-insns:-fdump-final-insns=.} %<fdump-final-insns",
#ifdef ENABLE_OFFLOADING
- /* If the user didn't specify any, default to all configured offload
- targets. */
- "%{!foffload=*:-foffload=" OFFLOAD_TARGETS "}",
/* If linking against libgomp, add a setup file. */
"%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*} 1):" \
"%:add-omp-infile()}",
@@ -4291,6 +4288,11 @@ process_command (unsigned int decoded_options_coun
CL_DRIVER, &handlers, global_dc);
}
+ /* If the user didn't specify any, default to all configured offload
+ targets. */
+ if (offload_targets == NULL)
+ handle_foffload_option (OFFLOAD_TARGETS);
+
if (output_file
&& strcmp (output_file, "-") != 0
&& strcmp (output_file, HOST_BIT_BUCKET) != 0)
--
Joseph S. Myers
joseph@codesourcery.com