Skip to content
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

Added object comparability verification for CL_DEVICE_PLATFORM query #2225

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

shajder
Copy link
Contributor

@shajder shajder commented Jan 13, 2025

Fixes #1485 according to work plan, point CL_DEVICE_PLATFORM

Comment on lines +678 to +685
error = clGetDeviceIDs(platforms[p], CL_DEVICE_TYPE_ALL, 0, nullptr,
&num_devices);
test_error(error, "clGetDeviceIDs failed");

std::vector<cl_device_id> devices(num_devices);
error = clGetDeviceIDs(platforms[p], CL_DEVICE_TYPE_ALL, num_devices,
devices.data(), nullptr);
test_error(error, "clGetDeviceIDs failed");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should ignore platforms where these queries return an error vs. failing the test. I know this is atypical and not the pattern used by most tests, but I think it is the right thing to do here for two reasons:

  1. If we fail the test when these queries return an error, it means that a buggy platform that just so happens to be installed on the system alongside the platform being tested could cause the test to fail, even if the platform being tested is correct and conformant.
  2. clGetDeviceIDs is a little weird in that it is specified to return an error when no devices are found rather than returning num_device equal to zero. This means that a conformant platform could return an error, which would also cause the test to fail. Linking in: remove unavoidable error conditions OpenCL-Docs#1269

Since this test is run through the harness, we could also consider using the CL_PLATFORM_INDEX environment variable to choose the platform to test against, though this loop is fine too, and it has the added benefit of testing that clGetDeviceIDs returns the same set of device IDs if it is called multiple times.

devices.data(), nullptr);
test_error(error, "clGetDeviceIDs failed");

// try to find invalid device
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: I don't think this is an "invalid device" that we are looking for.

Comment on lines +692 to +693
comp_platform = platforms[p];
break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we fail the test if no comp_platform is found, basically if we get out of this loop and comp_platform is still nullptr?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add test for object comparability
3 participants