From 2f780b5667ca8722a844f7cfc1f871342ccbb96a Mon Sep 17 00:00:00 2001 From: Victor Lomuller Date: Wed, 10 Apr 2024 19:49:22 +0100 Subject: [PATCH 1/2] Enable syntax cpp highlighting Code blocks was not configured leading Shpinx to assume python. The patch sets `highlight_language` to `cpp` and locally change to `none` non C++ code blocks --- source/conf.py | 2 ++ source/iface/async_handler.rst | 1 + source/iface/atomic_ref.rst | 1 + source/iface/buffer.rst | 1 + source/iface/command-group-handler.rst | 2 ++ source/iface/context.rst | 1 + source/iface/defining-kernels.rst | 1 + source/iface/device-selector.rst | 1 + source/iface/device.rst | 1 + source/iface/event.rst | 1 + source/iface/exception.rst | 1 + source/iface/group-algorithms-library.rst | 1 + source/iface/platform.rst | 1 + source/iface/private_memory.rst | 1 + source/iface/queue.rst | 2 ++ source/iface/specialization-constants.rst | 1 + source/iface/stream.rst | 1 + source/iface/usm_allocations.rst | 2 ++ source/iface/vector-types.rst | 4 ++-- 19 files changed, 24 insertions(+), 2 deletions(-) diff --git a/source/conf.py b/source/conf.py index 0143e75b..b9c81d55 100644 --- a/source/conf.py +++ b/source/conf.py @@ -418,6 +418,8 @@ def make_ref(ref_str, ref_view, ref_sufix): primary_domain = "cpp" +highlight_language = 'cpp' + # -- Options for spelling extension ------------------------------------------- spelling_show_suggestions = True diff --git a/source/iface/async_handler.rst b/source/iface/async_handler.rst index 04278ecf..347e9b5f 100644 --- a/source/iface/async_handler.rst +++ b/source/iface/async_handler.rst @@ -78,4 +78,5 @@ function and passing it to the :ref:`queue`. Output: .. literalinclude:: /examples/async-handler.out + :language: none :lines: 5- diff --git a/source/iface/atomic_ref.rst b/source/iface/atomic_ref.rst index f77e632a..4b023244 100644 --- a/source/iface/atomic_ref.rst +++ b/source/iface/atomic_ref.rst @@ -682,5 +682,6 @@ Examples :caption: Thread-safe push/pop using atomic operations. .. literalinclude:: /examples/atomic.out + :language: none :lines: 5- :caption: Output. diff --git a/source/iface/buffer.rst b/source/iface/buffer.rst index 2106e108..3a581106 100644 --- a/source/iface/buffer.rst +++ b/source/iface/buffer.rst @@ -964,4 +964,5 @@ An example of creating sub-buffers from a parent buffer: Output: .. literalinclude:: /examples/creating-sub-buffers.out + :language: none :lines: 5- diff --git a/source/iface/command-group-handler.rst b/source/iface/command-group-handler.rst index 5b3bfc0f..4d3591bb 100644 --- a/source/iface/command-group-handler.rst +++ b/source/iface/command-group-handler.rst @@ -1053,6 +1053,7 @@ described in :ref:`host_task-basic` chapter. Output: .. literalinclude:: /examples/host-task.out + :language: none :lines: 5- .. _handler-example2: @@ -1075,4 +1076,5 @@ buffer on the device unchanged. Output: .. literalinclude:: /examples/handler-copy.out + :language: none :lines: 5- diff --git a/source/iface/context.rst b/source/iface/context.rst index 3d995cc2..27335105 100644 --- a/source/iface/context.rst +++ b/source/iface/context.rst @@ -301,4 +301,5 @@ Print out all the devices within a context. Potential Output: .. literalinclude:: /examples/context.out + :language: none :lines: 5- diff --git a/source/iface/defining-kernels.rst b/source/iface/defining-kernels.rst index c48e3256..85e08e44 100644 --- a/source/iface/defining-kernels.rst +++ b/source/iface/defining-kernels.rst @@ -61,6 +61,7 @@ number. Possible output: .. literalinclude:: /examples/def_kernels_named_function_obj.out + :language: none :lines: 5- The random number is generated during the construction diff --git a/source/iface/device-selector.rst b/source/iface/device-selector.rst index d178badc..509fa42e 100644 --- a/source/iface/device-selector.rst +++ b/source/iface/device-selector.rst @@ -109,4 +109,5 @@ Example 1 Output on a system without a GPU: .. literalinclude:: /examples/gpu-selector.out + :language: none :lines: 5- diff --git a/source/iface/device.rst b/source/iface/device.rst index 61871c2e..536a1433 100644 --- a/source/iface/device.rst +++ b/source/iface/device.rst @@ -1627,4 +1627,5 @@ Enumerate the GPU devices. Output example: .. literalinclude:: /examples/get_devices.out + :language: none :lines: 5- diff --git a/source/iface/event.rst b/source/iface/event.rst index a191faf0..0ce0c4df 100644 --- a/source/iface/event.rst +++ b/source/iface/event.rst @@ -369,4 +369,5 @@ event profiling info. Output example: .. literalinclude:: /examples/event-elapsed-time.out + :language: none :lines: 5- diff --git a/source/iface/exception.rst b/source/iface/exception.rst index c1bc3e89..d78986c9 100644 --- a/source/iface/exception.rst +++ b/source/iface/exception.rst @@ -381,4 +381,5 @@ Catching asynchronous exceptions for incorrect range construction. Output: .. literalinclude:: /examples/exception-handling.out + :language: none :lines: 5- diff --git a/source/iface/group-algorithms-library.rst b/source/iface/group-algorithms-library.rst index ffa9f821..2de9c50f 100644 --- a/source/iface/group-algorithms-library.rst +++ b/source/iface/group-algorithms-library.rst @@ -678,5 +678,6 @@ Example :caption: Using the group algorithms library to perform a work-group reduce. .. literalinclude:: /examples/reduce-alg-lib.out + :language: none :lines: 5- :caption: Output. diff --git a/source/iface/platform.rst b/source/iface/platform.rst index 3edc0768..31d9298b 100644 --- a/source/iface/platform.rst +++ b/source/iface/platform.rst @@ -224,4 +224,5 @@ Enumerate the platforms and the devices they contain. Output: .. literalinclude:: /examples/get-platforms.out + :language: none :lines: 5- diff --git a/source/iface/private_memory.rst b/source/iface/private_memory.rst index a07b15b7..db23b35e 100644 --- a/source/iface/private_memory.rst +++ b/source/iface/private_memory.rst @@ -102,4 +102,5 @@ Example of usage of the ``sycl::private_memory``: Output example: .. literalinclude:: /examples/private_memory_example.out + :language: none :lines: 5- diff --git a/source/iface/queue.rst b/source/iface/queue.rst index 7558af20..51cba2dc 100644 --- a/source/iface/queue.rst +++ b/source/iface/queue.rst @@ -630,6 +630,7 @@ Submission of a single task SYCL kernel function. Output: .. literalinclude:: /examples/queue-single-task.out + :language: none :lines: 5- .. _queue-example-2: @@ -647,4 +648,5 @@ Submission of a parallel SYCL kernel function. Output: .. literalinclude:: /examples/queue-parallel.out + :language: none :lines: 5- diff --git a/source/iface/specialization-constants.rst b/source/iface/specialization-constants.rst index be963f8e..d1553f50 100644 --- a/source/iface/specialization-constants.rst +++ b/source/iface/specialization-constants.rst @@ -265,4 +265,5 @@ specialization constants to set the values of the coefficients. Output: .. literalinclude:: /examples/specialization-constants.out + :language: none :lines: 5- diff --git a/source/iface/stream.rst b/source/iface/stream.rst index aff33b51..6b68b9f4 100644 --- a/source/iface/stream.rst +++ b/source/iface/stream.rst @@ -231,4 +231,5 @@ Output text to the console in a kernel. Output: .. literalinclude:: /examples/stream.out + :language: none :lines: 5- diff --git a/source/iface/usm_allocations.rst b/source/iface/usm_allocations.rst index 1c5c750f..96825a74 100644 --- a/source/iface/usm_allocations.rst +++ b/source/iface/usm_allocations.rst @@ -436,6 +436,7 @@ See :ref:`usm-implicit-data-movement` for usage. Output: .. literalinclude:: /examples/std-vector.out + :language: none :lines: 5- .. _usm-implicit-data-movement: @@ -458,4 +459,5 @@ by the host code, all without programmer intervention. Output: .. literalinclude:: /examples/usm-implicit-data-movement.out + :language: none :lines: 5- diff --git a/source/iface/vector-types.rst b/source/iface/vector-types.rst index cafadbdf..a149df25 100644 --- a/source/iface/vector-types.rst +++ b/source/iface/vector-types.rst @@ -1023,7 +1023,7 @@ stored in memory sequentially and contiguously and are aligned to the size of the element type in bytes multiplied by the number of elements: -:: +.. code-block:: none sizeof(DataT)â‹…NumElements @@ -1031,7 +1031,7 @@ The exception to this is when the number of element is three in which case the SYCL ``sycl::vec`` is aligned to the size of the element type in bytes multiplied by four: -:: +.. code-block:: none sizeof(DataT)â‹…4 From 949611bebf54850f89e7c53651220b01311e1f56 Mon Sep 17 00:00:00 2001 From: Victor Lomuller Date: Thu, 11 Apr 2024 14:54:08 +0100 Subject: [PATCH 2/2] Fix python formating --- source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/conf.py b/source/conf.py index b9c81d55..d48e3c48 100644 --- a/source/conf.py +++ b/source/conf.py @@ -418,7 +418,7 @@ def make_ref(ref_str, ref_view, ref_sufix): primary_domain = "cpp" -highlight_language = 'cpp' +highlight_language = "cpp" # -- Options for spelling extension -------------------------------------------