Skip to content

DVDThread: State save read requests without result data. #13612

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jordan-woyak
Copy link
Member

@jordan-woyak jordan-woyak commented May 1, 2025

This completes two TODOs in DVDThread.

Rather than waiting for read requests to complete, all requests are now state saved without their results.

I added some additional features to WorkQueueThread to accomplish this.
A separate WaitableSPSCQueue command queue eliminates the "run_thread" and "skip_work" flags and allows additional tasks like gathering all the items while the thread is running.

I also changed result data from std::vector to Common::UniqueBuffer to avoid the zero-initialization.

In my testing, there are usually zero pending requests, and this isn't a huge benefit, but here it is anyway.
Maybe someone knows a particular game that's DVD-read heavy?

@jordan-woyak jordan-woyak force-pushed the state-dvd-requests branch 2 times, most recently from c77bb81 to 6d43643 Compare May 1, 2025 07:26
@JosJuice
Copy link
Member

JosJuice commented May 1, 2025

Maybe someone knows a particular game that's DVD-read heavy?

I guess you could try a DTK game? One that loads data while still using DTK would be ideal, as that's the only way you can get more than one command in the queue at the time IIRC. I suppose Super Monkey Ball 1 and 2 fit the bill - maybe there are others too.

@jordan-woyak jordan-woyak force-pushed the state-dvd-requests branch 5 times, most recently from 9f5bbdd to 4224ed1 Compare May 2, 2025 05:20
@jordan-woyak
Copy link
Member Author

jordan-woyak commented May 10, 2025

Alright, with and without this PR, DVDThread::DoState generally takes less than 2us to handle zero pending requests (which is the typical situation).

In Super Monkey Ball 2, when mashing the the Save State button during game play I could occasionally see 3 pending requests.
Master's DoState would take around 12us to handle this.
In this PR, however, it was still around 2us.

When mashing Save State during boot I could see quite a bit more pending requests, around 15 or so.

In master, 15 pending requests could take more than 150us.
In this PR, the same situation was usually under 3us, and never more than 10us.

So yes, I suppose this PR makes things faster, in atypical situations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants