xnn.common.models.fast.AutoPolicy#

class xnn.common.models.fast.AutoPolicy(min_edges=<factory>, min_edges_float64=<factory>, default_min_edges=0, default_min_edges_float64=0)[source]#

Bases: object

When use_fast="auto" takes the fast path.

The fast kernels have a fixed per-call cost, so they lose on small inputs and win on large ones. The crossover is measured per GPU model and precision and stored as a minimum edge count of the neighbor graph; a GPU without a measured entry uses the default.

Parameters:
  • min_edges (dict of str to int) – float32 thresholds, keyed by a substring of the CUDA device name (matched case-insensitively, first match wins).

  • min_edges_float64 (dict of str to int) – The same for float64 (where the reference is slower, so the kernels win earlier).

  • default_min_edges (int) – The thresholds of a GPU in neither table.

  • default_min_edges_float64 (int) – The thresholds of a GPU in neither table.

threshold(device, dtype=torch.float32)[source]#

The minimum edge count for device and dtype.

Parameters:
Return type:

int

decide(device, dtype, num_edges)[source]#

Whether a graph with num_edges edges takes the fast path.

Parameters:
Return type:

bool