Skip to content

[SYCL][Bindless] Fix bindless vulkan interop tests selecting wrong vulkan device #14386

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

Merged
Merged
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
9 changes: 4 additions & 5 deletions sycl/test-e2e/bindless_images/vulkan_interop/mipmaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,11 +444,10 @@ int main() {
return EXIT_FAILURE;
}

const char *devices[] = {"Intel", "NVIDIA"};
if (std::none_of(std::begin(devices), std::end(devices),
[](const char *device) {
return vkutil::setupDevice(device) == VK_SUCCESS;
})) {
sycl::device dev;

if (vkutil::setupDevice(dev.get_info<sycl::info::device::name>()) !=
VK_SUCCESS) {
std::cerr << "Device setup failed!\n";
return EXIT_FAILURE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,10 @@ int main() {
return EXIT_FAILURE;
}

const char *devices[] = {"Intel", "NVIDIA"};
if (std::none_of(std::begin(devices), std::end(devices),
[](const char *device) {
return vkutil::setupDevice(device) == VK_SUCCESS;
})) {
sycl::device dev;

if (vkutil::setupDevice(dev.get_info<sycl::info::device::name>()) !=
VK_SUCCESS) {
std::cerr << "Device setup failed!\n";
return EXIT_FAILURE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -622,11 +622,10 @@ int main() {
return EXIT_FAILURE;
}

const char *devices[] = {"Intel", "NVIDIA"};
if (std::none_of(std::begin(devices), std::end(devices),
[](const char *device) {
return vkutil::setupDevice(device) == VK_SUCCESS;
})) {
sycl::device dev;

if (vkutil::setupDevice(dev.get_info<sycl::info::device::name>()) !=
VK_SUCCESS) {
std::cerr << "Device setup failed!\n";
return EXIT_FAILURE;
}
Expand Down
12 changes: 11 additions & 1 deletion sycl/test-e2e/bindless_images/vulkan_interop/vulkan_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ VkResult setupDevice(std::string device) {
#endif
};

// Make lowercase to fix inconsistent capitalization between SYCL and Vulkan
// device naming.
std::transform(device.begin(), device.end(), device.begin(),
[](unsigned char c) { return std::tolower(c); });

// From all physical devices, find the first one that supports all our
// required device extensions.
for (int i = 0; i < physicalDeviceCount; i++) {
Expand All @@ -240,6 +245,10 @@ VkResult setupDevice(std::string device) {
vkGetPhysicalDeviceProperties(vk_physical_device, &props);
std::string name(props.deviceName);

// Make lowercase for comparision.
std::transform(name.begin(), name.end(), name.begin(),
[](unsigned char c) { return std::tolower(c); });

if (name.find(device) == std::string::npos) {
continue;
}
Expand All @@ -261,7 +270,8 @@ VkResult setupDevice(std::string device) {
}

foundDevice = true;
std::cout << "Found suitable Vulkan device: " << name << std::endl;
std::cout << "Found suitable Vulkan device: " << props.deviceName
<< std::endl;
break;
}

Expand Down
Loading