Page MenuHomePhabricator

Pierre (Pierre)
User

Projects

User does not belong to any projects.

User Details

User Since
Apr 15 2019, 3:20 AM (8 w, 5 d)

Recent Activity

Tue, Jun 11

Pierre updated the diff for D62849: Moving OpenCLBuiltins.td and remove unused include.

Dependencies were not satisfied with the last version:
clangSema was built after ClangOpenCLBuiltinsImpl,
but it didn't imply that OpenCLBuiltins.inc had to be built before SemaLookup.cpp

Tue, Jun 11, 7:19 AM · Restricted Project

Mon, Jun 10

Pierre updated the diff for D62849: Moving OpenCLBuiltins.td and remove unused include.

It was not necessary to add the .inc file in the add_clang_library

Mon, Jun 10, 3:58 AM · Restricted Project

Wed, Jun 5

Pierre added a comment to D60763: Prototype OpenCL BIFs using Tablegen.

A bit late to the review, but I've noticed a couple of issues with some of the implemented builtins:

  • The fmin/fmax builtins are defined twice for scalar types, does this create problems in overload resolution when using them?
  • The convert_ builtins don't have support for half types (which is present in the opencl-c.h header. Is that intended?
Wed, Jun 5, 2:59 AM · Restricted Project, Restricted Project
Pierre updated the diff for D62849: Moving OpenCLBuiltins.td and remove unused include.

At the right location this time

Wed, Jun 5, 1:29 AM · Restricted Project

Tue, Jun 4

Pierre added a reviewer for D62849: Moving OpenCLBuiltins.td and remove unused include: thakis.
Tue, Jun 4, 3:42 AM · Restricted Project
Pierre created D62849: Moving OpenCLBuiltins.td and remove unused include.
Tue, Jun 4, 3:35 AM · Restricted Project
Pierre added a comment to D60763: Prototype OpenCL BIFs using Tablegen.

From what I can tell, the only client of OpenCLBuiltins.td is currently lib/Sema. Do you expect that to change? If not, does it make more sense to move the .td file to there?

Do you expect OpenCLBuiltins.td to include other files in the future? At the moment, the -I ${CMAKE_CURRENT_SOURCE_DIR}/../../ bit in the cmake file isn't needed for anything.

Tue, Jun 4, 2:23 AM · Restricted Project, Restricted Project

Thu, May 23

Pierre updated the diff for D60763: Prototype OpenCL BIFs using Tablegen.
Thu, May 23, 6:47 AM · Restricted Project, Restricted Project

Tue, May 21

Pierre updated the diff for D60763: Prototype OpenCL BIFs using Tablegen.
Tue, May 21, 7:01 AM · Restricted Project, Restricted Project
Pierre added a comment to D60763: Prototype OpenCL BIFs using Tablegen.

The wrong patch was uploaded. Sorry for this.

Tue, May 21, 7:01 AM · Restricted Project, Restricted Project
Pierre added inline comments to D60763: Prototype OpenCL BIFs using Tablegen.
Tue, May 21, 3:34 AM · Restricted Project, Restricted Project

Fri, May 17

Pierre added inline comments to D60763: Prototype OpenCL BIFs using Tablegen.
Fri, May 17, 2:19 AM · Restricted Project, Restricted Project
Pierre updated the diff for D60763: Prototype OpenCL BIFs using Tablegen.

Corrections from the comments on the previous version.

Fri, May 17, 2:18 AM · Restricted Project, Restricted Project

May 3 2019

Pierre updated the diff for D60763: Prototype OpenCL BIFs using Tablegen.

Requested changes have been made in this diff. Some comments/ TODO have not been done yet. They will be done in a next patch. This first patch is meant to start introducing the feature in Clang.
This patch integrates the new command line option introduced in https://reviews.llvm.org/D60764

May 3 2019, 2:31 AM · Restricted Project, Restricted Project
Pierre added inline comments to D60763: Prototype OpenCL BIFs using Tablegen.
May 3 2019, 2:31 AM · Restricted Project, Restricted Project

Apr 25 2019

Pierre added a comment to D60763: Prototype OpenCL BIFs using Tablegen.

I also think we could reduce the size of the tables.
To sum up how this is working right now:

  1. The isOpenCLBuiltin(char* functionName) funcion is called to determine if a function is part of OpenCL builtin functions. If so, it returns its associated pair (index, number of signatures) in the OpenCLBuiltinDecl, otherwise it returns 0.
  2. The OpenCLBuiltinDecl table is storing, for each OpenCL builtin function, the list of the possible signature associated for this function (e.g. cos can be "float cos(float)", "double cos(double)", ...). The available signatures are stored in the OpenCLSignature table. In the OpenCLBuiltinDecl are stored the indexes corresponding to the possible signature for each function.
  3. The OpenCLSignature is storing the possible signatures.
Apr 25 2019, 7:52 AM · Restricted Project, Restricted Project
Pierre added a comment to D60763: Prototype OpenCL BIFs using Tablegen.

Other comments:
1-
When a header file is included, its function declarations are decorated with the "nounwind" attribute, meaning that the function is not supposed to throw an exception. This decorator is currently not added with the new mechanism.
The "readnone" decorator is also present for these builtin functions and added somewhere y clang, but not added with the new mechanism.
This can be tested with the following command line, on an .cl file containing a function calling a builtin function (e.g.: acos):

clang -cc1 -cl-std=CL2.0 -emit-llvm -O0 -I<path_to>/llvm-project/clang/lib/Headers <your_file.cl>  [-fadd-opencl-builtins|-finclude-default-header]

2-
When the function definition is inserted, it seems to be actually just resolving the identifier for the current lookup. Calling the same builtin function multiple times currently result in multiple lookup. Maybe there is a way to add the function declaration for the scope/file, so the lookup is only performed one time for each function. This part is done around the code taken from Sema::LazilyCreateBuiltin function, and I will spend more time on it.
3-
I haven't looked at the test file yet.
4-
If you have any suggestion/comment, feel free to share.

Apr 25 2019, 2:52 AM · Restricted Project, Restricted Project
Pierre updated the diff for D60763: Prototype OpenCL BIFs using Tablegen.

In this new patch:

  • Documentation has been added
  • The multiclasses in OpenCLBuiltins.td filehave been slighly changed to have a more generic way to generate function prototypes
  • In ClangOpenCLBuiltinEmitter.cpp, the code of the Emit() function has been shifted to functions
  • In SemaLookUp.cpp, the OCL2Qual function, used to retrieve the QualType instance of a type, is now generated by Tablegen backend
Apr 25 2019, 2:52 AM · Restricted Project, Restricted Project
Pierre updated the diff for D60764: Add clang cc1 option to generate OpenCL builtin functions.

Forgot to update one argument

Apr 25 2019, 2:39 AM · Restricted Project

Apr 24 2019

Pierre updated the diff for D60764: Add clang cc1 option to generate OpenCL builtin functions.

The name of the command line option has been updated.

Apr 24 2019, 9:54 AM · Restricted Project

Apr 16 2019

Pierre created D60764: Add clang cc1 option to generate OpenCL builtin functions.
Apr 16 2019, 1:52 AM · Restricted Project
Pierre updated the diff for D60763: Prototype OpenCL BIFs using Tablegen.

Deleted blank line

Apr 16 2019, 1:47 AM · Restricted Project, Restricted Project
Pierre created D60763: Prototype OpenCL BIFs using Tablegen.
Apr 16 2019, 1:45 AM · Restricted Project, Restricted Project