2015-09-21 18:15 GMT+03:00 Thomas Schwinge <tho...@codesourcery.com>: > (<https://gcc.gnu.org/PR67300>, "--foffload* undocumented", has recently > been filed.) > > (In the following, "intelmic" is short for > "x86_64-intelmicemul-linux-gnu", and "nvptx" is short for "nvptx-none".) > > What is the syntax to use for building both intelmic and nvptx offloading > code? I understand we allow for separate -foffload=intelmic > -foffload=nvptx options. Do we also intend to allow > -foffload=intelmic,nvptx or -foffload=intelmic:nvptx? > > And then, we allow for specifying offloading compiler options with > -foffload=intelmic=[...] and -foffload=nvptx=[...]; do we also intend to > allow -foffload=intelmic,nvptx=[...] (do the options apply to nvptx only, > or to both intelmic and nvptx?), and/or > -foffload=intelmic=[...],nvptx=[...], and/or > -foffload=intelmic:nvptx=[...] (which "looks a bit like" the options > ought to apply to nvptx only -- or to both intelmic and nvptx?), and/or > -foffload=intelmic=[...]:nvptx=[...]?
The plan was: 1. -foffload=intelmic,nvptx=[...] <- apply options to both intelmic,nvptx. Just like -foffload=[...] applies to both targets (if configured so). 2. -foffload=intelmic=[...],nvptx=[...] <- is not allowed. 3. To apply different options to different targets, one should pass: -foffload=intelmic=[...] -foffload=nvptx=[...]. > 3612 /* Check that GCC is configured to support the offload > target. */ > 3613 c = OFFLOAD_TARGETS; > 3614 while (c) > 3615 { > 3616 n = strchr (c, ','); > 3617 if (n == NULL) > 3618 n = strchr (c, '\0'); > 3619 > 3620 if (next - cur == n - c && strncmp (target, c, n - c) > == 0) > 3621 break; > 3622 > 3623 c = *n ? n + 1 : NULL; > 3624 } > 3625 > 3626 if (!c) > 3627 fatal_error (input_location, > 3628 "GCC is not configured to support %s as > offload target", > 3629 target); > > So, this code will not do the right thing when configured with > --enable-offload-targets=intelmic,nvptx (thus, > OFFLOAD_TARGETS=intelmic:nvptx): using -foffload=nvptx will then result > in "xgcc: fatal error: GCC is not configured to support nvptx as offload > target". > > If I'm understanding the following code correctly, this supports the idea > that the intention has been for -foffload=[targets]=[options] to separate > the targets by commas, and separate the options by spaces -- is that > correct? Yes, targets are separated by commas, options are the whole string after the equal sign, spaces inside are allowed. -- Ilya