[Bug 2060619] [NEW] gcc-14 offload support for amd gfx103x and gfx110x gpus is broken
oscarbg
2060619 at bugs.launchpad.net
Tue Apr 9 06:22:00 UTC 2024
Public bug reported:
Hi,
for context bug was posted here first:
https://github.com/gcc-mirror/gcc/commit/1bf18629c54adf4893c8db5227a36e1952ee69a3#commitcomment-140648051
gcc Andrew Stubbs author mentions:
"Yes, it looks like the libgomp device-side library is missing. Probably not listed in the packaging script?"
using gcc-14:
gcc-14 --version
gcc-14 (Ubuntu 14-20240330-1ubuntu2) 14.0.1 20240330 (experimental) [master r14-9728-g6fc84f680d0]
using the code posted below as sum.c
testing building with offload support on gfx1036:
gcc-14 -fopenmp -foffload=amdgcn-amdhsa -foffload-options=-march=gfx1036
-fcf-protection=none sum.c -o sumamd1030.exe
fails with:
ld: error: incompatible mach: /usr/lib/gcc/x86_64-linux-gnu/14/accel/amdgcn-amdhsa/libgomp.a(parallel.o)
collect2: error: ld returned 1 exit status
gcn mkoffload: fatal error: x86_64-linux-gnu-accel-amdgcn-amdhsa-gcc-14 returned 1 exit status
compilation terminated.
lto-wrapper: fatal error: /usr/libexec/gcc/x86_64-linux-gnu/14//accel/amdgcn-amdhsa/mkoffload returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
instead selecting gfx900 works:
gcc-14 -fopenmp -foffload=amdgcn-amdhsa -foffload-options=-march=gfx900 -fcf-protection=none sum.c -o sumamd900.exe
note gfx103x and gfx11xx targets are new to GCC-14..
inspecting files seems the error is due to package
gcc-14-offload-amdgcn_14-20240330-1ubuntu2_amd64.deb
missing libgomp.so files in
\usr\lib\gcc\x86_64-linux-gnu\14\accel\amdgcn-amdhsa\gfx1036 folder
but having this file in gfx9xx folders for ex:
\usr\lib\gcc\x86_64-linux-gnu\14\accel\amdgcn-amdhsa\gfx906 folder
code used:
sum.c:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <omp.h>
int main(int argc, char *argv[]) {
long long int j, largeN;
double sum = 0.0;
clock_t tstart, tend;
int num_dev;
num_dev = omp_get_num_devices();
printf("%d\n", num_dev);
largeN = (long long int) atoll(argv[1]);
printf("Large Number = %lld\n", largeN);
tstart = clock();
#pragma omp parallel for private(j) reduction(+:sum)
for(j=1; j<largeN; j++) {
sum += (double) (1.0/j);
}
tend = clock();
printf("Sum [1, ... , %lld] = %.6f\n", largeN, sum);
printf("\nCompleted in %.2f seconds%45s\n\n", ( (double) (tend - tstart) ) / CLOCKS_PER_SEC, "");
sum = 0.0;
tstart = clock();
#pragma omp target map(to:largeN) map(tofrom:sum)
#pragma omp parallel for simd private(j) reduction(+:sum)
for (j=1; j<largeN; j++) {
sum += (double) (1.0/j);
}
tend = clock();
printf("Sum [1, ... , %lld] = %.6f\n", largeN, sum);
printf("\nCompleted in %.2f seconds%45s\n\n", ( (double) (tend - tstart) ) / CLOCKS_PER_SEC, "");
return(0);
}
** Affects: gcc-14 (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-14 in Ubuntu.
https://bugs.launchpad.net/bugs/2060619
Title:
gcc-14 offload support for amd gfx103x and gfx110x gpus is broken
Status in gcc-14 package in Ubuntu:
New
Bug description:
Hi,
for context bug was posted here first:
https://github.com/gcc-mirror/gcc/commit/1bf18629c54adf4893c8db5227a36e1952ee69a3#commitcomment-140648051
gcc Andrew Stubbs author mentions:
"Yes, it looks like the libgomp device-side library is missing. Probably not listed in the packaging script?"
using gcc-14:
gcc-14 --version
gcc-14 (Ubuntu 14-20240330-1ubuntu2) 14.0.1 20240330 (experimental) [master r14-9728-g6fc84f680d0]
using the code posted below as sum.c
testing building with offload support on gfx1036:
gcc-14 -fopenmp -foffload=amdgcn-amdhsa -foffload-
options=-march=gfx1036 -fcf-protection=none sum.c -o sumamd1030.exe
fails with:
ld: error: incompatible mach: /usr/lib/gcc/x86_64-linux-gnu/14/accel/amdgcn-amdhsa/libgomp.a(parallel.o)
collect2: error: ld returned 1 exit status
gcn mkoffload: fatal error: x86_64-linux-gnu-accel-amdgcn-amdhsa-gcc-14 returned 1 exit status
compilation terminated.
lto-wrapper: fatal error: /usr/libexec/gcc/x86_64-linux-gnu/14//accel/amdgcn-amdhsa/mkoffload returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
instead selecting gfx900 works:
gcc-14 -fopenmp -foffload=amdgcn-amdhsa -foffload-options=-march=gfx900 -fcf-protection=none sum.c -o sumamd900.exe
note gfx103x and gfx11xx targets are new to GCC-14..
inspecting files seems the error is due to package
gcc-14-offload-amdgcn_14-20240330-1ubuntu2_amd64.deb
missing libgomp.so files in
\usr\lib\gcc\x86_64-linux-gnu\14\accel\amdgcn-amdhsa\gfx1036 folder
but having this file in gfx9xx folders for ex:
\usr\lib\gcc\x86_64-linux-gnu\14\accel\amdgcn-amdhsa\gfx906 folder
code used:
sum.c:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <omp.h>
int main(int argc, char *argv[]) {
long long int j, largeN;
double sum = 0.0;
clock_t tstart, tend;
int num_dev;
num_dev = omp_get_num_devices();
printf("%d\n", num_dev);
largeN = (long long int) atoll(argv[1]);
printf("Large Number = %lld\n", largeN);
tstart = clock();
#pragma omp parallel for private(j) reduction(+:sum)
for(j=1; j<largeN; j++) {
sum += (double) (1.0/j);
}
tend = clock();
printf("Sum [1, ... , %lld] = %.6f\n", largeN, sum);
printf("\nCompleted in %.2f seconds%45s\n\n", ( (double) (tend - tstart) ) / CLOCKS_PER_SEC, "");
sum = 0.0;
tstart = clock();
#pragma omp target map(to:largeN) map(tofrom:sum)
#pragma omp parallel for simd private(j) reduction(+:sum)
for (j=1; j<largeN; j++) {
sum += (double) (1.0/j);
}
tend = clock();
printf("Sum [1, ... , %lld] = %.6f\n", largeN, sum);
printf("\nCompleted in %.2f seconds%45s\n\n", ( (double) (tend - tstart) ) / CLOCKS_PER_SEC, "");
return(0);
}
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-14/+bug/2060619/+subscriptions
More information about the foundations-bugs
mailing list