4.6 chooses wrong GPU on a multi-GPU laptop

I have a laptop with both a INTEL HD 4600 (embedded in CPU) and a Nvidia GTX 870M GPU. For previous versions, the editor would always choose (correctly) the 870M. With the latest 4.6.0 binary, it now chooses the HD4600, which gives incredibly bad performance (2FPS vs 60FPS). I also have 4.5.1 and 4.4.3 installed and they both choose the correct GPU. I downloaded and built the latest 4.6 source and it chooses the 860M as well… It’s only the binary version that fails.

To reproduce. Launch 4.6.0 Project selector and choose any Blueprint project. I choose the empty one, with started content. When it launches, select show FPS from the Editor Preferences (Miscellaneous). It will show 2-5 FPS. My laptop also has an LED that shows the selected GPU and it confirms that the GPU selected is the HD 4600.

Repeat for 4.5.1 and 4.4.3 and you should see 60 FPS.

I’ve got the same problem!

ASUS K750J with Intel HD Graphics 4600 + NVIDIA GT740M. Even when I force the GT740M in the NVidia control panel on unreal-engine, unreal-game, unreal-editor, etc. it’s not working!

Same here…

Nvidia GTX 980 stays idle and Quadro 2000 does it all. Result: 26FPS in the Third Person Template. :frowning:

How can I fix that? (4.6.1)

SOLUTION 1

I found this document:

“Starting with the Release 302 drivers, application developers can direct the Optimus
driver at runtime to use the High Performance Graphics to render any application–even
those applications for which there is no existing application profile.”

We must export a variable NvOptimusEnablement that Optimus driver is supposed to detect an enable the nvidia card:

extern "C" {
	_declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
}

Even with that variable it’s not working!!! I create a little program in C++ to test it. I even used NVidia Inspector to force some values: nothing!!! I verify the percentage of use with MSI AfterBurner and NVidiaInspector.
For the moment, only google Sketchup and 3DS Max are recognized by the Optimus driver on my computer.
Not working: unreal engine 4, JMonkey Engine, Autodesk Inventor, SolidWorks, etc.

Source code: NVidia Optimus Driver - TEST - Pastebin.com

SOLUTION 2

Some people says that if you call just a CUDA function, the optimus driver will detect it and enable the NVidia card.
Not tested because I’ve to install the CUDA SDK, etc.

SOLUTION 3

I also found an another tricks:
https://forums.geforce.com/default/topic/748213/nvidia-optimus-big-problem-with-my-gtx660m/?offset=24


My solution - works without reboot (!):

After a deep scan - i used sysinternals Tools to understand when optimus is being invoked, and why it cannot start to activate the right GFX choosen in the nvidia control Center.
It is - as i thought - a really simple Problem in the registry.

Each time an appliction starts, nvidia Needs to be triggered to start correctly.
This is done by a registry entry : App_InitDlls
Here you can tell Windows what Needs to be triggered when an app starts.

x32bit: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows

x64bit: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Windows

There you find the link to the NVINIT.DLL or NVINITx.DLL which lets nvidia invoking the right GFX.
…alright…

But under the reg key RequireSignedAppInit_DLLs the System requires a signed DLL to be invoked/triggered - the value of the key is 1 (true).
After Setting this value to 0 (false) - my System runs perfectly!!

Solution:
set the following keys to 0:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\RequireSignedAppInit

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\WindowsNT\CurrentVersion\Windows\RequireSignedAppInit


Ok, that solution works sometimes but by example Autodesk Inventor goes into an endless loop, Unreal Engine 4 too, etc.

I hope it will help.

Thanks for trying to help, Peter. I don’t really like to mess with the Registry as it often make more harm than good… such as the infinite loop you describe. I hope they fix the problem.

Hey guys,

To ensure we are testing under the same environment on our end could you post the DXDiag for the machines that you are having this issue with?

Hello,

My results: Dropbox - File Deleted

I put my scripts, put0.reg and put1.reg, to modify the registry keys:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\RequireSignedAppInit
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\WindowsNT\CurrentVersion\Windows\RequireSignedAppInit

These scripts works! I can see with MSI AfterBurner that some softwares like Solidworks swith on my NVidia GPU when I execute “put0.reg”. However it makes by example Unreal Engine and Autodesk Inventor crashed…

There are 4 dxdiag files:

  • x86 => normal 32 bits
  • x64 => 64 bits
  • _0 => RequireSignedAppInit* put to 0 in the registry
  • _1 => RequireSignedAppInit* put to 1 in the registry (the loaded dll need to be signed)

I suppose that the dlls which make problem are NVINIT*.DLL. If you go to Windows/system32 and look in Properties → Digital signatures, you could see: “The certificate in the signature cannot be verified”.

Thank you in advance.

You’re welcome!

I made a little software in java which permits to force the NVidia card with these “tricks”.

It’s available on GitHub (source code and exec) : GitHub - PeterMacGonagan/NVIDIA