microsoft / OpenCLOn12

The OpenCL-on-D3D12 mapping layer
MIT License
104 stars 13 forks source link

Implement CL 3.0 #18

Closed jenatali closed 3 years ago

jenatali commented 3 years ago

This PR implements the entirety of the CL3.0 API surface area (the 3 new functions, all the new info queries, plus the required 2.x functions like clCloneKernel). Everything optional here is disabled except for read-write images, which are hooked up, but requires a compiler with some changes to actually work.

The new code is very poorly tested, but does pass the test_basic readwrite image test.

There's one missing required(?) feature that I haven't hooked up yet, which is creating an image from an image, for the purpose of format casting. Should be easy enough.

Optional features and extensions that I'd like to start implementing after this:

jenatali commented 3 years ago

Note: Even after this, we can't start actually defining CLON12_SUPPORT_3_0 until we have a version of Clang that properly supports CL3.0. Currently none of opencl-c.h (what we're currently using), clc.h (the header used to compile libclc), nor the Clang builtins for CL (OpenCLBuiltins.td) fully support CL3.0.

Specifically (so far), I'm seeing that vload and vstore is completely broken:

Based on this table it looks like it's going to be a while.

jenatali commented 3 years ago

Note: Even after this, we can't start actually defining CLON12_SUPPORT_3_0 until we have a version of Clang that properly supports CL3.0. Currently none of opencl-c.h (what we're currently using), clc.h (the header used to compile libclc), nor the Clang builtins for CL (OpenCLBuiltins.td) fully support CL3.0.

Actually I think I just need to parameterize this so we can claim CL3.0 API but still CL C 1.2 as the max version.

jenatali commented 3 years ago

Merging this without defining the CL3.0 define just yet. I'll probably follow up with CMake build configuration for choosing OpenCL 3.0 support. For now, our shipped binaries will continue to come from the cl1.2 branch (even with master before merging).