{
  "schema": "aner.knn-workspace-evidence/1",
  "recorded_date": "2026-10-30",
  "native_source_commit": "32e34b92ef103156c9919212999b97b020e65aba",
  "measurement_kind": "workspace admission boundary verification, not RSS or peak allocation",
  "build": {
    "target": "macOS arm64",
    "compiler": "Apple clang version 21.0.0 (clang-2100.3.34.2)",
    "configuration": "Release",
    "flags": [
      "-std=c++20",
      "-O3",
      "-DNDEBUG",
      "-flto=thin",
      "-fno-fast-math",
      "-ffp-contract=off"
    ],
    "executable_sha256": "b9a3899718b4e39593e52f882131da7c05bb5fd0e5e46d33b0317fac8b85d53d"
  },
  "abi": {
    "double_bytes": 8,
    "size_t_bytes": 8,
    "neighbor_bytes": 16,
    "lane_control_bytes": 136,
    "fixed_control_bytes": 344
  },
  "formula": "344 + 8*Q + P*(136 + 16*N + 8*C + (distance ? 24*C : 0)); P=1 for serial, else min(workers,Q)",
  "default_workspace_budget_bytes": 67108864,
  "method": [
    "The public C++ predict API is called with the formula budget minus one byte; it must reject the workspace budget before dispatch.",
    "The same predict call must succeed at the exact formula budget and match serial label bits. This confirms charged workspace admission for these fixtures and this ABI.",
    "Probabilities, neighbor indices and neighbor distances are additionally compared bitwise with serial at the default budget; those readouts are not covered by the prediction-byte table.",
    "The deterministic SplitMix64 fixture uses the timing workloads shapes and five classes, with a duplicate fitted row and an exact-match query added. This probe does not collect prediction timings."
  ],
  "excluded": [
    "fitted model data",
    "input and host caches",
    "Tensor leaf metadata",
    "executor internals",
    "observer/context snapshot variable payloads",
    "thread stacks",
    "allocator overhead",
    "process RSS"
  ],
  "retained_model": {
    "vector_capacity_formula": "8*N*D + 16*N; same for original and updated implementations on the recorded build",
    "original_inline_state_bytes": 96,
    "updated_inline_state_bytes": 104,
    "weighting_flag_inline_increase_bytes": 8,
    "rows": [
      {
        "n": 2048,
        "d": 16,
        "vector_capacity_bytes": 294912
      },
      {
        "n": 4096,
        "d": 64,
        "vector_capacity_bytes": 2162688
      }
    ]
  },
  "serial_uniform_prediction_payload": {
    "formula": "8*Q + 16*N + 8*C",
    "same_original_and_updated": true,
    "note": "Numerical buffer payload only. The original implementation has no matching charged-workspace admission total."
  },
  "scope": [
    "Prediction admission boundaries only; no peak allocated-memory or RSS measurement.",
    "The admitted controls and vector capacities are an algorithm budget, not a complete process-memory total.",
    "Private scratch scales with active lanes; fitted model and query buffers are shared by workers.",
    "Bitwise agreement is checked within each weighting mode in the same binary and floating-point environment. Uniform and distance policies need not predict the same class."
  ],
  "artifacts": [
    {
      "path": "public/reference/tools/knn_workspace_probe.cpp",
      "sha256": "c2d12759856e216f7e2f327f51713c8a2936a25503f1384fc60fd21c702f3044"
    }
  ],
  "sources": {
    "src/ml.cpp": {
      "sha256": "12f9ef7d5175f0d3c29c7aa1c6b814980541d00c4bd3b322e88931ddc12b0e64"
    },
    "include/aner/ml.hpp": {
      "sha256": "f6340833c00df9da7f60d5f73418f7c74ac5f3ec6f9fe9dbdf5f91c4d35f4cdc"
    },
    "include/aner/parallel_jobs.hpp": {
      "sha256": "54253bab3bce3e1ed79303715bd16d76ee72dfb09487062b970d51b51c089cd7"
    }
  },
  "records": [
    {
      "workload": "batch",
      "n": 2048,
      "q": 256,
      "d": 16,
      "k": 5,
      "c": 5,
      "weights": "uniform",
      "operation": "predict",
      "execution": "serial",
      "workers_requested": 0,
      "active_lanes": 1,
      "charged_workspace_bytes": 35336,
      "one_byte_below_rejected": true,
      "at_budget_accepted": true,
      "bitwise_serial_equal": true,
      "bitwise_readouts": [
        "labels",
        "probabilities",
        "neighbor_indices",
        "neighbor_distances"
      ]
    },
    {
      "workload": "batch",
      "n": 2048,
      "q": 256,
      "d": 16,
      "k": 5,
      "c": 5,
      "weights": "uniform",
      "operation": "predict",
      "execution": "context",
      "workers_requested": 1,
      "active_lanes": 1,
      "charged_workspace_bytes": 35336,
      "one_byte_below_rejected": true,
      "at_budget_accepted": true,
      "bitwise_serial_equal": true,
      "bitwise_readouts": [
        "labels",
        "probabilities",
        "neighbor_indices",
        "neighbor_distances"
      ]
    },
    {
      "workload": "batch",
      "n": 2048,
      "q": 256,
      "d": 16,
      "k": 5,
      "c": 5,
      "weights": "uniform",
      "operation": "predict",
      "execution": "context",
      "workers_requested": 2,
      "active_lanes": 2,
      "charged_workspace_bytes": 68280,
      "one_byte_below_rejected": true,
      "at_budget_accepted": true,
      "bitwise_serial_equal": true,
      "bitwise_readouts": [
        "labels",
        "probabilities",
        "neighbor_indices",
        "neighbor_distances"
      ]
    },
    {
      "workload": "batch",
      "n": 2048,
      "q": 256,
      "d": 16,
      "k": 5,
      "c": 5,
      "weights": "uniform",
      "operation": "predict",
      "execution": "context",
      "workers_requested": 4,
      "active_lanes": 4,
      "charged_workspace_bytes": 134168,
      "one_byte_below_rejected": true,
      "at_budget_accepted": true,
      "bitwise_serial_equal": true,
      "bitwise_readouts": [
        "labels",
        "probabilities",
        "neighbor_indices",
        "neighbor_distances"
      ]
    },
    {
      "workload": "batch",
      "n": 2048,
      "q": 256,
      "d": 16,
      "k": 5,
      "c": 5,
      "weights": "distance",
      "operation": "predict",
      "execution": "serial",
      "workers_requested": 0,
      "active_lanes": 1,
      "charged_workspace_bytes": 35456,
      "one_byte_below_rejected": true,
      "at_budget_accepted": true,
      "bitwise_serial_equal": true,
      "bitwise_readouts": [
        "labels",
        "probabilities",
        "neighbor_indices",
        "neighbor_distances"
      ]
    },
    {
      "workload": "batch",
      "n": 2048,
      "q": 256,
      "d": 16,
      "k": 5,
      "c": 5,
      "weights": "distance",
      "operation": "predict",
      "execution": "context",
      "workers_requested": 1,
      "active_lanes": 1,
      "charged_workspace_bytes": 35456,
      "one_byte_below_rejected": true,
      "at_budget_accepted": true,
      "bitwise_serial_equal": true,
      "bitwise_readouts": [
        "labels",
        "probabilities",
        "neighbor_indices",
        "neighbor_distances"
      ]
    },
    {
      "workload": "batch",
      "n": 2048,
      "q": 256,
      "d": 16,
      "k": 5,
      "c": 5,
      "weights": "distance",
      "operation": "predict",
      "execution": "context",
      "workers_requested": 2,
      "active_lanes": 2,
      "charged_workspace_bytes": 68520,
      "one_byte_below_rejected": true,
      "at_budget_accepted": true,
      "bitwise_serial_equal": true,
      "bitwise_readouts": [
        "labels",
        "probabilities",
        "neighbor_indices",
        "neighbor_distances"
      ]
    },
    {
      "workload": "batch",
      "n": 2048,
      "q": 256,
      "d": 16,
      "k": 5,
      "c": 5,
      "weights": "distance",
      "operation": "predict",
      "execution": "context",
      "workers_requested": 4,
      "active_lanes": 4,
      "charged_workspace_bytes": 134648,
      "one_byte_below_rejected": true,
      "at_budget_accepted": true,
      "bitwise_serial_equal": true,
      "bitwise_readouts": [
        "labels",
        "probabilities",
        "neighbor_indices",
        "neighbor_distances"
      ]
    },
    {
      "workload": "wide",
      "n": 4096,
      "q": 64,
      "d": 64,
      "k": 5,
      "c": 5,
      "weights": "uniform",
      "operation": "predict",
      "execution": "serial",
      "workers_requested": 0,
      "active_lanes": 1,
      "charged_workspace_bytes": 66568,
      "one_byte_below_rejected": true,
      "at_budget_accepted": true,
      "bitwise_serial_equal": true,
      "bitwise_readouts": [
        "labels",
        "probabilities",
        "neighbor_indices",
        "neighbor_distances"
      ]
    },
    {
      "workload": "wide",
      "n": 4096,
      "q": 64,
      "d": 64,
      "k": 5,
      "c": 5,
      "weights": "uniform",
      "operation": "predict",
      "execution": "context",
      "workers_requested": 1,
      "active_lanes": 1,
      "charged_workspace_bytes": 66568,
      "one_byte_below_rejected": true,
      "at_budget_accepted": true,
      "bitwise_serial_equal": true,
      "bitwise_readouts": [
        "labels",
        "probabilities",
        "neighbor_indices",
        "neighbor_distances"
      ]
    },
    {
      "workload": "wide",
      "n": 4096,
      "q": 64,
      "d": 64,
      "k": 5,
      "c": 5,
      "weights": "uniform",
      "operation": "predict",
      "execution": "context",
      "workers_requested": 2,
      "active_lanes": 2,
      "charged_workspace_bytes": 132280,
      "one_byte_below_rejected": true,
      "at_budget_accepted": true,
      "bitwise_serial_equal": true,
      "bitwise_readouts": [
        "labels",
        "probabilities",
        "neighbor_indices",
        "neighbor_distances"
      ]
    },
    {
      "workload": "wide",
      "n": 4096,
      "q": 64,
      "d": 64,
      "k": 5,
      "c": 5,
      "weights": "uniform",
      "operation": "predict",
      "execution": "context",
      "workers_requested": 4,
      "active_lanes": 4,
      "charged_workspace_bytes": 263704,
      "one_byte_below_rejected": true,
      "at_budget_accepted": true,
      "bitwise_serial_equal": true,
      "bitwise_readouts": [
        "labels",
        "probabilities",
        "neighbor_indices",
        "neighbor_distances"
      ]
    },
    {
      "workload": "wide",
      "n": 4096,
      "q": 64,
      "d": 64,
      "k": 5,
      "c": 5,
      "weights": "distance",
      "operation": "predict",
      "execution": "serial",
      "workers_requested": 0,
      "active_lanes": 1,
      "charged_workspace_bytes": 66688,
      "one_byte_below_rejected": true,
      "at_budget_accepted": true,
      "bitwise_serial_equal": true,
      "bitwise_readouts": [
        "labels",
        "probabilities",
        "neighbor_indices",
        "neighbor_distances"
      ]
    },
    {
      "workload": "wide",
      "n": 4096,
      "q": 64,
      "d": 64,
      "k": 5,
      "c": 5,
      "weights": "distance",
      "operation": "predict",
      "execution": "context",
      "workers_requested": 1,
      "active_lanes": 1,
      "charged_workspace_bytes": 66688,
      "one_byte_below_rejected": true,
      "at_budget_accepted": true,
      "bitwise_serial_equal": true,
      "bitwise_readouts": [
        "labels",
        "probabilities",
        "neighbor_indices",
        "neighbor_distances"
      ]
    },
    {
      "workload": "wide",
      "n": 4096,
      "q": 64,
      "d": 64,
      "k": 5,
      "c": 5,
      "weights": "distance",
      "operation": "predict",
      "execution": "context",
      "workers_requested": 2,
      "active_lanes": 2,
      "charged_workspace_bytes": 132520,
      "one_byte_below_rejected": true,
      "at_budget_accepted": true,
      "bitwise_serial_equal": true,
      "bitwise_readouts": [
        "labels",
        "probabilities",
        "neighbor_indices",
        "neighbor_distances"
      ]
    },
    {
      "workload": "wide",
      "n": 4096,
      "q": 64,
      "d": 64,
      "k": 5,
      "c": 5,
      "weights": "distance",
      "operation": "predict",
      "execution": "context",
      "workers_requested": 4,
      "active_lanes": 4,
      "charged_workspace_bytes": 264184,
      "one_byte_below_rejected": true,
      "at_budget_accepted": true,
      "bitwise_serial_equal": true,
      "bitwise_readouts": [
        "labels",
        "probabilities",
        "neighbor_indices",
        "neighbor_distances"
      ]
    }
  ]
}
