<div dir="ltr">The code appended compiles to a single kernel. It uses the data mapping logic. The kernel that expects one argument gets invoked by cuda's rtl with two arguments. That looks wrong to me.<div><br></div><div>Is this a deliberate feature of target mapper, and if not, can anyone point me to roughly where to start looking?<div><br></div><div>Thanks,</div><div><br></div><div>Jon</div><div><div><br></div><div>Trailing test ompiled with:</div><div>~/llvm/bin/clang++  -O2  -target x86_64-pc-linux-gnu -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target=nvptx64-nvidia-cuda -march=sm_50  test.cpp -o test -L/usr/local/cuda/targets/x86_64-linux/lib -lcudart -save-temps<br></div><div><br></div><div>This errors because __dummy.omp_offloading.entry isn't marked weak, but ignoring that error for now because we still get the temp files out,</div><div><br></div><div>The device kernel has one argument:</div><div>llvm-dis test-openmp-nvptx64-nvidia-cuda.bc -o - | grep __omp_offloading<br></div><div><br></div><div>define weak void @__omp_offloading_802_9c0dba_main_l23([10 x i32*]* nonnull align 8 dereferenceable(80) %0) % <- one argument<br></div><div><br></div><div>It is passed to tgt_target_mapper, </div><div>llvm-dis test-host-x86_64-pc-linux-gnu.bc -o - | grep __omp_offloading<br></div><div>call i32 @__tgt_target_mapper(i64 -1, i8* @.__omp_offloading_802_9c0dba_main_l23.region_id, i32 2, <- arg num here ...)<br></div><div><br></div><div><br></div><div>// Smallest example from aomp's test suite that hits this case</div><div>#include <stdio.h><br>#include <omp.h><br>#include <stdint.h><br><br>#define N 640<br>#define C 64<br>#define P 10<br><br>int A[N];<br>int *p[P];<br><br>int main()<br>{<br>  int i;<br>  for(i=0; i<N; i++) A[i] = i;<br>  for(i=0; i<P; i++) p[i] = &A[i*C];<br><br>  #pragma omp target enter data map(to: A) map(alloc: p)<br>  for(i=0; i<P; i++) {<br>    #pragma omp target enter data map(alloc: p[i][0:C])<br>  }<br><br>  #pragma omp target map(alloc: A, p)<br>  {<br>    int i, j;<br>    for(i=0; i<P; i++) {<br>      for(j=0; j<C; j++) {<br>        p[i][j]++;<br>      }<br>    }<br>  }<br><br>  #pragma omp target update from( A)<br><br>  int error = 0;<br>  for(i=0; i<N; i++) {<br>    if (A[i] != i+1) printf("%4d: got %d, expected %d, error %d\n", i, A[i], i+1, ++error);<br>  }<br>  printf("completed TEST ARRAY with %d errors\n", error);<br><br>  return (error == 0)?0:1;<br>}<br></div></div></div></div>