@@ -61,7 +61,7 @@ static std::tuple<int32_t, int32_t> readTeamsThreadLimit() {
6161 int32_t ThreadLimit;
6262 ThreadLimit = omp_get_teams_thread_limit ();
6363 DP (" omp_get_teams_thread_limit() returned %" PRId32 " \n " , ThreadLimit);
64- // omp_get_thread_limit () would return INT_MAX by default.
64+ // omp_get_teams_thread_limit () would return INT_MAX by default.
6565 // NOTE: Windows.h defines max() macro, so we have to guard
6666 // the call with parentheses.
6767 ThreadLimit =
@@ -406,21 +406,12 @@ int32_t L0KernelTy::getGroupsShape(L0DeviceTy &Device, int32_t NumTeams,
406406 const auto DeviceId = Device.getDeviceId ();
407407 const auto &KernelPR = getProperties ();
408408
409- // Detect if we need to reduce available HW threads. We need this adjustment
410- // on XeHPG when L0 debug is enabled (ZET_ENABLE_PROGRAM_DEBUGGING=1).
411- static std::once_flag OnceFlag;
412- static bool ZeDebugEnabled = false ;
413- std::call_once (OnceFlag, []() {
414- const char *EnvVal = std::getenv (" ZET_ENABLE_PROGRAM_DEBUGGING" );
415- if (EnvVal && std::atoi (EnvVal) == 1 )
416- ZeDebugEnabled = true ;
417- });
418-
419409 // Read the most recent global thread limit and max teams.
420410 auto [NumTeamsICV, ThreadLimitICV] = readTeamsThreadLimit ();
421411
422412 bool IsXeHPG = Device.isDeviceArch (DeviceArchTy::DeviceArch_XeHPG);
423- bool HalfNumThreads = ZeDebugEnabled && IsXeHPG;
413+ bool HalfNumThreads =
414+ LevelZeroPluginTy::getOptions ().ZeDebugEnabled && IsXeHPG;
424415 uint32_t KernelWidth = KernelPR.Width ;
425416 uint32_t SIMDWidth = KernelPR.SIMDWidth ;
426417 INFO (OMP_INFOTYPE_PLUGIN_KERNEL, DeviceId,
0 commit comments