public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: Julian Brown <julian@codesourcery.com>,
	Marcel Vollweiler <marcel@codesourcery.com>
Cc: <gcc-patches@gcc.gnu.org>, Andrew Stubbs <ams@codesourcery.com>
Subject: Re: [PATCH] gcc/configure.ac: fix register issue for global_load assembler functions
Date: Mon, 14 Jun 2021 15:28:22 +0200	[thread overview]
Message-ID: <974716fa-185a-19f4-f8b5-adc555763233@codesourcery.com> (raw)
In-Reply-To: <20210614133654.0b5aae6f@squid.athome>

On 14.06.21 14:36, Julian Brown wrote:
> On Wed, 9 Jun 2021 16:47:21 +0200
> Marcel Vollweiler <marcel@codesourcery.com> wrote:
>> This patch fixes an issue with global_load assembler functions leading
>> to a "invalid operand for instruction" error since in different LLVM
>> versions those functions use either one or two registers.
> LLVM is neither forward- nor backward-compatible with regards to those
> registers then, I guess? That's unfortunate...
The old two-register variant was a bug – which was finally fixed, but it
broke the workaround.
>> In this patch a compatibility check is added to the configure.ac.
> The implementation of the solution looks fine, but I worry it's the
> wrong approach. What would someone packing GCC for a distribution use
> for the configuration setting? It'd mean having a dependency on the
> exact LLVM version for a given offloading-compiler build -- so LLVM
> couldn't be upgraded separately from the offloading compiler. Maybe
> that's OK in practice?

At the end, GCC uses 'as' which is a separate file – which in distros
is usually a symbolic link to the LLVM used in the system.

* Debian uses, https://salsa.debian.org/toolchain-team/gcc

ifneq (,$(filter $(distrelease),buster xenial bionic focal groovy))
   gcn_tools_llvm_version = 9
else ifneq (,$(filter $(distrelease),focal groovy))
   gcn_tools_llvm_version = 11
else
   gcn_tools_llvm_version = tools
endif

which is then used as
   ln -sf /usr/lib/llvm-$(gcn_tools_llvm_version)/bin/llvm-mc bin-gcn/as

Hence, for Debian it encodes the version and we should be fine.
(Not implying that the fixed version dependence is nice.)

* SUSE uses:
ln -s /usr/bin/llvm-mc target-tools/bin/amdgcn-amdhsa-as

I do not quickly see how SUSE solves the LLVM12 version issue.
Richard/Martin and Matthias can answer this better.

I know that for gcn, only, some GCC patches avoid issues like the
.section issue with LLVM 11 but I fail to see how those help with
the assembler problem.

> I wonder if the LLVM assembler has a macro system we could abuse
> instead?

as -defsym=MC_VERSION=`as -v|grep version|sed -e 's/.*version //'` ? ;-)

> Perhaps not. Or another (very ugly) alternative that would work
> with either assembler is giving up and emitting the instruction bit
> patterns directly (as we have done elsewhere for certain "SCC"-setting
> instructions).
Tobias
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf

  reply	other threads:[~2021-06-14 13:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09 14:47 Marcel Vollweiler
2021-06-14 12:36 ` Julian Brown
2021-06-14 13:28   ` Tobias Burnus [this message]
2021-06-14 14:26   ` Andrew Stubbs
2021-06-14 15:28   ` Julian Brown
2021-06-16  9:34 ` Marcel Vollweiler
2021-06-16 16:01   ` Julian Brown
2021-06-16 17:19     ` Joseph Myers
2021-06-17 13:50       ` Marcel Vollweiler
2021-06-17 20:31         ` Joseph Myers

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=974716fa-185a-19f4-f8b5-adc555763233@codesourcery.com \
    --to=tobias@codesourcery.com \
    --cc=ams@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=julian@codesourcery.com \
    --cc=marcel@codesourcery.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).