From e0b713a0357aa31ef906111115d4e881503e56ba Mon Sep 17 00:00:00 2001 From: Dhruva Chakrabarti Date: Tue, 29 Jun 2021 15:07:57 -0700 Subject: [PATCH] [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 --- openmp/libomptarget/plugins/amdgpu/src/rtl.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp b/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp index aaa6812..be64ed2 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); } -- 2.7.4