Skip to content

Commit 5193689

Browse files
committed
comment
1 parent 6b0cef4 commit 5193689

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

src/torchcodec/_core/BetaCudaDeviceInterface.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,14 +1331,6 @@ void BetaCudaDeviceInterface::convert_av_frame_to_frame_output(
13311331
//
13321332
// In contrast, a PacketDecoder will always upload CPU frames before retuning
13331333
// them because its contract is to respect its device parameter.
1334-
//
1335-
// TODO_API_BREAKDOWN UF P1: Should test mismatch between device param of
1336-
// PacketDecoder and ColorConversion - maybe we're fine not handling this?
1337-
// Should check CUDA-CPU, CPU-CUDA, and CUDA-CUDA (with different devices)
1338-
// cases.
1339-
// TODO_API_BREAKDOWN UF P1: OK but we want the ColorConverter to be
1340-
// standalone: can we feed it frames on CPU and then on GPU? Will it be OK
1341-
// with that? Does that influence the TODO just above?
13421334
bool needs_upload = mode() == Mode::Both && decoding_on_cpu_;
13431335

13441336
// `uploaded` owns the GPU buffer for as long as it's in scope, which covers

src/torchcodec/decoders/_blocks/_color_converter.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ def __init__(
5454
output_dtype=convert_output_dtype_to_str(output_dtype),
5555
)
5656

57+
# TODO_API_BREAKDOWN DESIGN P2: The frame device must match the converter
58+
# device. We have two alternative options:
59+
# - not take a device parameter in the constructor and make the converter
60+
# device-agnostic. It requires caching the interfaces on the Converter.
61+
# - take a device parameter and always honor it: that means downloading or
62+
# uploading CPU frames when needed.
63+
# I feel like maybe we want to allow a CPU frame to be CCed on the GPU and
64+
# do the upload ourselves (the download makes no sense, it's super slow).
65+
# Anyway, that can be done later.
5766
def convert(self, raw_frame: RawFrame) -> Frame:
5867
data = _blocks_convert_frame(self._handle, raw_frame._handle, raw_frame._device)
5968
if raw_frame.storage is not None:

0 commit comments

Comments
 (0)