@@ -294,10 +294,11 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
294
294
// with `std::queue<std::pair<key_type_t, value_type_t>>` or something similar.)
295
295
auto maybeEnvVarMap = getenv_to_map (" ONEAPI_DEVICE_SELECTOR" , false );
296
296
std::cout
297
- << " DEBUG: " << (maybeEnvVarMap.has_value ()
298
- ? " getenv_to_map parsed env var and produced a map"
299
- : " getenv_to_map parsed env var and failed to produce a map" )
300
- << std::endl;
297
+ << " DEBUG: "
298
+ << (maybeEnvVarMap.has_value ()
299
+ ? " getenv_to_map parsed env var and produced a map"
300
+ : " getenv_to_map parsed env var and failed to produce a map" )
301
+ << std::endl;
301
302
302
303
// if the ODS env var is not set at all, then pretend it was set to the default
303
304
using EnvVarMap = std::map<std::string, std::vector<std::string>>;
@@ -426,7 +427,8 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
426
427
427
428
for (auto &termPair : mapODS) {
428
429
std::string backend = termPair.first ;
429
- if (backend.empty ()) { // FIXME: never true because getenv_to_map rejects this case
430
+ if (backend
431
+ .empty ()) { // FIXME: never true because getenv_to_map rejects this case
430
432
// malformed term: missing backend -- output ERROR, then continue
431
433
// TODO: replace std::cout with URT message output mechanism
432
434
std::cout << " ERROR: missing backend, format of filter = "
@@ -452,13 +454,14 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
452
454
// Note the hPlatform -> platformBackend -> platformBackendName conversion above
453
455
// guarantees minimal sanity for the comparison with backend from the ODS string
454
456
if (backend.front () != ' *' &&
455
- !std::equal (platformBackendName.cbegin (), platformBackendName.cend (),
456
- backend.cbegin (), backend.cend (),
457
- [](const auto &a, const auto &b) {
458
- // case-insensitive comparison by converting both tolower
459
- return std::tolower (static_cast <unsigned char >(a)) ==
460
- std::tolower (static_cast <unsigned char >(b));
461
- })) {
457
+ !std::equal (platformBackendName.cbegin (),
458
+ platformBackendName.cend (), backend.cbegin (),
459
+ backend.cend (), [](const auto &a, const auto &b) {
460
+ // case-insensitive comparison by converting both tolower
461
+ return std::tolower (
462
+ static_cast <unsigned char >(a)) ==
463
+ std::tolower (static_cast <unsigned char >(b));
464
+ })) {
462
465
// irrelevant term for current request: different backend -- silently ignore
463
466
// TODO: replace std::cout with URT message output mechanism
464
467
std::cout << " WARNING: ignoring term with irrelevant backend"
@@ -475,7 +478,8 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
475
478
}
476
479
if (std::find_if (termPair.second .cbegin (), termPair.second .cend (),
477
480
[](const auto &s) { return s.empty (); }) !=
478
- termPair.second .cend ()) { // FIXME: never true because getenv_to_map rejects this case
481
+ termPair.second
482
+ .cend ()) { // FIXME: never true because getenv_to_map rejects this case
479
483
// malformed term: missing filterString -- output warning, then continue
480
484
// TODO: replace std::cout with URT message output mechanism
481
485
std::cout << " WARNING: empty filterString, format of filterStrings "
@@ -528,7 +532,7 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
528
532
const auto firstDeviceId = getDeviceId (firstPart);
529
533
// first dot found, look for another
530
534
std::string::size_type locationDot2 =
531
- filterString.find (' .' , locationDot1+ 1 );
535
+ filterString.find (' .' , locationDot1 + 1 );
532
536
std::string secondPart = filterString.substr (
533
537
locationDot1 + 1 , locationDot2 == std::string::npos
534
538
? std::string::npos
@@ -571,7 +575,7 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
571
575
acceptDeviceList.push_back (DeviceSpec{
572
576
DevicePartLevel::ROOT, ::UR_DEVICE_TYPE_ALL, DeviceIdTypeALL});
573
577
}
574
-
578
+
575
579
std::cout << " DEBUG: size of acceptDeviceList = " << acceptDeviceList.size ()
576
580
<< std::endl
577
581
<< " DEBUG: size of discardDeviceList = "
@@ -816,8 +820,7 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
816
820
std::cout << " WARNING: an accept term was ignored because it "
817
821
" does not select any additional devices"
818
822
" selectedDevices.size() = "
819
- << selectedDevices.size ()
820
- << std::endl;
823
+ << selectedDevices.size () << std::endl;
821
824
}
822
825
}
823
826
0 commit comments