-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: BSOD on Ryzen with directml if memory overflows 16 GB #557
Comments
|
In other words, the only way to free memory is to restart whole process. Am I right?
Correct me if I'm wrong, but it seems to not support directml as torch backend, am I right? I have Low-end Ryzen, so zluda/Rocm under Windows seems to be out of the options for me. At least stable-diffusion-webui-amdgpu I was able to run only with --use-directml. |
Yes.
Strictly speaking, restarting process is not possible. You may manually restart webui via terminal. Or, there should be another (master) process that saves states and restarts (kill and spawn) python.
Forge supports DirectML. It is |
That process is
Didn't know it exist, thanks. After a lot of trial and error, I was able to run it on my system with every possible tweak to use less memory. What's strange, stable-diffusion-webui-amdgpu-forge does use more than 16G of shared memory without crash, although I still caught crashes a few times. However, main issue with your fork of Forge was that it uses way too much all memory for my system. I peaked at 40 GB of system memory usage (half of which was shared) without even generating 1 Mpx image. At the same time, my modified version of your stable-diffusion-webui-amdgpu allows me to generate 1,15 megapixel image without crash or memory overflow. |
Checklist
What happened?
Generation on AMD Ryzen 3 5300G with directml leads to BSOD every time Shared video memory usage exceeds 16GB limit.
Steps to reproduce the problem
Generate a batch of images with directml on Ryzen iGPU
What should have happened?
System should not restart with Blue Screen Of Death message.
What browsers do you use to access the UI ?
Other
Sysinfo
sysinfo-2024-11-02-08-32.json
Console logs
Additional information
I use webui on AMD Ryzen 3 5300G, it has Radeon Vega iGPU.
Windows 11, latest video driver.
In my case I've been able to run only with --use-directml option, no ONNX.
I use --lowvram and other optimizations, but even then, depending on image size, memory consumption can be over 12-14 GB (for image sizes around 1 megapixel).
Also, there seems to be a memory leak. Shared video memory (aka dynamic) does not get freed after every generation. So, the only way to avoid huge memory consumption is to restart the whole script.
On top of all that, I get BSOD every time memory consumption exceeds 16GB limit.
So, my only option is to restart batch file every time there is a chance that the next generation will overflow memory usage. I suppose it's a problem for every Windows Ryzen user, not just me.
This can be considered both as bug report and as a Feature Request. I'll describe possible solutions from ideal one to the simplest in implementation. I don't have those solutions, only the simplest one.
For now, my solution is a bad version of variant 3. It restarts script if memory usage exceeds the threshold given by the user. However, while doing so, it fails to send last generated data to the gui. So, image gets saved, and memory gets free, but gui shows confusing data. Also, this method fails to protect memory when user generates in batches, as it runs only after all generations are finished. Still, with "Generate forever" gui function, my method allows to run many hours of image generation without interruptions. And with how slow Ryzed GPU is, this is very much needed.
My solution adds 6 lines into call_queue.py: 2 lines in the beginning and 4 in wrap_gradio_call_no_job. Here are they:
What I ask is for a better solution, that would:
The text was updated successfully, but these errors were encountered: