llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[OpenMP] `-Xopenmp-target=<triple> <arg>` does not pass `<arg>` to `<triple>`

Open AntonRydahl opened this issue 3 years ago • 4 comments

I don't know if this is the desired behavior, but I tried to pass -verify to the offloading toolchain. With -Xopenmp-target -verify I got the warning argument unused during compilation: '-Xopenmp-target -verify'. I instead tried to pass it as -Xopenmp-target=amdgcn-amd-amdhsa -verify to pass it to the offloading toolchain, and while the warning was not emitted, the -verify argument was also not passed to the offloading toolchain when compiling for an amdgcn-amd-amdhsa target. Is this the expected behavior?

AntonRydahl avatar Aug 02 '23 19:08 AntonRydahl

A small update: One can for instance pass -fopenmp-simd or -Werror to the device with -Xopenmp-target=<triple>.

AntonRydahl avatar Aug 02 '23 20:08 AntonRydahl

@llvm/issue-subscribers-openmp

I don't know if this is the desired behavior, but I tried to pass `-verify` to the offloading toolchain. With `-Xopenmp-target -verify` I got the warning `argument unused during compilation: '-Xopenmp-target -verify'`. I instead tried to pass it as `-Xopenmp-target=amdgcn-amd-amdhsa -verify` to pass it to the offloading toolchain, and while the warning was not emitted, the `-verify` argument was also not passed to the offloading toolchain when compiling for an `amdgcn-amd-amdhsa` target. Is this the expected behavior?

llvmbot avatar Sep 20 '23 13:09 llvmbot

@llvm/issue-subscribers-clang-driver

I don't know if this is the desired behavior, but I tried to pass `-verify` to the offloading toolchain. With `-Xopenmp-target -verify` I got the warning `argument unused during compilation: '-Xopenmp-target -verify'`. I instead tried to pass it as `-Xopenmp-target=amdgcn-amd-amdhsa -verify` to pass it to the offloading toolchain, and while the warning was not emitted, the `-verify` argument was also not passed to the offloading toolchain when compiling for an `amdgcn-amd-amdhsa` target. Is this the expected behavior?

llvmbot avatar Sep 20 '23 13:09 llvmbot

I'm pretty sure -verify is a CC1 option, meaning you need to pass it with -Xclang. However, using -Xopenmp-target or -Xarch_device both cannot forward options requiring arguments. E.g., the following doesn't work clang foo.c -Xarch_device -Xclang -Xarch_device -verify. Your best bet for now is probably to use -### to get the list of options that clang would generate and put it into a script, then add the desired option.

jhuber6 avatar Sep 20 '23 13:09 jhuber6