Skip to content

Revert "[UR] Fixes for using ONEAPI_DEVICE_SELECTOR with linear ids" #18054

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 1 addition & 40 deletions unified-runtime/source/loader/ur_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
std::vector<DeviceSpec> acceptDeviceList;
std::vector<DeviceSpec> discardDeviceList;

bool deviceIdsInUse = false;
for (auto &termPair : mapODS) {
std::string backend = termPair.first;
// TODO: Figure out how to process all ODS errors rather than returning
Expand Down Expand Up @@ -579,10 +578,6 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
deviceList.push_back(DeviceSpec{DevicePartLevel::ROOT, hardwareType,
firstDeviceId, 0, 0, nullptr});
}

if (deviceList.back().rootId != DeviceIdTypeALL) {
deviceIdsInUse = true;
}
}
}

Expand Down Expand Up @@ -626,41 +621,7 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform,
return UR_RESULT_ERROR_DEVICE_NOT_FOUND;
}

uint32_t startIdCount = 0;
if (deviceIdsInUse) {
ur_adapter_handle_t adapter;
if (UR_RESULT_SUCCESS !=
urPlatformGetInfo(hPlatform, UR_PLATFORM_INFO_ADAPTER,
sizeof(adapter), &adapter, nullptr)) {
return UR_RESULT_ERROR_INVALID_PLATFORM;
}

uint32_t numPlatforms;
if (UR_RESULT_SUCCESS !=
urPlatformGet(adapter, 0, nullptr, &numPlatforms)) {
return UR_RESULT_ERROR_INVALID_PLATFORM;
}
std::vector<ur_platform_handle_t> platforms;
platforms.resize(numPlatforms);
if (UR_RESULT_SUCCESS !=
urPlatformGet(adapter, numPlatforms, platforms.data(), nullptr)) {
return UR_RESULT_ERROR_INVALID_PLATFORM;
}

for (auto p : platforms) {
if (p == hPlatform) {
break;
}
uint32_t deviceCount;
if (UR_RESULT_SUCCESS !=
urDeviceGet(p, UR_DEVICE_TYPE_ALL, 0, nullptr, &deviceCount)) {
return UR_RESULT_ERROR_INVALID_PLATFORM;
}
startIdCount += deviceCount;
}
}

DeviceIdType deviceCount = startIdCount;
DeviceIdType deviceCount = 0;
std::transform(rootDeviceHandles.cbegin(), rootDeviceHandles.cend(),
std::back_inserter(rootDevices),
[&](ur_device_handle_t urDeviceHandle) {
Expand Down
9 changes: 1 addition & 8 deletions unified-runtime/tools/urinfo/urinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ struct app {
bool verbose = false;
bool linear_ids = true;
bool ignore_device_selector = false;
bool using_environment_selector = false;
ur_loader_config_handle_t loaderConfig = nullptr;
std::vector<ur_adapter_handle_t> adapters;
std::unordered_map<ur_adapter_handle_t, std::vector<ur_platform_handle_t>>
Expand All @@ -35,7 +34,6 @@ struct app {
"To see all devices, use the "
"--ignore-device-selector CLI option.\n\n",
device_selector);
using_environment_selector = true;
}
}
UR_CHECK(urLoaderConfigCreate(&loaderConfig));
Expand Down Expand Up @@ -141,12 +139,7 @@ devices which are currently visible in the local execution environment.
auto device = devices[deviceIndex];
auto device_type = urinfo::getDeviceType(device);

// If we are using ONEAPI_DEVICE_SELECTOR, then the device id numbers
// won't match, so don't print them. This matches the behavior of
// sycl-ls.
if (using_environment_selector) {
std::cout << "[" << adapter_backend << ":" << device_type << "]";
} else if (linear_ids) {
if (linear_ids) {
std::cout << "[" << adapter_backend << ":" << device_type << "]";
std::cout << "[" << adapter_backend << ":" << adapter_device_id
<< "]";
Expand Down
Loading