|
| 1 | +<!DOCTYPE html> |
| 2 | + |
| 3 | +<html> |
| 4 | + <head> |
| 5 | + <meta charset="utf-8"> |
| 6 | + <link rel="stylesheet" href="../common-revealjs/css/reveal.css"> |
| 7 | + <link rel="stylesheet" href="../common-revealjs/css/theme/white.css"> |
| 8 | + <link rel="stylesheet" href="../common-revealjs/css/custom.css"> |
| 9 | + <script> |
| 10 | + // This is needed when printing the slides to pdf |
| 11 | + var link = document.createElement( 'link' ); |
| 12 | + link.rel = 'stylesheet'; |
| 13 | + link.type = 'text/css'; |
| 14 | + link.href = window.location.search.match( /print-pdf/gi ) ? '../common-revealjs/css/print/pdf.css' : '../common-revealjs/css/print/paper.css'; |
| 15 | + document.getElementsByTagName( 'head' )[0].appendChild( link ); |
| 16 | + </script> |
| 17 | + <script> |
| 18 | + // This is used to display the static images on each slide, |
| 19 | + // See global-images in this html file and custom.css |
| 20 | + (function() { |
| 21 | + if(window.addEventListener) { |
| 22 | + window.addEventListener('load', () => { |
| 23 | + let slides = document.getElementsByClassName("slide-background"); |
| 24 | + |
| 25 | + if (slides.length === 0) { |
| 26 | + slides = document.getElementsByClassName("pdf-page") |
| 27 | + } |
| 28 | + |
| 29 | + // Insert global images on each slide |
| 30 | + for(let i = 0, max = slides.length; i < max; i++) { |
| 31 | + let cln = document.getElementById("global-images").cloneNode(true); |
| 32 | + cln.removeAttribute("id"); |
| 33 | + slides[i].appendChild(cln); |
| 34 | + } |
| 35 | + |
| 36 | + // Remove top level global images |
| 37 | + let elem = document.getElementById("global-images"); |
| 38 | + elem.parentElement.removeChild(elem); |
| 39 | + }, false); |
| 40 | + } |
| 41 | + })(); |
| 42 | + </script> |
| 43 | + |
| 44 | + </head> |
| 45 | + <body> |
| 46 | + <div class="reveal"> |
| 47 | + <div class="slides"> |
| 48 | + <div id="global-images" class="global-images"> |
| 49 | + <img src="../common-revealjs/images/sycl_academy.png" /> |
| 50 | + <img src="../common-revealjs/images/sycl_logo.png" /> |
| 51 | + <img src="../common-revealjs/images/trademarks.png" /> |
| 52 | + </div> |
| 53 | + <!--Slide 1--> |
| 54 | + <section class="hbox" data-markdown> |
| 55 | + # Summary |
| 56 | + </section> |
| 57 | + <!--Slide 2--> |
| 58 | + <section class="hbox"> |
| 59 | + <div class="hbox" data-markdown> |
| 60 | + ## 1. What is SYCL? |
| 61 | + </div> |
| 62 | + <div class="container"> |
| 63 | + <div class="col" data-markdown> |
| 64 | +  |
| 65 | + </div> |
| 66 | + <div class="col" data-markdown> |
| 67 | + * Single source, high-level, standard C++ programming model, |
| 68 | + that can target a range of heterogeneous platforms |
| 69 | + * Provides high-level abstractions over common boilerplate code |
| 70 | + </div> |
| 71 | + </div> |
| 72 | + </section> |
| 73 | + <!--Slide 3--> |
| 74 | + <section class="hbox"> |
| 75 | + <div class="hbox" data-markdown> |
| 76 | + ## 2. Enqueueing a Kernel |
| 77 | + </div> |
| 78 | + <div class="container"> |
| 79 | + <div class="col"> |
| 80 | + <code><pre> |
| 81 | +class my_kernel; |
| 82 | + |
| 83 | +queue deviceQueue; |
| 84 | +deviceQueue.submit([&](handler& cgh){ |
| 85 | + |
| 86 | + auto os = sycl::stream(1024, 128, cgh); |
| 87 | + |
| 88 | + cgh.single_task<my_kernel>([=]() { |
| 89 | + os << "Hello world!\n"; |
| 90 | + }); |
| 91 | +}).wait(); |
| 92 | + </code></pre> |
| 93 | + </div> |
| 94 | + <div class="col" data-markdown> |
| 95 | + * Series of commands are enqueued via command groups |
| 96 | + * Performed via `sycl::queue::submit` |
| 97 | + * Commands are scheduled for execution on a device |
| 98 | + * Kernels submitted as kernel functions, either as C++ lambdas or function objects |
| 99 | + * There are restrictions on kernel code because of device limitations |
| 100 | + * Can use a `sycl::stream` to write text on device |
| 101 | + </div> |
| 102 | + </div> |
| 103 | + </section> |
| 104 | + <!--Slide 4--> |
| 105 | + <section class="hbox"> |
| 106 | + <div class="hbox" data-markdown> |
| 107 | + ## 3. Managing Data |
| 108 | + </div> |
| 109 | + <div class="container"> |
| 110 | + <div class="col"> |
| 111 | + <code><pre> |
| 112 | + |
| 113 | +class my_kernel; |
| 114 | +queue deviceQueue; |
| 115 | + |
| 116 | +// Create a buffer and allocate USM memory |
| 117 | +buffer<int> user_buffer{range{128}}; |
| 118 | +int* usm_ptr = malloc_device<int>(128, deviceQueue); |
| 119 | + |
| 120 | +deviceQueue.submit([&](handler& cgh){ |
| 121 | + // Request access to buffer |
| 122 | + accessor user_acc{user_buffer, cgh, write_only}; |
| 123 | + |
| 124 | + // USM pointer doesn't need to request access |
| 125 | + |
| 126 | + cgh.single_task<my_kernel>([=]() { |
| 127 | + user_acc[0] = 1; |
| 128 | + usm_ptr[0] = 2; |
| 129 | + }); |
| 130 | +}).wait(); |
| 131 | + |
| 132 | + </code></pre> |
| 133 | + </div> |
| 134 | + <div class="col" data-markdown> |
| 135 | + * Two models for managing data: Buffer/accessor model and Unified Shared Memory |
| 136 | + * SYCL separates the storage (buffer) and access of data (accessor) |
| 137 | + * Different types of accessor provide different ways to access data |
| 138 | + * In buffer/accessor model the scheduler takes care of data movement |
| 139 | + * Access modes specify how to access data (read/write/no_init) |
| 140 | + * USM memory can be allocated as host, device, or shared |
| 141 | + * USM requires manual operations |
| 142 | + </div> |
| 143 | + </div> |
| 144 | + </section> |
| 145 | + <!--Slide 5--> |
| 146 | + <section class="hbox"> |
| 147 | + <div class="hbox" data-markdown> |
| 148 | + ## 4. DATA PARALLELISM and ND-Range Kernels |
| 149 | + </div> |
| 150 | + <div class="container"> |
| 151 | + <div class="col" data-markdown> |
| 152 | +  |
| 153 | + </div> |
| 154 | + <div class="col" data-markdown> |
| 155 | + * Task parallelism: Executes separate tasks simultaneously |
| 156 | + * Data parallelism: Performs the same task on multiple data elements |
| 157 | + * Work-items perform computation, execute independently (threads) |
| 158 | + * Work-items grouped into work-groups. Work-groups invoked within an ND-range. Work-items within a group can synchronize |
| 159 | + * Each work-item has private memory, can't access others' |
| 160 | + </div> |
| 161 | + </div> |
| 162 | + </section> |
| 163 | + <!--Slide 6--> |
| 164 | + <section class="hbox"> |
| 165 | + <div class="hbox" data-markdown> |
| 166 | + ## Further Resources |
| 167 | + </div> |
| 168 | + <div class="container"> |
| 169 | + <div class="col" data-markdown> |
| 170 | + * The SYCL Academy "main" branch contains many more materials to learn from |
| 171 | + * You can follow the guides to install SYCL on your own machine or cluster |
| 172 | + * There is a free SYCL book that can be downloaded |
| 173 | + * The sycl.tech website has a SYCL playground and lots of videos and resources |
| 174 | + * You can find information about SYCL libraries for math and DNN to use alongside your SYCL code (see uxlfoundation.org or Google oneAPI) |
| 175 | + * Search for oneAPI to find Jupyter notebook exercises in SYCL and using the oneAPI libraries |
| 176 | + </div> |
| 177 | + </div> |
| 178 | + </section> |
| 179 | + </div> |
| 180 | + </div> |
| 181 | + <script src="../common-revealjs/js/reveal.js"></script> |
| 182 | + <script src="../common-revealjs/plugin/markdown/marked.js"></script> |
| 183 | + <script src="../common-revealjs/plugin/markdown/markdown.js"></script> |
| 184 | + <script src="../common-revealjs/plugin/notes/notes.js"></script> |
| 185 | + <script> |
| 186 | + Reveal.initialize({mouseWheel: true, defaultNotes: true}); |
| 187 | + Reveal.configure({ slideNumber: true }); |
| 188 | + </script> |
| 189 | + </body> |
| 190 | +</html> |
0 commit comments