-
Notifications
You must be signed in to change notification settings - Fork 103
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
ext/draft/scratch-memory: Specify num_concurrent_buffers
#436
base: next
Are you sure you want to change the base?
Conversation
This commit adds a new parameter to the `reserve()` method of the draft `scratch-memory` extension which allows a plugin to indicate to the host whether its `thread-pool` tasks need to access scratch memory buffers or not, and if so, how many of them the host must accommodate.
Peter Bridgman seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
I have signed the CLA but the bot doesn't seem to be happy - not sure if there's a step I'm missing? |
Thank you for the PR. |
Maybe you can try to visit this link again? |
I find that this additional parameter makes everything more complicated and harder to understand. If a plugin wants concurrent buffers, but doesn't know what its maximum concurrency is, what should it pass for Here's a proposal to simplify the change:
Actually that list above isn't short either... 🤔 |
To me forcing every hosts to modify their behavior depending on the concurrency hint is a no. |
@jatinchowdhury18 what's your thought? |
I think it's important to say that as currently specified, this change does not force any host to modify their behaviour. The host is already free to ignore the parameter: the host could still return a thread-local buffer for every I would be happy to change the name of the parameter to
I'm not sure that this case makes much sense to me: it's basically saying, "what if a plugin wants to allocate memory, but doesn't know how much memory it wants to allocate?" In the same way as you have to pass a number of bytes to This design is as was agreed in #423 and is only intended to make this extension possible to implement in environments where resources are constrained - if we can't know how many scratch buffers we have to allocate ahead of time to satisfy the thread pool requirements, we simply can't implement this extension. |
I like Disclaimer: I've never worked on a host that implements
So the concurrency hint would allow the host to save memory, but only in case (3). I guess the ultimate question is: does that potential memory saving justify the added complexity for the plugin and host devs implementing/using this extension? I'm trying to imagine a scenario where this memory saving would have the most impact:
To me that scenario seems unlikely. In particular, I can't think of a scenario where the host would be memory constrained but also able to support a high thread count. But I would be very curious to hear if such systems do exist (or could exist in the future)! On the plugin side, I don't think the added complexity is too bad. The thought process as a plugin dev would be:
The only potentially confusing thing is making sure the plugin knows whether the |
Hi, So here's my aggregated thoughts:
I'll take the PR and do the adjustments so I'm happy with the doc/spec. Does that work for both of you @p--b, @jatinchowdhury18 ? |
That sounds good to me! I'm happy to help out with testing/debugging from the plugin side if needed. |
This commit adds a new parameter to the
reserve()
method of the draftscratch-memory
extension which allows a plugin to indicate to the host whether itsthread-pool
tasks need to access scratch memory buffers or not, and if so, how many of them the host must accommodate.