cassiebreviu / StableDiffusion

Inference Stable Diffusion with C# and ONNX Runtime
MIT License
222 stars 51 forks source link

DirectML doesn't use gpu #28

Closed Deins closed 1 year ago

Deins commented 1 year ago

Currently I don't see how DirectML is supposed to work with gpu. device_id in sessionOptions.AppendExecutionProvider_DMLas I understand is supposed to be DirectML device created with https://learn.microsoft.com/en-us/windows/win32/api/directml/nf-directml-dmlcreatedevice While I can't seem to find any c# exposed functions to actually create such device.

What id is supposed to be used AppendExecutionProvider_DML ?

cassiebreviu commented 1 year ago

Did you check to make sure the Device ID is correct in the config? It depends on your device. Usually DeviceId=0 is correct, however if you are on a laptop with an integrated GPU and external, you might need DeviceId=1