[Openmp-commits] [openmp] e0b713a - [libomptarget] [amdgpu] Change default number of teams per computation unit

Dhruva Chakrabarti via Openmp-commits openmp-commits at lists.llvm.org
Tue Jun 29 15:35:09 PDT 2021


Author: Dhruva Chakrabarti
Date: 2021-06-29T15:34:35-07:00
New Revision: e0b713a0357aa31ef906111115d4e881503e56ba

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

LOG: [libomptarget] [amdgpu] Change default number of teams per computation unit

This patch is related to https://reviews.llvm.org/D98832. Based on discussions there, I decided to separate out the teams default as this patch. This change is to increase the number of teams per computation unit so as to provide more wavefronts for hiding latency. This change improves performance for some programs, including 20-50% for some Stream benchmarks.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D99003

Added: 
    

Modified: 
    openmp/libomptarget/plugins/amdgpu/src/rtl.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp b/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
index aaa68121db105..be64ed2bbfa41 100644
--- a/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
+++ b/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
@@ -70,6 +70,10 @@ hostrpc_assign_buffer(hsa_agent_t, hsa_queue_t *, uint32_t device_id) {
 }
 }
 
+// Heuristic parameters used for kernel launch
+// Number of teams per CU to allow scheduling flexibility
+static const unsigned DefaultTeamsPerCU = 4;
+
 int print_kernel_trace;
 
 #ifdef OMPTARGET_DEBUG
@@ -1083,7 +1087,7 @@ int32_t __tgt_rtl_init_device(int device_id) {
        DeviceInfo.EnvNumTeams);
   } else {
     char *TeamsPerCUEnvStr = getenv("OMP_TARGET_TEAMS_PER_PROC");
-    int TeamsPerCU = 1; // default number of teams per CU is 1
+    int TeamsPerCU = DefaultTeamsPerCU;
     if (TeamsPerCUEnvStr) {
       TeamsPerCU = std::stoi(TeamsPerCUEnvStr);
     }


        


More information about the Openmp-commits mailing list