sd: support for CLIP and VAE on different devices#2184
Conversation
1517922 to
197cc2f
Compare
|
merged your other PR so now this conflicts |
197cc2f to
ed81427
Compare
|
Fixed. |
ed81427 to
bd5330a
Compare
|
So I looked through this PR and it does seem like quite a lot of changes + complexities for something that doesn't seem too useful in my opinion. Especially with the ability to already use Also it does modify a bunch of extra upstream code too. |
We (and upstream) do get requests for this functionality from time to time.
Kind of? It's mostly the unavoidable device initialization for each component. I expect that code to change upstream when multi-device support gets implemented, but in that case dropping our changes would be simple enough. Edit: rebased on top of #2204 to avoid conflicts. |
bd5330a to
49ca0ac
Compare
|
merged 2204 |
c900e1c to
93caa6d
Compare
93caa6d to
a8eb544
Compare
|
Just rebased for now, to deal with the conflict with the mmap flag. The flags There is a related bug if the boolean flags are set, though 😕 And I agree the display should be adjusted for that; will fix it.
This is not a query: |
|
I see. But yeah, it was glitching out and double allocating when i set |
Indeed, it would pose as a separate module, and get its own entry on the backend map. 🤦 And I think I understand why it looks like it is initializing everything prematurely:
I could either store the config as-is first and validate it later, or make the device scan explicit at a previous point. |
|
Oh, one thing I forgot to ask you about: GPU numbering. env vars, device names, and (I think) our own command line use zero-based counting; but the launcher shows them as one-based. I guess we avoid zero-counting on the launcher because it doesn't feel natural for normal people; but maybe showing them as names instead ("CUDA0", "GPU0", etc) would avoid that issue while still keeping everything consistent? |
|
I believe the config selection is fixed; but since leejet just pushed multi-device support, I'll focus on getting that ready, then adapt this PR for it. |
main concern is space. window is very tight on space so i try to maximize as much as possible, |
0e70800 to
c93423a
Compare
|
Adapted to the mainstream support. |
|
Hmm, if they enable tae sd then the vae backend selector will disappear? probably can be confusing |
|
Should I still consider merging this or is this superceded by #2213 ? |
I think the VAE backend is used for the TAE model, too. TAE is a VAE, just a lightweight one.
If we had a lot of space, or better controls, I'd add a "Text encoder" box grouping the backend selector and all the text models; a VAE one with backend, models, threshold; etc. |
c93423a to
8b998f9
Compare




Support for placing CLIP or VAE on separate devices (e.g. diffusion on Vulkan0, VAE on Vulkan1). It also enables keeping the diffusion model itself on CPU.
The first two commits adapt the C++ code: the interface receives device numbers instead of booleans, with -1 for "main device" and -2 for "CPU", and the backend includes a global config to choose which model gets which device. The last commit changes the
sdclipgpuandsdvaecpuboolean parameters to accept "CPU", "main" or a device number.Tested on Vulkan with my GPU and iGPU. Seems to work fine with command-line and config settings; however, I wasn't able to fully test the launcher, because there doesn't seem to be a way to select a discrete GPU and an iGPU through it (so I likely got its 1-based indexes wrong).
Edit: rebased on top of #2213 for the upstream multi-device support.