Real-ESRGAN_GUI icon indicating copy to clipboard operation
Real-ESRGAN_GUI copied to clipboard

Won't work with GPU

Open starshadowx2 opened this issue 2 years ago • 5 comments

This works fine if I have the Device Id set to the default of -1 but that uses my CPU, if I change it to 0 for my GPU it seems to start using it but then crashes. I have a 3090 with 24GB of memory so it seems like it should be able to run on this, but maybe I'm missing something

unknown . unknown

starshadowx2 avatar Jun 18 '22 06:06 starshadowx2

Hmmm, I can replicate the same bug. This looks like a DirectML bug to me. I'll look into this issue.

net2cn avatar Jun 18 '22 15:06 net2cn

In between my post and your reply we also found this program that uses Real-ESRGAN and does work fine with GPU - https://github.com/n00mkrad/cupscale

starshadowx2 avatar Jun 18 '22 23:06 starshadowx2

The issue seems to be related to the OnnxRuntime with the DirectML backend. I cannot get the bug reproduced on some machines but machines with both integrated graphics and discrete graphics. I'll test the CUDA backend later.

net2cn avatar Jun 19 '22 04:06 net2cn

Seems like I have the same issue. I have both integrated and discrete graphics. If I run on the CPU, inference works fine. But If I try to use either GPU, I get an exception.

The following is the exception at Model.Inference (line 120):

[ErrorCode:RuntimeException] Non-zero status code returned while running Resize node. Name:'Resize_1177' Status Message: D:\a_work\1\s\onnxruntime\core\providers\dml\DmlExecutionProvider\src\MLOperatorAuthorImpl.cpp(1660)\onnxruntime.DLL!00007FF9488A6310: (caller: 00007FF9488A5824) Exception(3) tid(3204) 80070057 The parameter is incorrect.

Stack trace:

at Microsoft.ML.OnnxRuntime.NativeApiStatus.VerifySuccess(IntPtr nativeStatus) at Microsoft.ML.OnnxRuntime.InferenceSession.RunImpl(RunOptions options, IntPtr[] inputNames, IntPtr[] inputValues, IntPtr[] outputNames, DisposableList1 cleanupList) at Microsoft.ML.OnnxRuntime.InferenceSession.Run(IReadOnlyCollection1 inputs, IReadOnlyCollection1 outputNames, RunOptions options) at Microsoft.ML.OnnxRuntime.InferenceSession.Run(IReadOnlyCollection1 inputs, IReadOnlyCollection1 outputNames) at Microsoft.ML.OnnxRuntime.InferenceSession.Run(IReadOnlyCollection1 inputs) at Real_ESRGAN_GUI.Model.<>c__DisplayClass5_0.<Inference>b__0() in C:\Users\KEG\Documents\Visual Studio 2022\Projects\Real-ESRGAN_GUI\Real-ESRGAN_GUI\Model.cs:line 120 at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj) at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)

keg247 avatar Jun 24 '22 02:06 keg247

If I try to use GPU, I get an exception. Microsoft.ML.OnnxRuntime.OnnxRuntimeException:“[ErrorCode:RuntimeException] Non-zero status code returned while running Transpose node. Name:'Transpose_28' Status Message: ”

QX396485266 avatar Jul 08 '22 03:07 QX396485266