Skip to content

Conversation

@bbernhar
Copy link
Contributor

@bbernhar bbernhar commented Jun 29, 2022

Instead of polling for latest usage, OS event based updates are used by default. #319

@bbernhar bbernhar added the enhancement New feature or request label Jun 29, 2022
@github-actions github-actions bot added D3D12 DirectX 12 Backend Change Frontend Changes to common or GPU API agnostic code. Test Changes in tests. labels Jun 29, 2022
@bbernhar bbernhar force-pushed the notify branch 3 times, most recently from b495183 to a3143b1 Compare June 29, 2022 20:23
@bbernhar bbernhar requested a review from bjjones June 29, 2022 22:17
@bbernhar
Copy link
Contributor Author

@bjjones can you PTAL?

Copy link
Contributor

@bjjones bjjones left a comment

Choose a reason for hiding this comment

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

LGTM. Did you plan to add functionality for paging based off of budget changes? Seems like it would make this feature more useful.

@bbernhar
Copy link
Contributor Author

Did you plan to add functionality for paging based off of budget changes?

Could you elaborate on this more?

If I call Evict on a background thread, wouldn't that be nearly equivelent to checking then calling Evict upon ExecuteCommandLists? In both cases, Evict is called the same number of times. But I do see an opprotunity to unblock the main thread, when Evict is called, but only if nothing else uses the device (or it will block again).

In contrast, QueryVideoMemoryInfo gets called per ExecuteCommandLists, not per paging, so moving it away from the main thread holds more beneifit since it saves CPU cycles when under budget.

However, it does seem like a good idea to have async Evict since real world apps may keep busy enough to hide this latency.

@bjjones
Copy link
Contributor

bjjones commented Jun 30, 2022

Could you elaborate on this more?

I was thinking in the case that you had maxed out the budget and a significant budget change occurred (which can happen when changing focus to a different window) your memory residency would not be in the optimal state and wouldn't be fixed until the next ExecuteCommandLists call. Maybe this isn't impactful in reality - since ExecuteCommandLists is usually called at a granularity that would hide dropped frames - but could there be an ML/AI scenario that doesn't call so frequently? Note that it could not just be for page out, but could be for page in too if you were switching your residency-managed app back to the foreground causing a big budget increase.

I know Evict is very fast already so I don't know that there's really much value offloading it.

Instead of polling for latest residency usage, OS event based updates are used.

Closes Update budget using OS events or non-polling based. #319
@bbernhar
Copy link
Contributor Author

bbernhar commented Jul 1, 2022

@bjjones We can't page-in heaps outside of ExecuteCommandList (ignoring resource creation), the budget change event could only evict older heaps. Since Evict() makes no guarentee heaps will be paged out sooner rather then later (speeding up the subsequent MakeResident), the benefit isn't obvious but I captured this potential optimization as #478.

@bbernhar bbernhar merged commit ca49f0e into main Jul 1, 2022
@bbernhar bbernhar deleted the notify branch July 1, 2022 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

D3D12 DirectX 12 Backend Change enhancement New feature or request Frontend Changes to common or GPU API agnostic code. Test Changes in tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants