https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97102

            Bug ID: 97102
           Summary: [nvptx] PTX JIT compilation failed when using aliases
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: openmp
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: vries at gcc dot gnu.org
  Target Milestone: ---

[Found when testing a patch for PR96390, which works with GCN offloading but
not with nvptx]

When compiling the following with -fopenmp
--------------------------------------
#pragma omp declare target
int foo () { return 42; }
int bar () __attribute__((alias ("foo")));
#pragma omp end declare target

int
main ()
{
  int n;
  #pragma omp target map(from:n)
    n = bar ();
  if (n != 42)
    __builtin_abort ();
}
--------------------------------------

it fails with when running with:

libgomp: Link error log ptxas application ptx input, line 89; error   : Label
expected for argument 0 of instruction 'call'
ptxas application ptx input, line 89; fatal   : Call target not recognized
ptxas fatal   : Ptx assembly aborted due to errors

libgomp: cuLinkAddData (ptx_code) error: a PTX JIT compilation failed


The generated PTX has:
------------
// BEGIN GLOBAL FUNCTION DECL: foo
.visible .func (.param.u32 %value_out) foo;

// BEGIN GLOBAL FUNCTION DEF: foo
.visible .func (.param.u32 %value_out) foo
{
        .reg.u32 %value;
        .reg.u32 %r22;
        .reg.u32 %r23;
                mov.u32 %r22, 42;
                mov.u32 %r23, %r22;
                mov.u32 %value, %r23;
        st.param.u32    [%value_out], %value;
        ret;
}
...
call (%value_in), bar;
------

Namely: 'bar' only appears in the call.

Reply via email to