public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Stubbs <ams@baylibre.com>
To: Tobias Burnus <tburnus@baylibre.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	Thomas Schwinge <tschwinge@baylibre.com>,
	Jakub Jelinek <jakub@redhat.com>
Subject: Re: [patch] [gcn][nvptx] Add warning to mkoffload for 32bit host code
Date: Thu, 25 Apr 2024 16:07:53 +0100	[thread overview]
Message-ID: <33b46e95-20fa-42a0-b426-1fe69146a4e4@baylibre.com> (raw)
In-Reply-To: <575ee46d-748c-4f2c-8f24-1ec71155ec9e@baylibre.com>

On 25/04/2024 11:51, Tobias Burnus wrote:
> Motivated by a surprise of a colleague that with -m32,
> no offload dumps were created; that's because mkoffload
> does not process host binaries when the are 32bit (i.e. ilp32).
> 
> Internally, that done as follows: The host compiler passes to
> 'mkoffload' the used host ABI, i.e. -foffload-abi=ilp32 or -foffload-abi=lp64
> 
> That's done via TARGET_OFFLOAD_OPTIONS, which is supported by aarch64, i386, and rs6000.
> 
> While it is sensible (albeit not strictly required) that GCC requires that
> the host and device side agree and that only 64bit is implemented for the
> device side, it can be confusing that silently no offloading code is generated.
> 
> 
> Hence, I propose to print a warning in that case - as implemented in the attached patch:
> 
> $ gcc -fopenmp -m32 test.c
> nvptx mkoffload: warning: offload code generation skipped: offloading with 32-bit host code is currently not supported
> gcn mkoffload: warning: offload code generation skipped: offloading with 32-bit host code is currently not supported
> 
> * * *
> 
> This shouldn't have any effect on offload builds using -m64
> and non-offload builds – while several testcases already have
> issues with '-m32' when offloading is enabled or an offloading
> device is available.
> 
> To make it not worse, this patch adds some pruning and for
> a subset of the failing testcases, I added code to avoids FAILS.
> There are some more fails, but those aren't new.
> 
> Comments, remarks, suggestions?
> Is the mkoffload.cc part is okay?

The mkoffload part looks reasonable to me. I'm not sure if there are 
other ABIs we might want to warn about, but this is definitely an 
improvement.

Andrew

      reply	other threads:[~2024-04-25 15:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-25 10:51 Tobias Burnus
2024-04-25 15:07 ` Andrew Stubbs [this message]

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=33b46e95-20fa-42a0-b426-1fe69146a4e4@baylibre.com \
    --to=ams@baylibre.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=tburnus@baylibre.com \
    --cc=tschwinge@baylibre.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).