File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
asynchronous-data-flow/sycl-2.2 Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,9 @@ runtime to perform further optimizations when available.
34
34
For example, a SYCL runtime may decide to map / unmap instead of copy operations,
35
35
or performing asynchronous transfers while data is being computed.
36
36
37
+ It is possible to run multiple host tasks in the same command group - the host
38
+ tasks are executed in-order within the command group.
39
+
37
40
``` cpp
38
41
auto cgH = [=] (handler& h) {
39
42
auto accA = bufA.get_access<access::mode::read>(h);
@@ -42,10 +45,20 @@ or performing asynchronous transfers while data is being computed.
42
45
h.host_task([=]() {
43
46
accB[0] = accA[0] * std::rand();
44
47
}
45
- };
48
+
49
+ auto accC = bufC.get_access<access::mode::read>(h);
50
+ h.host_task([=]() {
51
+ accC[0] += accA[0] * accB[0];
52
+ }
53
+ };
46
54
qA.submit(cgH);
47
55
```
48
56
57
+ Note that in the code above `accC` was created after the first host task has
58
+ been scheduled, but the actual data may already be available before the first
59
+ host task starts executing. In the second host task, the value of `accB` is
60
+ consistent with the value set in the first host task.
61
+
49
62
#### API changes
50
63
51
64
| Method | Description |
You can’t perform that action at this time.
0 commit comments