Function TVMBackendSetDevice#
Defined in File c_backend_api.h
Function Documentation#
-
int TVMBackendSetDevice(int device_type, int device_index)#
Select the runtime device for the calling host thread.
Dispatches to DeviceAPI::SetDevice with the given local DLPack device type and runtime device index (DLDevice::device_id). This does not save or restore the previous selection. Backends without device-selection state may treat selection as a no-op. Valid indices and index validation are backend-specific.
- Parameters:
device_type – Local DLPack device type, not an RPC session-encoded type.
device_index – Nonnegative runtime device index, not a device type or target configuration index.
- Returns:
0 on success, -1 on invalid arguments, unavailable backend, or backend failure. Failure records the raised TVM FFI error on the calling thread; no C++ exception crosses this C entry point.