Skip to content
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

Fix placeholder accessor wrong checking #683

Conversation

aleksmesh
Copy link
Contributor

@aleksmesh aleksmesh commented Jun 2, 2023

Moved placeholder accessor constructor checking from sycl::handler command.
Cherry-picked PR #669 to avoid CI failures.

To review changes follow this link.

Moved placeholder accessor constructor checking from sycl::handler command.
@aleksmesh aleksmesh requested a review from a team as a code owner June 2, 2023 15:01
@keryell
Copy link
Member

keryell commented Jun 2, 2023

I can wait for the other PRs to land first.

@bader
Copy link
Contributor

bader commented Jun 2, 2023

I can wait for the other PRs to land first.

@keryell, I would appreciate if you could review the patch before #669 is landed.

std::fill(conditions_check, conditions_check + conditions_checks_size, true);

auto acc = get_accessor_functor(data_buf);
if constexpr (AccType != accessor_type::host_accessor) {
Copy link
Member

Choose a reason for hiding this comment

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

Why is there a difference for iterators between host and device?

Copy link
Contributor Author

@aleksmesh aleksmesh Jun 5, 2023

Choose a reason for hiding this comment

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

In paragraph 4.7.6.12. Common members for buffer and local accessors I found this:

iterator begin() const noexcept Returns an iterator to the first element of the memory this accessor may access.For a buffer accessor this is an iterator to the first element of the underlying buffer, unless this is a ranged accessor in which case it is an iterator to first element within the accessor’s range.For accessor and local_accessor, this function may only be called from within a command.

Also in paragraph 4.9.4.1. SYCL functions for adding requirements we have restriction for empty accessors:

template <typename DataT, int Dimensions, access_mode AccessMode, target AccessTarget, access::placeholder IsPlaceholder> void require( accessor<DataT, Dimensions, AccessMode, AccessTarget, IsPlaceholder> acc) Requires access to the memory object associated with the accessor.The command group now has a requirement to gain access to the given memory object before executing the kernel. If the accessor has already been registered with the command group, calling this function has no effect.Throws exception with the errc::invalid error code if (acc.empty() == true).

So we can't check iteration methods of empty placeholder sycl::accessor and we can check sycl::host_accessor iteration methods.

Copy link
Member

Choose a reason for hiding this comment

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

Could you summarize this in some comments around the code? We might forget about the rationale... :-)

Copy link
Contributor Author

@aleksmesh aleksmesh Jun 26, 2023

Choose a reason for hiding this comment

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

@keryell Comments added.

@bader bader requested a review from keryell June 5, 2023 16:17
@bader
Copy link
Contributor

bader commented Jun 26, 2023

@aleksmesh, could you take a look at new conflicts, please?

@aleksmesh
Copy link
Contributor Author

@bader Conflicts are merged.

Copy link
Member

@keryell keryell left a comment

Choose a reason for hiding this comment

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

Thanks.

@bader bader merged commit 9552084 into KhronosGroup:SYCL-2020 Jun 28, 2023
8 checks passed
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