Skip to content

Commit a011f09

Browse files
authored
Merge pull request #1767 from hdelan/docs-fixup
[UR][doc] Reword some programming guide sections
2 parents 41c6290 + 3229503 commit a011f09

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

scripts/core/PROG.rst

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ Initialization and Discovery
7777
Device handle lifetime
7878
----------------------
7979

80-
The device objects are reference-counted, and there are ${x}DeviceRetain and ${x}DeviceRelease.
81-
The ref-count of a device is automatically incremented when device is obtained by ${x}DeviceGet.
82-
After device is no longer needed to the application it must call to ${x}DeviceRelease.
83-
When ref-count of the underlying device handle becomes zero then that device object is deleted.
84-
Note, that besides the application itself, the Unified Runtime may increment and decrement ref-count on its own.
85-
So, after the call to ${x}DeviceRelease below, the device may stay alive until other
86-
objects attached to it, like command-queues, are deleted. But application may not use the device
87-
after it released its own reference.
80+
Device objects are reference-counted, using ${x}DeviceRetain and ${x}DeviceRelease.
81+
The ref-count of a device is automatically incremented when a device is obtained by ${x}DeviceGet.
82+
After a device is no longer needed by the application it must call ${x}DeviceRelease.
83+
When the ref-count of the underlying device handle becomes zero then that device object is deleted.
84+
Note that a Unified Runtime adapter may internally increment and decrement a device's ref-count.
85+
So after the call to ${x}DeviceRelease below, the device may stay active until other
86+
objects using it, such as a command-queue, are deleted. However, an application
87+
may not use the device after it releases its last reference.
8888

8989
.. parsed-literal::
9090
@@ -120,7 +120,7 @@ In case where the info size is only known at runtime then two calls are needed,
120120
Device partitioning into sub-devices
121121
------------------------------------
122122

123-
The ${x}DevicePartition could partition a device into sub-device. The exact representation and
123+
${x}DevicePartition partitions a device into a sub-device. The exact representation and
124124
characteristics of the sub-devices are device specific, but normally they each represent a
125125
fixed part of the parent device, which can explicitly be programmed individually.
126126

@@ -161,9 +161,10 @@ An implementation will return "0" in the count if no further partitioning is sup
161161
Contexts
162162
========
163163

164-
Contexts are serving the purpose of resources sharing (between devices in the same context),
165-
and resources isolation (resources do not cross context boundaries). Resources such as memory allocations,
166-
events, and programs are explicitly created against a context. A trivial work with context looks like this:
164+
Contexts serve the purpose of resource sharing (between devices in the same context),
165+
and resource isolation (ensuring that resources do not cross context
166+
boundaries). Resources such as memory allocations, events, and programs are
167+
explicitly created against a context.
167168

168169
.. parsed-literal::
169170
@@ -235,18 +236,20 @@ explicit and implicit kernel arguments along with data needed for launch.
235236
Queue and Enqueue
236237
=================
237238

238-
A queue object represents a logic input stream to a device. Kernels
239-
and commands are submitted to queue for execution using Equeue commands:
239+
Queue objects are used to submit work to a given device. Kernels
240+
and commands are submitted to queue for execution using Enqueue commands:
240241
such as ${x}EnqueueKernelLaunch, ${x}EnqueueMemBufferWrite. Enqueued kernels
241242
and commands can be executed in order or out of order depending on the
242243
queue's property ${X}_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE when the
243-
queue is created.
244+
queue is created. If a queue is out of order, the queue may internally do some
245+
scheduling of work to achieve concurrency on the device, while honouring the
246+
event dependencies that are passed to each Enqueue command.
244247

245248
.. parsed-literal::
246249
247250
// Create an out of order queue for hDevice in hContext
248251
${x}_queue_handle_t hQueue;
249-
${x}QueueCreate(hContext, hDevice,
252+
${x}QueueCreate(hContext, hDevice,
250253
${X}_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE, &hQueue);
251254
252255
// Launch a kernel with 3D workspace partitioning

0 commit comments

Comments
 (0)