godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.29k stars 21.05k forks source link

High load without any profit on ANY video card #60100

Closed br3eze closed 1 year ago

br3eze commented 2 years ago

Godot version

3.4.4

System information

Arch linux (godot has been installed from repos), GLES3, NVIDIA 2060m

Issue description

image

It's All about FullHD. If it will help.

Completely empty scene in a new project == 100% load on NVIDIA 2060m with only ~300 fps! Caping fps will just reduce load, but a high fps cost will be still there. Veeery simple scenes do the same. Performance of the engine is very poor. How to fix? Why so? What I do wrong?

Please give me some explanation. I can play 3D online shooter with 60 people and have ~120 fps on my Intel 620. And I have on this intel around 250 fps on the same empty scene. I can run a 3D game, can't get performance in an empty scene. Or may be I completely misunderstand something?

Thank You.

Steps to reproduce

Create empty project and run it on NVIDIA card. I add label to see FPS, but it's not because of that.

Minimal reproduction project

extends Spatial

func _ready(): OS.set_use_vsync(false)

var t func _process(_delta): t = "FPS: " + str(Engine.get_frames_per_second()) $Label.set_text(t)

mrjustaguy commented 2 years ago

I think you're running into a Driver issue or something..

Try running the TPS demo and benchmark performance there, that should give a more realistic FPS.. it should be around 30-60 FPS on the GPU on high settings at Full HD (The Third Person Shooter Demo is seriously poorly optimized, no culling and an unrealistic crap ton of triangles being processed)

If the TPS demo runs within those figures, there's probably some bottleneck unrelated to the GPU going on, while the GPU is just being Pegged in a Loop doing actually nothing smart in reality (considering the power draw this could be the case, as it'd be drawing a bit more at 90% utilization or higher if it was genuinely doing something)

If the TPS demo runs at lower Framerates, the Utilization figures are probably showing it's actual utilization, and it's most likely bad drivers, which on Linux wouldn't surprise me with nvidia.

br3eze commented 2 years ago

"and it's most likely bad drivers, which on Linux wouldn't surprise me with nvidia". Quake Champions, Starcraft 2, Squad, Horizon Zero Dawn (maximum settings 60fps caped) - these are my 100% benchmarks and everything is ok. Just have a look at these games, they are pretty heavy. So, they haven't "Driver issue" and empty project has..

"The Third Person Shooter Demo" I didn't even mentioned it, I realize that is not about optimization. I mean real games and everything is ok with them.

Zireael07 commented 2 years ago

@br3eze: Those real games use a variety of techniques (some are DirectX, some are OpenGL). Also Starcraft and Quake are fairly old so it's not surprising they perform well.

Personally I concur you may have bad drivers, for instance on my Dell Vostro, the discrete card gives worse performance in Linux than the integrated Intel Kaby Lake, because it immediately gets so hot that thermal throttling kicks in.

br3eze commented 2 years ago

"it immediately gets so hot" look at the screenshot It looks like the temperature is ok. "Starcraft and Quake are fairly old" older than empty scene? Come on..

300 fps in empty scene with the last drivers, no problem with actually not old games like "Horizon Zero Dawn".

With all respect, I don't think guesses and guessing are the best way to find the answer.

Calinou commented 2 years ago

Arch linux NVIDIA 2060m

Remember that using NVIDIA Optimus has a performance overhead, especially on Linux where the implementation is known to be subpar compared to Windows. You won't be able to achieve thousands of FPS on an empty scene like you can on a desktop GPU. This is especially noticeable in very simple scenes, which is where the Optimus overhead is the most noticeable.

If you try running glxgears with V-Sync disabled on the dedicated GPU, you'll likely run into the same issue.

Also, to reach a higher framerate, disable compositing in your window manager[^1]. Doing so can double your framerate in simple scenes (if not more). Lastly, if your goal is to reach the highest possible framerate, using the GLES2 rendering backend will often perform better than GLES3 in simple scenes, but it'll perform worse in complex scenes.

[^1]: This is not possible on GNOME in windowed mode, but it can be done on KDE (with KWin) or Xfce (with Xfwm).

mrjustaguy commented 2 years ago

Eh, I've seen what Driver issues do to Performance...

One great example in my experience is Age of Mythology on Virtual Box (Win XP machine, darn Windows killing SecDrv which killed DRM..) and just the menu at low res was running at barely 2 FPS, with high utilization, Due to poor Driver emulation and that's on a Desktop machine that's running ARK Survival Evolved on High Settings and doing 30 FPS no problems.

Age of Mythology is a Game from 2002 and is very basic 3D that wants a 450MHz processor with 128MB RAM paired with a 16 MB VRAM 3D capable GPU ARK Survival Evolved is a Game from 2017 and is a Massive, Visually Impressive Open World Game running on Unreal Engine 4

So yes, Poor drivers can result in such a stupid utilization giving such idiotically poor performance, and as with all software, only a very specific part could be the bottleneck in any given situation, which is why doing more testing is required to be able to better narrow down to what's happening.

br3eze commented 2 years ago

"disable compositing in your window manager" "using NVIDIA Optimus has a performance overhead"

Already tried fluxbox and kde with/without compositing. Of course it's not about it. And of course it's not about vsync at all! Look at fps on the screenshot. May be 345 Hz displays exist on laptops, but I haven't even saw them (I have 144 Hz). I play mentioned games without vsync and with compositing with a super heavy scenes. Really BIG GAMES! Against just an empty scene or a simple scene with a low poly standard meshes.

"So yes, Poor drivers can result"

I made builds for windows and other OS. People say the same: "wow, why so stupid simple scenes make so high load and no fps at all while we can play AAA games without any problems?" Obvious it's not about drivers.

We've tried 4.x branch but it's buggy as hell yet, so we're trying to deal with 3.4.4. We didn't tried much lower versions, if someone really know which version can help it will be great. But I think it's a system issue. If somebody will check this too it will really help to stop guessing by stars process too.

clayjohn commented 2 years ago

If somebody will check this too it will really help to stop guessing by stars process too.

For somebody to help further you will need to provide a minimal reproduction project that exhibits the problem you are describing. The people trying to help are left guessing because they aren't seeing the problem on their hardware and you haven't provided much information to go on.

To be clear, low FPS on an empty scene is not a common problem which is why the other commenters are trying to guess what os/driver issues exist for your specific setup. It's more likely an issue with your computer than it is with Godot as none of the other commenters are able to reproduce your issue.

br3eze commented 2 years ago

"I can freely play Quake Champions, Starcraft 2, Squad, Horizon Zero Dawn (maximum settings)" "made builds for windows and other OS. People say the same" ---- "low FPS but 100% load on NVIDIA 2060 on an empty or simple scene is not a common problem" ---- "It's more likely an issue with your computer than it is with Godot"

"Just an empty scene or a simple scene with a low poly standard meshes" ---- "you will need to provide a minimal reproduction project"

If I will add a real scene with post effects, animations, complex objects and collisions, actually, I don't even know why, but it will just die there. Sure, may be I'm wrong, I don't know why it is happening at all. Just want to figure everything out. But look at my post, comments and "the answers". I'm not a psychiatrist but it's not normal at all.

image

Oh God help me...

mrjustaguy commented 2 years ago

I'd tell you to reinstall the drivers, but I'm unsure how much that'd help if it's a Driver bug, unless something messed up the Driver install, such as Windows installing their own drivers during the User's installation, which I have seen happen on a Windows 10 Machine a few months ago, rendering certain games unplayable that shouldn't have any issues running on the hardware, while not causing any issues for others, however I don't think many Linux distros love f-ing up the driver installs the way Windows likes to do.

The thing is, We don't really know what's going on, as we are so far unable to reproduce the issue ourselves, so were kind of like Doctors irl, making educated guesses as to what's the problem based on symptoms we see... and here it's quite clear that Hardware side is ok, otherwise you'd almost surely be running into issues with other things too, and You're running into an issue only with Godot, which we are unable to see on our machines, which means it's not a Godot problem, but rather something it's interacting with - so 99% chance it's an issue with some driver it's interacting with.

Try using GLES 2.. that might help narrow down the issue further

br3eze commented 2 years ago

@mrjustaguy "Try using GLES 2.. that might help narrow down the issue further" Driver from repos. GLES2 and 3 produce the same thing last 4 months.

Can I ask You something. AAA games are O.K., BFGames, they are much more complex than just an empty scene with a box. On this background, why You are still using this logic? In other words: what can't do Horizon Zero Dawn, Metro Exodus, Squad, Arma 3, and many, many other games with the poor driver, what Godot can and does from start with his super boxes? I completely can't understand it..

Can You upload a screenshot with a new default project and the same scene? What card do You use? What fps You will have? If You're right, something with my laptop and drivers, I will change them and we will play Horizon Zero and Squad with 500+ fps then.. cool. Integrated video cards shouldn't be taken here, as You know (No You don't), they simplify many commands and then can give You even fps boost. NVIDIA will calculate every command honestly.

mrjustaguy commented 2 years ago

My Specs: Windows 11 i3 10105f @ 3.7GHz (Turbo Boost Disabled due to personal preference) 16 GB 3200 MHz Memory GTX 1050 Ti (4 GB VRAM), Windows Driver 512.15 1920x1080 (60 Hz Display)

4 Cube Scene 3.4.4 Stable 1920x1080 3 4 4 FPS

As you can see, I'm Getting ~1300 FPS just fine, and the limiting factor is almost surely the Pixel Fill rate According to Tech Powerup charts, my GPU is 55% of your GPU's horsepower https://www.techpowerup.com/gpu-specs/geforce-rtx-2060-max-q.c3533

HerrSersch commented 2 years ago

I made some tests on Windows 10 (can't test on Linux now, will do that later). I've got an Nvidia GTX 970 and a desktop resolution of 1920x1080. My setup is similar to yours, but I'm using a single spinning cube. The scene is running as a build without debug in a maximized window. The only other applications running are Krita for pasting screenshots, the Task Manager and a CMD window that outputs nvidia-smi -l 1

The FPS are clamped by the "Max Frame Rate" setting in the Nvidia driver. My GPU has a base power consumption of 18 watts in idle mode (P8) and can use a maximum of 200 watts in performance mode (P0).

Here are the values that I get:

30 FPS - 14,9% load - P8 - 19 watts 60 FPS - 24,2% load - P8 - 22 watts 120 FPS - 20,7% load - P5 - 23 watts 300 Fps - 49% load - P5 - 29 watts 2000+ FPS - 98,6% load - P0 - 161 watts

The load values would need to be avaraged over time to be more accurate, because they are changing a bit up and down.

Godot FPS GPU Test 30 Godot FPS GPU Test 60 Godot FPS GPU Test 120 Godot FPS GPU Test 300 Godot FPS GPU Test Uncapped

mrjustaguy commented 2 years ago

@br3eze Also, you know, if something is bad with a Driver, it can impact only One piece of software, so other programs running fine, while some run into issues and it's unlikely that the issue is in Godot itself as others would be much more successful in observing the issue means something in the background is causing the issue, like a bad Driver which again, Linux isn't known for good nvidia Drivers

Try running Godot 4 alpha 6, see if Vulkan helps...

br3eze commented 2 years ago

Can't be... and what should I do? Why other people get this fps drops too? Can You share Your project and exe/bin file please?

Thank You for help.

Godot 4 alpha 6 hangs on project select window with any graphic card (msi stealth 15m).

Very strange.. I can work in Unreal Engine without any problems. Sad strory with godot.

mrjustaguy commented 2 years ago

Hm, The Hang in Godot 4 Alpha 6 is very, VERY weird.. could you maybe try using a different Distro and see what happens there? I mean that, and/or trying a DDU to clean install the drivers (DDU - Display Driver Uninstaller), however if it's happening on multiple machines it's likely similar OS, some similar background software interfering or a Driver bug, and it's unlikely that DDU is going to help as it's unlikely to be a bad driver install in that case.

br3eze commented 2 years ago

@mrjustaguy "different Distro" Sure I will do it now. Thanks for the advice.

"similar OS" no, there was Windows.

mrjustaguy commented 2 years ago

are you running the official Stable release or custom build? I mean that is like the only other thing I can think of at this point, that there is a regression in a build that none of us were using.

CoreTaxxe commented 2 years ago

I had the same issue with an AMD card (rx 6600, ryzen 5 3600, win10) a few months myslef. Empty scene barely hit the 200 fps at max load and complex scenes could barely reach 60. Other games ran perfectly fine (battlefield 5 max settings 120 fps ). Even a whole system reinstall didnt fix the issue. All drivers were up to date and properly installed. I know personal experience doesnt add too öuch to this but it might indicate that there is something weird however rarely occurong going on.

mrjustaguy commented 2 years ago

@CoreTaxxe This does help significantly, as it removes Driver issue from the equation more or less completely, as it's unlikely for both Nvidia and AMD to have the same issue, and Windows 10 is a very commonly used OS that both companies support well.

Any non vanilla (don't come with W10) Software running in the background, such as Steam, Origin, Discord, etc that you know of?

Here's a List of thing's I've tested that didn't have an impact for me during testing: Virtual Clone Drive Discord client Steam Epic Games Launcher Origin Open Hardware Monitor Google Chrome Riva Tuner Statistics Server Windows Task Manager

CoreTaxxe commented 2 years ago

@mrjustaguy im currently not using this pc anymore (since developing with it simply didnt work lol) and switched with my sister. Once I got home I can try and pinpoint the issue further down but as for now i have no clue wich program might cause the issue. (Irrc i tested godot right after the system wipe so the only launcher that might come into play is steam, amd enterprise , titanwolf mouse config, roccat swarm. Everything else should have been windows preinstalled.

mrjustaguy commented 2 years ago

On your current PC Godot runs fine, and all of the said software is also there too? If so it probably eliminates those..

CoreTaxxe commented 2 years ago

On your current PC Godot runs fine, and all of the said software is also there too? If so it probably eliminates those..

Yes. On my current machine godot runs flaweslly. And yes all these softwares and more is also installed. I have a dumb theory tho : Godot used to have hiccups (stutters) when rotating the camera fast (also empty scene). This was not unique to godot but other gamed had it far far less often. I ultimatively narrowed this issue down to the RAM sleeping part filling up the space completely and "stealing godots" space so to speak. I fixed that issue by clearing this sleeping ram with an external script every few seconds. Tldr ; maybe Godot gets not enough priorities and therefore is forced to step back of other processes ask for resources. Im by all means no expert so this is just an uneducated guess

mrjustaguy commented 2 years ago

That probably wouldn't explain why it's using 90% of an rtx 2060 mobile at like full clock speeds.. I mean sure doing a Memory Check just to be on the safe side might make sense, but it's like a 1 in a million chance that it has anything to do with it pegging the GPU so hard for no good reason.. Priorities might be it if for some reason when Godot runs some background Program decides it wants all that GPU horsepower and the two fight over it... but if task manger or some such program is saying Godot's using 90% of the GPU, it's probably what's actually using 90% of the GPUs power.

I've actually run into something a little bit like this... When Playing some games (such as ARK Survival Evolved in the Menu when hosting a server and tabbing to the server cmd window) and alt tabbing, the GPU utilization would max out (the game was reported to use full GPU power) even when the game itself is only using like 5% of the GPU power when in the foreground, actually rendering stuff and not background minimized..

akien-mga commented 2 years ago

Just to clarify, when you disable V-Sync, the engine will attempt to render as many frames as possible. So that means that you're going to get either 100% GPU or 100% CPU usage, and the max FPS that matches the hit bottleneck. 350 FPS doesn't sound particularly impressive on an empty scene, and this can result from various issues which have been discussed above, but it's (AFAIK) completely expected that either CPU or GPU usage would be maxed out with VSync disabled.

For example running glxspheres64 with VSync disabled on my Linux laptop with Intel IGP: image

image

This is working as intended - I'm asking glxspheres64 to hammer my GPU to render as many frames per second as it can.

lawnjelly commented 2 years ago

Please give me some explanation. I can play 3D online shooter with 60 people and have ~120 fps on my Intel 620. And I have on this intel around 250 fps on the same empty scene. I can run a 3D game, can't get performance in an empty scene. Or may be I completely misunderstand something?

Do you have another game that runs full screen using OpenGL etc that runs at e.g. 1000 fps that is giving you the reason for this expectation? Otherwise, this kind of performance characteristics is often the case. Run the app with a small window e.g. 100x100 pixels see if the frame rate increases. You haven't mentioned the resolution you are running at, which will usually be totally key to this.

There are lots of different bottlenecks that kick in depending on what you are doing, and there are fixed costs to a full screen update (e.g. fill rate) especially at high resolution which will make the frame rate lower than you might be expecting with no load. This is twice as important if some kind of secondary processing is going on (e.g. OS, compositing, the nvidia optimus thing).

These characteristics are often also seen on mobile and integrated GPU, it is usually only desktop GPU with minimal OS etc interference that will reach very high frame rates full screen. Also mobile GPUs might cap things to stop you hammering the battery etc.

And yes, as @akien-mga says, ideally almost by definition with vsync off you should be at 100% GPU or CPU (at least one of the cores). You are telling the app to "run as fast as you can", and 100% is by definition as fast as it can.

mrjustaguy commented 2 years ago

1080p, says in stats.. CPU max single thread usage is ~30% The issue probably isn't with Godot but something else, it's just manifesting in Godot..

mrjustaguy commented 2 years ago

@CoreTaxxe What GPU are you using on your machine that doesn't have any issues with Godot? is it an nvidia GPU by any chance?

br3eze commented 2 years ago

@mrjustaguy Thank You for Your patience! You were right! I've tested a few distros and it is true. Somehow true. One of them shows 350 fps other 2k fps. Amazing situation in 2022.. Thank You!

mrjustaguy commented 2 years ago

Glad I could help.

My last post is no longer relevant as the Problem was found to be the Distro not playing nice (for whatever reason), I originally wanted to know the GPU manufacturer as the case for that specific issue could have been AMD's not so great OpenGL support as pointed out by Calinou on Godot's Contributor Chat, and moving to nvidia would have fixed that, meaning the culprit was most likely AMD's drivers and thus sadly not actually be helpful with determining the issue.

Now Why the Distro had an issue only with Godot and not any other intensive games or programs is a Good question, but we will probably never know

br3eze commented 2 years ago

@mrjustaguy While I was completely amazed with this, I was thinking.. what differences have all these distros? Closed drivers - nope it almost can't be, soft versions - sure, but not likely. May be kernel config: timers resolution, anti-cpu-bugs (this is already even in UEFI BIOS), and other stuff in kernel can be very harmful for performance? And kernel really differs from distro to distro. What do You think?

But yes, the only thing confuses me that I can't even start work with 4.x branch. It's just hangs on the project creation dialog.

Like a painful interference of software pieces..

mrjustaguy commented 2 years ago

It could be any number of things, but like you said it's probably not the GPU Drivers, rather how they communicate with the OS probably, and somewhere in there is probably a bug if some specific thing is asked (which Godot seems to be doing and others aren't) and the communication between the two goes through hell, telling the GPU nonsense, it doing a super inefficient render route as a result of the miscommunication or even telling it such nonsense that it refuses to work.

This is My guess, however I'm not an expert in these things, I'm just working with Experience I've had with fixing such stupid problems and just following my instincts that I've tuned over years of fixing Games that won't work properly on Modern OS-es (mainly windows) out of the box.. and oh boy can I tell you just how stupid the problems can be and how even dumber the solutions to them are... These things have just soo many moving pieces and sometimes something completely unrelated can slightly change how something else works, leading to a cascading effect that breaks the end software..

I mean one great example was how a game refused to run because it was named differently, but stating a totally unrelated issue, that had Nothing to do with how it was fixed.. and I'm not sure anymore, but I think it just refused to run with the OG exe name.. I know that I had to just rename something, but not sure what it was anymore..

br3eze commented 2 years ago

"refused to run because it was named differently" Just... wow! The UNBELIEVABLE reality we only have.

CoreTaxxe commented 2 years ago

@CoreTaxxe What GPU are you using on your machine that doesn't have any issues with Godot? is it an nvidia GPU by any chance?

It is indeed (rtx 3070)

CoreTaxxe commented 2 years ago

But yes, the only thing confuses me that I can't even start work with 4.x branch. It's just hangs on the project creation dialog.

Like a painful interference of software pieces..

Yeah, i have this issue as well with the alpha 6. 1-4 worked fine but 6 hanga itself while creating the project.

mrjustaguy commented 2 years ago

Hm yea 6 hangs probably because it cant create folder - see https://github.com/godotengine/godot/issues/59956 This isn't an issue for existing projects, only for new ones, or when you're trying to create a folder in an existing project.. I've only now noticed that..

It is likely that had you gone with an AMD GPU in you system change you would still have had issues in OpenGL and that your issue was purely on their Drivers, but Godot 4 shouldn't have AMD Driver issues like that with Vulkan being the API used and not OpenGL

BTW I remembered what Game it was! Commandos https://en.wikipedia.org/wiki/Commandos:_Behind_Enemy_Lines The game Exe was called Comandos.exe and when you ran it it'd give this and refuse to run: image Renaming the exe to Commandos.exe and runs fine, no error pops up 🤣

Srsly this should be made into a Meme lol

br3eze commented 2 years ago

@mrjustaguy Obviously, in 99% of common things, there are only a few of them can reduce performance: 1 - mesa, 2 - kernel, 3- xorg. It is not a driver or vulkan stuff, as we know already. I'm configuring kernel, already made mesa 22.1. But can You help me build mesa 20.3? I get some errors while building it on Arch linux and can't understand what it wants.

mrjustaguy commented 2 years ago

Sadly I don't have any experience with that... I generally tend to stick to really high level stuff, with only a fairly decent idea of what's going on in the background (stuff that's mostly just General Computer Basics) and I only got Windows experience..

Linux sadly never was an acceptable option for me, not because I don't like tinkering with these things, I probably would come to enjoy that, it's just that some things I need just really don't want to work on Linux.

I might get some experience when W10 support goes out and some old machines get turned to Linux machines, but that's still a way off and it is still unclear what will even end up happening with the machines at that point.

br3eze commented 2 years ago

@mrjustaguy @CoreTaxxe

Hey guys. I think I have found something. In the last week: 2 kernel versions, 3 mesa, 2 xorg, 3 intel, 2 nvidia )

  1. Don't install xf86-video-intel - it KILLS all the "Intel HD Video" performance and somehow sometimes (even some fresh install iterations) can break NVIDIA too. Tested on Manjaro, Arch and Artix distros. I don't sure on 100%, but I have tested one version and it worked, but was too old. So never mind. Sometimes You can't revert it back uninstalling intel and nvidia drivers. I don't even know why, may be it's a various versions issue.

  2. Sometimes, Mangohud can break some things (some games for example), try to check everything without it. But it is a seldom situation. Mangohud is a very useful thing, just use it carefully.

  3. Some old hidden stuff in Your home directory can help this low fps story to exist. Don't have a clue, just have deleted it all out. But it has helped only partly.

  4. I can play Arma 3 on Ultra settings with a stable 60 fps with vsync. So may be.. just may be, it is about Godot too? Can someone say something about it? I can build a debug version and send You some information? Help? NVIDIA performance is ugly yet: 0 __GL_SYNC_TO_VBLANK=0 ~/nvidia_run.sh godot_empty_project gives only 1'100 fps on nvidia: Temp: 66C P0 39W Load: 94%** Nvidia support:

    • Thank You, but my NVIDIA card is a primary one now, for what? And why intel and nvidia cards don't work on 100%?
    • I really don't know why Your nvidia optimus doesn't work well, but "Let it be" nvidia is Your primary gpu now, have a nice day.

But at least I can continue my work now somehow on intel: it gives now 3'300 fps. I'm not an expert in such things, just hope it will help You to not have to change Your laptops just because of a ** software and the best support ever.

If someone know how to fix nvidia please share.

xyproto commented 1 year ago

Does it work when godot is launched with prime-run?

akien-mga commented 1 year ago

Closing as there isn't much actionable for us in this issue.

There's definitely room for optimization in future releases, but this will need to be driven by bottleneck analysis and benchmarks.