{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/VMAFx/vmafx/docs/hardware-reports/report.schema.json",
  "title": "VMAFx tester report, schema versions 1 to 3",
  "description": "Written by vmaf-tester-report (tools/rc1-tester/src/vmaf_rc1_tester/hw_report.py). Checked by scripts/ci/check-hardware-reports.py.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "tool",
    "generated_utc",
    "image",
    "host",
    "dispatch_equivalence",
    "reference_equivalence",
    "metal_equivalence",
    "unit_tests",
    "golden_gate",
    "not_exercised",
    "verdict",
    "failed_checks",
    "note",
    "report_sha256"
  ],
  "properties": {
    "schema_version": {
      "enum": [
        "1",
        "2",
        "3"
      ],
      "description": "2 adds metal_gate, metal_rows and per-case unit verdicts (ADR-1496); 3 adds the backend-neutral gpu section and per-test results (the Intel GPU image); older reports stay valid."
    },
    "tool": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "version"
      ],
      "properties": {
        "name": {
          "const": "vmaf-tester-report"
        },
        "version": {
          "type": "string"
        }
      }
    },
    "generated_utc": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "image": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "source_commit",
        "source_ref",
        "built_by_workflow",
        "image_arch",
        "compiler",
        "libc",
        "base_image",
        "tag",
        "digest",
        "vmaf_version",
        "vmaf_sha256",
        "libvmaf_sha256",
        "files_match_build",
        "python",
        "recipe_commit"
      ],
      "properties": {
        "kind": {
          "enum": [
            "container-image",
            "macos-bundle",
            "windows-zip"
          ]
        },
        "source_commit": {
          "type": "string"
        },
        "source_ref": {
          "type": "string"
        },
        "built_by_workflow": {
          "type": "boolean"
        },
        "image_arch": {
          "type": "string"
        },
        "compiler": {
          "type": "string"
        },
        "libc": {
          "type": "string"
        },
        "base_image": {
          "type": "string"
        },
        "tag": {
          "type": "string"
        },
        "digest": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^sha256:[0-9a-f]{64}$"
        },
        "vmaf_version": {
          "type": "string"
        },
        "vmaf_sha256": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^[0-9a-f]{64}$"
        },
        "libvmaf_sha256": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^[0-9a-f]{64}$"
        },
        "files_match_build": {
          "type": "boolean"
        },
        "python": {
          "type": "string"
        },
        "recipe_commit": {
          "type": "string"
        },
        "gpu_backend": {
          "type": [
            "string",
            "null"
          ],
          "description": "The GPU backend the package's build carries (sycl, cuda or hip), null for a CPU build."
        }
      }
    },
    "host": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "platform",
        "machine",
        "kernel_release",
        "in_container",
        "cpu_model",
        "cpuinfo",
        "cpu_features",
        "hwcap",
        "hwcap2",
        "sve_in_hwcap",
        "dispatch_flags",
        "dispatch_flags_source",
        "logical_cores"
      ],
      "properties": {
        "platform": {
          "enum": [
            "linux",
            "darwin",
            "windows"
          ]
        },
        "machine": {
          "type": "string"
        },
        "kernel_release": {
          "type": "string"
        },
        "in_container": {
          "type": "boolean"
        },
        "cpu_model": {
          "type": "string"
        },
        "cpuinfo": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "cpu_features": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "hwcap": {
          "type": [
            "integer",
            "null"
          ]
        },
        "hwcap2": {
          "type": [
            "integer",
            "null"
          ]
        },
        "sve_in_hwcap": {
          "type": "boolean"
        },
        "dispatch_flags": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "dispatch_flags_source": {
          "type": "string"
        },
        "logical_cores": {
          "type": [
            "integer",
            "null"
          ]
        },
        "os_version": {
          "type": [
            "string",
            "null"
          ]
        },
        "hw_model": {
          "type": [
            "string",
            "null"
          ]
        },
        "metal_device": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "dispatch_equivalence": {
      "$ref": "#/$defs/fixtureSection"
    },
    "reference_equivalence": {
      "type": "object",
      "required": [
        "status"
      ],
      "properties": {
        "status": {
          "enum": [
            "identical",
            "differing",
            "missing",
            "error",
            "not_run"
          ]
        },
        "own_arch_scalar": {
          "$ref": "#/$defs/referenceCell"
        },
        "own_arch_default": {
          "$ref": "#/$defs/referenceCell"
        },
        "cross_arch_x86_scalar": {
          "$ref": "#/$defs/referenceCell"
        }
      },
      "additionalProperties": false
    },
    "metal_equivalence": {
      "$ref": "#/$defs/fixtureSection",
      "description": "Metal twins against the CPU (macOS bundle); no_device when the host exposes no Metal device."
    },
    "unit_tests": {
      "$ref": "#/$defs/suite"
    },
    "golden_gate": {
      "$ref": "#/$defs/suite"
    },
    "not_exercised": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "item",
          "reason"
        ],
        "properties": {
          "item": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          }
        }
      }
    },
    "verdict": {
      "enum": [
        "pass",
        "fail",
        "incomplete"
      ]
    },
    "failed_checks": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "note": {
      "type": "string",
      "maxLength": 500
    },
    "report_sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "metal_gate": {
      "$ref": "#/$defs/gateSection",
      "description": "The parity gate's Metal cells, CPU against Metal held exact, on every fixture (macOS bundle, ADR-1496)."
    },
    "metal_rows": {
      "$ref": "#/$defs/rowsSection",
      "description": "Per Metal state row of docs/state.md, the measurements of this run that close it (ADR-1496)."
    },
    "gpu": {
      "type": "object",
      "required": [
        "status"
      ],
      "additionalProperties": false,
      "description": "One GPU backend measured on every device it finds (hw_gpu.py): twins against the CPU, the parity gate, device tests, audits, state rows.",
      "properties": {
        "status": {
          "enum": [
            "pass",
            "fail",
            "error",
            "no_device",
            "not_applicable",
            "not_run"
          ]
        },
        "reason": {
          "type": "string"
        },
        "backend": {
          "type": "string"
        },
        "access": {
          "type": "object",
          "description": "How the container reaches the GPU; path names the route a run took (sycl: drm, wsl or none; cuda: nvidia, wsl or none; hip: kfd or none).",
          "required": [
            "path"
          ],
          "properties": {
            "path": {
              "type": "string"
            }
          }
        },
        "runtime": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "devices": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/gpuDevice"
          }
        }
      }
    }
  },
  "$defs": {
    "cell": {
      "type": "object",
      "required": [
        "fixture"
      ],
      "properties": {
        "fixture": {
          "type": "string"
        },
        "error": {
          "type": "string"
        },
        "metrics": {
          "type": "integer",
          "minimum": 0
        },
        "values": {
          "type": "integer",
          "minimum": 0
        },
        "differing_values": {
          "type": "integer",
          "minimum": 0
        },
        "differing_metrics": {
          "type": "integer",
          "minimum": 0
        },
        "details_truncated": {
          "type": "integer",
          "minimum": 0
        },
        "details": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "metric",
              "differing_values",
              "first_frame",
              "left",
              "right"
            ],
            "properties": {
              "metric": {
                "type": "string"
              },
              "differing_values": {
                "type": "integer",
                "minimum": 0
              },
              "first_frame": {
                "type": "integer",
                "minimum": 0
              },
              "left": {
                "type": "string"
              },
              "right": {
                "type": "string"
              },
              "max_abs_diff": {
                "type": "string"
              }
            }
          }
        },
        "extractors_on_metal": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "extractors_on_cpu": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "extractors_on_device": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false
    },
    "fixtureSection": {
      "type": "object",
      "required": [
        "status"
      ],
      "properties": {
        "status": {
          "enum": [
            "identical",
            "differing",
            "error",
            "no_device",
            "not_applicable",
            "not_run"
          ]
        },
        "fixtures": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/cell"
          }
        }
      },
      "additionalProperties": false
    },
    "referenceCell": {
      "type": "object",
      "required": [
        "file",
        "status",
        "gating",
        "fixtures"
      ],
      "properties": {
        "file": {
          "type": "string"
        },
        "status": {
          "enum": [
            "identical",
            "differing",
            "missing",
            "error"
          ]
        },
        "gating": {
          "type": "boolean"
        },
        "comparable": {
          "type": "boolean"
        },
        "generated_with_flags": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "fixtures": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/cell"
          }
        }
      },
      "additionalProperties": false
    },
    "suite": {
      "type": "object",
      "required": [
        "status",
        "total",
        "passed",
        "failed",
        "skipped",
        "failures"
      ],
      "properties": {
        "status": {
          "enum": [
            "pass",
            "fail",
            "not_run",
            "not_applicable"
          ]
        },
        "reason": {
          "type": [
            "string",
            "null"
          ]
        },
        "total": {
          "type": "integer",
          "minimum": 0
        },
        "passed": {
          "type": "integer",
          "minimum": 0
        },
        "failed": {
          "type": "integer",
          "minimum": 0
        },
        "skipped": {
          "type": "integer",
          "minimum": 0
        },
        "failures": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "cases": {
          "type": "object",
          "description": "Per test executable that prints @case lines, the verdict of each case (ADR-1496).",
          "additionalProperties": {
            "type": "object",
            "additionalProperties": {
              "enum": [
                "pass",
                "fail",
                "skip"
              ]
            }
          }
        },
        "case_messages": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 300
            }
          }
        },
        "results": {
          "type": "object",
          "description": "Verdict of every test executable that ran.",
          "additionalProperties": {
            "enum": [
              "pass",
              "fail",
              "skip"
            ]
          }
        },
        "skipped_tests": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "left_out": {
          "type": "array",
          "description": "Tests of the listed suites the package cannot run, with the reason.",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "name",
              "reason"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            }
          }
        }
      },
      "additionalProperties": false
    },
    "gateFixture": {
      "type": "object",
      "required": [
        "fixture"
      ],
      "additionalProperties": false,
      "properties": {
        "fixture": {
          "type": "string"
        },
        "error": {
          "type": "string"
        },
        "exit_code": {
          "type": "integer"
        },
        "left_out": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "feature",
              "reason"
            ],
            "properties": {
              "feature": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            }
          }
        },
        "cells": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "feature",
              "status",
              "tolerance",
              "tolerance_source",
              "frames",
              "max_abs_diff",
              "mismatches",
              "note"
            ],
            "properties": {
              "feature": {
                "type": "string"
              },
              "status": {
                "enum": [
                  "OK",
                  "FAIL",
                  "ERROR",
                  "SKIP"
                ]
              },
              "tolerance": {
                "type": "string"
              },
              "tolerance_source": {
                "type": "string"
              },
              "frames": {
                "type": "integer",
                "minimum": 0
              },
              "max_abs_diff": {
                "type": "string"
              },
              "mismatches": {
                "type": "integer",
                "minimum": 0
              },
              "note": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "rowVerdict": {
      "type": "object",
      "required": [
        "id",
        "verdict",
        "evidence"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^T-[A-Z0-9-]+$"
        },
        "verdict": {
          "enum": [
            "pass",
            "fail",
            "not_measured",
            "not_applicable"
          ]
        },
        "device_free": {
          "type": "string"
        },
        "evidence": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "kind",
              "result"
            ],
            "properties": {
              "kind": {
                "enum": [
                  "case",
                  "metric",
                  "gate",
                  "test",
                  "audit"
                ]
              },
              "result": {
                "enum": [
                  "pass",
                  "fail",
                  "skip",
                  "not_run",
                  "identical",
                  "within_bound",
                  "differing",
                  "absent",
                  "not_on_metal",
                  "OK",
                  "FAIL",
                  "ERROR",
                  "SKIP"
                ]
              },
              "test": {
                "type": "string"
              },
              "case": {
                "type": "string"
              },
              "fixture": {
                "type": "string"
              },
              "extractor": {
                "type": "string"
              },
              "metric": {
                "type": "string"
              },
              "feature": {
                "type": "string"
              },
              "max_abs_diff": {
                "type": "string"
              }
            }
          }
        },
        "part": {
          "type": "string"
        }
      }
    },
    "gateSection": {
      "type": "object",
      "required": [
        "status"
      ],
      "additionalProperties": false,
      "properties": {
        "status": {
          "enum": [
            "pass",
            "fail",
            "error",
            "no_device",
            "not_applicable",
            "not_run"
          ]
        },
        "reason": {
          "type": "string"
        },
        "fixtures": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/gateFixture"
          }
        }
      }
    },
    "rowsSection": {
      "type": "object",
      "required": [
        "status",
        "rows"
      ],
      "additionalProperties": false,
      "properties": {
        "status": {
          "enum": [
            "pass",
            "fail",
            "not_measured",
            "not_applicable"
          ]
        },
        "counts": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "pass",
            "fail",
            "not_measured"
          ],
          "properties": {
            "pass": {
              "type": "integer",
              "minimum": 0
            },
            "fail": {
              "type": "integer",
              "minimum": 0
            },
            "not_measured": {
              "type": "integer",
              "minimum": 0
            },
            "not_applicable": {
              "type": "integer",
              "minimum": 0
            }
          }
        },
        "rows": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/rowVerdict"
          }
        }
      }
    },
    "twinFeature": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "feature",
        "bound",
        "source",
        "status",
        "values",
        "differing_values"
      ],
      "properties": {
        "feature": {
          "type": "string"
        },
        "bound": {
          "type": "string"
        },
        "source": {
          "type": "string"
        },
        "status": {
          "enum": [
            "identical",
            "within_bound",
            "differing",
            "not_on_device",
            "not_in_run",
            "gate_only"
          ]
        },
        "values": {
          "type": "integer",
          "minimum": 0
        },
        "differing_values": {
          "type": "integer",
          "minimum": 0
        },
        "max_abs_diff": {
          "type": "string"
        },
        "first": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "fixture",
            "metric",
            "frame",
            "cpu",
            "device"
          ],
          "properties": {
            "fixture": {
              "type": "string"
            },
            "metric": {
              "type": "string"
            },
            "frame": {
              "type": "integer",
              "minimum": 0
            },
            "cpu": {
              "type": "string"
            },
            "device": {
              "type": "string"
            }
          }
        }
      }
    },
    "twinsSection": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "fixtures",
        "features"
      ],
      "properties": {
        "status": {
          "enum": [
            "identical",
            "within_bound",
            "differing",
            "error"
          ]
        },
        "fixtures": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/cell"
          }
        },
        "features": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/twinFeature"
          }
        }
      }
    },
    "audit": {
      "type": "object",
      "required": [
        "status"
      ],
      "description": "What a backend's audit test found; the backend adds its counts (the SYCL scratch audit: kernels_audited, kernels_in_scratch, ratchet_entries, failing_kernels, scratch_probe).",
      "properties": {
        "status": {
          "enum": [
            "pass",
            "fail",
            "skip",
            "error",
            "not_run"
          ]
        },
        "row_result": {
          "enum": [
            "pass",
            "fail",
            "skip",
            "not_run"
          ]
        },
        "reason": {
          "type": "string"
        }
      },
      "additionalProperties": {
        "type": [
          "integer",
          "string",
          "boolean",
          "array",
          "object"
        ]
      }
    },
    "gpuDevice": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "index",
        "selector",
        "facts",
        "status",
        "twins",
        "gate",
        "device_tests",
        "audits",
        "rows"
      ],
      "properties": {
        "index": {
          "type": "integer",
          "minimum": 0
        },
        "selector": {
          "type": "object",
          "description": "Environment that pinned every run to this device.",
          "additionalProperties": {
            "type": "string"
          }
        },
        "facts": {
          "type": "object",
          "description": "The device as its runtime reports it; no UUID, serial number or PCI address.",
          "additionalProperties": {
            "type": [
              "string",
              "integer",
              "boolean",
              "array",
              "null"
            ]
          }
        },
        "device_lines": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "status": {
          "enum": [
            "pass",
            "fail",
            "error"
          ]
        },
        "twins": {
          "$ref": "#/$defs/twinsSection"
        },
        "gate": {
          "$ref": "#/$defs/gateSection"
        },
        "device_tests": {
          "$ref": "#/$defs/suite"
        },
        "audits": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/$defs/audit"
          }
        },
        "rows": {
          "$ref": "#/$defs/rowsSection"
        }
      }
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "schema_version": {
            "const": "2"
          }
        }
      },
      "then": {
        "required": [
          "metal_gate",
          "metal_rows"
        ]
      }
    },
    {
      "if": {
        "properties": {
          "schema_version": {
            "const": "3"
          }
        }
      },
      "then": {
        "required": [
          "metal_gate",
          "metal_rows",
          "gpu"
        ]
      }
    }
  ]
}
