[PATCH] D149028: [Clang] Always pass `-fconvergent-functions` for GPU targets

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 23 12:37:13 PDT 2023


jhuber6 created this revision.
jhuber6 added reviewers: JonChesterfield, jdoerfert, tianshilei1992, tra, yaxunl.
Herald added a subscriber: kosarev.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

GPU targets like `nvptx64-nvidia-cuda` and `amdgcn-amd-amdhsa` require
that we have convergent functions on. Currently we apply this to all the
offloading languages, but this patch applies it based on the triple
directly. This is so users can specify `--target=nvptx64-nvidia-cuda`
and get this behaviour as an implementation detail of the architecture.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149028

Files:
  clang/lib/Frontend/CompilerInvocation.cpp


Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -3737,7 +3737,7 @@
     && Opts.OpenCLVersion == 200);
 
   Opts.ConvergentFunctions = Opts.OpenCL || (Opts.CUDA && Opts.CUDAIsDevice) ||
-                             Opts.SYCLIsDevice ||
+                             Opts.SYCLIsDevice || T.isNVPTX() || T.isAMDGPU() ||
                              Args.hasArg(OPT_fconvergent_functions);
 
   Opts.NoBuiltin = Args.hasArg(OPT_fno_builtin) || Opts.Freestanding;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149028.516197.patch
Type: text/x-patch
Size: 626 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230423/9f5fdc45/attachment.bin>


More information about the cfe-commits mailing list