Skip to content

Commit 3eb5b7d

Browse files
authored
Revert "[UR] Fixes for using ONEAPI_DEVICE_SELECTOR with linear ids (#18029)"
This reverts commit 1008730.
1 parent 1008730 commit 3eb5b7d

File tree

2 files changed

+2
-48
lines changed

2 files changed

+2
-48
lines changed

unified-runtime/source/loader/ur_lib.cpp

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,6 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
454454
std::vector<DeviceSpec> acceptDeviceList;
455455
std::vector<DeviceSpec> discardDeviceList;
456456

457-
bool deviceIdsInUse = false;
458457
for (auto &termPair : mapODS) {
459458
std::string backend = termPair.first;
460459
// TODO: Figure out how to process all ODS errors rather than returning
@@ -579,10 +578,6 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
579578
deviceList.push_back(DeviceSpec{DevicePartLevel::ROOT, hardwareType,
580579
firstDeviceId, 0, 0, nullptr});
581580
}
582-
583-
if (deviceList.back().rootId != DeviceIdTypeALL) {
584-
deviceIdsInUse = true;
585-
}
586581
}
587582
}
588583

@@ -626,41 +621,7 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
626621
return UR_RESULT_ERROR_DEVICE_NOT_FOUND;
627622
}
628623

629-
uint32_t startIdCount = 0;
630-
if (deviceIdsInUse) {
631-
ur_adapter_handle_t adapter;
632-
if (UR_RESULT_SUCCESS !=
633-
urPlatformGetInfo(hPlatform, UR_PLATFORM_INFO_ADAPTER,
634-
sizeof(adapter), &adapter, nullptr)) {
635-
return UR_RESULT_ERROR_INVALID_PLATFORM;
636-
}
637-
638-
uint32_t numPlatforms;
639-
if (UR_RESULT_SUCCESS !=
640-
urPlatformGet(adapter, 0, nullptr, &numPlatforms)) {
641-
return UR_RESULT_ERROR_INVALID_PLATFORM;
642-
}
643-
std::vector<ur_platform_handle_t> platforms;
644-
platforms.resize(numPlatforms);
645-
if (UR_RESULT_SUCCESS !=
646-
urPlatformGet(adapter, numPlatforms, platforms.data(), nullptr)) {
647-
return UR_RESULT_ERROR_INVALID_PLATFORM;
648-
}
649-
650-
for (auto p : platforms) {
651-
if (p == hPlatform) {
652-
break;
653-
}
654-
uint32_t deviceCount;
655-
if (UR_RESULT_SUCCESS !=
656-
urDeviceGet(p, UR_DEVICE_TYPE_ALL, 0, nullptr, &deviceCount)) {
657-
return UR_RESULT_ERROR_INVALID_PLATFORM;
658-
}
659-
startIdCount += deviceCount;
660-
}
661-
}
662-
663-
DeviceIdType deviceCount = startIdCount;
624+
DeviceIdType deviceCount = 0;
664625
std::transform(rootDeviceHandles.cbegin(), rootDeviceHandles.cend(),
665626
std::back_inserter(rootDevices),
666627
[&](ur_device_handle_t urDeviceHandle) {

unified-runtime/tools/urinfo/urinfo.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ struct app {
1717
bool verbose = false;
1818
bool linear_ids = true;
1919
bool ignore_device_selector = false;
20-
bool using_environment_selector = false;
2120
ur_loader_config_handle_t loaderConfig = nullptr;
2221
std::vector<ur_adapter_handle_t> adapters;
2322
std::unordered_map<ur_adapter_handle_t, std::vector<ur_platform_handle_t>>
@@ -35,7 +34,6 @@ struct app {
3534
"To see all devices, use the "
3635
"--ignore-device-selector CLI option.\n\n",
3736
device_selector);
38-
using_environment_selector = true;
3937
}
4038
}
4139
UR_CHECK(urLoaderConfigCreate(&loaderConfig));
@@ -141,12 +139,7 @@ devices which are currently visible in the local execution environment.
141139
auto device = devices[deviceIndex];
142140
auto device_type = urinfo::getDeviceType(device);
143141

144-
// If we are using ONEAPI_DEVICE_SELECTOR, then the device id numbers
145-
// won't match, so don't print them. This matches the behavior of
146-
// sycl-ls.
147-
if (using_environment_selector) {
148-
std::cout << "[" << adapter_backend << ":" << device_type << "]";
149-
} else if (linear_ids) {
142+
if (linear_ids) {
150143
std::cout << "[" << adapter_backend << ":" << device_type << "]";
151144
std::cout << "[" << adapter_backend << ":" << adapter_device_id
152145
<< "]";

0 commit comments

Comments
 (0)