|
68 | 68 | </div>
|
69 | 69 | <div class="container" data-markdown>
|
70 | 70 | * In SYCL there are two models for managing data:
|
71 |
| - * The buffer/accessor model. |
72 |
| - * The USM (unified shared memory) model. |
| 71 | + * The buffer/accessor model. |
| 72 | + * The USM (unified shared memory) model. |
73 | 73 | * Which model you choose can have an effect on how you enqueue kernel functions.
|
74 | 74 | </div>
|
75 | 75 | </section>
|
|
81 | 81 | </div>
|
82 | 82 | <div class="container" data-markdown>
|
83 | 83 | * A GPU has its own memory, separate to CPU memory.
|
84 |
| - * In order for the GPU to use memory from the CPU we need to: |
85 |
| - * Allocate memory on the GPU. |
86 |
| - * Memcpy data from the CPU to the allocation on the GPU. |
87 |
| - * Perform some computation on the GPU. |
88 |
| - * Memcpy the result back to CPU. |
89 |
| - |
| 84 | + * In order for the GPU to use memory from the CPU, the following actions must take place (either explicitly or implicitly): |
| 85 | + * Memory allocation on the GPU. |
| 86 | + * Data migration from the CPU to the allocation on the GPU. |
| 87 | + * Some computation on the GPU. |
| 88 | + * Migration of the result back to the CPU. |
90 | 89 | </div>
|
91 | 90 | <img src="../common-revealjs/images/gpu_cpu_memory.png" height="400">
|
92 | 91 | </section>
|
|
398 | 397 | auto accA = sycl::accessor{bufA, cgh, sycl::read_only};
|
399 | 398 | auto accB = sycl::accessor{bufA, cgh, sycl::no_init};
|
400 | 399 |
|
401 |
| - cgh.single_task(...); // Do some work |
| 400 | + cgh.single_task<mykernel>(...); // Do some work |
402 | 401 | });
|
403 | 402 |
|
404 | 403 | } // var updated here
|
|
423 | 422 | auto inA = sycl::accessor{bufA, cgh, sycl::read_only};
|
424 | 423 | auto inB = sycl::accessor{bufB, cgh, sycl::read_only};
|
425 | 424 | auto out = sycl::accessor{bufO, cgh, sycl::write_only};
|
426 |
| - cgh.single_task([=]{ |
| 425 | + cgh.single_task<mykernel>([=]{ |
427 | 426 | <mark>out[0] = inA[0] + inB[0];</mark>
|
428 | 427 | });
|
429 | 428 | });
|
|
0 commit comments