ptx_for_config

Function ptx_for_config 

Source
pub fn ptx_for_config(
    model_type: &str,
    hidden_size: usize,
    model_refs: &[&str],
    pinned_target: Option<&str>,
) -> Result<Option<TargetPtxSet>, TargetResolveError>
Expand description

Find the PTX module set matching a checkpoint.

Matching rules (full statement + rationale in this module):

  1. Exact match on (model_type, Some(hidden_size)) beats wildcard (model_type, None).
  2. When several differently-named targets declare the same pair (the configs of e.g. Qwen3.6-27B and Qwen3.8-27B are bit-identical), the tie is broken by matching each target’s declared match_names needles against model_refs (HF id, --model-name, resolved model dir) — and a tie that does not break to exactly one target is Err(TargetResolveError::Ambiguous), never a build-order pick.
  3. pinned_target (--kernel-target) bypasses the tie-break but must name a compiled target that declares the (model_type, hidden_size).
  4. Ok(None) if no compiled target declares the pair at all.