-
Notifications
You must be signed in to change notification settings - Fork 543
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
[ll] Memory management - Heaps #1484
Comments
I vote for keeping the old I'm unsure about exposing heaps, but for the moment we should do it and see how much overhead they introduce. |
Thanks for writing this down @Bastacyclop , it's great to have as a basis for discussion and moving forward! For For the allocation API, please please make it simple, or at least - start with something dead simple. Even specifying |
I don't really understand what that means, aren't the heap types always exposed by
Sounds good
I'll do my best ;) |
Right, I meant |
Don't think this is relevant any more, |
This discussion is about memory management for
render
, necessary for #1466.More precisely, heap management for images and buffers.
Quick reminder of the old memory API:
As previously discussed, the
Dynamic
usage is not satisfying. We want to directly support update commands forData
instead (see #1418). We could remove it, or it could get another meaning (details following).Memory type selection
First, we have to select what's best from the available memory types. The core API exposes the following properties:
For
Data
we needDEVICE_LOCAL
, we also want to avoidCPU_VISIBLE
to keep it for other uses.For
Upload
we needCPU_VISIBLE
and we aim forWRITE_COMBINED
withoutCPU_CACHED
.For
Download
we needCPU_VISIBLE
and we aim forCPU_CACHED
withoutWRITE_COMBINED
.Now
Dynamic
could leverageDEVICE_LOCAL & CPU_VISIBLE
to upload without staging.Once we are able to manage invalidations and flushes,
COHERENT
shouldn't really matter. But it will be a time saver for the first implementation.Should we check that what we select is not
LAZILY_ALLOCATED
?Resource heap type
We also have to pick a resource type. We could use
Any
when available for more flexiblity and fall back to specific types otherwise, or we could always use the specific types. If I understand correctlyTargets
will be necessary forImages
with theRENDER_TARGET
bind.Allocation API
The most convenient for the user would be to keep the old API where you simply ask for a buffer or an image and memory allocation is just taken care of. But this requires a good general-purpose allocation strategy and might hurt performances. A compromise could be to expose different optional allocation strategies or hints when you want more control, or even allow you to write your own. However the latter would probably require a
Box<Fn>
callback on buffer and image drops, unless a channel returning information like some kind of offset would be suitable.For example you could decide to bypass the default allocator and use a simple
StackAllocator
where memory is only acquired and released in a stack fashion if it fits your needs for a bunch of objects.We could start with a simple default allocator that would be improved with time, and provide other allocators when good use-cases arise.
The text was updated successfully, but these errors were encountered: