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

[SYCL][PI/CL] Check device version/extensions rather than platform version/extensions #6795

Merged
merged 2 commits into from
Sep 28, 2022

Conversation

dakr
Copy link
Contributor

@dakr dakr commented Sep 15, 2022

For OpenCL backends currently piProgramCreate() queries the platform version (CL_PLATFORM_VERSION) and platform extensions (CL_PLATFORM_EXTENSIONS) to check whether we're capable of running on top of a particular OpenCL backend.

However, there might be platforms where the supported device version is lower than the platform version or where not all devices do support the same extensions and hence some extensions supported by a particular device are not reported in the platform extensions.

In particular for CL_PLATFORM_EXTENSIONS the OpenCL specification says: "[...] Each extension that is supported by all devices associated with this platform must be reported here."

In 3.4.1 Mixed Version Support the specification also says: "[...] The version returned corresponds to the highest version of the OpenCL specification for which the device is conformant, but is not higher than the platform version."

Hence, check for the device version and extensions rather than the platform version and extensions in piProgramCreate().

@dakr dakr requested review from a team as code owners September 15, 2022 16:44
@dakr dakr requested a review from romanovvlad September 15, 2022 16:44
@dakr dakr force-pushed the pi_cl_plat_to_dev branch from 5cb6ca5 to c0afeea Compare September 15, 2022 16:46
Copy link
Contributor

@smaslov-intel smaslov-intel left a comment

Choose a reason for hiding this comment

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

Please do not alter PI API for this

@dakr dakr force-pushed the pi_cl_plat_to_dev branch from c0afeea to a68d3bd Compare September 22, 2022 00:56
@dakr dakr requested a review from smaslov-intel September 22, 2022 00:56
@dakr dakr force-pushed the pi_cl_plat_to_dev branch from a68d3bd to 7d553c0 Compare September 22, 2022 13:46
@dakr dakr requested review from romanovvlad and smaslov-intel and removed request for smaslov-intel and romanovvlad September 22, 2022 13:50
@dakr dakr force-pushed the pi_cl_plat_to_dev branch 4 times, most recently from 98af518 to fc5144c Compare September 23, 2022 02:11
sycl/plugins/opencl/pi_opencl.hpp Outdated Show resolved Hide resolved
sycl/plugins/opencl/pi_opencl.hpp Outdated Show resolved Hide resolved
sycl/plugins/opencl/pi_opencl.hpp Outdated Show resolved Hide resolved
sycl/plugins/opencl/pi_opencl.hpp Show resolved Hide resolved
sycl/plugins/opencl/pi_opencl.hpp Outdated Show resolved Hide resolved
sycl/plugins/opencl/pi_opencl.cpp Outdated Show resolved Hide resolved
sycl/plugins/opencl/pi_opencl.cpp Outdated Show resolved Hide resolved
sycl/plugins/opencl/pi_opencl.cpp Outdated Show resolved Hide resolved
sycl/plugins/opencl/pi_opencl.cpp Outdated Show resolved Hide resolved
sycl/plugins/opencl/pi_opencl.cpp Outdated Show resolved Hide resolved
@dakr dakr force-pushed the pi_cl_plat_to_dev branch 2 times, most recently from ecf2a33 to e3ca585 Compare September 25, 2022 20:52
@dakr dakr requested review from romanovvlad and smaslov-intel and removed request for smaslov-intel and romanovvlad September 25, 2022 20:53
sycl/plugins/opencl/pi_opencl.cpp Outdated Show resolved Hide resolved
sycl/plugins/opencl/pi_opencl.cpp Outdated Show resolved Hide resolved
sycl/plugins/opencl/pi_opencl.cpp Outdated Show resolved Hide resolved
sycl/plugins/opencl/pi_opencl.cpp Outdated Show resolved Hide resolved
sycl/plugins/opencl/pi_opencl.cpp Outdated Show resolved Hide resolved
sycl/plugins/opencl/pi_opencl.cpp Outdated Show resolved Hide resolved
sycl/plugins/opencl/pi_opencl.hpp Show resolved Hide resolved
@dakr dakr force-pushed the pi_cl_plat_to_dev branch from e3ca585 to 8d69871 Compare September 26, 2022 14:43
@dakr dakr requested a review from romanovvlad September 26, 2022 14:43
@dakr dakr force-pushed the pi_cl_plat_to_dev branch 2 times, most recently from d7062c6 to 78f8344 Compare September 27, 2022 01:11
sycl/plugins/opencl/pi_opencl.cpp Outdated Show resolved Hide resolved
sycl/plugins/opencl/pi_opencl.cpp Outdated Show resolved Hide resolved
@dakr dakr force-pushed the pi_cl_plat_to_dev branch from 78f8344 to 6f689c2 Compare September 27, 2022 14:35
@dakr dakr requested a review from romanovvlad September 27, 2022 14:35
Copy link
Contributor

@romanovvlad romanovvlad left a comment

Choose a reason for hiding this comment

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

LGTM

@dakr dakr requested a review from smaslov-intel September 27, 2022 15:10
This commit adds helper functions to query OpenCL device and platform
versions as well as device extensions.

While this patch is mainly motivated by a subsequent patch that adds
some necessary version and extension checks to piProgramCreate() it also
cleans up a few other places doing such queries.

While at it, fix the missing error handling querying device extensions
in piDeviceGetInfo().

Signed-off-by: Danilo Krummrich <dakr@redhat.com>
There might be platforms where the supported device version is lower
than the platform version or where not all devices do support the same
extensions and hence some extensions supported by particular devices
are not reported in the platform extensions.

In particular for CL_PLATFORM_EXTENSIONS the OpenCL specification says:
"[...] Each extension that is supported by all devices associated with
this platform must be reported here."

In "3.4.1 Mixed Version Support" the specification also says: "[...] The
version returned corresponds to the highest version of the OpenCL
specification for which the device is conformant, but is not higher than
the platform version."

Hence, check for the device version and extensions rather than the
platform version and extensions in piProgramCreate().

Signed-off-by: Danilo Krummrich <dakr@redhat.com>
@dakr dakr force-pushed the pi_cl_plat_to_dev branch from 6f689c2 to 5524e9f Compare September 27, 2022 19:07
@bader bader changed the title [SYCL][PI/CL] check device version/extensions rather than platform version/extensions [SYCL][PI/CL] Check device version/extensions rather than platform version/extensions Sep 28, 2022
@bader bader merged commit 9f89247 into intel:sycl Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants