Page MenuHomePhabricator

[OpenCL] Add version handling for builtin functions
Needs ReviewPublic

Authored by Pierre on Jun 18 2019, 10:38 AM.

Details

Reviewers
svenvh
Anastasia
Summary

This patch allows to set a MinVersion, stating from which OpenCL version
a function is available, and a MaxVersion, stating the version from which
a function should not be available anymore.
Definitions of the "work-item" functions have been updated, and some of
the "vector data load and store" functions (e.g.: vload/vstore) have been
added to show use of versions.

This depends on:
-1, splitting opencl-c.h file: https://reviews.llvm.org/D63256/new/
-2, Adding generic types: https://reviews.llvm.org/D63434
-3, Adding const, volatile and pointer types: https://reviews.llvm.org/D63442
-4, Adding image types: https://reviews.llvm.org/D63480

Diff Detail

Event Timeline

Pierre created this revision.Jun 18 2019, 10:38 AM
Anastasia added inline comments.Jul 1 2019, 8:02 AM
clang/lib/Sema/OpenCLBuiltins.td
183

Would it make sense to rename this to CLAny or CLAll instead? Although do we even need to add a name for this or may be rather keep as numeric value representing default initialization?

308

Table 15 from?

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

This should also work in CL2 right?

Pierre updated this revision to Diff 207349.Jul 1 2019, 9:21 AM
Pierre marked 4 inline comments as done.

Corrections on names, wrong OpenCL versions in comment, missing comma ...

clang/lib/Sema/OpenCLBuiltins.td
183

Indeed, it makes more sense to rename it CLAny or CLAll. It also might be possible not to define this version (and not to give a name). I would prefer to use a name though. I changed it to CLAll for now.

308

This is from OpenCL v2.0 s6.13.7. This was just a hint to help find back the definition in the specification. I didn't want to have too many ornaments around these hints. Should I give the exact chapter each time?

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

This is correct, I removed the condition.

Pierre updated this revision to Diff 207811.Jul 3 2019, 9:02 AM

Rebase on previous patches.

Pierre updated this revision to Diff 208347.Jul 8 2019, 3:12 AM