Hard to Reproduce GPU Hangs from MMU Faults

That’s probably a good idea. Fyi, there is a separate CVar for turning off shader code optimization (r.Shaders.Optimize=0). The CVars I mentioned before should not automatically disable optimization.

Some clarification on the aftermath CVar placement. The aftermath CVar (r.GPUCrashDebugging.Aftermath.DumpShaderDebugInfo=1) should be placed in either:

File [<ENGINE_PATH>/Config/ConsoleVariables.ini], section [Startup]

or

File [<PROJECT_PATH>/Config/DefaultEngine.ini], section [ConsoleVariables]

Placing this CVar anywhere else will probably not work (e.g. placing it under the [/Script/Engine.RendererSettings] section in DefaultEngine.ini will not work).

Since the crash is so infrequent, it’s probably also a good idea to verify that you can get proper shader code association from GPU crashes in your QA builds.

To purposely trigger a GPU crash for testing you can use the following code snippet.

float alpha = 1;
float result = 1;
while (alpha > 0.0)
{
   alpha -= LightVector.x; // Some input to the shader
   result *= (1.0 - 0.1*alpha);
}
 
 
// …
float Masking = result; // Use the result somehow, this is used in TranslucentLightInjectionShaders.usf

You can do something like this in any global shader, but this is the one I have been using. It can be tricky to these kinds of shaders to compile, so I always use the same example. This one modifies TranslucentLightInjectionShaders.usf. Place this snippet right before the lines:

// 0: no contribution, 1:full contribution

float Masking = 1.0f;

And comment out or replace this existing Masking assignment. This will trigger a crash a GPU crash dump you can use for testing shader code association.

I’ve confirmed that the crashing machine does not need shader symbols output (r.Shaders.Symbols=1). Shader symbols can be associated later, as long as the *.nvdbg file is output (r.GPUCrashDebugging.Aftermath.DumpShaderDebugInfo=1).

For CI generating shader symbol build artifacts, Unreal has CVars for outputting a pre-zipped version of the shader files for easier handling. Add these settings to you WindowsEngine.ini instead of r.Shaders.Symbols=1:

[ShaderCompiler]

r.Shaders.GenerateSymbols=1

r.Shaders.WriteSymbols=1

r.Shaders.WriteSymbols.Zip=1

or

[ShaderCompiler_BuildMachine]

r.Shaders.GenerateSymbols=1

r.Shaders.WriteSymbols=1

r.Shaders.WriteSymbols.Zip=1

See shader symbol docs here.

Let me know if you have any more question, or once you get a new crash with the shader debugging information. As I said before sending the debug files, including the *.nvdbg, *.nv-gpudmp, and associated dxil shader and pdb symbol files (listed when you click the “Show Symbol Files” button) in addition to the crash log showing active shader breadcrumbs, would be very helpful.

Regards,

Lance Chaney