User:Hooray/SandBox/FlightGear Performance and Run-Time Footprint Debate
Work in progress This article or section will be worked on in the upcoming hours or days. See history for the latest developments. |
Background
Symptoms
Why do I have frame-rates of 8 - 60 sometimes, depending (mostly) on local weather and all settings to maxx. And here comes the part I mean to talk about: Why does my GPU jumps to 70°C in a minute or so, while my 2CPUs run gently with 50% usage each. (threading : auto)
— chris_blues (Thu Apr 18). Can FG computations be made more balanced?.
(powered by Instant-Cquotes) |
v2.0 Scenery
The numbers say that without any doubt, 2.0 scenery is what uses all the memory, nothing else - not hires textures, not trees.
|
Memory Footprint
CPU vs. GPU work
If you have a halfway decent GPU, when you ask a rendering task (texture lookups, vector transformations, matrix multiplications,...) , the additional performance of 8 CPUs is pretty negligible. The GPU does these tasks in lightning speed.
— Thorsten (Fri Apr 19). Re: Can FG computations be made more balanced?.
(powered by Instant-Cquotes) |
on a high-end GPU (which I assume you have), the single determining factor for the framerate seems to be the vertex count of clouds, buildings and trees (in this order). So rendering overcast sky makes a huge difference to rendering clear sky, rendering a city worth of random buildings makes a huge difference to rendering a desert, and rendering dense forests makes a difference to rendering a few patches of green. With all details to max, we probably burn 99% of the total computational load in rendering (it's about 1200 lines of instructions per pixel 30-60 times per second), all other flight related tasks like computing aerodynamics are small in comparison.
— Thorsten (Fri Apr 19). Re: Can FG computations be made more balanced?.
(powered by Instant-Cquotes) |
the only thing that I can identify as affecting my framerate is the vertex pipeline. Currently, with the rest I can pretty much do what I like. The Concorde with it's gazillions of systems runs as fast as a glider. The high-fideltity (or at least quite complex FDM) T4T Spitfire runs as fast as any other plane. Switching background Nasal on and off makes no bloody difference for anything. Only what enters the vertex pipeline does. Or lots and lots of semi-transparent stacks in the fragment pipeline - they can eventually kill as well.
— Thorsten (Fri Apr 19). Re: Can FG computations be made more balanced?.
(powered by Instant-Cquotes) |
The vast majority of the computing load is generated due to rendering, i.e. if you have GPU support (as with any modern graphics card) it doesn't touch the CPU at all. The framerate is usually determined exclusively by the GPU capability - distributing CPU load across several cores may be elegant conceptually, but doesn't make anything run faster.
— Thorsten (Thu Mar 15). Re: [SUGGESTION] Multi-core FlightGear support.
(powered by Instant-Cquotes) |
Our Main Loop & HLA
I think HLA is a great idea for many reasons, because it addresses many unnecessary sources of bottlenecks. But I don't think it addresses all bottlenecks, in particular I don't think it addresses mine. Mathias has made it abundantly clear that he's not interested in high-end shader effects, but that he cares for multiple display setups and similar things. It's also become quite apparent to me that he doesn't really follow how our high-end effects actually are implemented and what they do. So my impression is that HLA will be a good thing for many purposes - when you're CPU limited for any reason, for MP, for multi-display setups,..., but I don't see how it will address situations where the bottleneck is shader code.
— Thorsten (Fri Apr 19). Re: Can FG computations be made more balanced?.
(powered by Instant-Cquotes) |
About Testing
Lack of Feedback from End Users
many people don't even know how to get/deploy and use a nightly snapshot, let alone actually provide useful/actionable data, "useful" in the sense that developers can actually act upon that data
|
Poor Quality of Bug Reports
Proposals
FlightGear light ?
I looked at the "FGCanvas" branch I started last year to see how many subsystems can be easily made optional these days. Primarily with a focus on aircraft & scenery subsystems - the idea is to put those into dedicated subsystem groups, so that resource utilization can be OPTIONALLY tracked per group. This would make it possible to overload operator new at the SGSubsystem/Group-level to track most allocations and provide /some/ stats.
|
Resource Utilization Tracking
that's basically a matter of providing some kind of dedicated monitoring function, analogous to the existing system monitor, which also tracks other resources, such as RAM/VRAM - at least optionally.
|
Feature Scaling
Thus, while the idea to scale features up/down, depending on available resources, the majority of the legacy code in FG (especially anything unrelated to OSG/rendering) would need to be explicitly re-architected to 1) track memory allocations & freeing, and to also adjust subsystems and their features accordingly.
|
OpenCL Support
Also, eventually adopting OpenCL support would be a great way for some projects like local weather to parallelize more and more code.
|
Moving some Nasal code to other cores
some people have repeatedly expressed an interest in eventually running a weather simulation asynchronously from the main loop, i.e. either multi-threaded or in a separate process (the HLA interface was mentioned by Mathias and Torsten).
|
Feature Scaling
This isn't the first person/contributor to state pretty clearly that they're kinda disappointed with the way FG has evolved over the years, some others stated pretty clearly that even a recent version of X-Plane looks and works better than FG 3.x using the same hardware - so I guess we should take this for what it is, i.e. feedback demonstrating that people no longer know how to scale down FlightGear's features. Admittedly, I also find myself having to do quite a bit of tweaking these days, despite having fairly powerful hardware. Stating that all these are optional features and that people "merely" need to disable those, is as short-sighted as the whole multi-threading debate that we've been having since ~2006 ... Obviously, the "minimal startup profile" should still work for people, and it should easily provide ~60 fps, but that's not what people want FG to look like, and there are other products that simply provide a better experience.
|
So, I'd say we do have a problem, but what people consider the problem is usually just a symptom and not the real culprit. But that should be understandable, most non-coders cannot easily understand all the factors involved here. |
To see for yourself, start up in a place without any scenery, keep FG running for several hours and then see the valgrind report (one of those tools that you refuse to use), while it's true that valgrind outupt is misleading in the context of OSG's ref_ptr's (smart pointers, that manage memory), we do have a number of memory-leaking features, including particles and even effects.
|
Things like a slow Nasal/GC scheme are those that you cannot easily track down, without using tools like a profiler, debugger or leaks checking tool.
|
I never even questioned that our current issue is scenery related, I just said that we've been seeing other issues, and I pointed out that a few of us provided patches to recognize such issues much earlier (the v2.0 scenery issue was RANDOMLY identified by Atlas core developer Brian Schack if you remember). Had we integrated the corresponding resource tracking patches that we discussed (and posted) 4+ years ago, we would have had a much better chance of detecting such issues - even regardless of them being specific to scenery, the Nasal GC or whatever.
|
Optional Features
All it takes to run the recent FG version on old hardware is to not use optional features and dial down the configuration. The project is most definitely not going into any direction making it impossible for some people to use FG - there's huge concern over backward compatibility on the devel list.
|
I mean, in that context FG is just a platform which runs the data you throw at it. Someone decided to develop that 777-S at high detail, and then it consumes more memory. Should the devel team veto detailed aircraft based on the notion that they might not run on all systems? Or could we perhaps trust users to select aircraft based on what runs on their system and what they want to have?
|
I agree wrt to valgrind, specifically if you want to profile, use callgrind and see in pretty colours how much time a piece of code takes to run. Requires lots of patience though.
|