[RFC][OpenCL] Allow -cl-std and other standard -cl- options in driver


Currently, -cl-std= and -cl- options are only accepted by clang compiler with –cc1, which is not convenient for OpenCL users.

Is it possible to allow these options into clang driver (without –cc1)?


Aaron (En Ye) Shi
PEY, SW Engineering | Stream OpenCL
O +(1) 289-695-0685 M +(1) 647-709-3020

You should be able to pass –std=CL1.1¦CL1.2¦CL2.0 to the Clang driver. We have broken it lately though, but the fix is on the way: http://reviews.llvm.org/D20630

Some other options are supported too, but not called the same way i.e. -ffast-math (analogue to -cl-fast-relaxed-math).

Which options would you be interested in particular? I think we should try to avoid duplication with existing ones that are already in Clang.

The -cl options are generally a part of the OpenCL runtime API spec, but they might be useful to have for standalone compilation indeed.



Hi Anastasia,

We would like to let driver accept all –cl- options listed here https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clBuildProgram.html

Currently when users use clang to compile OpenCL program to ISA, they have to pass these options with –Xclang, e.g.

Clang –Xclang -cl-kernel-arg-info a.cl

When there are many –cl options, each one needs to be preceded with –Xclang, which is very inconvenient.

We took a look of Options.td and found there are lots of –cc1 options already there which are allowed to be used with driver and passed on to –cc1 instance. Since these –cl options are frequently used by OpenCL users, I think it is reasonable to also allow driver to accept them and pass on to –cc1.

Aaron has a patch for this. Only some simple changes are needed.



Sure, feel free to setup the review.