Skip to content

Placeholder accessors can be default constructed #18

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
23 changes: 21 additions & 2 deletions placeholder_accessors/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
| Reply-to | Ruyman Reyes <[email protected]> |
| Original author | Ruyman Reyes <[email protected]> |
| Requirements | CP001 |
| Contributors | Gordon Brown <[email protected]>, Victor Lomuller <[email protected]>, Mehdi Goli <[email protected]>, Peter Zuzek <[email protected]>, Luke Iwanski <[email protected]> |
| Contributors | Gordon Brown <[email protected]>, Victor Lomuller <[email protected]>, Mehdi Goli <[email protected]>, Peter Zuzek <[email protected]>, Luke Iwanski <[email protected]>, Michael Haidl <[email protected]> |

## Overview

Expand Down Expand Up @@ -172,7 +172,10 @@ except for the aforementioned modifications.

### When `is_placeholder` returns true

The accessor API features constructors that don't take the handler parameter.
The accessor API features constructors that don't take the handler parameter
and/or memory object as a constructor. Accessors can then be default
constructed, and the memory object can be assigned later when registering
the accessor in the command group.

In addition, a new method to obtain a normal accessor from the placeholder
accessor is provided.
Expand All @@ -192,6 +195,22 @@ The handler gains a new method,
that registers the requirements of the placeholder accessor on the given
Copy link
Contributor

Choose a reason for hiding this comment

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

If we wish to support the option for constructing a regular accessor from a placeholder accessor (i.e. get_access) then this interface should also be extended to allow you to specify a memory object. We should also specify that an exception should be thrown if get_access is called without providing a memory object on a placeholder accessor which doesn't have a memory object already.

On a side note, perhaps we should consider changing the naming of this member function, get_access could be confused with the regular get_access member functions.

command group.

Another method, that allows specifying the memory object the placeholder
accessor will be associated is also provided:

`handler::require(buffer<T, dim> b,
accessor<T, dim, mode, target, access::placeholder::true_t>)`

### Placeholder `accessor` without a buffer

If a placeholder accessor which was not constructed with a buffer is not tied
to a buffer within a command group, then an exception is thrown. An accessor
can be checked for the existence of an associated a buffer using `has_buffer()`.

|Member function |Description |
|-----------------------|---------------------------------------------------------|
|bool has_buffer() const|Returns true if the accessor is associated with a buffer,|
| |and false otherwise. |

[1]: https://github.com/codeplaysoftware/sycl-blas "SYCL-BLAS"
[2]: https://github.com/lukeiwanski/tensorflow "TensorFlow/Eigen"
Expand Down