[PATCH] D97869: [OpenCL][Draft] Add OpenCL builtin test generator

2021-05-26 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment. I think this is a very good starting point for the testing of built-in functions. Btw should we now remove '[Draft]' from the title? Comment at: clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp:242 + // functions. + void Emit(); + ---

[PATCH] D97869: [OpenCL][Draft] Add OpenCL builtin test generator

2021-05-24 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh updated this revision to Diff 347428. svenvh edited the summary of this revision. svenvh added a comment. Fix formatting issues, rebase patch, add test. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97869/new/ https://reviews.llvm.org/D97869 Files: clang/test/Headers/lit.local

[PATCH] D97869: [OpenCL][Draft] Add OpenCL builtin test generator

2021-03-24 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment. I have done some measurements using the test produced from this Tablegen emitter (59K lines). I have used the test it in two files: 1. `SemaOpenCL/all-std-buitins.cl` that has the following RUN line appended 6 times (for every supported OpenCL version v1.0, v1.1, v1.

[PATCH] D97869: [OpenCL][Draft] Add OpenCL builtin test generator

2021-03-23 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh updated this revision to Diff 332675. svenvh added a comment. Emit `#if` guards for extensions and versions. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97869/new/ https://reviews.llvm.org/D97869 Files: clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp clang/utils/TableGe

[PATCH] D97869: [OpenCL][Draft] Add OpenCL builtin test generator

2021-03-18 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment. In D97869#2628679 , @azabaznov wrote: > I have one more though. > > I like the idea of turning `opencl-c.h` into the test: as it is already in > the repo and is already being used for quite a while we can assume it as a > mainl

[PATCH] D97869: [OpenCL][Draft] Add OpenCL builtin test generator

2021-03-16 Thread Anton Zabaznov via Phabricator via cfe-commits
azabaznov added a comment. I have one more though. I like the idea of turning `opencl-c.h` into the test: as it is already in the repo and is already being used for quite a while we can assume it as a mainline for now. I think the first step should be to test that `-fdeclare-oprencl-builtins`

[PATCH] D97869: [OpenCL][Draft] Add OpenCL builtin test generator

2021-03-15 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment. In D97869#2617063 , @svenvh wrote: > In D97869#2616772 , @Anastasia wrote: > >> Regarding 2 and 4 I think we should drive towards deprecation of >> `opencl-c.h` as it is a maintenance ove

[PATCH] D97869: [OpenCL][Draft] Add OpenCL builtin test generator

2021-03-10 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh added a comment. In D97869#2616772 , @Anastasia wrote: > Regarding 2 and 4 I think we should drive towards deprecation of `opencl-c.h` > as it is a maintenance overhead but we could convert it into a test instead? Perhaps you misunderstood option

[PATCH] D97869: [OpenCL][Draft] Add OpenCL builtin test generator

2021-03-10 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment. Thanks for the comprehensive summary. I don't have many other suggestions in mind but I would like to add a few thoughts. We could always consider writing the tests manually from scratch too. But it doesn't feel like a good cost/benefit trade-off. Regarding 2 and 4 I

[PATCH] D97869: [OpenCL][Draft] Add OpenCL builtin test generator

2021-03-05 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh added a comment. To be honest, I don't have a concrete picture yet of how to deploy this emitter for testing. So here are a few thoughts about the various options that come to mind: 1. Regenerate the test file every time we run check-clang and use it to validate the `-fdeclare-opencl-b

[PATCH] D97869: [OpenCL][Draft] Add OpenCL builtin test generator

2021-03-05 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment. In D97869#2603068 , @svenvh wrote: > In D97869#2602943 , @Anastasia wrote: > >> I was just thinking if we could combine the calls into one function to >> minimize the number of lines to p

[PATCH] D97869: [OpenCL][Draft] Add OpenCL builtin test generator

2021-03-05 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment. In D97869#2603249 , @azabaznov wrote: > That's awesome! > > I'm thinking of how can you track correctness of generated built-ins > according to spec.  Perhaps you can compare the number of distinct > declarations for each  buil

[PATCH] D97869: [OpenCL][Draft] Add OpenCL builtin test generator

2021-03-04 Thread Anton Zabaznov via Phabricator via cfe-commits
azabaznov added a comment. That's awesome! I'm thinking of how can you track correctness of generated built-ins according to spec.  Perhaps you can compare the number of distinct declarations for each  built-in in the spec and in tablegen and diagnose if they are not equal. This is a very stra

[PATCH] D97869: [OpenCL][Draft] Add OpenCL builtin test generator

2021-03-04 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh added a comment. In D97869#2602943 , @Anastasia wrote: > I was just thinking if we could combine the calls into one function to > minimize the number of lines to parse? Perhaps this will make the Tablegen > generator too complex? That will increa

[PATCH] D97869: [OpenCL][Draft] Add OpenCL builtin test generator

2021-03-04 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment. > `` > > float test6092_cos(float arg1) { > return cos(arg1); > } > double test6093_cos(double arg1) { > return cos(arg1); > } > half test6094_cos(half arg1) { > return cos(arg1); > } > float2 test6095_cos(float2 arg1) { > return cos(arg1);

[PATCH] D97869: [OpenCL][Draft] Add OpenCL builtin test generator

2021-03-03 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment. If possible to add a fragment of what is generated it would be great! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97869/new/ https://reviews.llvm.org/D97869 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D97869: [OpenCL][Draft] Add OpenCL builtin test generator

2021-03-03 Thread Sven van Haastregt via Phabricator via cfe-commits
svenvh created this revision. svenvh added reviewers: Anastasia, azabaznov. Herald added subscribers: jfb, yaxunl. svenvh requested review of this revision. Add a new clang-tblgen flag `-gen-clang-opencl-builtin-tests` that generates a .cl file containing calls to every builtin function defined in