[PATCH] D64418: [Docs][OpenCL] Documentation of C++ for OpenCL mode

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 16 04:56:18 PDT 2019


Anastasia added inline comments.


================
Comment at: docs/LanguageExtensions.rst:1673
+
+All builtin operators will be available in the specific address spaces, thus no conversion
+to generic is performed.
----------------
mantognini wrote:
> "specific" seems to imply to the user will have to explicitly write down the AS. Maybe "requested" or "desired" would fit better?
Ok, specific here is as opposite to generic. 


================
Comment at: docs/LanguageExtensions.rst:1753-1761
+Global objects are constructed before the first kernel using the global
+objects is executed and destroyed just after the last kernel using the
+program objects is executed. In OpenCL v2.0 drivers there is no specific
+API for invoking global constructors. However, an easy workaround would be
+to enqueue constructor initialization kernel that has a name
+``@_GLOBAL__sub_I_<compled file name>``. This kernel is only present if there
+are any global objects to be initialized in the compiled binary. One way to
----------------
mantognini wrote:
> Is it expected of the user to call this special kernel, or is it expected that the driver takes care of that?
In v2.0 drivers this is a manual step. In v2.2 drivers it is expected to be done automatically.


================
Comment at: docs/LanguageExtensions.rst:1758
+to enqueue constructor initialization kernel that has a name
+``@_GLOBAL__sub_I_<compled file name>``. This kernel is only present if there
+are any global objects to be initialized in the compiled binary. One way to
----------------
keryell wrote:
> "<compiled"?
> Is there an issue if you link a program from several files with the same file names?
I think IR linker makes them unique i.e. adds a suffix. Although I think the files (including the path) linked are supposed to be unique. Anyway, good point to look into.

No idea about obj linker. We currently don't support this feature.


================
Comment at: docs/LanguageExtensions.rst:1768
+.. code-block:: console
+ clang -cl-std=c++ test.cl
+
----------------
mantognini wrote:
> As it stands, I'm not sure why this command is mentioned in this paragraph. Maybe it's a leftover of things that are now in the User's Manual?
This is the example I am explaining just below.


================
Comment at: docs/UsersManual.rst:2797
+
+     clang -cl-std=c++ test.cl
+
----------------
mantognini wrote:
> I would remove this code sample; it is already explained above that `-cl-std=c++` should be used.
Manual is good for examples. Some new developers might find it useful to have the full line even though it's quite simple.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64418/new/

https://reviews.llvm.org/D64418





More information about the cfe-commits mailing list