Issue Compiling using Clang14.x with OpenMP Offloading

Hello all,

Any OpenMP offloading program with schedule(auto) clause does not compile successfully with the latest LLVM-CLANG(14.x) version. However replacing the same with schedule(static) works without any errors. It did not show any such issues with previous versions.

Everytime schedule(auto) clause is used in the program below error is observed. Please look into the issue and help us solve it.

ptxas fatal   : Ptx assembly aborted due to errors
clang-14: error: ptxas command failed with exit code 255 (use -v to see invocation)
clang version 14.0.1 (https://github.com/llvm/llvm-project.git 0e27d08cdeb338766a477fba071b3df7a06ea6e2)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Example usage in the program that throws the above error

#pragma omp target teams distribute parallel for schedule(auto) 

Please let us know how to solve the issue.
Thank You
Rama

Hi Rama,

it is generally more helpful to provide actual reproducers. The error you show is also only the “tail” part which does not mention what went wrong, just that something did.

I tried to reproduce this quickly but failed. Can you add code that can be compiled and causes the issue? Also, feel free to open github issues for such bugs.

Finally, there is most likely no benefit from auto on the GPU right now. Still should work though.

~ Johannes

Hello Johannes,

You could try compiling the below code

int main()                                                                      
{                                                                               
#pragma omp target teams distribute parallel for schedule(auto)                 
  for(int i=0; i<1000; i++)                                                     
  {}                                                                            
  return 0;                                                                     
}

I compile it using the below command

clang -fopenmp -fopenmp-targets=nvptx64 -Xopenmp-target -march=sm_70 -o test test.c

Below is the complete error observed

ptxas /tmp/test-f7e4d8.s, line 266; error : Module-scoped variables in .local state space are not allowed with ABI
ptxas fatal : Ptx assembly aborted due to errors
clang-14: **error: ptxas command failed with exit code 255 (use -v to see invocation)**
clang version 14.0.1 (https://github.com/llvm/llvm-project.git 0e27d08cdeb338766a477fba071b3df7a06ea6e2)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang-14: **note:** diagnostic msg: Error generating preprocessed source(s).

Thank you
Rama

-O2/3 will fix this.
In general I would not recommend -O0 for OpenMP GPU code, unfortunately O1 isn’t enough here either.

We’ll look into this eventually, feel free to open an issue to track progress.

~ Johannes

1 Like