Hi Salvatore,

Salvatore Filippone wrote:
I am stuck by a strange problem when compiling with
          -fopenacc   -foffload=nvptx-none=-march=sm_75
a code that used to work until relatively recently, is now sistematically throwing the following (or similar) error:
libgomp: Cannot map target functions or variables (expected 25, have 20)

In order to associated global variables on the device
with those on the host ('acc declare') and, likewise,
for running compute regions – which internally are
split-off into functions, GCC uses a table on the
host and on the device to find the other side.

Namely, if the compute region is entry 123 on the host,
we know that we have to launch the offload kernel which
is entry 123 on the device.

The error message you got implies that this fails for
some reason as some table has too many/too few entries.

The question is only why?

* * *

We found - and solved - a couple of those issues over
the time; there might be more.

Let's that with the following questions:

* What GCC version do you have (I guess a fairly recent one,
  but still for completeness)

* What version of Binutils / 'ld' do you have? ("ld --version")

I know that one large failure was fixed in the following commit
on the Binutils side:

b21318bd2c2 Add LDPT_REGISTER_CLAIM_FILE_HOOK_V2 linker plugin hook [GCC 
PR109128]
  (May 11, 2023) / https://gcc.gnu.org/PR109128
and an associated GCC change.

More recently (mid 2024), another fix was done.
On the GCC side, r15-3135-gcb51e0b236c7d4 is a follow up issue fix:
  lto: Don't check obj.found for offload section
  (Aug 23, 2024) / https://gcc.gnu.org/PR116361

But it also has a Binutils side, cf.
https://sourceware.org/bugzilla/show_bug.cgi?id=32083

I have not checked in which Binutils version those two fixes went.

Tobias

Reply via email to