beehive-lab / TornadoVM

TornadoVM: A practical and efficient heterogeneous programming framework for managed languages
https://www.tornadovm.org
Apache License 2.0
1.18k stars 113 forks source link

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

Closed coldav closed 3 months ago

coldav commented 4 months ago

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

OS tested

Mark the OS where this PR is tested.

Did you check on FPGAs?

If it is applicable, check your changes on FPGAs.

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.


CLAassistant commented 4 months ago

CLA assistant check
All committers have signed the CLA.

jjfumero commented 4 months ago

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 commented 3 months ago

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 commented 3 months ago

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