Skip to main content

Module cost

Module cost 

Source
Expand description

Cross-backend cost interface.

Each backend implements BackendCostModel to expose its execution characteristics (kernel throughput, dispatch overhead, memory bw). The runtime can then estimate the cost of running a graph on each available backend and pick the fastest.

This is what enables “auto device” — given a graph, pick CPU or Metal automatically based on which is faster for THIS workload on THIS hardware.

Structs§

CpuCostModel
BackendCostModel impl backed by rlx_cpu::cost::HwModel.

Traits§

BackendCostModel
Hardware-aware cost characteristics for a backend on the current machine.

Functions§

estimate_graph_cost
Estimate forward-pass time (ns) for a graph on the given backend. Uses node-level cost contributions; conservative — actual time may be lower due to hardware parallelism we don’t model.
pick_best_device
Pick the device with the lowest predicted cost for this graph.