-
Notifications
You must be signed in to change notification settings - Fork 88
[wip] Create parallel EncodingDeviceInterface #1212
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
base: main
Are you sure you want to change the base?
[wip] Create parallel EncodingDeviceInterface #1212
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/meta-pytorch/torchcodec/1212
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 03db5c9 with merge base a9e1ae3 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
|
||
| PerGpuCache<AVBufferRef, Deleterp<AVBufferRef, void, av_buffer_unref>> | ||
| g_cached_hw_device_ctxs(MAX_CUDA_GPUS, MAX_CONTEXTS_PER_GPU_IN_CACHE); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is moved here from CudaDeviceInterface.cpp so that EncodingCudaDeviceInterface.cpp can reuse the context creation and caching.
| TORCH_CHECK( | ||
| avFrame != nullptr, | ||
| "convertTensorToAVFrame failed for frame ", | ||
| i, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Encoding interface handles both CPU and CUDA, and removes repeated conditionals:
if (frames_.device().is_cuda && deviceInterface_) { ... }
| getFFMPEGErrorStringFromErrorCode(status)); | ||
| } | ||
|
|
||
| UniqueAVFrame VideoEncoder::convertTensorToAVFrame( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CPU specific implementation is removed from Encoder.cpp.
|
|
||
| explicit EncodingDeviceInterfaceKey(torch::DeviceType type) | ||
| : deviceType(type) {} | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is mostly copied over from DeviceInterface.h.
We could move these registration functions to a new header that is shared between EncodingDeviceInterface and DeviceInterface, but I'm not sure that's necessary. For now, I've added this parallel implementation using Encoding... types.
Alternatively, if we never expect to implement a BetaCuda variant for encoding, this can be simplified.
No description provided.