Skip to content

Commit 51a44b4

Browse files
authored
Merge pull request #6 from ProGTX/ProGTX/host_single_task
Renamed `host_task` to `single_task`
2 parents 6a4a121 + 860b8ba commit 51a44b4

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

asynchronous-data-flow/sycl-2.2/03_interacting_with_data_on_the_host.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ enable accessing SYCL memory objects from the host.
1717
### Enqueuing host tasks on SYCL queues
1818

1919
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+
2223
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).
2627
By submitting this command group to the SYCL device queue, we guarantee it is
2728
executed in-order w.r.t the other command groups on the same queue.
2829
Simultaneously, we guarantee that this operation is performed
@@ -32,7 +33,7 @@ Other command groups enqueued in the same or different queues
3233
can be executed following the sequential consistency by guaranteeing the
3334
satisfaction of the requisites of this command group.
3435

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
3637
runtime to perform further optimizations when available.
3738
For example, a SYCL runtime may decide to map / unmap instead of copy operations,
3839
or performing asynchronous transfers while data is being computed.
@@ -48,12 +49,12 @@ include kernel invocation methods.
4849
auto accA = bufA.get_access<access::mode::read>(h);
4950
auto accB = bufB.get_access<access::mode::read_write>(h);
5051

51-
h.host_task([=]() {
52+
h.single_task([=]() {
5253
accB[0] = accA[0] * std::rand();
5354
}
5455

5556
auto accC = bufC.get_access<access::mode::read>(h);
56-
h.host_task([=]() {
57+
h.single_task([=]() {
5758
accC[0] += accA[0] * accB[0];
5859
}
5960
};
@@ -78,15 +79,15 @@ class host_handler {
7879
7980
public:
8081
template <typename FunctorT>
81-
void host_task(FunctorT hostFunction);
82+
void single_task(FunctorT hostFunction);
8283
};
8384
} // namespace sycl
8485
} // namespace cl
8586
```
8687

8788
| Method | Description |
8889
|--------|-------------|
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. |
9091

9192
### Updating data on the host or the device from SYCL queues
9293

0 commit comments

Comments
 (0)