DuoStream / Duo

An HDR-compatible multiseat streaming solution based around RdpWrap, Sunshine, Moonlight, and a variety of custom driver and library patches
426 stars 1 forks source link

Major performance problem with 2 CCD 3D V-Cache CPUs #42

Closed Gammler closed 8 months ago

Gammler commented 9 months ago

Hello,

i just noticed that Core Parking which is very important to newer top end X3D CPUs like 7900X3D and 7950X3D is manipulated just using DUO.

I don't know if you are familiar with the Core Parking Feature on "2 CCD 3D V-Cache" CPUs but here some information what happens.

So to get you onboard: https://youtu.be/9gCzXdLmjPY?si=qpul2wAUtTHBO_ki&t=199 https://hwbusters.com/cpu/amd-ryzen-9-7950x3d-core-parking-problem-solution/

So there is a service called amd3dvcacheSvc.exe which spawns a user version of that application on logon to monitor gaming workload. image

The Problem here now is:

If you login into a user session at your real pc, (not remote) it spawns that amd3dvacheUser.exe So then Core parking - where half of the CPU is running at 0% utilization which greatly benefits gaming performance due to not engaging with with the second CCD - is working fine.

If Duo starts another User Session, that amd3dvacheUser.exe is stopping and spawning under the user account which Duo logs in. At this point, core parking still does work on all user sessions it seems, even though it looks a little bit weird then:

image

Now: If you stop that Duo instance, the amd3dvacheUser.exe is getting killed again but does not automatically spawn at the remaining user session.

Now until you restart the PC, gaming performance tanks a good amount, because core parking does not engage anymore.

Black-Seraph commented 9 months ago

Okay, I actually have a 7950X3D myself so maybe we can do something about this.

What do you suggest though? I see no obvious clean solution to this.

Whichever way I spin this, the fix would be a nasty workaround for a problem that should be fixed on the AMD side.

This process could die in so many other ways, they need to make sure it stays alive, and, if needed, gets restarted, either via a scheduled task, or their session 0 service.

Gammler commented 9 months ago

I totally agree that this is on AMDs side and i am really out of ideas here.

I tried to manually start that XXXUser.exe but it seems that it does not work then until i really restart my PC. I don't know if there is a special way how the service is starting that particular .exe

Everything that we do here would be stupid but effective workaround until AMD updates this behaviour. The problem is we don't know if this is getting fixed and affected users are a minority problem. (we stupid duo users for example) Because i never used a second windows account until i started using DUO, really never.

Because i don't know if I want to use DUO with that problem until this is fixed or I know a way a workaround. i just don't want to think about my performance everytime. Using Duo standalone would be a major step back but this is more important for me. That means you can only safely use a 7800X3D with Duo at this time. (1 CDD only)

PS: I hate modern hardware....

Gammler commented 9 months ago

I just noticed that restarting the service "amd3dvcacheSvc.exe" instead of manually starting the user EXE, automatically spawns the User EXE back at the remaining session. Maybe that could be our workaround ?

Gammler commented 9 months ago

But the core parking does not work :'( so i guess i am forced to restart? i don't know

EDIT: no, logging out and in again in my windows account fixes it again.

Black-Seraph commented 9 months ago

There is no way to start a hidden session, and I highly doubt it would make a difference if there was.

I'll look into your core parking issue though, even if just for research purposes.

Out of curiosity, what's the best way to verify if things are / aren't working right?

Can you provide step by step instructions?

The first step in fixing anything is to be able to verify things are / aren't working right in a factual / non-placebo way.

Gammler commented 9 months ago

This post is gonna be a short info post, i can add more later because i don't have time tomorrow probably and its already bedtime here. I can add some links at the end. Your options would be:

-UnparkCPU app (use only the information visualized here ( don't unpark the cores in that app though !!) image https://coderbag.com/programming-c/disable-cpu-core-parking-utility

Parking only engages with Xbox Gamebar recognizing the focussed application as a game. You can even force windows applications to be recognized as games in game bar if it doesn't know that the application you have in focus is a game. Also Gamemode in windows must be enabled and energyplan must be set to balanced, not high performance. image

Additional information:

https://hwbusters.com/cpu/amd-ryzen-9-7950x3d-core-parking-problem-solution/2/

https://hwbusters.com/cpu/amd-ryzen-9-7950x3d-core-parking-problem-solution/3/

Gammler commented 9 months ago

We can just get the almost same behaviour without DUO just by logging into a different user account on the same computer. The amd3dvcacheUser.exe is killed and spawns with the other user account. If you then logoff that user, the amd3dvcacheUser.exe is gone but somehow the Core Parking still works. But i don't know if it is working as intended then. EDIT: I bet the core parking then just freezes with the last state, not adapting to changes.

But with DUO when the session is killed, not only the amd3dvcacheUser.exe is gone, but also the core parking is completely gone then. Is there a difference between logging off a user and DUO stopping an instance with a dedicated user? Is DUO killing the applications before stopping the User session or something?

I might try to contact AMD about this or get some attention on reddit if i can't find someone else mentioning this. But i don't think i can do much alone if the core parking only stops working with how duo logs off a user.

Black-Seraph commented 8 months ago

The service probably listens for logon notifications.

If it doesn't find any, it won't spawn the process.

At least that's what I think.

I'll have to load up their service binary in Ghidra when I find a moment to spare.

Black-Seraph commented 8 months ago

@Gammler I've been giving your issue a lot of thought over the last few weeks and came to the conclusion that I just can't think of a proper way to address it within the scope of this project.

Technically this is a driver / windows scheduler issue and should be addressed by the parties that caused it.

Anything but is a bandaid solution at best, or a breaking driver change at worst, and not something I'd like to risk at this point in time.

Especially given how this issue isn't even fully related to Duo in the first place.

Having looked into this issue for the last few weeks I find that this can be caused by a plethora of other things in the system as well, which clearly shows me that 2 CCD 3D V-Cache CPUs just aren't ready for widespread use yet.