{
  "$schema": "../../config/schema/policy/capability-transform-policy.schema.json",
  "schemaVersion": 1,
  "source": "doppler",
  "capabilityTransforms": [
    {
      "kind": "explicit-lane",
      "dtypeEffect": "widen-to-f32",
      "match": {
        "modelId": "qwen-3-8-flash-next-text-q4k-ehf16-af32",
        "kvDtype": "f32",
        "hasF16": true
      },
      "transforms": [
        "widenAttentionKvToF32"
      ],
      "reason": "Explicit Flash-Next F32 KV candidate preserves Q4K experts, F16 stored weights and existing F32 projection arithmetic; only attention-cache readers widen. No qualification of the F16 KV lane is implied.",
      "evidence": [
        "tests/integration/flash-next-f32kv-policy.test.js",
        "tests/kernels/indexed-attention-gpu.test.js"
      ]
    },
    {
      "kind": "lane-mismatch-guard",
      "dtypeEffect": "fail-closed",
      "match": {
        "modelId": "gemma-4-e2b-it-q4k-ehf16-af16-int4ple",
        "platformVendor": "apple"
      },
      "transforms": [
        "failClosedLaneMismatch"
      ],
      "reason": "af16-int4ple lane requires retainQ4KMaterialization=true to dispatch the fused-q4k+f16 widetile pool, which produces intermittent NaN at L1.attn_core_out on Apple Metal - load the af32 manifest variant instead. Bug is intermittent and depends on buffer-pool aliasing patterns; confirmed re-emerged 2026-05-07 after e5c9a6a tightened bucket defaults.",
      "evidence": [
        "tests/demo/demo-models.test.js",
        "tests/inference/gemma4-e2b-q4k-apple-retain-regression.test.js"
      ]
    },
    {
      "kind": "platform-workaround",
      "dtypeEffect": "none",
      "match": {
        "modelId": {
          "in": [
            "gemma-4-e2b-it-q4k-ehf16-af32",
            "gemma-4-e2b-it-q4k-ehf16-af32-int4ple",
            "gemma-4-e2b-it-q4k-ehf16-af16-int4ple"
          ]
        },
        "platformVendor": "apple",
        "retainQ4KMaterialization": true
      },
      "transforms": [
        "disableRetainQ4KMaterialization"
      ],
      "reason": "Fused-q4k FFN kernels under retain=mixed corrupt subsequent-layer attention compute on Apple Metal (intermittent NaN at L1.attn_core_out and beyond). Standalone-q4k projection kernels are clean; only the fused gate+up+down dispatch is the perturbation source.",
      "evidence": [
        "tests/config/capability-retain-q4k-policy.test.js",
        "tests/config/gemma4-e2b-conversion-config-contract.test.js",
        "tests/inference/gemma4-e2b-q4k-apple-retain-regression.test.js"
      ]
    },
    {
      "kind": "explicit-lane",
      "dtypeEffect": "selective-f16",
      "match": {
        "modelId": {
          "in": [
            "qwen-3-5-0-8b-q4k-ehaf16",
            "qwen-3-5-2b-q4k-ehaf16"
          ]
        },
        "requestedActivationDtype": "f16",
        "hasSubgroups": true,
        "hasF16": true
      },
      "transforms": [
        "useQwenF16PrimaryMatmuls"
      ],
      "reason": "Runtime explicitly requested the selective f16 probe lane for Qwen 3.5 small execution-v1 Q4K models with the shared linear/full attention graph. Promotion remains device- and evidence-specific.",
      "evidence": [
        "tests/integration/qwen-execution-v1-linear-decode-f16.test.js",
        "tests/integration/execution-graph-transforms.test.js"
      ]
    },
    {
      "kind": "explicit-lane",
      "dtypeEffect": "narrow-to-f16",
      "match": {
        "modelId": "qwen-3-6-27b-q4k-eaf16",
        "activationDtype": "f16",
        "mathDtype": "f16",
        "accumDtype": "f16",
        "hasSubgroups": true,
        "hasF16": true
      },
      "transforms": [
        "useQwen36F16Activations"
      ],
      "reason": "Runtime requested the experimental all-f16 lane for Qwen 3.6 27B.",
      "evidence": [
        "tests/config/qwen36-f16-variant-identity.test.js",
        "tests/integration/execution-graph-transforms.test.js"
      ]
    },
    {
      "kind": "explicit-lane",
      "dtypeEffect": "selective-f16",
      "match": {
        "modelId": "gemma-4-e2b-it-q4k-ehf16-af32-int4ple",
        "requestedActivationDtype": "f16",
        "hasSubgroups": true,
        "hasF16": true
      },
      "transforms": [
        "useGemma4Int4PleSelectiveF16Decode"
      ],
      "reason": "Runtime requested the experimental selective f16 decode lane for Gemma 4 E2B INT4 PLE.",
      "evidence": [
        "docs/perf-investigations/gemma-4-int4ple-loop.md",
        "tests/config/gemma4-e2b-conversion-config-contract.test.js"
      ]
    },
    {
      "kind": "explicit-lane",
      "dtypeEffect": "narrow-to-f16",
      "match": {
        "modelId": "gemma-4-12b-it-text-q4k-ehf16-af16",
        "activationDtype": "f16",
        "mathDtype": "f16",
        "accumDtype": "f16",
        "hasSubgroups": true,
        "hasF16": true
      },
      "transforms": [
        "useGemma412BTextF16Activations"
      ],
      "reason": "af16 manifest variant on shader-f16 GPU - dispatch the Gemma 4 12B text f16-residual lane with stable f32-Q/f16-KV prefill/decode attention boundaries and stable post-layer tail.",
      "evidence": [
        "tests/integration/gemma4-12b-f16-activations.test.js",
        "tests/integration/execution-graph-transforms.test.js"
      ]
    },
    {
      "kind": "lane-mismatch-guard",
      "dtypeEffect": "fail-closed",
      "match": {
        "modelId": "gemma-4-12b-it-text-q4k-ehf16-af32",
        "activationDtype": "f16",
        "mathDtype": "f16",
        "accumDtype": "f16",
        "hasSubgroups": true,
        "hasF16": true
      },
      "transforms": [
        "failClosedLaneMismatch"
      ],
      "reason": "af32 manifest cannot dispatch f16 activations - load the af16 manifest variant or pick an f32 runtime profile.",
      "evidence": [
        "tests/integration/gemma4-12b-f16-activations.test.js",
        "tests/integration/execution-graph-transforms.test.js"
      ]
    },
    {
      "kind": "explicit-lane",
      "dtypeEffect": "narrow-to-f16",
      "match": {
        "modelId": "gemma-4-31b-it-text-q4k-ehf16-af16",
        "activationDtype": "f16",
        "mathDtype": "f16",
        "accumDtype": "f16",
        "hasSubgroups": true,
        "hasF16": true
      },
      "transforms": [
        "useGemma431BTextF16Activations"
      ],
      "reason": "af16 manifest variant on shader-f16 GPU - dispatch the all-f16 lane.",
      "evidence": [
        "tests/integration/gemma4-31b-f16-activations.test.js",
        "tests/integration/execution-graph-transforms.test.js"
      ]
    },
    {
      "kind": "explicit-lane",
      "dtypeEffect": "narrow-to-f16",
      "match": {
        "modelId": "gemma-4-e2b-it-q4k-ehf16-af16-int4ple",
        "activationDtype": "f16",
        "mathDtype": "f16",
        "accumDtype": "f16",
        "hasSubgroups": true,
        "hasF16": true
      },
      "transforms": [
        "useGemma4Int4PleAf16Activations"
      ],
      "reason": "af16-int4ple manifest variant on shader-f16 GPU - dispatch the all-f16 lane (q4_widetile_f16a + decode multicol_f16a + lm_head_gemv_subgroup_f16a).",
      "evidence": [
        "tests/config/gemma4-e2b-int4ple-f16-variant-identity.test.js",
        "tests/inference/gemma4-e2b-q4k-apple-retain-regression.test.js"
      ]
    },
    {
      "kind": "lane-mismatch-guard",
      "dtypeEffect": "fail-closed",
      "match": {
        "modelId": "gemma-4-31b-it-text-q4k-ehf16-af32",
        "activationDtype": "f16",
        "mathDtype": "f16",
        "accumDtype": "f16",
        "hasSubgroups": true,
        "hasF16": true
      },
      "transforms": [
        "failClosedLaneMismatch"
      ],
      "reason": "af32 manifest cannot dispatch f16 activations - load the af16 manifest variant or pick an f32 runtime profile.",
      "evidence": [
        "tests/integration/gemma4-31b-f16-activations.test.js",
        "tests/integration/execution-graph-transforms.test.js"
      ]
    },
    {
      "kind": "capability-optimization",
      "dtypeEffect": "none",
      "match": {
        "modelId": {
          "in": [
            "gemma-4-e2b-it-q4k-ehf16-af32",
            "gemma-4-e2b-it-q4k-ehf16-af32-int4ple",
            "gemma-4-e2b-it-q4k-ehf16-af16-int4ple"
          ]
        },
        "activationDtype": "f32",
        "headDim": 256,
        "kvDtype": "f16",
        "hasF16": true,
        "maxWorkgroupStorageSize": {
          "gte": 16384
        }
      },
      "transforms": [
        "useHead256SmallPrefillAttention"
      ],
      "reason": "Gemma 4 E2B promotes only small-tile prefill attention onto the head256 kernel on capable GPUs.",
      "evidence": [
        "tests/config/gemma4-e2b-conversion-config-contract.test.js",
        "tests/integration/execution-graph-transforms.test.js"
      ]
    },
    {
      "kind": "explicit-lane",
      "dtypeEffect": "narrow-to-f16",
      "match": {
        "activationDtype": "f16",
        "hasSubgroups": false,
        "hasF16": true,
        "requiresF16ActivationNarrowing": true
      },
      "transforms": [
        "narrowToF16Activations",
        "removeSubgroups"
      ],
      "reason": "Runtime requested f16 activations on a non-subgroup shader-f16 GPU.",
      "evidence": [
        "tests/integration/execution-graph-transforms.test.js",
        "tests/integration/execution-v1-capability-policy.test.js"
      ]
    },
    {
      "kind": "explicit-lane",
      "dtypeEffect": "narrow-to-f16",
      "match": {
        "activationDtype": "f16",
        "hasSubgroups": true,
        "hasF16": true,
        "requiresF16ActivationNarrowing": true
      },
      "transforms": [
        "narrowToF16Activations"
      ],
      "reason": "Runtime requested f16 activations on a shader-f16 GPU.",
      "evidence": [
        "tests/integration/execution-graph-transforms.test.js",
        "tests/integration/execution-v1-capability-policy.test.js"
      ]
    },
    {
      "kind": "runtime-session-compatibility",
      "dtypeEffect": "full-f32",
      "match": {
        "kvDtype": "f32",
        "hasSubgroups": false,
        "hasF16": true
      },
      "transforms": [
        "removeSubgroups",
        "widenToF32CorrectnessFallback"
      ],
      "reason": "Runtime KV cache resolved f32 on a non-subgroup shader-f16 GPU.",
      "evidence": [
        "tests/integration/execution-v1-capability-policy.test.js"
      ]
    },
    {
      "kind": "runtime-session-compatibility",
      "dtypeEffect": "full-f32",
      "match": {
        "kvDtype": "f32",
        "hasSubgroups": true,
        "hasF16": true
      },
      "transforms": [
        "widenToF32CorrectnessFallback"
      ],
      "reason": "Runtime KV cache resolved f32; online subgroup attention retains its topology with f32 KV storage.",
      "evidence": [
        "tests/integration/attention-f32kv-online-policy.test.js",
        "tests/inference/attention-f32kv-online-gpu-regression.test.js",
        "tests/integration/execution-v1-capability-policy.test.js"
      ]
    },
    {
      "kind": "hardware-compatibility",
      "dtypeEffect": "full-f32",
      "match": {
        "hasSubgroups": false,
        "hasF16": false
      },
      "transforms": [
        "removeSubgroups",
        "widenToF32Activations"
      ],
      "reason": "GPU lacks subgroups and shader-f16.",
      "evidence": [
        "tests/integration/execution-v1-capability-policy.test.js"
      ]
    },
    {
      "kind": "hardware-compatibility",
      "dtypeEffect": "none",
      "match": {
        "hasSubgroups": false,
        "hasF16": true
      },
      "transforms": [
        "removeSubgroups"
      ],
      "reason": "GPU lacks subgroups.",
      "evidence": [
        "tests/integration/execution-v1-capability-policy.test.js"
      ]
    },
    {
      "kind": "hardware-compatibility",
      "dtypeEffect": "full-f32",
      "match": {
        "hasSubgroups": true,
        "hasF16": false
      },
      "transforms": [
        "widenToF32Activations"
      ],
      "reason": "GPU lacks shader-f16.",
      "evidence": [
        "tests/integration/execution-v1-capability-policy.test.js"
      ]
    },
    {
      "kind": "default-noop",
      "dtypeEffect": "none",
      "match": {},
      "transforms": [],
      "reason": "GPU supports all required features.",
      "evidence": []
    }
  ]
}
