Skip to content

[SYCL][Reduction] Avoid implicit atomic64 requirements #9070

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

Conversation

steffenlarsen
Copy link
Contributor

Some of the existing reduction strategies use atomic operations on partial reduction results. However, for reductions on 64-bit values this implicitly adds a requirement that the corresponding device supports aspect::atomic64. This commit adds additional logic to select different strategies based on this.
Note; one of these naively chooses another strategy if the type is 64-bit without checking the support at runtime. Follow-up patches should refactor the strategy selection, allowing this to do appropriate runtime checks.

Some of the existing reduction strategies use atomic operations on
partial reduction results. However, for reductions on 64-bit values this
implicitly adds a requirement that the corresponding device supports
aspect::atomic64. This commit adds additional logic to select different
strategies based on this.
Note; one of these naively chooses another strategy if the type is
64-bit without checking the support at runtime. Follow-up patches should
refactor the strategy selection, allowing this to do appropriate
runtime checks.

Signed-off-by: Larsen, Steffen <[email protected]>
@steffenlarsen steffenlarsen requested a review from a team as a code owner April 14, 2023 11:58
@steffenlarsen steffenlarsen temporarily deployed to aws April 14, 2023 12:22 — with GitHub Actions Inactive
Signed-off-by: Larsen, Steffen <[email protected]>
@steffenlarsen steffenlarsen temporarily deployed to aws April 14, 2023 14:01 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws April 14, 2023 14:34 — with GitHub Actions Inactive
Comment on lines +9 to +12
// TODO: When aspect requirements are added to testing, this test could be set
// to require that atomic64 is NOT supported, to limit how frequently the
// test is run. However, it should work on devices that support atomic64
// as well.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest adding runtime aspect check for that here in this PR with the expectation that we'll uplift it to // REQUIRES once the support is added to the llvm.lit.cfg.py.

I also think that a slightly better option would be to "unit-test" the dynamic strategy selector once it's implemented (i.e., don't even run the actual reduction kernel).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd suggest adding runtime aspect check for that here in this PR with the expectation that we'll uplift it to // REQUIRES once the support is added to the llvm.lit.cfg.py.

We could do a runtime check if you prefer. The test is still valid, so this TODO is more of a suggestion than a requirement really.

I also think that a slightly better option would be to "unit-test" the dynamic strategy selector once it's implemented (i.e., don't even run the actual reduction kernel).

I agree that would be better, but sadly the unittests don't compile the kernels, so we would have no way of knowing if the corresponding kernels had any requirements. We could set the requirements ourselves, but that really defeats the purpose of the tests.

Signed-off-by: Larsen, Steffen <[email protected]>
@steffenlarsen steffenlarsen temporarily deployed to aws April 14, 2023 16:50 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws April 14, 2023 17:26 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen merged commit e11b358 into intel:sycl Apr 17, 2023
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.

2 participants