candding 0.1.0

Pure candle embeddings for Rust with no ONNX: dense, sparse, multi-vector and rerank models today, image models on the roadmap
Documentation
//! The CUDA column as `cuda.yml` run 37127370028, the full sweep, left it on a T4.

use super::cells::every_entry;
use super::*;

const RUN: &str = "run 37127370028";

/// The entries the sweep verified nothing for on CUDA: no F32 or F16 module of theirs passed, or none ran.
const T4_UNVERIFIED: [(&str, &str); 7] = [
  ("dense", "Qwen/Qwen3-Embedding-8B"),
  ("dense", "google/embeddinggemma-300m"),
  ("sparse", "naver/splade-code-06B"),
  ("multi-vector", "jinaai/jina-colbert-v2"),
  ("rerank", "Qwen/Qwen3-Reranker-4B"),
  ("rerank", "Qwen/Qwen3-Reranker-8B"),
  ("rerank", "jinaai/jina-reranker-v2-base-multilingual"),
];

/// The cell the sweep left untested in an entry it verified: F32 over the ceiling.
const T4_SKIPPED: [(&str, &str, DType); 1] = [("dense", "Qwen/Qwen3-Embedding-4B", DType::F32)];

/// The cells the sweep measured failing, which CUDA refuses: NaN vectors and a score over its ceiling.
const T4_FAILED: [(&str, &str, DType); 3] = [
  ("dense", "jinaai/jina-embeddings-v2-base-de", DType::F16),
  ("dense", "jinaai/jina-embeddings-v2-base-zh", DType::F16),
  ("rerank", "Qwen/Qwen3-Reranker-0.6B", DType::F16),
];

fn refused_everywhere(row: BackendSupport) -> bool {
  row.cpu == Support::Unsupported && row.metal == Support::Unsupported
}

#[test]
fn the_sweep_verifies_f32_and_f16_where_they_passed_and_leaves_bf16_untested() {
  let mut verified = 0;
  for (catalog, cells) in every_entry() {
    let no_axis = cells.backends.cuda == Support::NotApplicable;
    if no_axis || T4_UNVERIFIED.contains(&(catalog, cells.id)) {
      continue;
    }
    verified += 1;
    assert_eq!(
      cells.backends.cuda,
      Support::Verified,
      "{catalog} {}",
      cells.id
    );
    for (dtype, row) in [
      (DType::F32, cells.rows.f32),
      (DType::F16, cells.rows.f16),
      (DType::BF16, cells.rows.bf16),
    ] {
      let cell = (catalog, cells.id, dtype);
      let expected = if refused_everywhere(row) || T4_FAILED.contains(&cell) {
        Support::Unsupported
      } else if dtype == DType::BF16 || T4_SKIPPED.contains(&cell) {
        Support::Untested
      } else {
        Support::Verified
      };
      assert_eq!(row.cuda, expected, "{catalog} {} {dtype:?}", cells.id);
    }
  }
  assert_eq!(verified, 35 + 6 + 4 + 8 - T4_UNVERIFIED.len() - 1);
}

#[test]
fn every_entry_the_sweep_did_not_verify_reads_untested_on_cuda() {
  let mut others = 0;
  for (catalog, cells) in every_entry() {
    let no_axis = cells.backends.cuda == Support::NotApplicable;
    if !no_axis && !T4_UNVERIFIED.contains(&(catalog, cells.id)) {
      continue;
    }
    others += 1;
    assert!(
      no_axis || cells.backends.cuda == Support::Untested,
      "{catalog} {}",
      cells.id
    );
    for row in [cells.rows.f32, cells.rows.f16, cells.rows.bf16] {
      let expected = if no_axis {
        Support::NotApplicable
      } else if refused_everywhere(row) {
        Support::Unsupported
      } else {
        Support::Untested
      };
      assert_eq!(row.cuda, expected, "{catalog} {}: {row:?}", cells.id);
    }
  }
  assert_eq!(others, T4_UNVERIFIED.len() + 1);
}

#[test]
fn every_cuda_exception_names_the_sweep_and_why_its_cell_is_not_verified() {
  let mut found = 0;
  for (catalog, cells) in every_entry() {
    for exception in cells
      .exceptions
      .iter()
      .filter(|e| e.backend == Backend::Cuda)
    {
      found += 1;
      let (dtype, reason) = (exception.dtype, exception.reason);
      assert!(
        !T4_UNVERIFIED.contains(&(catalog, cells.id)),
        "{catalog} {}",
        cells.id
      );
      let failed = T4_FAILED.contains(&(catalog, cells.id, dtype));
      let status = match failed {
        true => Support::Unsupported,
        false => Support::Untested,
      };
      assert_eq!(exception.status, status, "{catalog} {} {dtype:?}", cells.id);
      assert!(reason.contains(RUN), "{reason}");
      let expected = match dtype {
        DType::BF16 => "sm_75",
        DType::F32 => "ceiling",
        _ => "F16",
      };
      assert!(
        reason.contains(expected),
        "{catalog} {} {dtype:?}: {reason}",
        cells.id
      );
      let skipped = T4_SKIPPED.contains(&(catalog, cells.id, dtype));
      assert_eq!(
        dtype == DType::BF16,
        !skipped && !failed,
        "{catalog} {} {dtype:?}",
        cells.id
      );
    }
  }
  // Splade's and bge-m3's multi-vector BF16 are refused everywhere, so neither takes the BF16 exception.
  assert_eq!(
    found,
    35 + 6 + 4 + 8 - T4_UNVERIFIED.len() - 1 - 2 + T4_SKIPPED.len() + T4_FAILED.len()
  );
}