TornadoVM icon indicating copy to clipboard operation
TornadoVM copied to clipboard

Fixed CL_DEVICE_TYPE_ALL to be a long type to avoid sign extension

Open coldav opened this issue 1 year ago • 2 comments
trafficstars

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

  • [x] OpenCL
  • [ ] PTX
  • [ ] SPIRV

OS tested

Mark the OS where this PR is tested.

  • [x] Linux
  • [ ] OSx
  • [ ] Windows

Did you check on FPGAs?

If it is applicable, check your changes on FPGAs.

  • [ ] Yes
  • [x] 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.


coldav avatar May 13 '24 16:05 coldav

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar May 13 '24 16:05 CLAassistant

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 avatar May 13 '24 17:05 jjfumero

Thanks @coldav . We did received the CLA. In order to merge the PR, can you please resolve the conflicting file? Ping me if you have questions.

jjfumero avatar Jul 02 '24 10:07 jjfumero

Awesome! Thank you @coldav . I will merge this PR.

jjfumero avatar Jul 02 '24 10:07 jjfumero