Skip to content

[GPU] choose kernel compile option for work_group_(OPS) #30162

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 4 commits into from
May 14, 2025

Conversation

sungeunk
Copy link
Contributor

Tickets:

  • 165719

@github-actions github-actions bot added the category: GPU OpenVINO GPU plugin label Apr 15, 2025
@sungeunk sungeunk marked this pull request as ready for review April 17, 2025 01:55
@sungeunk sungeunk requested review from a team as code owners April 17, 2025 01:55
Comment on lines 180 to 183
if (engine_info.supports_work_group)
kernel_string->options += " -cl-std=CL3.0";
else
kernel_string->options += " -cl-std=CL2.0";
Copy link
Contributor

Choose a reason for hiding this comment

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

Why should the support/implementation of some feature affect the kernel's OpenCL version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OpenCL_C::unified-spec
the opencl_c<feature_name> feature: Features that were introduced in OpenCL C 2.0 as mandatory, but made optional in OpenCL C 3.0.
On Elkhart Lake(Legacy platform), OpenCL C 3.0 is working but work_group
APIs are not supported.
OpenCL C 2.0 includes work_group_ on EHL.

@@ -388,6 +388,7 @@ struct EngineInfo {
bool enable_sub_groups_emulation = false;
bool bOptHintsSupport = false;
bool supports_microkernels = false;
bool supports_work_group = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

[random spot]
We have KernelBase::get_required_device_features_key() function, I suppose this work_group functions should be exposed as an independent option and considering during kernel selection

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good idea. The only ref kernel that requires workgroup collective feature is dynamic_quantize_gpu_ref.cl, and I think we can disable dynamic quantize if the collective function is not supported.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll apply work_group to it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If not support_work_group_collective_func, it selects '-cl-std=CL2.0' for kernel build. OpenCL 2.0 supports work_group_ API.
Other issues can be made if it just disables kernels use work_group_ API.

Copy link
Contributor

Choose a reason for hiding this comment

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

@sungeunk, does it mean that some device/runtime fully supports OpenCL 2.0 (including its required features such as work_group_* functions), but also supports OpenCL 3.0, where these features are reported as unsupported?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sshlyapn Support varies depending on the opencl version used when compiling the kernel.

  Legacy platform (ex. Gen11) New platform (ex. UHD 770)
CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT false true
work_group_ API at OpenCL 2.0 (runtime) working working
work_group_ API at OpenCL 3.0 (runtime) not working working

Copy link
Contributor

Choose a reason for hiding this comment

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

@sungeunk, let's discuss it with the driver team first

-rename to supports_work_group_collective_functions
-supports_work_group is true if CL_HPP_TARGET_OPENCL_VERSION is 200
Copy link
Contributor

@isanghao isanghao left a comment

Choose a reason for hiding this comment

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

LGTM

@isanghao isanghao added this pull request to the merge queue May 14, 2025
Merged via the queue into openvinotoolkit:master with commit 135b624 May 14, 2025
172 of 174 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: GPU OpenVINO GPU plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants