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

result_and_scratch_storage/future design issues: #2003

Open
MikeDvorskiy opened this issue Jan 17, 2025 · 3 comments
Open

result_and_scratch_storage/future design issues: #2003

MikeDvorskiy opened this issue Jan 17, 2025 · 3 comments
Milestone

Comments

@MikeDvorskiy
Copy link
Contributor

MikeDvorskiy commented Jan 17, 2025

Actually, there are really result_and_scratch_storage/future design issues:

  • result_and_scratch_storage type combines live-time extension of a temporary buffer and provides returning some result values from a kernel.
  • Moreover result_and_scratch_storage type has limitation - only one type for return values and temporary values.
  • result_and_scratch_storage allows to set more than one value return, but just the same type and there is not effective API in future object to get the all values, just the first.

Originally posted by @MikeDvorskiy in #1942 (comment)

@danhoeflinger
Copy link
Contributor

I agree that there are issues which need to be addressed here. However, if we want to expand its functionality to be suitable to more cases, we just need to be sure not to harm performance of the existing cases. I think that is possible but we need to be aware of it.

@danhoeflinger
Copy link
Contributor

As mentioned here, I think we can use result_and_scratch_storage return array to implement returning multiple elements from __future with a generic function which will return a tuple of size M where M is a template integer argument to a function.

I would at least like to fix this and remove the specific functions which are only there to return a pair of std::size_t for 2022.9.0, if not complete our entire plan for refactoring __future, and __result_and_scratch_storage.

@danhoeflinger danhoeflinger added this to the 2022.9.0 milestone Jan 28, 2025
@danhoeflinger
Copy link
Contributor

I do think the second point:

Moreover result_and_scratch_storage type has limitation - only one type for return values and temporary values.

Needs to be treated with care though, while this would be "nice to have" to allow differing types for return and temporary, it does limit potential performance, so it should be done with care. Certainly we can design it to give the most optimal performance for the types used though.

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

2 participants