Repository navigation
VAE: tile the encoder when the device cannot hold its graph, and retry with smaller tiles when a graph does not fit - #125
Conversation
… chunk) frames - the untiled short track and the 1024-frame tile alike, about 10 MB a frame (after HOT-Step #186)
…and both halve the tile down to 64 when a graph does not fit
…ytes a latent frame, plus a tenth
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
The decoder checks the device's free memory before it builds a graph and tiles at 256 frames when a graph of min(T, chunk) frames would not fit (about 10 MB of activations a frame; HOT-Step #186: a 726-frame graph asked for 6.78 GB and took a 4 GB card down). The encoder had no such check: a cover, a timbre reference or an understand pass over a long source built one graph per 1024-frame tile, or one for the whole source when it was shorter than the chunk, whatever the card had free.
ggml_backend_sched_get_buffer_sizeafter a successfulggml_backend_sched_alloc_graph) grows by exactly 6,389,760 bytes a latent frame with no constant part (96 to 1024-frame tiles,--vae-chunk128/256/512/1024 on a 173 s song, RTX 4090, CUDA, F32 activations); the check takes that plus a tenth.Seen on a 6-minute source (8986 latent frames) with a graph for the whole track, which is what a 1024-frame tile is to a small card: before,
[VAE-Enc] Graph: 565 nodes, T_audio=17253120thenCUDA error: invalid argument; after, the encoder tiles at 256, 71 tiles, and the cover renders. On the 173 s song with--vae-chunk 9000:A 4333-frame encode graph needs about 28.36 GB, 22.34 GB free: tiling at 256, 34 tiles.Known limit of the check: on Windows with CUDA (WDDM), the free memory the backend reports does not count what other processes hold, since WDDM pages their memory out. The estimate then sees almost the whole card, so the check does not tile for memory taken by other programs, and as long as WDDM pages instead of refusing, the graph allocation does not fail either, so the retry does not start. Vulkan reports a budget that does include other processes.
Summary by CodeRabbit