Skip to main content

resolve_target_backend

Function resolve_target_backend 

Source
pub fn resolve_target_backend(
    registry: &CapabilityRegistry,
    op: OpKind,
    dtype: DType,
) -> Result<BackendId>
Expand description

Resolve which backend should handle (op, dtype) given the registry of available backends. Returns the chosen BackendId or Error::NoBackendForOp with diagnostic data on miss.

The chosen backend is the first registered backend that supports (op, dtype). Convention: register GPU before CPU so GPU wins ties; the universal CPU fallback is picked iff no GPU registered.

Phase 7.5 B3 — used by op-builder methods to populate Graph::target_backends at DAG construction time. After the full migration, every Node has a target_backend set this way.