[Openmp-commits] [PATCH] D105644: [libomptarget][nfc][devicertl] Split execution params

Jon Chesterfield via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Jul 8 10:52:45 PDT 2021


JonChesterfield created this revision.
JonChesterfield added reviewers: jdoerfert, tianshilei1992, jhuber6, carlo.bertolli.
JonChesterfield requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

Use two uint16_t shared variables in place of one uint32_t
Intended to simplify load/store propagation, as part of working out
why some dead branches remain in spmd kernels.

Uses uint16_t as there are no existing uint8_t shared variables.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105644

Files:
  openmp/libomptarget/deviceRTLs/common/omptarget.h
  openmp/libomptarget/deviceRTLs/common/src/omp_data.cu
  openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
  openmp/libomptarget/deviceRTLs/common/src/support.cu
  openmp/libomptarget/deviceRTLs/common/support.h


Index: openmp/libomptarget/deviceRTLs/common/support.h
===================================================================
--- openmp/libomptarget/deviceRTLs/common/support.h
+++ openmp/libomptarget/deviceRTLs/common/support.h
@@ -22,17 +22,14 @@
 enum ExecutionMode {
   Spmd = 0x00u,
   Generic = 0x01u,
-  ModeMask = 0x01u,
 };
 
 enum RuntimeMode {
   RuntimeInitialized = 0x00u,
   RuntimeUninitialized = 0x02u,
-  RuntimeMask = 0x02u,
 };
 
 void setExecutionParameters(ExecutionMode EMode, RuntimeMode RMode);
-bool isGenericMode();
 bool isRuntimeUninitialized();
 bool isRuntimeInitialized();
 
Index: openmp/libomptarget/deviceRTLs/common/src/support.cu
===================================================================
--- openmp/libomptarget/deviceRTLs/common/src/support.cu
+++ openmp/libomptarget/deviceRTLs/common/src/support.cu
@@ -20,19 +20,13 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 void setExecutionParameters(ExecutionMode EMode, RuntimeMode RMode) {
-  execution_param = EMode;
-  execution_param |= RMode;
+  executionMode = EMode;
+  runtimeMode = RMode;
 }
 
-bool isGenericMode() { return (execution_param & ModeMask) == Generic; }
+bool isRuntimeUninitialized() { return runtimeMode == RuntimeUninitialized; }
 
-bool isRuntimeUninitialized() {
-  return (execution_param & RuntimeMask) == RuntimeUninitialized;
-}
-
-bool isRuntimeInitialized() {
-  return (execution_param & RuntimeMask) == RuntimeInitialized;
-}
+bool isRuntimeInitialized() { !isRuntimeUninitialized(); }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Execution Modes based on location parameter fields
Index: openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
===================================================================
--- openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
+++ openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
@@ -161,8 +161,6 @@
 }
 
 // Return true if the current target region is executed in SPMD mode.
-EXTERN int8_t __kmpc_is_spmd_exec_mode() {
-  return (execution_param & ModeMask) == Spmd;
-}
+EXTERN int8_t __kmpc_is_spmd_exec_mode() { return executionMode == Spmd; }
 
 #pragma omp end declare target
Index: openmp/libomptarget/deviceRTLs/common/src/omp_data.cu
===================================================================
--- openmp/libomptarget/deviceRTLs/common/src/omp_data.cu
+++ openmp/libomptarget/deviceRTLs/common/src/omp_data.cu
@@ -55,7 +55,8 @@
 ////////////////////////////////////////////////////////////////////////////////
 // OpenMP kernel execution parameters
 ////////////////////////////////////////////////////////////////////////////////
-uint32_t SHARED(execution_param);
+uint16_t SHARED(executionMode);
+uint16_t SHARED(runtimeMode);
 
 ////////////////////////////////////////////////////////////////////////////////
 // Scratchpad for teams reduction.
Index: openmp/libomptarget/deviceRTLs/common/omptarget.h
===================================================================
--- openmp/libomptarget/deviceRTLs/common/omptarget.h
+++ openmp/libomptarget/deviceRTLs/common/omptarget.h
@@ -296,7 +296,9 @@
 extern omptarget_nvptx_ThreadPrivateContext *
     EXTERN_SHARED(omptarget_nvptx_threadPrivateContext);
 
-extern uint32_t EXTERN_SHARED(execution_param);
+extern uint16_t EXTERN_SHARED(executionMode);
+extern uint16_t EXTERN_SHARED(runtimeMode);
+
 extern void *EXTERN_SHARED(ReductionScratchpadPtr);
 
 ////////////////////////////////////////////////////////////////////////////////


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105644.357279.patch
Type: text/x-patch
Size: 3565 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210708/7f2c54c9/attachment.bin>


More information about the Openmp-commits mailing list