Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ class MandelParallel : public Mandel {
// We submit a command group to the queue.
q.submit([&](handler &h) {
// Get access to the buffer.
auto b = data_buf.get_access<access::mode::write>(h);
auto b = data_buf.get_access(h,write_only);

// Iterate over image and compute mandel for each point.
h.parallel_for(range(rows, cols), [=](id<2> index) {
h.parallel_for(range<2>(rows, cols), [=](auto index) {
int i = int(index[0]);
int j = int(index[1]);
auto c = MandelParameters::ComplexF(p.ScaleRow(i), p.ScaleCol(j));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ double MonteCarloPi(rgb image_plot[]) {
// Perform Monte Carlo simulation and reduce results
q.submit([&](handler& h) {
// Set up accessors
auto imgplot_acc = imgplot_buf.get_access<access::mode::write>(h);
auto coords_acc = coords_buf.get_access<access::mode::read_write>(h);
auto total_acc = total_buf.get_access<access::mode::read_write>(h);
auto imgplot_acc = imgplot_buf.get_access(h);
auto coords_acc = coords_buf.get_access(h);
auto total_acc = total_buf.get_access(h);

// Monte Carlo Procedure + Reduction
h.parallel_for(nd_range<1>(num_wg * size_wg, size_wg),
sycl::intel::reduction(total_acc, 0, std::plus<int>()),
sycl::ONEAPI::reduction(total_acc, 0, std::plus<int>()),
[=](nd_item<1> it, auto& total_acc) {
// Index for accessing buffers
int i = it.get_global_id();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,20 +230,20 @@ void ProcessImage(rgb* indataset, rgb* outdataset, int width, int height) {
// Creating a transpose of DCT matrix
MatrixTranspose(dct, dctinv);

buffer<rgb, 1> indata_buf((rgb*)indataset, range<1>(image_size));
buffer<rgb, 1> outdata_buf((rgb*)outdataset, range<1>(image_size));
buffer<float, 1> dct_buf((float*)dct, range<1>(block_size));
buffer<float, 1> dctinv_buf((float*)dctinv, range<1>(block_size));
buffer indata_buf(indataset, range<1>(image_size));
buffer outdata_buf(outdataset, range<1>(image_size));
buffer dct_buf(dct, range<1>(block_size));
buffer dctinv_buf(dctinv, range<1>(block_size));

q.submit([&](handler& h) {
auto i_acc = indata_buf.get_access<access::mode::read>(h);
auto o_acc = outdata_buf.get_access<access::mode::read_write>(h);
auto d_acc = dct_buf.get_access<access::mode::read>(h);
auto di_acc = dctinv_buf.get_access<access::mode::read>(h);
auto i_acc = indata_buf.get_access(h,read_only);
auto o_acc = outdata_buf.get_access(h);
auto d_acc = dct_buf.get_access(h,read_only);
auto di_acc = dctinv_buf.get_access(h,read_only);

// Processes individual 8x8 chunks in parallel
h.parallel_for(
range<2>(width / block_dims, height / block_dims), [=](id<2> idx) {
range<2>(width / block_dims, height / block_dims), [=](auto idx) {
int start_index = idx[0] * block_dims + idx[1] * block_dims * width;
ProcessBlock(i_acc.get_pointer(), o_acc.get_pointer(),
d_acc.get_pointer(), di_acc.get_pointer(), start_index,
Expand Down