public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Pinski <pinskia@gmail.com>
To: Prathamesh Kulkarni <prathameshk@nvidia.com>
Cc: "rguenther@suse.de" <rguenther@suse.de>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [nvptx] Pass -m32/-m64 to host_compiler if it has multilib support
Date: Thu, 8 Aug 2024 06:46:25 -0700	[thread overview]
Message-ID: <CA+=Sn1=MjVHYcNKF2CPr_FdFrN581QLrHT6Rjs5=ednOWHnPUw@mail.gmail.com> (raw)
In-Reply-To: <IA1PR12MB9031FB935ABA54B93D831A9BCEB92@IA1PR12MB9031.namprd12.prod.outlook.com>

On Thu, Aug 8, 2024 at 6:11 AM Prathamesh Kulkarni
<prathameshk@nvidia.com> wrote:
>
> Hi Richard,
> After differing NUM_POLY_INT_COEFFS fix for AArch64/nvptx offloading, the following minimal test:
>
> int main()
> {
>   int x;
>   #pragma omp target map(x)
>     x = 5;
>   return x;
> }
>
> compiled with -fopenmp -foffload=nvptx-none now fails with:
> gcc: error: unrecognized command-line option '-m64'
> nvptx mkoffload: fatal error: ../install/bin/gcc returned 1 exit status compilation terminated.
>
> As mentioned in RFC email, this happens because nvptx/mkoffload.cc:compile_native passes -m64/-m32 to host compiler depending on whether
> offload_abi is OFFLOAD_ABI_LP64 or OFFLOAD_ABI_ILP32, and aarch64 backend doesn't recognize these options.
>
> Based on your suggestion in: https://gcc.gnu.org/pipermail/gcc/2024-July/244470.html,
> The attached patch generates new macro HOST_MULTILIB derived from $enable_as_accelerator_for, and in mkoffload.cc it gates passing -m32/-m64
> to host_compiler on HOST_MULTILIB. I verified that the macro is set to 0 for aarch64 host (and thus avoids above unrecognized command line option error),
> and is set to 1 for x86_64 host.
>
> Does the patch look OK ?

Note I think the usage of the name MULTILIB here is wrong because
aarch64 (and riscv) could have MUTLILIB support just the options are
different. For aarch64, it would be -mabi=ilp32/-mabi=lp64 (riscv it
is more complex).

This most likely should be something more complex due to the above.
Maybe call it HOST_64_32 but even that seems wrong due to Aarch64
having ILP32 support and such.
What about HOST_64ABI_OPTS="-mabi=lp64"/HOST_32ABI_OPTS="-mabi=ilp32"
but  I am not sure if that would be enough to support RISCV which
requires two options.

Thanks,
Andrew Pinski

>
> Signed-off-by: Prathamesh Kulkarni <prathameshk@nvidia.com>
>
> Thanks,
> Prathamesh

  reply	other threads:[~2024-08-08 13:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-08 13:10 Prathamesh Kulkarni
2024-08-08 13:46 ` Andrew Pinski [this message]
2024-08-08 19:24   ` Thomas Schwinge
2024-08-12  7:50     ` Prathamesh Kulkarni
2024-08-13 15:47       ` Thomas Schwinge
2024-08-13 16:35         ` Richard Biener
2024-08-16 15:36           ` Prathamesh Kulkarni
2024-09-06  9:00             ` Thomas Schwinge
2024-09-09  6:31               ` Prathamesh Kulkarni
2024-09-09 15:19                 ` Thomas Schwinge
2024-09-10 13:22                   ` Prathamesh Kulkarni
2024-09-10 14:49                     ` Thomas Schwinge
2024-09-10 15:47                       ` Prathamesh Kulkarni
2024-08-19 11:46 ` Richard Biener

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='CA+=Sn1=MjVHYcNKF2CPr_FdFrN581QLrHT6Rjs5=ednOWHnPUw@mail.gmail.com' \
    --to=pinskia@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=prathameshk@nvidia.com \
    --cc=rguenther@suse.de \
    /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).