[WIP][video][cuda] NVDECCache eviction policy, static implementation#1243
Open
[WIP][video][cuda] NVDECCache eviction policy, static implementation#1243
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/meta-pytorch/torchcodec/1243
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
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.
Summary
Adds the notion of statically defined eviction policy to
NVDECCache. Eviction policy decides which entry should leave the cache when it's full and a new decoder needs to be created. This PR suggests the following API for an eviction policy:Three example policies are provided:
LRUEvictionPolicyis proposed as the default eviction policy.Test Plan
Benchmarks were run on a set of 1200 diverse videos of 132 different resolutions; top 10 resolution buckets are:
On the plots below, different numbers of frames at different frame steps were extracted from these videos using different numbers of worker threads by decoders using this PR (
with eviction) and decoders before this PR (baseline). Throughput in terms of the number of decoded frames per second (FPS) is plotted as a function of the number of worker threads (# threads).15 decoded frames:

30 decoded frames:

60 decoded frames:

90 decoded frames:

Conclusion
Eviction policy brings advantage in terms of performance and scaling across almost all the settings. However, if the number of decoded frames is too small (e.g. 15 frames at frame step 1) or too big (60 frames at larger frame steps, 90 frames), cache eviction seems to no longer yield advantage.