You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PyModule::allocate_output_tensors in extension/pybindings/pybindings.cpp (the _load_for_executorch / Module path) backs every unplanned tensor output with std::vector<uint8_t>(nbytes) through make_tensor_ptr, whatever device the program tagged the output with.
So a program exported device resident (skip_d2h_for_method_outputs=True with alloc_graph_output=False) fails through this path the same way the Method path did before #23547:
The CUDA backend rejects the host buffer with InvalidArgument (0x12), because its cudaPointerGetAttributes check finds no CUDA allocation.
A delegate without that check writes into the host buffer. The CUDA tensor returned over it then fails to clone on a GPU that cannot read pageable host memory, with CUDA error: invalid argument and "Allocation not found" from cuMemcpyDtoDAsync_v2.
#23547 fixes the Method path (PyMethod::allocate_output_storages). This path needs the same choice, with one more requirement: make_tensor_ptr takes ownership of the host bytes, so a device buffer has to be owned by the tensor the same way, or the next call writes through a result the caller still holds.
Fixed by #23090, with follow-up work in #23957: the Module path now gives device-tagged unplanned outputs device memory, owned by the returned tensor. A device-resident CUDA program runs through _load_for_executorch and matches eager. Closing.
Activity
Give device-tagged method outputs device memory in the Python bindings (
shoumikhin commentedon Oct 26, 2026
Fixed by #23090, with follow-up work in #23957: the Module path now gives device-tagged unplanned outputs device memory, owned by the returned tensor. A device-resident CUDA program runs through
_load_for_executorchand matches eager. Closing.