Skip to content

Commit 2e01ec1

Browse files
Dan Holmeskbenzie
authored andcommitted
Apply code formatting patches
1 parent e246aba commit 2e01ec1

File tree

2 files changed

+26
-21
lines changed

2 files changed

+26
-21
lines changed

source/loader/ur_lib.cpp

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,11 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
294294
// with `std::queue<std::pair<key_type_t, value_type_t>>` or something similar.)
295295
auto maybeEnvVarMap = getenv_to_map("ONEAPI_DEVICE_SELECTOR", false);
296296
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;
301302

302303
// if the ODS env var is not set at all, then pretend it was set to the default
303304
using EnvVarMap = std::map<std::string, std::vector<std::string>>;
@@ -426,7 +427,8 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
426427

427428
for (auto &termPair : mapODS) {
428429
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
430432
// malformed term: missing backend -- output ERROR, then continue
431433
// TODO: replace std::cout with URT message output mechanism
432434
std::cout << "ERROR: missing backend, format of filter = "
@@ -452,13 +454,14 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
452454
// Note the hPlatform -> platformBackend -> platformBackendName conversion above
453455
// guarantees minimal sanity for the comparison with backend from the ODS string
454456
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+
})) {
462465
// irrelevant term for current request: different backend -- silently ignore
463466
// TODO: replace std::cout with URT message output mechanism
464467
std::cout << "WARNING: ignoring term with irrelevant backend"
@@ -475,7 +478,8 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
475478
}
476479
if (std::find_if(termPair.second.cbegin(), termPair.second.cend(),
477480
[](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
479483
// malformed term: missing filterString -- output warning, then continue
480484
// TODO: replace std::cout with URT message output mechanism
481485
std::cout << "WARNING: empty filterString, format of filterStrings "
@@ -528,7 +532,7 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
528532
const auto firstDeviceId = getDeviceId(firstPart);
529533
// first dot found, look for another
530534
std::string::size_type locationDot2 =
531-
filterString.find('.', locationDot1+1);
535+
filterString.find('.', locationDot1 + 1);
532536
std::string secondPart = filterString.substr(
533537
locationDot1 + 1, locationDot2 == std::string::npos
534538
? std::string::npos
@@ -571,7 +575,7 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
571575
acceptDeviceList.push_back(DeviceSpec{
572576
DevicePartLevel::ROOT, ::UR_DEVICE_TYPE_ALL, DeviceIdTypeALL});
573577
}
574-
578+
575579
std::cout << "DEBUG: size of acceptDeviceList = " << acceptDeviceList.size()
576580
<< std::endl
577581
<< "DEBUG: size of discardDeviceList = "
@@ -816,8 +820,7 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
816820
std::cout << "WARNING: an accept term was ignored because it "
817821
"does not select any additional devices"
818822
"selectedDevices.size() = "
819-
<< selectedDevices.size()
820-
<< std::endl;
823+
<< selectedDevices.size() << std::endl;
821824
}
822825
}
823826

test/conformance/device/urDeviceGetSelected.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// See LICENSE.TXT
44
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55

6-
#include <uur/fixtures.h>
76
#include "helpers.h"
7+
#include <uur/fixtures.h>
88

99
using urDeviceGetSelectedTest = uur::urPlatformTest;
1010

@@ -61,7 +61,7 @@ TEST_F(urDeviceGetSelectedTest, SuccessSelected_StarColonStar) {
6161
ASSERT_EQ(countAll, count);
6262
std::vector<ur_device_handle_t> devicesAll(countAll);
6363
ASSERT_SUCCESS(urDeviceGet(platform, UR_DEVICE_TYPE_ALL, countAll,
64-
devicesAll.data(), nullptr));
64+
devicesAll.data(), nullptr));
6565
for (auto &device : devicesAll) {
6666
ASSERT_NE(nullptr, device);
6767
}
@@ -115,7 +115,8 @@ TEST_F(urDeviceGetSelectedTest, SuccessSelected_SelectAndDiscard) {
115115
ASSERT_EQ(count, 0);
116116
}
117117

118-
TEST_F(urDeviceGetSelectedTest, SuccessSelected_SelectSomethingAndDiscardSomethingElse) {
118+
TEST_F(urDeviceGetSelectedTest,
119+
SuccessSelected_SelectSomethingAndDiscardSomethingElse) {
119120
setenv("ONEAPI_DEVICE_SELECTOR", "*:0;!*:1", 1);
120121
uint32_t count = 0;
121122
ASSERT_SUCCESS(
@@ -178,7 +179,8 @@ TEST_F(urDeviceGetSelectedTest, InvalidGarbageBackendString) {
178179
TEST_F(urDeviceGetSelectedTest, InvalidMissingFilterStrings) {
179180
setenv("ONEAPI_DEVICE_SELECTOR", "*", 1);
180181
uint32_t count = 0;
181-
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_VALUE,
182+
ASSERT_EQ_RESULT(
183+
UR_RESULT_ERROR_INVALID_VALUE,
182184
urDeviceGetSelected(platform, UR_DEVICE_TYPE_ALL, 0, nullptr, &count));
183185
ASSERT_EQ(count, 0);
184186
setenv("ONEAPI_DEVICE_SELECTOR", "*:", 1);

0 commit comments

Comments
 (0)