Deep-Live-Cam icon indicating copy to clipboard operation
Deep-Live-Cam copied to clipboard

DirectML: More than 1 execution thread crashes video processing

Open nicolasxbx opened this issue 1 year ago • 4 comments

Using "python run.py --execution-provider dml --execution-threads 1" works for DirectML video processing.

Going any higher on execution-threads than 1 crashes on this line:

[DLC.FACE-SWAPPER] Progressing...
Processing:   0%| | 0/38 [00:00<?, ?frame/s, execution_providers=['DmlExecutionProvider'], execution_threads=2, max_mem

I also tried installing different onnxruntime-directml versions.

nicolasxbx avatar Aug 21 '24 22:08 nicolasxbx

Using "python run.py --execution-provider dml --execution-threads 1" works for DirectML video processing.

Going any higher on execution-threads than 1 crashes on this line:

[DLC.FACE-SWAPPER] Progressing...
Processing:   0%| | 0/38 [00:00<?, ?frame/s, execution_providers=['DmlExecutionProvider'], execution_threads=2, max_mem

Yes, I have more than 1 thread available, don't ask. I also tried installing different onnxruntime-directml versions.

Probably out of vram, as threads count determine how many instances can run parallel. Eg: 3thread mean 3x vram usage. What gpu are you using?? Using --max-memory (vram of your gpu) flag may help.

skrohit22087 avatar Aug 22 '24 05:08 skrohit22087

@skrohit22087 AMD RX 5600 XT (6 GB of VRAM)

--execution-threads 1 --max-memory 6 works the same --execution-threads 2 --max-memory 6 crashes.

nicolasxbx avatar Aug 22 '24 17:08 nicolasxbx

Same here with AMD RX 7900 XT:

It crashes as soon as I set execution-threads higher than 1 (with dml). Tried lots of combinations with max-memory, but couldn't get it to work.

MysteryInAustralia avatar Aug 23 '24 04:08 MysteryInAustralia

@nicolasxbx @MysteryInAustralia "The DirectML execution provider does not support the use of memory pattern optimizations or parallel execution in onnxruntime." according to https://github.com/microsoft/onnxruntime-openenclave/blob/openenclave-public/docs/execution_providers/DirectML-ExecutionProvider.md

skrohit22087 avatar Aug 23 '24 05:08 skrohit22087