From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91968 invoked by alias); 7 Oct 2015 08:02:48 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 91957 invoked by uid 89); 7 Oct 2015 08:02:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Oct 2015 08:02:45 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1ZjjgO-0002BQ-KR from Thomas_Schwinge@mentor.com ; Wed, 07 Oct 2015 01:02:40 -0700 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.3.224.2; Wed, 7 Oct 2015 09:02:38 +0100 From: Thomas Schwinge To: James Norris , David Edelsohn CC: Subject: Re: [gomp4] Add -foffload-abi support for PPC In-Reply-To: <5613F8EC.4000400@codesourcery.com> References: <87zizxcxnm.fsf@schwinge.name> <5613F8EC.4000400@codesourcery.com> User-Agent: Notmuch/0.9-125-g4686d11 (http://notmuchmail.org) Emacs/24.5.1 (i586-pc-linux-gnu) Date: Wed, 07 Oct 2015 08:02:00 -0000 Message-ID: <87bncbp0mi.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-SW-Source: 2015-10/txt/msg00669.txt.bz2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 6185 Hi! rs6000/powerpc port maintainer copied. On Tue, 6 Oct 2015 11:38:04 -0500, James Norris = wrote: > The attached patch adds the -foffload-abi option support for PPC. > Only support for the 64-bit ABI has been added. (Yes, only powerpc64le-linux-gnu configurations can be supported.) > Committed after regtesting with x86_64 and powerpc64le. Such a patch needs to go into trunk. (It's of course OK to test-drive it on gomp-4_0-branch first.) However: > + * common.opt (OFFLOAD_ABI_PPC64): New enum. > + * config/nvptx/mkoffload.c (compile_native): Handle new enum. > + (main): Handle new option. > + * config/rs6000/rs6000.c (rs6000_offload_options): New hook. > + * gcc/coretypes.h (OFFLOAD_ABI_PPC64): New enum. > --- a/gcc/common.opt > +++ b/gcc/common.opt > @@ -1730,6 +1730,9 @@ Enum(offload_abi) String(ilp32) Value(OFFLOAD_ABI_I= LP32) > EnumValue > Enum(offload_abi) String(lp64) Value(OFFLOAD_ABI_LP64) >=20=20 > +EnumValue > +Enum(offload_abi) String(ppc64) Value(OFFLOAD_ABI_PPC64) > --- a/gcc/config/nvptx/mkoffload.c > +++ b/gcc/config/nvptx/mkoffload.c > @@ -367,6 +367,8 @@ compile_native (const char *infile, const char *outfi= le, const char *compiler) > case OFFLOAD_ABI_ILP32: > obstack_ptr_grow (&argv_obstack, "-m32"); > break; > + case OFFLOAD_ABI_PPC64: > + break; > default: > gcc_unreachable (); > } > @@ -458,6 +460,8 @@ main (int argc, char **argv) > offload_abi =3D OFFLOAD_ABI_LP64; > else if (strcmp (argv[i] + strlen (STR), "ilp32") =3D=3D 0) > offload_abi =3D OFFLOAD_ABI_ILP32; > + else if (strcmp (argv[i] + strlen (STR), "ppc64") =3D=3D 0) > + offload_abi =3D OFFLOAD_ABI_PPC64; > else > fatal_error (input_location, > "unrecognizable argument of option " STR); > @@ -485,6 +489,8 @@ main (int argc, char **argv) > case OFFLOAD_ABI_ILP32: > obstack_ptr_grow (&argv_obstack, "-m32"); > break; > + case OFFLOAD_ABI_PPC64: > + break; > default: > gcc_unreachable (); > } > @@ -518,7 +524,8 @@ main (int argc, char **argv) >=20=20 > /* PR libgomp/65099: Currently, we only support offloading in 64-bit > configurations, and only for OpenACC offloading. */ > - if (offload_abi =3D=3D OFFLOAD_ABI_LP64 && fopenacc) > + if ((offload_abi =3D=3D OFFLOAD_ABI_LP64 > + || (offload_abi =3D=3D OFFLOAD_ABI_PPC64)) && fopenacc) > { > ptx_name =3D make_temp_file (".mkoffload"); > obstack_ptr_grow (&argv_obstack, "-o"); > --- a/gcc/config/rs6000/rs6000.c > +++ b/gcc/config/rs6000/rs6000.c > +#undef TARGET_OFFLOAD_OPTIONS > +#define TARGET_OFFLOAD_OPTIONS rs6000_offload_options > +/* Implement the TARGET_OFFLOAD_OPTIONS hook. */ > +static char * > +rs6000_offload_options (void) > +{ > + return xstrdup ("-foffload-abi=3Dppc64"); > +} > --- a/gcc/coretypes.h > +++ b/gcc/coretypes.h > @@ -170,7 +170,8 @@ enum tls_model { > enum offload_abi { > OFFLOAD_ABI_UNSET, > OFFLOAD_ABI_LP64, > - OFFLOAD_ABI_ILP32 > + OFFLOAD_ABI_ILP32, > + OFFLOAD_ABI_PPC64 > }; No, that's not how I meant it to be done; I wrote: | On Mon, 5 Oct 2015 07:06:55 -0500, James Norris = wrote: | > [The -foffload-abi parameter] is not passed [to mkoffload] when using t= he | > ppc compiler, and as a result the 'unreachable' assertion [in mkoffload] | > went off. |=20 | That's the bug: you need to pass this parameter: the target (a.k.a. host) | and offload target (a.k.a. device) compilers need to agree on the ABI to | use. This should be straightforward to do; see here: |=20 | $ git grep -i offload.options -- gcc/config/i386/ | gcc/config/i386/i386.c:/* Implement the TARGET_OFFLOAD_OPTIONS hook. = */ | gcc/config/i386/i386.c:ix86_offload_options (void) | gcc/config/i386/i386.c:#undef TARGET_OFFLOAD_OPTIONS | gcc/config/i386/i386.c:#define TARGET_OFFLOAD_OPTIONS \ | gcc/config/i386/i386.c: ix86_offload_options |=20 | gcc/config/i386/i386.c:ix86_offload_options: |=20 | /* Implement the TARGET_OFFLOAD_OPTIONS hook. */ | static char * | ix86_offload_options (void) | { | if (TARGET_LP64) | return xstrdup ("-foffload-abi=3Dlp64"); | return xstrdup ("-foffload-abi=3Dilp32"); | } |=20 | In case that PowerPC supports additional ABIs, you need to add these to | gcc/coretypes.h:enum offload_abi, and adjust the parsing in the | mkoffloads (I can easily test the IntelMIC mkoffload patch for you); of | course we don't need to support anything but the 64-bit ABI (that you're | currently already using, I suppose). =46rom a quick look at the *_TYPE_SIZE definitions in gcc/config/rs6000/rs6000.h as well as , "3-1 Fundamental Types", and , I gather we're dealing with regular ilp32/lp64 here. Then, I assume the right thing is to use the 64BIT flag from gcc/config/rs6000/sysv4.opt (which, per gcc/config.gcc I suppose is used for the relevant powerpc64le-linux-gnu configuration). (David?) I'm not sure where to place the TARGET_OFFLOAD_OPTIONS #define and the function definition in rs6000.c. (David?) So, please revert your patch and instead try the following. --- gcc/config/rs6000/rs6000.c +++ gcc/config/rs6000/rs6000.c @@ -1688,6 +1688,9 @@ static const struct attribute_spec rs6000_attribute_t= able[] =3D #define TARGET_LIBGCC_SHIFT_COUNT_MODE rs6000_abi_word_mode #undef TARGET_UNWIND_WORD_MODE #define TARGET_UNWIND_WORD_MODE rs6000_abi_word_mode + +#undef TARGET_OFFLOAD_OPTIONS +#define TARGET_OFFLOAD_OPTIONS rs6000_offload_options =0C =20 /* Processor table. */ @@ -9532,6 +9535,16 @@ rs6000_abi_word_mode (void) return TARGET_32BIT ? SImode : DImode; } =20 +/* Implement the TARGET_OFFLOAD_OPTIONS hook. */ +static char * +rs6000_offload_options (void) +{ + if (TARGET_64BIT) + return xstrdup ("-foffload-abi=3Dlp64"); + else + return xstrdup ("-foffload-abi=3Dilp32"); +} + /* On rs6000, function arguments are promoted, as are function return values. */ =20 Gr=C3=BC=C3=9Fe, Thomas --=-=-= Content-Type: application/pgp-signature; name="signature.asc" Content-length: 472 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJWFNGWAAoJEK3/DN1sMFFt5b0IALKqEtsNl6nx6jSsbiJRzjfC Hb7vs96oq377bwxtjknFVeCu557s2QLJf+ohZersnpU/Nm0N2TGBpc7KvizV8Dr3 vFozgAL/WE+T7X0v2iRuBOSvzv2iuQxbHTDB4SUqmdG1z/JPwmmEcKB6Es3utLim WbbJnaBSNVc20olJo5sPojN2+ll19nGdTr4rxaAHY/DsZTUUSCmA2aZ4W8njXs23 bZGO4Dmo9ivp1Yucwb1WlM3Be28kcJQW1VO5MPwIsT+LhxjXQc2M8GX3puY53SEG RQRYpWJV7KtE20QYHaLoaJWLZFIlFlhWSUXbr6OKM+Irizcy+U/SzjU6jHNFriI= =MxRc -----END PGP SIGNATURE----- --=-=-=--