[libc-commits] [libc] e3d2a7d - [libc] Compile the GPU functions with '-fconvergent-functions' (#70229)

via libc-commits libc-commits at lists.llvm.org
Wed Oct 25 12:13:25 PDT 2023


Author: Joseph Huber
Date: 2023-10-25T14:13:21-05:00
New Revision: e3d2a7d0a51b7836d70e580aaf1b08ea5da45a3b

URL: https://github.com/llvm/llvm-project/commit/e3d2a7d0a51b7836d70e580aaf1b08ea5da45a3b
DIFF: https://github.com/llvm/llvm-project/commit/e3d2a7d0a51b7836d70e580aaf1b08ea5da45a3b.diff

LOG: [libc] Compile the GPU functions with '-fconvergent-functions' (#70229)

Summary:
This patch simply adds the `-fconvergent-functions` flag to the GPU
compilation. This is in relation to the behaviour of SIMT
architectures under divergence. With the flag, we assume every function
is convergent by default and rely on the compiler's divergence analysis
to transform it if possible.

Fixes: https://github.com/llvm/llvm-project/issues/63853

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCObjectRules.cmake

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index 7caa3b2db75dd2f..cf5097e23a20453 100644
--- a/libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -68,6 +68,7 @@ function(_get_common_compile_options output_var flags)
   if (LIBC_TARGET_ARCHITECTURE_IS_GPU)
     list(APPEND compile_options "-nogpulib")
     list(APPEND compile_options "-fvisibility=hidden")
+    list(APPEND compile_options "-fconvergent-functions")
 
     # Manually disable all standard include paths and include the resource
     # directory to prevent system headers from being included.


        


More information about the libc-commits mailing list