Skip to content

Make image conv memory coalescence example more intuitive #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2022
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
3 changes: 2 additions & 1 deletion Code_Exercises/Exercise_15_Image_Convolution/reference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ TEST_CASE("image_convolution_naive", "image_convolution_reference") {
auto halo = filter.half_width();

auto globalRange = sycl::range(inputImgWidth, inputImgHeight);
auto localRange = sycl::range(32, 1);
auto localRange = sycl::range(1, 32);
auto ndRange = sycl::nd_range(globalRange, localRange);

auto inBufRange = (inputImgWidth + (halo * 2)) * sycl::range(1, channels);
Expand All @@ -86,6 +86,7 @@ TEST_CASE("image_convolution_naive", "image_convolution_reference") {
cgh.parallel_for<image_convolution>(
ndRange, [=](sycl::nd_item<2> item) {
auto globalId = item.get_global_id();
globalId = sycl::id{globalId[1], globalId[0]};

auto channelsStride = sycl::range(1, channels);
auto haloOffset = sycl::id(halo, halo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ TEST_CASE("image_convolution_coalesced", "coalesced_global_memory_solution") {
auto halo = filter.half_width();

auto globalRange = sycl::range(inputImgWidth, inputImgHeight);
auto localRange = sycl::range(32, 1);
auto localRange = sycl::range(1, 32);
auto ndRange = sycl::nd_range(globalRange, localRange);

auto inBufRange = (inputImgWidth + (halo * 2)) * sycl::range(1, channels);
Expand All @@ -86,7 +86,6 @@ TEST_CASE("image_convolution_coalesced", "coalesced_global_memory_solution") {
cgh.parallel_for<image_convolution>(
ndRange, [=](sycl::nd_item<2> item) {
auto globalId = item.get_global_id();
globalId = sycl::id{globalId[1], globalId[0]};

auto channelsStride = sycl::range(1, channels);
auto haloOffset = sycl::id(halo, halo);
Expand Down
3 changes: 1 addition & 2 deletions Code_Exercises/Exercise_17_Vectors/solution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ TEST_CASE("image_convolution_vectorized", "vectors_solution") {
auto halo = filter.half_width();

auto globalRange = sycl::range(inputImgWidth, inputImgHeight);
auto localRange = sycl::range(32, 1);
auto localRange = sycl::range(1, 32);
auto ndRange = sycl::nd_range(globalRange, localRange);

auto inBufRange = (inputImgWidth + (halo * 2)) * sycl::range(1, channels);
Expand Down Expand Up @@ -95,7 +95,6 @@ TEST_CASE("image_convolution_vectorized", "vectors_solution") {
cgh.parallel_for<image_convolution>(
ndRange, [=](sycl::nd_item<2> item) {
auto globalId = item.get_global_id();
globalId = sycl::id{globalId[1], globalId[0]};

auto haloOffset = sycl::id(halo, halo);
auto src = (globalId + haloOffset);
Expand Down