[PATCH] D73104: [Attr][Doc][NFC] Fix code snippet formatting for attribute documentation
Alexey Bader via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 21 06:57:55 PST 2020
bader created this revision.
bader added reviewers: aaron.ballman, Fznamznon.
Herald added subscribers: cfe-commits, ebevhan.
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D73104
Files:
clang/include/clang/Basic/AttrDocs.td
Index: clang/include/clang/Basic/AttrDocs.td
===================================================================
--- clang/include/clang/Basic/AttrDocs.td
+++ clang/include/clang/Basic/AttrDocs.td
@@ -260,6 +260,7 @@
to outline device code and to generate an OpenCL kernel.
Here is a code example of the SYCL program, which demonstrates the compiler's
outlining job:
+
.. code-block:: c++
int foo(int x) { return ++x; }
@@ -282,27 +283,29 @@
specification Section 6.4.
To show to the compiler entry point to the "device part" of the code, the SYCL
runtime can use the ``sycl_kernel`` attribute in the following way:
+
.. code-block:: c++
-namespace cl {
-namespace sycl {
-class handler {
- template <typename KernelName, typename KernelType/*, ...*/>
- __attribute__((sycl_kernel)) void sycl_kernel_function(KernelType KernelFuncObj) {
- // ...
- KernelFuncObj();
- }
- template <typename KernelName, typename KernelType, int Dims>
- void parallel_for(range<Dims> NumWorkItems, KernelType KernelFunc) {
-#ifdef __SYCL_DEVICE_ONLY__
- sycl_kernel_function<KernelName, KernelType, Dims>(KernelFunc);
-#else
- // Host implementation
-#endif
- }
-};
-} // namespace sycl
-} // namespace cl
+ namespace cl {
+ namespace sycl {
+ class handler {
+ template <typename KernelName, typename KernelType/*, ...*/>
+ __attribute__((sycl_kernel)) void sycl_kernel_function(KernelType KernelFuncObj) {
+ // ...
+ KernelFuncObj();
+ }
+
+ template <typename KernelName, typename KernelType, int Dims>
+ void parallel_for(range<Dims> NumWorkItems, KernelType KernelFunc) {
+ #ifdef __SYCL_DEVICE_ONLY__
+ sycl_kernel_function<KernelName, KernelType, Dims>(KernelFunc);
+ #else
+ // Host implementation
+ #endif
+ }
+ };
+ } // namespace sycl
+ } // namespace cl
The compiler will also generate an OpenCL kernel using the function marked with
the ``sycl_kernel`` attribute.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73104.239312.patch
Type: text/x-patch
Size: 1942 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200121/80bac549/attachment.bin>
More information about the cfe-commits
mailing list