Use a thread for meminfo and defer tag lookup for copies #18233
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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]