@@ -664,23 +664,17 @@ pi_result piPlatformsGet(pi_uint32 NumEntries, pi_platform *Platforms,
664
664
665
665
std::lock_guard<std::mutex> Lock (*PiPlatformsCacheMutex);
666
666
if (!PiPlatformCachePopulated) {
667
- // We will retrieve the Max CommandList Cache in this lamda function so that
668
- // it only has to be executed once
669
- static pi_uint32 CommandListCacheSizeValue = ([] {
670
- const char *CommandListCacheSize =
671
- std::getenv (" SYCL_PI_LEVEL0_MAX_COMMAND_LIST_CACHE" );
672
- pi_uint32 CommandListCacheSizeValue;
673
- try {
674
- CommandListCacheSizeValue =
675
- CommandListCacheSize ? std::stoi (CommandListCacheSize) : 20000 ;
676
- } catch (std::exception const &) {
677
- zePrint (
678
- " SYCL_PI_LEVEL0_MAX_COMMAND_LIST_CACHE: invalid value provided, "
679
- " default set.\n " );
680
- CommandListCacheSizeValue = 20000 ;
681
- }
682
- return CommandListCacheSizeValue;
683
- })();
667
+ const char *CommandListCacheSize =
668
+ std::getenv (" SYCL_PI_LEVEL0_MAX_COMMAND_LIST_CACHE" );
669
+ pi_uint32 CommandListCacheSizeValue;
670
+ try {
671
+ CommandListCacheSizeValue =
672
+ CommandListCacheSize ? std::stoi (CommandListCacheSize) : 20000 ;
673
+ } catch (std::exception const &) {
674
+ zePrint (" SYCL_PI_LEVEL0_MAX_COMMAND_LIST_CACHE: invalid value provided, "
675
+ " default set.\n " );
676
+ CommandListCacheSizeValue = 20000 ;
677
+ }
684
678
685
679
try {
686
680
@@ -821,8 +815,8 @@ pi_result piextPlatformCreateWithNativeHandle(pi_native_handle NativeHandle,
821
815
}
822
816
823
817
if (NumPlatforms) {
824
- std::vector<pi_platform> PlatformCache (NumPlatforms);
825
- Res = piPlatformsGet (NumPlatforms, PlatformCache .data (), nullptr );
818
+ std::vector<pi_platform> Platforms (NumPlatforms);
819
+ Res = piPlatformsGet (NumPlatforms, Platforms .data (), nullptr );
826
820
if (Res != PI_SUCCESS) {
827
821
return Res;
828
822
}
@@ -832,7 +826,7 @@ pi_result piextPlatformCreateWithNativeHandle(pi_native_handle NativeHandle,
832
826
// of the Level Zero drivers when we initialized the platform cache, so the
833
827
// "NativeHandle" must already be in the cache. If it is not, this must not
834
828
// be a valid Level Zero driver.
835
- for (const pi_platform &CachedPlatform : PlatformCache ) {
829
+ for (const pi_platform &CachedPlatform : Platforms ) {
836
830
if (CachedPlatform->ZeDriver == ZeDriver) {
837
831
*Platform = CachedPlatform;
838
832
return PI_SUCCESS;
0 commit comments