Skip to content

Conversation

@Dan-Flores
Copy link
Contributor

No description provided.

@pytorch-bot
Copy link

pytorch-bot bot commented Jan 29, 2026

🔗 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 Failures

As of commit 03db5c9 with merge base a9e1ae3 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jan 29, 2026

PerGpuCache<AVBufferRef, Deleterp<AVBufferRef, void, av_buffer_unref>>
g_cached_hw_device_ctxs(MAX_CUDA_GPUS, MAX_CONTEXTS_PER_GPU_IN_CACHE);

Copy link
Contributor Author

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,
Copy link
Contributor Author

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(
Copy link
Contributor Author

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) {}
};
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant