Skip to content

createDeviceInterface() C++ API lacks public visibility #1345

@dvrogozh

Description

@dvrogozh

With 0.11.1 torchcodec.

std::unique_ptr<DeviceInterface> createDeviceInterface(

The createDeviceInterface() API lacks public visibility causing load errors for accelerator plugins who attempt to use it:

OSError: /localdisk/dmitry/git/torchlib-xpu/.venv/lib/python3.14/site-packages/torchcodec_xpu/xpu_ops6.cpython-314-x86_64-linux-gnu.so: undefined symbol: _ZN8facebook10torchcodec21createDeviceInterfaceERKN5torch6stable6DeviceESt17basic_string_viewIcSt11char_traitsIcEE

This API is needed to create CPU device interface to implement CPU fallback in the corner cases when underlying accelerator device does not support some codecs or codec features. Similar to the following handling in CUDA device interface:

cpuInterface_ = createDeviceInterface(kStableCPU);
STD_TORCH_CHECK(
cpuInterface_ != nullptr, "Failed to create CPU device interface");
cpuInterface_->initialize(avStream, avFormatCtx, codecContext);
cpuInterface_->initializeVideo(
VideoStreamOptions(),
{},
/*resizedOutputDims=*/std::nullopt);

CC: @NicolasHug @eromomon

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions