This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL] Add cl_khr_subgroup_ballot to TableGen BIFs
ClosedPublic

Authored by svenvh on Jan 27 2021, 6:41 AM.

Details

Summary

Add the builtin functions brought by the cl_khr_subgroup_ballot
extension to -fdeclare-opencl-builtins.

Also add placeholder comments for the other Extended Subgroup
Functions from the OpenCL Extension Specification.

I have verified (semi-manually) that this adds the same ballot functions
that are also in opencl-c.h already.

Diff Detail

Event Timeline

svenvh created this revision.Jan 27 2021, 6:41 AM
svenvh requested review of this revision.Jan 27 2021, 6:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 27 2021, 6:41 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
svenvh updated this revision to Diff 319860.Jan 28 2021, 6:59 AM

Add test after rebasing on dependent commit (D95616).

Anastasia added inline comments.Feb 1 2021, 10:57 AM
clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
38

Not related to this patch - I think we should have included opencl-c-base.h by default when passing -fdeclare-opencl-builtins or do you see any issues with that?

144

I appreciate we haven't addressed the standard header testing holistically yet and this functionality was added in opencl-c.h without testing the functions, but would it be better to test each function at least here?

Even though the final goal should be testing all overloads, this is outside of the scope of this work that is closing the gap between opencl-c.h and this experimental function declaration mechanism.

svenvh added inline comments.Feb 2 2021, 3:08 AM
clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
38

That's something we probably want to do in the future indeed.

144

but would it be better to test each function at least here?

I think that defeats the purpose of this test. This test is meant to test the basic functionality of -fdeclare-opencl-builtins. It is not a completeness test.

A completeness test shouldn't be tied to -fdeclare-opencl-builtins alone; such a test should also be run against opencl-c.h, so this would be the wrong test to turn into a completeness test in my opinion.

Anastasia accepted this revision.Feb 2 2021, 4:46 AM

LGTM! Thanks!

clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
144

Ok, this test does test functionality selectively but I wouldn't be able to tell how one selects what to test. Perhaps a comment would help for the future development...

This revision is now accepted and ready to land.Feb 2 2021, 4:46 AM
svenvh added inline comments.Feb 2 2021, 8:38 AM
clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
144

There are no formal selection criteria here I think. The test aims to cover the different functional aspects of -fdeclare-opencl-builtins. The new functional aspect for -fdeclare-opencl-builtins in this patch is an extension that is not in OpenCLExtensions.def, so it makes sense to add such a case to the test.

I will add a comment to the top of the test file.

Anastasia added inline comments.Feb 2 2021, 9:10 AM
clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
144

Makes sense! Thanks!

This revision was landed with ongoing or failed builds.Feb 3 2021, 2:24 AM
This revision was automatically updated to reflect the committed changes.