This is an archive of the discontinued LLVM Phabricator instance.

opencl-c.h: add 3.0 optional extension support for a few more bits
ClosedPublic

Authored by airlied on Jul 12 2021, 4:35 PM.

Details

Summary

These 3 are fairly simple, pipes, workgroups and subgroups.

Diff Detail

Event Timeline

airlied created this revision.Jul 12 2021, 4:35 PM
airlied requested review of this revision.Jul 12 2021, 4:35 PM
Anastasia added inline comments.
clang/lib/Headers/opencl-c-base.h
329

We had a discussion with @azabaznov around features that are aliasing each other and we have discussed to use one feature macro for those. Clang should already ensure that both are set/unset simultaneously? And for those that are not set in clang we can set them correctly here in the header directly.

clang/lib/Headers/opencl-c.h
15290

I think that here guarding the OpenCL version is correct?

azabaznov added inline comments.Jul 13 2021, 9:13 AM
clang/lib/Headers/opencl-c-base.h
329

Yeah, I we did. Note that this is applicable to fp64 and 3d image writes, while __openc_c_subgroups and cl_khr_subgroups are not equivalent as extension requires subgroup-independent forward progress but subgroup-independent forward progress is optional in OpenCL C 3.0. I'll try submit a patch for 3d image writes feature macro support this week.

airlied updated this revision to Diff 359114.Jul 15 2021, 1:39 PM

fixed up missing cl_khr_subgroups checks.

airlied updated this revision to Diff 359166.Jul 15 2021, 4:41 PM

leave version checks alone since they are inside the outer extension check.

airlied marked an inline comment as done.Jul 15 2021, 4:42 PM

yeah I agree I'll drop those two changes.

Anastasia added inline comments.Jul 19 2021, 3:03 PM
clang/lib/Headers/opencl-c-base.h
329

Ok, I see so while the functions are identical they are not entirely equivalent extensions so vendors might support one but not the other? In this case I think we should keep checking both but it would be good to add a comment explaining why we are checking both macros here.

Btw do you happen to have spec reference? I can't find anything relevant.

airlied updated this revision to Diff 364372.Aug 5 2021, 12:31 AM

Added a comment on the subgroups difference.

Anastasia accepted this revision.Aug 6 2021, 10:24 AM

LGTM! Thanks

This revision is now accepted and ready to land.Aug 6 2021, 10:24 AM
This revision was landed with ongoing or failed builds.Aug 6 2021, 4:25 PM
This revision was automatically updated to reflect the committed changes.