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

Fixed CL_DEVICE_TYPE_ALL to be a long type to avoid sign extension #419

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

coldav
Copy link

@coldav coldav commented May 13, 2024

Description

This fixes CL_DEVICE_TYPE_ALL to be passed correctly to OpenCL backend by changing the immediate for CL_DEVICE_TYPE_ALL to be have the suffix 'L' which avoids the sign extension and removes the previous workaround for Codeplay as a backend.

Problem description

CL_DEVICE_TYPE_ALL was not being correctly provided to OpenCL backends. The CL_DEVICE_TYPE_ALL enumeration was coming out as 0xffffffffffffffff rather than 0xffffffff when used with clGetDeviceIDs which was causing some OpenCL backends to fail as it was passing a technically incorrect value.
This can be seen by building Codeplay "host" target - https://github.com/codeplaysoftware/oneapi-construction-kit/blob/main/doc/developer-guide.md#compiling-oneapi-construction-kit

Backend/s tested

  • OpenCL
  • PTX
  • SPIRV

OS tested

Mark the OS where this PR is tested.

  • Linux
  • OSx
  • Windows

Did you check on FPGAs?

If it is applicable, check your changes on FPGAs.

  • Yes
  • No

How to test the new patch?

Run any test with OpenCL backend chosen and oneAPIConstructionKit built as "host"
Provide instructions about how to test the new patch.


The CL_DEVICE_TYPE_ALL enumeration was coming out as 0xffffffffffffffff
rather than 0xffffffff when used with clGetDeviceIDs which was causing
some OpenCL backends to fail as it was passing a technically incorrect
value.

This resolves this by changing the immediate for CL_DEVICE_TYPE_ALL to
be have the suffix 'L' which avoids the sign extension and removes the
previous workaround for Codeplay as a backend.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@jjfumero
Copy link
Member

Thank you @coldav . This makes sense. I wish Java has unsigned primitive types.

Pending action is the CLA. It needs to be singed with the same email as the author commit.

@jjfumero jjfumero self-assigned this May 13, 2024
@jjfumero jjfumero added fix Provides a fix OpenCL labels May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Provides a fix OpenCL
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

3 participants