Skip to content

[SYCL] Implement local_accessor begin/end #6692

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 9 commits into from
Sep 22, 2022

Conversation

KornevNikita
Copy link
Contributor

@KornevNikita KornevNikita commented Sep 2, 2022

SYCL2020 introduces various accessor begin/end member functions that
allow user to iterate through the underlying buffer.
llvm-test-suite patch: intel/llvm-test-suite#1225

SYCL2020 introduces various accessor begin/end member functions that
allow user to iterate through the underlying buffer.
@KornevNikita
Copy link
Contributor Author

/verify with intel/llvm-test-suite#1225

@KornevNikita
Copy link
Contributor Author

Looks like CI & jenkins/llvm-test-suite failures are not related to this patch. @steffenlarsen @AlexeySachkov take a look please

@steffenlarsen
Copy link
Contributor

Looks like the same test fails on #6666

@KornevNikita
Copy link
Contributor Author

/verify with intel/llvm-test-suite#1225

steffenlarsen
steffenlarsen previously approved these changes Sep 5, 2022
Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

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

LGTM, but how is this an ABI-break?

@KornevNikita KornevNikita changed the title [SYCL][ABI-BREAK] Implement accessor begin/end [SYCL] Implement accessor begin/end Sep 5, 2022
@KornevNikita
Copy link
Contributor Author

Re-trigger tests

@KornevNikita KornevNikita reopened this Sep 6, 2022
@KornevNikita
Copy link
Contributor Author

/verify with intel/llvm-test-suite#1225

@KornevNikita
Copy link
Contributor Author

@AlexeySachkov @dm-vodopyanov could you please take a look?

@KornevNikita
Copy link
Contributor Author

Re-trigger tests

@KornevNikita KornevNikita reopened this Sep 7, 2022
@KornevNikita
Copy link
Contributor Author

/verify with intel/llvm-test-suite#1225

using const_reference = const DataT &;
using iterator = value_type *;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please do not consider my comments as meaningful or blocking since I'm not an expert in this.
But, I'm just curious, will iterator that defined as a pointer work for some weird test cases like 2D sub-acccessor. See Ranged accessors in SYCL 2020 to understand what I mean - https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:accessors.ranged . The phrase that concerns me most is:

If the ranged accessor is multi-dimensional, the sub-range is allowed to describe a region of memory in the underlying buffer that is not contiguous in the linear address space.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make sense. Need to investigate, thank you

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed this part of changes because it will be done in scope of #6815

@KornevNikita KornevNikita marked this pull request as draft September 8, 2022 09:34
@KornevNikita
Copy link
Contributor Author

Converting to draft since this interface should also be implemented for local_accessor

@KornevNikita KornevNikita changed the title [SYCL] Implement accessor begin/end [SYCL] Implement local_accessor begin/end Sep 19, 2022
@KornevNikita
Copy link
Contributor Author

/verify with intel/llvm-test-suite#1225

@KornevNikita KornevNikita marked this pull request as ready for review September 19, 2022 16:35
@aelovikov-intel
Copy link
Contributor

How does it work without #6815 ?

@KornevNikita
Copy link
Contributor Author

@aelovikov-intel Hi, we need a new special iterator class from #6815 only for the accessor, because accessor can be ranged hence it's underlying buffer may not be continuous in memory (please check Maria's comment above). For the local_accessor we can just use basic pointer to data, because his buffer always continuous.

@aelovikov-intel
Copy link
Contributor

That makes sense, thanks! One more question - where does the guarantee that

local_accessor<double, 2> a{cgh, range{3, 3}};

would be consecutive comes from? Is it the standard or the implementation?

@KornevNikita
Copy link
Contributor Author

KornevNikita commented Sep 20, 2022

@aelovikov-intel I can't find any confirmative statement about this moment in the spec. But, according to the same quote from the Maria's comment - If the ranged accessor is multi-dimensional, the sub-range is allowed to describe a region of memory in the underlying buffer that is not contiguous in the linear address space - I believe the only sub-range of the ranged accessor is allowed to describe a non-contiguous region. And since the local_accessor hasn't an offset - it can't be ranged, so it's ensured by implementation, isn't it?

@aelovikov-intel
Copy link
Contributor

I don't think it does, because, despite similarities, accessor and local_accessor are different entities after all.

I'm fine if our implementation ensures that and it would be enough for me.

Copy link
Contributor

@aelovikov-intel aelovikov-intel left a comment

Choose a reason for hiding this comment

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

LGTM, I'll let others to take a look/approve.

Copy link
Contributor

@Fznamznon Fznamznon left a comment

Choose a reason for hiding this comment

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

No more tricky questions from my side :)

Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

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

LGTM!

@KornevNikita
Copy link
Contributor Author

/verify with intel/llvm-test-suite#1225

@AlexeySachkov
Copy link
Contributor

@KornevNikita, even though failures look unrelated, we need to have them fixed or at least covered by a tracker - could you please create such?

@AlexeySachkov AlexeySachkov merged commit 5b9fd3c into intel:sycl Sep 22, 2022
@KornevNikita KornevNikita deleted the accessor-iterators branch September 23, 2022 10:07
steffenlarsen pushed a commit to intel/llvm-test-suite that referenced this pull request Oct 13, 2022
aelovikov-intel pushed a commit to aelovikov-intel/llvm that referenced this pull request Mar 27, 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.

5 participants