Repository navigation
EdenLive AR: optional decode_to_cpu so GPU memory does not grow with the video length - #1642
Open
hiroki-abe-58 wants to merge 1 commit into
Open
hiroki-abe-58 wants to merge 1 commit into
hiroki-abe-58 wants to merge 1 commit into
Conversation
The decoded chunks stay on the GPU until the end of a request and are then concatenated there, so GPU memory grows with the video length. With ar_config.decode_to_cpu each chunk is copied to the CPU as it is decoded; GPU memory then no longer depends on the length. Off by default.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EdenLive AR keeps every decoded chunk on the GPU until the end of a request, then concatenates the chunks there, so GPU memory grows with the video length. On a 32 GB card at 1280×704, a 30 s clip fit in my runs. A 45 s clip ran out of memory at the end of the request, while the MP4 was being saved.
This PR adds an opt-in
ar_configkey,"decode_to_cpu": true, which copies each decoded chunk to host memory as soon as it is decoded. With it, GPU memory no longer depends on the clip length. The default is unchanged. With the option on, chunk callbacks receive CPU tensors. The README (EN/ZH) documents the key next toT5_CPU_OFFLOAD.Measurements
Setup:
cryo-crossingsample. "45 s" is that clip followed by its frames in reverse (1077 frames).decode_to_cpusave_to_videoafter all 90 chunks (tried to allocate 5.42 GiB)Output is unchanged:
wan_vae_to_comfy(the--return_result_tensorpath) aretorch.equalwith and without the option.Cost:
Async decode (
"async_vae_decode": true, where the copy runs on the decode worker thread): I checked it on the 5 s clip only.decode_to_cpu, and identical to the synchronous decode: the MP4s are byte-identical.🤖 Generated with Claude Code