You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: asynchronous-data-flow/sycl-2.2/03_interacting_with_data_on_the_host.md
+11-10Lines changed: 11 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,12 +17,13 @@ enable accessing SYCL memory objects from the host.
17
17
### Enqueuing host tasks on SYCL queues
18
18
19
19
Listing [hostcg:req] shows a command group
20
-
(CG<sub>h</sub>{r<sub>read(bufA)</sub>,r<sub>read_write(bufB)</sub>}) that it is enqueued on a device queue but
21
-
performs operations on the host.
20
+
(CG<sub>h</sub>{r<sub>read(bufA)</sub>,r<sub>read_write(bufB)</sub>}) that is
21
+
enqueued on a device queue but performs operations on the host.
22
+
22
23
We introduce a new type of handler, the **host\_handler**, which includes a new
23
-
**host\_task** method that executes a task on the host. The`host_handler` can
24
-
be passed to any function that expects a `handler` parameter (e.g. calling
25
-
`get_access(handler)` on a buffer).
24
+
**single\_task** method that executes a single task on the host. The
25
+
`host_handler` can be passed to any function that expects a `handler` parameter
26
+
(e.g. calling `get_access(handler)` on a buffer).
26
27
By submitting this command group to the SYCL device queue, we guarantee it is
27
28
executed in-order w.r.t the other command groups on the same queue.
28
29
Simultaneously, we guarantee that this operation is performed
@@ -32,7 +33,7 @@ Other command groups enqueued in the same or different queues
32
33
can be executed following the sequential consistency by guaranteeing the
33
34
satisfaction of the requisites of this command group.
34
35
35
-
The possibility of enqueuing host task on SYCL queues also enables the
36
+
The possibility of enqueuing host tasks on SYCL queues also enables the
36
37
runtime to perform further optimizations when available.
37
38
For example, a SYCL runtime may decide to map / unmap instead of copy operations,
38
39
or performing asynchronous transfers while data is being computed.
@@ -48,12 +49,12 @@ include kernel invocation methods.
48
49
auto accA = bufA.get_access<access::mode::read>(h);
49
50
auto accB = bufB.get_access<access::mode::read_write>(h);
50
51
51
-
h.host_task([=]() {
52
+
h.single_task([=]() {
52
53
accB[0] = accA[0] * std::rand();
53
54
}
54
55
55
56
auto accC = bufC.get_access<access::mode::read>(h);
56
-
h.host_task([=]() {
57
+
h.single_task([=]() {
57
58
accC[0] += accA[0] * accB[0];
58
59
}
59
60
};
@@ -78,15 +79,15 @@ class host_handler {
78
79
79
80
public:
80
81
template <typename FunctorT>
81
-
void host_task(FunctorT hostFunction);
82
+
void single_task(FunctorT hostFunction);
82
83
};
83
84
} // namespace sycl
84
85
} // namespace cl
85
86
```
86
87
87
88
| Method | Description |
88
89
|--------|-------------|
89
-
|*`template <typename FunctorT> void host_task(FunctorT hostFunction)`*| The user-provided hostFunction will be executed once all requirements for the command group are met. The hostFunction must be a Callable object. |
90
+
|*`template <typename FunctorT> void single_task(FunctorT hostFunction)`*| The user-provided hostFunction will be executed once all requirements for the command group are met. The hostFunction must be a Callable object. |
90
91
91
92
### Updating data on the host or the device from SYCL queues
0 commit comments