@@ -170,8 +170,8 @@ aforementioned buffer accessors. Let's create these now - replace the TODO
170170before the kernel function with the following:
171171
172172```cpp
173- auto r_input = input_buf.get_access< celerity::access_mode::read>( cgh, celerity::access::neighborhood( 1, 1)) ;
174- auto dw_edge = edge_buf.get_access< celerity::access_mode::discard_write>(cgh , celerity::access::one_to_one()) ;
173+ celerity::accessor r_input{input_buf, cgh, celerity::access::neighborhood{ 1, 1}, celerity::read_only} ;
174+ celerity::accessor dw_edge{edge_buf, cgh, celerity::access::one_to_one{} , celerity::write_only, celerity::no_init} ;
175175```
176176
177177If you have worked with SYCL before, these buffer accessors will look
@@ -183,8 +183,8 @@ the previous contents of `edge_buf`, which is why we choose to discard them
183183and use the ` discard_write ` access mode.
184184
185185So far everything works exactly as it would in a SYCL application. However,
186- there is a second parameter passed into the ` celerity::buffer::get_access `
187- function that is not present in its SYCL counterpart. In fact, this parameter
186+ there is an additional parameter passed into the ` accessor `
187+ constructor that is not present in its SYCL counterpart. In fact, this parameter
188188represents one of Celerity's most important API additions: While access modes
189189tell the runtime system how a kernel intends to access a buffer, it does not
190190include any information about _ where_ a kernel will access said buffer. In
@@ -252,7 +252,7 @@ your `main()` function:
252252
253253``` cpp
254254queue.submit([=](celerity::handler& cgh) {
255- auto out = edge_buf.get_access< celerity::access_mode::read, celerity::target::host_task>( cgh, celerity::access::all()) ;
255+ celerity::accessor out{edge_buf, cgh, celerity::access::all{}, celerity::read_only_host_task} ;
256256 cgh.host_task(celerity::on_master_node, [=]() {
257257 stbi_write_png ("result.png", img_width, img_height, 1, out.get_pointer(), 0);
258258 });
0 commit comments