[g3.5pre-44-g1455111dd] 50% performance regression since 3.3

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Blzut3
 
 
Posts: 3144
Joined: Wed Nov 24, 2004 12:59 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

[g3.5pre-44-g1455111dd] 50% performance regression since 3.3

Post by Blzut3 »

Running the classic renderer I've noticed about a 50% performance regression on my system going from GZDoom 3.3.2 to 3.4.0 (remains to current master of course). Running at 1920x1080 on vanilla maps I was able to get over 200fps but with 3.4.0 barely 100fps can be broken (I have 144Hz display). OS is Kubuntu 18.04 64-bit. System is an AMD Threadripper 1950X running in NUMA mode with an AMD FirePro W7100 (roughly an R9 285). Graphics driver is Mesa 18.1.1 from Padoka Stable PPA.

Bisection points to the refactor done to unify the back ends. Can't point to a single commit since the SDL stuff was broken through most of it.
Spoiler: Bisect output
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [g3.5pre-44-g1455111dd] 50% performance regression since

Post by Graf Zahl »

Good luck finding it. I do not experience any regression so I cannot test this. This needs input from someone experiencing the problem.

Can you at least check if this is caused by the software renderer or the 2D stuff? That should be easily doable because you can disable the HUD.
User avatar
drfrag
Vintage GZDoom Developer
Posts: 3141
Joined: Fri Apr 23, 2004 3:51 am
Location: Spain
Contact:

Re: [g3.5pre-44-g1455111dd] 50% performance regression since

Post by drfrag »

If my legacy branch is not affected it's not the software renderer itself.
Blzut3
 
 
Posts: 3144
Joined: Wed Nov 24, 2004 12:59 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

Re: [g3.5pre-44-g1455111dd] 50% performance regression since

Post by Blzut3 »

Disabling the hud, player sprites, and crosshair doesn't change the performance. GZDoom 3.3.2 already uses an OpenGL canvas on Linux and the hardware renderer performs well, so I guess that does point to a regression in the software renderer itself? I haven't been watching things close enough to have any idea how close 3.3.2 with the GL canvas and 3.4.0 are.

Side note: There is no obvious performance regression using the OpenGL renderer.
drfrag wrote:If my legacy branch is not affected it's not the software renderer itself.
g3.4pre-278-gd7c227469 on g3.3mgw is not affected. Breaking 200fps just fine.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [g3.5pre-44-g1455111dd] 50% performance regression since

Post by Graf Zahl »

Can you compare the different modes of the software renderer? Does it only happen with paletted rendering or always? Or with Softpoly?
dpJudas
 
 
Posts: 3036
Joined: Sat May 28, 2016 1:01 pm

Re: [g3.5pre-44-g1455111dd] 50% performance regression since

Post by dpJudas »

There are a couple of differences between how the old OpenGLSWFrameBuffer mapped its buffer and how master does it currently.

On master it does:

Code: Select all

void Init()
{
	glBufferData(GL_PIXEL_UNPACK_BUFFER, w*h*texelsize, nullptr, GL_DYNAMIC_DRAW);
}

void Lock()
{
	glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_READ_WRITE);
}
Old frame buffer did:

Code: Select all

void Init()
{
	if (glMapBufferRange)
		glBufferData(GL_PIXEL_UNPACK_BUFFER, size, nullptr, GL_DYNAMIC_DRAW);
}

void Lock()
{
	if (glMapBufferRange)
	{
		return (FBVERTEX*)glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, size, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
	}
	else
	{
		glBufferData(GL_PIXEL_UNPACK_BUFFER, size, nullptr, GL_STREAM_DRAW);
		return glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
	}
}
Primary difference here is that old one would use GL_STREAM_DRAW for older OpenGL versions (master always uses GL_DYNAMIC_DRAW) and secondly the older version used glMapBufferRange on newer OpenGL. There's also an error in the old version as it maps them WRITE_ONLY, which isn't safe.

The old version also sent strong hints to OpenGL that it did not need the old contents between frames. Don't know if any of that explains the performance difference, but it is probably worth investigating. If you want to do some testing, the buffer initialization is done in FHardwareTexture::AllocateBuffer and the mapping in FHardwareTexture::MapBuffer.
dpJudas
 
 
Posts: 3036
Joined: Sat May 28, 2016 1:01 pm

Re: [g3.5pre-44-g1455111dd] 50% performance regression since

Post by dpJudas »

Eek, that was the wrong locking code. Never mind - seems the lock code is identical. No idea what the cause is then.
Blzut3
 
 
Posts: 3144
Joined: Wed Nov 24, 2004 12:59 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

Re: [g3.5pre-44-g1455111dd] 50% performance regression since

Post by Blzut3 »

Graf Zahl wrote:Can you compare the different modes of the software renderer? Does it only happen with paletted rendering or always? Or with Softpoly?
All modes are affected although less so in true color.

For both classic and soft poly
Paletted ~201fps -> ~116fps
Truecolor ~55fps -> ~44fps

Can also reproduce on my laptop which is running a processor similar to a Core i3 5020U (I say similar to since it's an Thinkpad X61 with an after market motherboard which has an engineering sample CPU 2.2GHz with 2.3GHz turbo and IIRC an 800MHz GPU clock). There the classic renderer goes from ~184fps to ~106fps. Again Kubuntu 18.04 64-bit with Mesa 18.1.1.
dpJudas
 
 
Posts: 3036
Joined: Sat May 28, 2016 1:01 pm

Re: [g3.5pre-44-g1455111dd] 50% performance regression since

Post by dpJudas »

Did a test on my computer with 3.3.0 vs master and I'm getting 275 fps for both on them (palette mode, Windows 10, nvidia gtx 980 at 1920x1080).
Blzut3
 
 
Posts: 3144
Joined: Wed Nov 24, 2004 12:59 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

Re: [g3.5pre-44-g1455111dd] 50% performance regression since

Post by Blzut3 »

I'm fairly confident that the regression only manifests on Linux, but I'll test my systems on Windows later for completeness.
User avatar
drfrag
Vintage GZDoom Developer
Posts: 3141
Joined: Fri Apr 23, 2004 3:51 am
Location: Spain
Contact:

Re: [g3.5pre-44-g1455111dd] 50% performance regression since

Post by drfrag »

Blzut3 wrote:g3.4pre-278-gd7c227469 on g3.3mgw is not affected. Breaking 200fps just fine.
That's g3.4.1v i forgot to upload the tag. Also i've not uploaded a few recent commits yet.
Edit: the software renderer itself is the same in the legacy branch.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [g3.5pre-44-g1455111dd] 50% performance regression since

Post by Graf Zahl »

Blzut3 wrote:I'm fairly confident that the regression only manifests on Linux
I'd suspect the driver, not Linux.
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: [g3.5pre-44-g1455111dd] 50% performance regression since

Post by Blue Shadow »

In 3.3.2 I get up to 600 fps, while in 3.4.0 I get up to 173 fps. The test was done at the start area of Doom 2's first map.
Spoiler:
Considering OpenGL powers all the renderers now, even the software one, that performace dip is hardly surprising for me. This computer never really liked OpenGL :p.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [g3.5pre-44-g1455111dd] 50% performance regression since

Post by Graf Zahl »

My guess is that Direct3D was just more efficient at uploading the texture for the software rendered view. But in the end you lose a tiny bit of time only.

Going from 600 fps to 173 fps you lose a lot less than going from 200 to 100 fps where the 200 are most likely throttled by the engine.
dpJudas
 
 
Posts: 3036
Joined: Sat May 28, 2016 1:01 pm

Re: [g3.5pre-44-g1455111dd] 50% performance regression since

Post by dpJudas »

Graf Zahl wrote:
Blzut3 wrote:I'm fairly confident that the regression only manifests on Linux
I'd suspect the driver, not Linux.
That is now confirmed. I tried both versions on my Debian Linux with my Nvidia 980 card. The 3.3.0 version gave me 332 fps in a release build. Master gave me 455 fps. So there the new version is actually faster.

One interesting thing, though. I did get those 105 fps Blzut3 is mentioning, but that's when cmake was set to do a debug build.

blzut3: are you absolutely sure you built it in release mode? (not that I think you'd normally make this kind of mistake, but its worth asking just to be sure)
Post Reply

Return to “Closed Bugs [GZDoom]”