[PATCH] D155850: [Clang][CodeGen][RFC] Add codegen support for C++ Parallel Algorithm Offload

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 21 08:28:34 PDT 2023


yaxunl added a comment.

Since we need to support -O0, we need to be prepared that we may not be able to remove all the calls of unsupported functions even though they may never be called at run time.

We could simply replace them with traps in the middle end. This should work if such functions are not called at run time. The only issue is that if they are called at run time, how do we tell users that they used unsupported functions and where. A trap does not help since it only crashes the program without useful information.

We could emit calls of any unsupported functions as calls of `__clang_unsupported(file_name, line_number, function_name)`.

In the middle-end pass where we eliminate functions not referenced by kernels, we could emit reports about calls of `__clang_unsupported` under a certain -R option. We could turn on that option for `-stdpar` in clang driver.

We can emit printf of file_name, line_number and function_name for the first active lane then emit trap for a call of `__clang_unsupported(file_name, line_number, function_name)` under an option in the middle-end pass to facilitate users debugging their code.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155850/new/

https://reviews.llvm.org/D155850



More information about the cfe-commits mailing list