On 14.06.21 14:36, Julian Brown wrote:
On Wed, 9 Jun 2021 16:47:21 +0200
Marcel Vollweiler <mar...@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 via email to