[Openmp-commits] [openmp] 382b975 - [OpenMP] Force the parallel abstraction to be inlined

Johannes Doerfert via Openmp-commits openmp-commits at lists.llvm.org
Wed Aug 23 11:48:33 PDT 2023


Author: Johannes Doerfert
Date: 2023-08-23T11:48:18-07:00
New Revision: 382b97554dd3e625a99bdaf3672f7f43ee6aef33

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

LOG: [OpenMP] Force the parallel abstraction to be inlined

This is good for performance and compile time and the indirection (+
switch statements) is nothing that needs to be preserved.

Added: 
    

Modified: 
    openmp/libomptarget/DeviceRTL/src/Parallelism.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/DeviceRTL/src/Parallelism.cpp b/openmp/libomptarget/DeviceRTL/src/Parallelism.cpp
index 9ff807038a99c4..1610b74fc78bc9 100644
--- a/openmp/libomptarget/DeviceRTL/src/Parallelism.cpp
+++ b/openmp/libomptarget/DeviceRTL/src/Parallelism.cpp
@@ -68,8 +68,10 @@ uint32_t determineNumberOfThreads(int32_t NumThreadsClause) {
 }
 
 // Invoke an outlined parallel function unwrapping arguments (up to 32).
-void invokeMicrotask(int32_t global_tid, int32_t bound_tid, void *fn,
-                     void **args, int64_t nargs) {
+__attribute__((always_inline)) void invokeMicrotask(int32_t global_tid,
+                                                    int32_t bound_tid, void *fn,
+                                                    void **args,
+                                                    int64_t nargs) {
   switch (nargs) {
 #include "generated_microtask_cases.gen"
   default:
@@ -82,9 +84,10 @@ void invokeMicrotask(int32_t global_tid, int32_t bound_tid, void *fn,
 
 extern "C" {
 
-void __kmpc_parallel_51(IdentTy *ident, int32_t, int32_t if_expr,
-                        int32_t num_threads, int proc_bind, void *fn,
-                        void *wrapper_fn, void **args, int64_t nargs) {
+__attribute__((always_inline)) void
+__kmpc_parallel_51(IdentTy *ident, int32_t, int32_t if_expr,
+                   int32_t num_threads, int proc_bind, void *fn,
+                   void *wrapper_fn, void **args, int64_t nargs) {
   uint32_t TId = mapping::getThreadIdInBlock();
 
   // Assert the parallelism level is zero if disabled by the user.


        


More information about the Openmp-commits mailing list