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

Use a thread for meminfo and defer tag lookup for copies #18233

Merged
merged 4 commits into from
Sep 29, 2023

Conversation

unknownbrackets
Copy link
Collaborator

In some games, especially when using detailed meminfo, the main reason meminfo is "slow" is that it has to sometimes look up the current tag to tag the write. For example, a copy from "VideoDecode" via memcpy has the tag "ReplaceMemcpy/VideoDecode" which helps fix texcache issues AND is useful for debugging.

But to find the previous tag, it has to flush any pending tag data, and this is done for all sorts of copies. And in most cases, we don't immediately need the previous tag (except VideoDecode, etc. above.)

This puts the copy (where the tag isn't immediately needed) on the queue entirely, including the src tag lookup. This prevents the unnecessary flush, allowing it to flush later.

Additionally, this adds a thread that handles flushing (the meminfo tagging already needed to be threadsafe, anyway) so for write-only common cases, the main thread will not spend any time flushing. This does increase time spent in locks a little, but it still speeds up the main thread. Helps games that do a lot of medium size block transfers or memcpys.

-[Unknown]

@unknownbrackets unknownbrackets added this to the v1.17.0 milestone Sep 25, 2023
@hrydgard
Copy link
Owner

Pretty decent boost at my favorite savestate in God of War: Chains of Olympus, 5%-ish or so, which is surprisingly much. It does do a lot of block transfers though.

@hrydgard hrydgard merged commit 70edf4f into hrydgard:master Sep 29, 2023
18 checks passed
@unknownbrackets unknownbrackets deleted the meminfo-defer branch September 30, 2023 15:37
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

Successfully merging this pull request may close these issues.

2 participants