Sorry, I had not seen that this was entirely within my amdgcn remit....
On 12/01/2022 09:43, Marcel Vollweiler wrote:
Hi,
Currently omp_get_device_num does not work on gcn targets with more than
one offload device. The reason is that GOMP_DEVICE_NUM_VAR is static in
icv-device.c and thus "__gomp_device_num" is not visible in the offload
image.
This patch removes "static" such that "__gomp_device_num" is now part of
the offload image and can now be found in GOMP_OFFLOAD_load_image in the
plugin.
To be clear, omp_get_device_num doesn't work correctly with any number
of offload devices. It so happens that the uninitialized value (zero) is
the correct answer on the first device so the failure was hidden on
single-device machines.
This is not an issue for nvptx. There, "__gomp_device_num" is in the
offload image even with "static".
This is probably related to the unusual way PTX files are "linked".
The patch was tested on x86_64-linux with amdgcn offloading with no
regressions.
OK to commit. I know this isn't a regression, but it's a silly bug in a
new feature on a secondary target, so I think we can have this in stage 4.
Andrew
P.S. Like Thomas says, the static can probably be safely removed in the
NVPTX file also, but then I think you're planning to unify the two files
in any case?