Skip to content

Fix range dimension order to reflect row-major #158

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 2 commits into from
May 23, 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
9 changes: 7 additions & 2 deletions Code_Exercises/Exercise_15_Image_Convolution/reference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,13 @@ TEST_CASE("image_convolution_naive", "image_convolution_reference") {
auto localRange = sycl::range(1, 32);
auto ndRange = sycl::nd_range(globalRange, localRange);

auto inBufRange = (inputImgWidth + (halo * 2)) * sycl::range(1, channels);
auto outBufRange = inputImgHeight * sycl::range(1, channels);
auto inBufRange =
sycl::range(inputImgHeight + (halo * 2), inputImgWidth + (halo * 2)) *
sycl::range(1, channels);
auto outBufRange =
sycl::range(inputImgHeight, inputImgWidth) * sycl::range(1, channels);


auto filterRange = filterWidth * sycl::range(1, channels);

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ TEST_CASE("image_convolution_coalesced", "coalesced_global_memory_solution") {
auto localRange = sycl::range(1, 32);
auto ndRange = sycl::nd_range(globalRange, localRange);

auto inBufRange = (inputImgWidth + (halo * 2)) * sycl::range(1, channels);
auto outBufRange = inputImgHeight * sycl::range(1, channels);
auto inBufRange =
sycl::range(inputImgHeight + (halo * 2), inputImgWidth + (halo * 2)) *
sycl::range(1, channels);
auto outBufRange =
sycl::range(inputImgHeight, inputImgWidth) * sycl::range(1, channels);
auto filterRange = filterWidth * sycl::range(1, channels);

{
Expand Down
7 changes: 5 additions & 2 deletions Code_Exercises/Exercise_17_Vectors/solution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,11 @@ TEST_CASE("image_convolution_vectorized", "vectors_solution") {
auto localRange = sycl::range(1, 32);
auto ndRange = sycl::nd_range(globalRange, localRange);

auto inBufRange = (inputImgWidth + (halo * 2)) * sycl::range(1, channels);
auto outBufRange = inputImgHeight * sycl::range(1, channels);
auto inBufRange =
sycl::range(inputImgHeight + (halo * 2), inputImgWidth + (halo * 2)) *
sycl::range(1, channels);
auto outBufRange =
sycl::range(inputImgHeight, inputImgWidth) * sycl::range(1, channels);
auto filterRange = filterWidth * sycl::range(1, channels);

{
Expand Down
9 changes: 6 additions & 3 deletions Code_Exercises/Exercise_18_Local_Memory_Tiling/solution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,15 @@ TEST_CASE("image_convolution_tiled", "local_memory_tiling_solution") {
auto filterWidth = filter.width();
auto halo = filter.half_width();

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

auto inBufRange = (inputImgWidth + (halo * 2)) * sycl::range(1, channels);
auto outBufRange = inputImgHeight * sycl::range(1, channels);
auto inBufRange =
sycl::range(inputImgHeight + (halo * 2), inputImgWidth + (halo * 2)) *
sycl::range(1, channels);
auto outBufRange =
sycl::range(inputImgHeight, inputImgWidth) * sycl::range(1, channels);
auto filterRange = filterWidth * sycl::range(1, channels);
auto scratchpadRange = localRange + sycl::range(halo * 2, halo * 2);

Expand Down
9 changes: 6 additions & 3 deletions Code_Exercises/Exercise_19_Work_Group_Sizes/solution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,15 @@ TEST_CASE("image_convolution_tiled", "local_memory_tiling_solution") {
auto filterWidth = filter.width();
auto halo = filter.half_width();

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

auto inBufRange = (inputImgWidth + (halo * 2)) * sycl::range(1, channels);
auto outBufRange = inputImgHeight * sycl::range(1, channels);
auto inBufRange =
sycl::range(inputImgHeight + (halo * 2), inputImgWidth + (halo * 2)) *
sycl::range(1, channels);
auto outBufRange =
sycl::range(inputImgHeight, inputImgWidth) * sycl::range(1, channels);
auto filterRange = filterWidth * sycl::range(1, channels);
auto scratchpadRange = localRange + sycl::range(halo * 2, halo * 2);

Expand Down