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

buffer::set_final_data *should* accept weak_ptr<T[]> #695

Open
tomdeakin opened this issue Jan 23, 2025 · 2 comments
Open

buffer::set_final_data *should* accept weak_ptr<T[]> #695

tomdeakin opened this issue Jan 23, 2025 · 2 comments

Comments

@tomdeakin
Copy link
Contributor

KhronosGroup/SYCL-CTS#1011

The WG discussed that this is an oversight in the spec

@fknorr
Copy link

fknorr commented Jan 23, 2025

What is the set of types you propose?

  • Any output iterator
  • std::weak_ptr<T>
  • std::weak_ptr<T[]>

at least I suppose. The CTS and DPC++ currently also requires / implements

  • std::shared_ptr<T[]>

and if this is intentional, maybe

  • std::shared_ptr<T>

should be added as well, with identical semantics to passing it as a buffer ctor argument?

@gmlueck
Copy link
Contributor

gmlueck commented Jan 23, 2025

We did not discuss this in depth in the WG today, so these are my own thoughts.

It seems like we should define separate overloads of set_final_data that take weak_ptr<T> and weak_ptr<T[]>. By defining them as separate overloads (vs. constraints on the template parameter), the user can pass anything that is implicitly convertible to these types. For example, an application could pass shared_ptr<T> because there is an implicit conversion from that to weak_ptr<T>.

We probably also want an overload which is a function template, where the template parameter is constrained to an output iterator to T.

I looked quickly at the DPC++ implementation. We do not have a special overload for shared_ptr<T>. Rather the template parameter just has no constraint. As a result, you can pass anything, include shared_ptr<T>.

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

No branches or pull requests

3 participants