Skip to content

Conversation

scotts
Copy link
Contributor

@scotts scotts commented Aug 27, 2024

Currently, the code in VideoDecoder.cpp has a lot of #ifdef ENABLE_CUDA directly in functions. This refactor applies the following principles:

  1. The logic in VideoDecoder.cpp should not need #ifdef ENABLE_CUDA inside of it.
  2. CUDA code should be localized to explicit CUDA source files.
  3. We should limit the entry points from generic code into CUDA code through an explicit API. Functions in this API will throw an exception if called from generic code that was not compiled with CUDA support.

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 27, 2024
torch::Tensor dummyTensorForCudaInitialization = torch::zeros(
{1},
torch::TensorOptions().dtype(torch::kUInt8).device(device));
codecContext->hw_device_ctx = av_buffer_ref(getCudaContext());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compilation is failing on this line with:

  /pytorch/torchcodec/src/torchcodec/decoders/_core/CUDACommon.cpp:81:3: error: ‘codecContext’ was not declared in this scope; did you mean ‘AVCodecContext’?

https://github.com/pytorch/torchcodec/actions/runs/10570986466/job/29286351387?pr=193

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'm working on compilation problems. I submitted a PR because the CI is the only way for me to test on GPUs right now.

@scotts scotts changed the title Refactor CUDA code into its own sets of files [WIP] Refactor CUDA code into its own sets of files Aug 27, 2024
@scotts scotts marked this pull request as draft August 27, 2024 13:14
@scotts scotts changed the title [WIP] Refactor CUDA code into its own sets of files Refactor CUDA code into its own sets of files Aug 27, 2024
@scotts scotts marked this pull request as ready for review August 27, 2024 14:50
@facebook-github-bot
Copy link
Contributor

@scotts has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@scotts
Copy link
Contributor Author

scotts commented Aug 27, 2024

Abandoning this PR because we are going to move CUDA changes off of main and onto a feature branch for now. I'll re-open this PR on the feature branch when we have it ready.

@scotts scotts closed this Aug 27, 2024
@scotts scotts mentioned this pull request Aug 28, 2024
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.

3 participants