Skip to content

Conversation

@lrpablo
Copy link
Contributor

@lrpablo lrpablo commented Jan 9, 2024

The solution.cpp uses items in the parallel_for but the README.md uses ids. I changed the README.md and added the code to the solution.cpp

@DuncanMcBain DuncanMcBain self-requested a review January 17, 2024 19:33
@DuncanMcBain DuncanMcBain self-assigned this Jan 17, 2024
```
auto rowMajorLinearId = (idx[1] * width) + idx[0]; // row-major
auto columnMajorLinearId = (idx[0] * height) + idx[1]; // column-major
auto rowMajorLinearId = sycl::id(globalId[0], globalId[1]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the original intent, here, since it talks about the linear id presumably the intent is to linearise it manually (to demonstrate the difference in striding). Can we change the other side instead to better match this?

Comment on lines +82 to +83
auto rowMajorLinearId = sycl::id(globalId[0], globalId[1]);
auto columnMajorLinearId = sycl::id(globalId[1], globalId[0]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly these are 2d ids, not linear ones

@lrpablo
Copy link
Contributor Author

lrpablo commented Feb 5, 2024 via email

@TApplencourt
Copy link
Collaborator

Update on the status will be appreciated : )

EwanC added a commit to EwanC/syclacademy that referenced this pull request Jan 16, 2026
This PR is inspired by the Lesson 4 `index.html` changes in
KhronosGroup#326
and fixes up the `handler::single_task` invocations in
a couple of places to make sure they are correct.

* Change `parallel_for` to `single_task` in early example where
  we haven't defined `bufO` yet to call `bufO.get_range()` on.
* Remove `(id<1> i)` parameter for `single_task` lambda invocation, as
  this shouldn't have any parameters.
EwanC added a commit to EwanC/syclacademy that referenced this pull request Jan 16, 2026
This PR tries to resolve the issue highlighted in
KhronosGroup#326
where the "Coalesced Global Memory" exercise README was
asking a user to manually calculate a linear id that
would be used to index memory. However, the exercise
code itself uses 2d buffers/accessors which are
indexed with a `sycl::id<2>`. So the current exercise
request doesn't make sense, or could only be achieved with
modifications beyond what is reasonably expected for a beginner.

Instead, I've updated the README to state the usage
of the 2d buffer/accessors and ask the user to experiment
with flipping the dimension indexes, as this is the only
difference between this exercise solution, and the
solution from the previous lesson

```sh
$ diff Code_Exercises/Coalesced_Global_Memory/solution.cpp Code_Exercises/Image_Convolution/reference.cpp
59a60
>
77a79
>                     globalId = sycl::id{globalId[1], globalId[0]};
```
EwanC added a commit to EwanC/syclacademy that referenced this pull request Jan 16, 2026
This PR tries to resolve the issue highlighted in
KhronosGroup#326
where the "Coalesced Global Memory" exercise README was
asking a user to manually calculate a linear id that
would be used to index memory. However, the exercise
code itself uses 2d buffers/accessors which are
indexed with a `sycl::id<2>`. So the current exercise
request doesn't make sense, or could only be achieved with
modifications beyond what is reasonably expected for a beginner.

Instead, I've updated the README to state the usage
of the 2d buffer/accessors and ask the user to experiment
with flipping the dimension indexes, as this is the only
difference between this exercise solution, and the
solution from the previous lesson

```sh
$ diff Code_Exercises/Coalesced_Global_Memory/solution.cpp Code_Exercises/Image_Convolution/reference.cpp
59a60
>
77a79
>                     globalId = sycl::id{globalId[1], globalId[0]};
```
@EwanC
Copy link
Contributor

EwanC commented Jan 16, 2026

Update on the status will be appreciated : )

I've created new PRs to try address the issues highlighted but based on up-to-date tip:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants