[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
This commit is contained in:
Dhruva Chakrabarti 2021-06-29 15:07:57 -07:00
parent 21e013303b
commit e0b713a035
1 changed files with 5 additions and 1 deletions

View File

@ -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);
}