Stalling GPU when creating workspace

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Post Reply
Lax
Orc
Posts: 476
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 30

Stalling GPU when creating workspace

Post by Lax »

Hi,

when I load a workspace, It now takes longer as before. In the log file I see the following entries:

Code: Select all

17:27:01: [WorkspacePbsComponent] Creating workspace: NOWAWorkspace1111111112
17:27:07: Texture memory budget exceeded. Stalling GPU.
17:27:08: Texture memory budget exceeded. Stalling GPU.
17:27:11: Texture memory budget exceeded. Stalling GPU.
17:27:14: Texture memory budget exceeded. Stalling GPU.
17:27:15: Texture memory budget exceeded. Stalling GPU.
17:27:17: Texture memory budget exceeded. Stalling GPU.
17:27:17: Stalling was not enough. Freeing memory.
17:27:17: Texture memory budget exceeded. Stalling GPU.
17:27:17: Stalling was not enough. Freeing memory.
Has anybody an idea, why I get those GPU stalling? Is it because of to huge textures?

Best Regards
Lax
Image
http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62
Image

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4501
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 936
Contact:

Re: Stalling GPU when creating workspace

Post by dark_sylinc »

This message shows up when lots of textures (and/or big textures) are being loaded and the memory pool is being overwhelmed. Probably from a call to either waitForStreamingCompletion or TextureGpu->waitForData (explicit or implicit: a Low level material in a compositor pass may be forcing a wait call. There's a recent commit where we fixed a potential bug caused in low level materials used by a compositor which references a texture in disk... it must call waitForData which is forced in TextureUnitState::ensureLoaded :( )

If you're loading lots of textures, then this is normal, use TextureGpuManager::dumpMemoryUsage to see if you see if the textures being loaded that shouldn't.

You can also see MemoryGameState::setRelaxedMemoryBudget and setTightMemoryBudget from Samples/2.0/Tutorials/Tutorial_Memory/Tutorial_MemoryGameState.cpp which lets you trade off allocating more memory for streaming in exchange for fewer stalls.

The best solution, after looking at the contents of dumpMemoryUsage and identifying the big textures, you may want to:
  1. Create workspace as late as possible, to give time for streaming without stalls (not recommended, it's hard to get this right)
  2. Create workspace as early as possible, before the big textures get loaded (recommended)
  3. Identify which textures are blocking inside workspace creation e.g. place a breakpoint in the blocking call from OgreCompositorPassQuad.cpp, and force-load them by scheduling them to resident them as early as possible (extremely recommended)

UPDATE: To clarify on the problem. If you do:

Code: Select all

smallTexture->scheduleTransitionTo( GpuResidency::Resident );
bigTexture->scheduleTransitionTo( GpuResidency::Resident );
smallTexture->waitForData();
Then it becomes extremely likely that 'bigTexture' will delay smallTexture's waitForData. If you have loaded lots of big textures between smallTexture->scheduleTransitionTo and smallTexture->waitForData, then stalls likely going to happen.

However if you do:

Code: Select all

smallTexture->scheduleTransitionTo( GpuResidency::Resident );
smallTexture->waitForData();
bigTexture->scheduleTransitionTo( GpuResidency::Resident );
bigTexture2->scheduleTransitionTo( GpuResidency::Resident );
bigTexture3->scheduleTransitionTo( GpuResidency::Resident );
...
Then smallTexture->waitForData will return very fast, while the rest of the big textures will keep streaming in the background.

That's why it's important in determining which textures are blocking, identify them, and load them first; so their blocking gets as minimal as possible, instead of being mixed up with big textures that can easily stream in the background

Lax
Orc
Posts: 476
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 30

Re: Stalling GPU when creating workspace

Post by Lax »

Hi dark_sylinc,

ok, thanks for the detailed information. I will investigate this.

Best Regards
Lax
Image
http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62
Image

Post Reply