llvm-project
f6ba2138 - [clang] Fix inconsistencies with the device_kernel attr on different targets (#161905)

Commit
86 days ago
[clang] Fix inconsistencies with the device_kernel attr on different targets (#161905) The original [change](https://github.com/llvm/llvm-project/pull/137882) unifying the device kernel attributes had some inexplicable behavior, such as `amdgpu_kernel` resulting in a function ending up with the `spir_kernel` CC but `nvptx_kernel` not doing the same, both cases compiling for SPIR. There was also a [crash](https://github.com/llvm/llvm-project/issues/161077). `sycl_kernel` is now separated out from `device_kernel`, but still there was some weird behavior for the remaining spellings. For the target-specific spellings (`nvptx_kernel` and `amdgpu_kernel`), while not technically required, we warn and ignore the attribute if the spelling doesn't match the target because it's weird from the user's point of view to allow it. Also we make sure that any valid usage actually applies the CC to the generated `llvm:Function`. This worked for `NVPTX` already but was missing for `SPIR/SPIR-V` and `AMDGPU`, it needs to be explicitly done in `TargetInfo`. This allows us to remove the `amdgpu_kernel` specific handing we had. That special handling was previously required because it was the only variation that was allowed on a type, and thus had a separate way to propagate the CC. These issues were reported [here](https://github.com/llvm/llvm-project/issues/161077) and [here](https://github.com/llvm/llvm-project/pull/161349). Closes: https://github.com/llvm/llvm-project/issues/161077 --------- Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
Author
Parents
Loading