Skip to content

video_core: garbage collector (part 2)#3396

Draft
LNDF wants to merge 63 commits intoshadps4-emu:mainfrom
LNDF:gc2
Draft

video_core: garbage collector (part 2)#3396
LNDF wants to merge 63 commits intoshadps4-emu:mainfrom
LNDF:gc2

Conversation

@LNDF
Copy link
Copy Markdown
Member

@LNDF LNDF commented Aug 6, 2025

This is a contiuation of #3350.

This will implement non-linear GPU modified image collection without losing the GPU modifications. This will reduce memory leaks even further (for example, in Bloodborne).

Currently, this depends on #3374 which implements tilers, required for non-linear image download.

@LNDF LNDF force-pushed the gc2 branch 2 times, most recently from e3cba51 to 9b6a30f Compare August 9, 2025 11:07
@LNDF
Copy link
Copy Markdown
Member Author

LNDF commented Sep 22, 2025

Yeah I just built it locally without the 2GB budget and the game doesn't crash anymore so I believe that was the issue.

The 2gb limit is only for testing. It makes it run the garage collector aggressively.

@Missake212
Copy link
Copy Markdown
Contributor

Yeah I just built it locally without the 2GB budget and the game doesn't crash anymore so I believe that was the issue.

The 2gb limit is only for testing. It makes it run the garage collector aggressively.

Yeah I know but I think it might be why the game crashed, since testing without it locally doesn't crash the game, I think the 2GB budget was too aggressive and some of the stuff the game still needed in memory was gone maybe? I don't know the specifics but like I said I'm pretty sure the 2GB limit is the reason why it crashed.

@Missake212
Copy link
Copy Markdown
Contributor

Did a bit of testing today in 3 games, here are the results I got.

Main:

Tekken 7: started around 6750 MB, finished at around 8300 MB.
Bloodborne: started around 6450 MB, finished at around 11250 MB.
NieR Replicant: started around 6340 MB, finished at around 7855 MB.

PR:

Tekken 7: started around 6400 MB, finished at around 7250 MB.
Bloodborne: started around 6100 MB, finished at around 9300 MB.
NieR Replicant (without 2GB budget): started around 6330 MB, finished at around 7772 MB.

Conclusion is that it works pretty nice, but like I said the other day I think it would be best if you removed the 2GB budget entirely, I know you added it for testing and it seems to work well but I'd like to test on a real 4GB card next without the budget to see how well it behaves.
I got lazy today so I didn't test Intel yet, will probably test it tomorrow. Also I think that if no one has tested AMD GPUs by the time I'm done testing both Intel and the 4GB card without the 2GB budget commit (and if I notice no issues obviously) it would probably be for the best to merge it, like Shadow says people never test unless it's on main.

Here's the video of all the runs together, the quality sucks and it's not worth watching honestly but I decided to upload it anyway just so you know I'm not making the numbers up.

https://www.youtube.com/watch?v=7-GS1QG4Rak

@Missake212
Copy link
Copy Markdown
Contributor

Tested a few games on Intel (Bloodborne, 13 Sentinels: Aegis Rim, Cars 3, Velocity 2X, Dead Island, Ratchet and Clank), they were all quick test because playing on an iGPU is unbearable but I couldn't notice any visual regressions from the PR, I'm not sure if you got someone to test AMD on the Discord server but it seems like no one has reported anything beside me, so I think it would be best if you removed the 2GB budget for me to test properly on a 4GB of VRAM GPU, and if that goes well this could probably get merged unless you want to make some other changes, everything has been working just fine on my end.

@LNDF
Copy link
Copy Markdown
Member Author

LNDF commented Sep 26, 2025

Tested a few games on Intel (Bloodborne, 13 Sentinels: Aegis Rim, Cars 3, Velocity 2X, Dead Island, Ratchet and Clank), they were all quick test because playing on an iGPU is unbearable but I couldn't notice any visual regressions from the PR, I'm not sure if you got someone to test AMD on the Discord server but it seems like no one has reported anything beside me, so I think it would be best if you removed the 2GB budget for me to test properly on a 4GB of VRAM GPU, and if that goes well this could probably get merged unless you want to make some other changes, everything has been working just fine on my end.

Thanks for testing. I will try to fix driver regression (reported on discord) this weekend now that I have some time.

The idea is that it shouldn't be regressing, even with the 2gb branch. I can make a branch without the 2gb limit later for you.

Also there is a known race condition that needs to be fixed before merging.

@Missake212
Copy link
Copy Markdown
Contributor

The idea is that it shouldn't be regressing, even with the 2gb branch. I can make a branch without the 2gb limit later for you.

Don't worry about it, I can do it myself, but like I reported it seems like NieR Replicant crashes a lot only with the 2GB limit (the game seems really sensible to memory stuff, for example when you first worked on DMA it made the game have all sort of issues, and after it was merged the game used to crash a lot during loading screen, now with it being a toggle the game never crashes anymore), perhaps I got unlucky or something, I'll try testing some more and I'll report back, since you still have other stuff to fix I'll wait a bit before thoroughly testing then.

@4b1tQu4ntN3k0
Copy link
Copy Markdown

Great job! I tested BB on linux with a 3060ti 8GB GPU using the gc2 branch, and observed stable VRAM usage around 5.5GB with only minor frame drops and stuttering. In comparison, the main branch could only run for about 20 minutes before memory usage exceeded 7GB, resulting in severe frame drops to below 30 fps.Would you consider further optimizing performance? This could greatly improve the overall gaming experience.

@Heliumrich
Copy link
Copy Markdown

Heliumrich commented Nov 24, 2025

I get massive flickering in BB (especially the house in the hunter's dream) seems to depend on the camera position or something.

Since the shader cache PR was merged
But I don't get this if I test this PR without the shader cache PR 🤔

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants