kernelvet 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kernelvet/__init__.py +10 -0
- kernelvet/__main__.py +3 -0
- kernelvet/benchmark/__init__.py +1 -0
- kernelvet/benchmark/engine.py +180 -0
- kernelvet/benchmark/workloads.py +153 -0
- kernelvet/cli/__init__.py +1 -0
- kernelvet/cli/app.py +64 -0
- kernelvet/cli/commands/__init__.py +1 -0
- kernelvet/cli/commands/diagnose.py +244 -0
- kernelvet/cli/commands/migrate.py +334 -0
- kernelvet/cli/commands/misc.py +216 -0
- kernelvet/cli/output.py +110 -0
- kernelvet/compatibility/__init__.py +1 -0
- kernelvet/compatibility/data/rocm_matrix.json +123 -0
- kernelvet/compatibility/engine.py +24 -0
- kernelvet/compatibility/matrix.py +128 -0
- kernelvet/compatibility/validators.py +405 -0
- kernelvet/config/__init__.py +10 -0
- kernelvet/config/settings.py +112 -0
- kernelvet/diagnose/__init__.py +1 -0
- kernelvet/diagnose/engine.py +296 -0
- kernelvet/diagnose/hardware.py +336 -0
- kernelvet/diagnose/runtime.py +332 -0
- kernelvet/diagnose/software.py +221 -0
- kernelvet/diagnose/system.py +67 -0
- kernelvet/execution/__init__.py +1 -0
- kernelvet/execution/compiler.py +275 -0
- kernelvet/execution/runner.py +125 -0
- kernelvet/execution/sandbox.py +51 -0
- kernelvet/history/__init__.py +3 -0
- kernelvet/history/store.py +157 -0
- kernelvet/main.py +19 -0
- kernelvet/migration/__init__.py +17 -0
- kernelvet/migration/analyzer.py +78 -0
- kernelvet/migration/auditor.py +89 -0
- kernelvet/migration/hipify.py +268 -0
- kernelvet/migration/planner.py +128 -0
- kernelvet/migration/rules.py +564 -0
- kernelvet/migration/scanner.py +234 -0
- kernelvet/migration/workflow.py +135 -0
- kernelvet/models/__init__.py +35 -0
- kernelvet/models/common.py +102 -0
- kernelvet/models/migration.py +236 -0
- kernelvet/models/report.py +126 -0
- kernelvet/models/system.py +89 -0
- kernelvet/reporting/__init__.py +80 -0
- kernelvet/reporting/common.py +74 -0
- kernelvet/reporting/html.py +149 -0
- kernelvet/reporting/json.py +20 -0
- kernelvet/reporting/loader.py +48 -0
- kernelvet/reporting/markdown.py +256 -0
- kernelvet/reporting/sarif.py +79 -0
- kernelvet/reporting/terminal.py +276 -0
- kernelvet/tui/__init__.py +1 -0
- kernelvet/tui/app.py +177 -0
- kernelvet/tui/screens/__init__.py +1 -0
- kernelvet/tui/screens/base.py +34 -0
- kernelvet/tui/screens/devices.py +211 -0
- kernelvet/tui/screens/diagnose.py +212 -0
- kernelvet/tui/screens/help.py +47 -0
- kernelvet/tui/screens/migration.py +573 -0
- kernelvet/tui/screens/overview.py +195 -0
- kernelvet/tui/screens/tools.py +357 -0
- kernelvet/tui/state.py +55 -0
- kernelvet/tui/widgets/__init__.py +1 -0
- kernelvet/tui/widgets/common.py +82 -0
- kernelvet/tui/workers/__init__.py +25 -0
- kernelvet/utils/__init__.py +1 -0
- kernelvet/utils/paths.py +48 -0
- kernelvet/utils/proc.py +178 -0
- kernelvet/utils/redact.py +47 -0
- kernelvet/utils/versions.py +34 -0
- kernelvet-0.1.0.dist-info/METADATA +275 -0
- kernelvet-0.1.0.dist-info/RECORD +77 -0
- kernelvet-0.1.0.dist-info/WHEEL +4 -0
- kernelvet-0.1.0.dist-info/entry_points.txt +2 -0
- kernelvet-0.1.0.dist-info/licenses/LICENSE +197 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": 1,
|
|
3
|
+
"rocm_version": "10.1.0",
|
|
4
|
+
"retrieved": "2026-11-18",
|
|
5
|
+
"sources": {
|
|
6
|
+
"sysreq": {
|
|
7
|
+
"title": "ROCm system requirements (Linux)",
|
|
8
|
+
"url": "https://rocm.docs.amd.com/projects/install-on-linux/en/latest/reference/system-requirements.html",
|
|
9
|
+
"page_date": "2026-07-15",
|
|
10
|
+
"describes": "7.14.x"
|
|
11
|
+
},
|
|
12
|
+
"matrix": {
|
|
13
|
+
"title": "ROCm 10.1.0 compatibility matrix",
|
|
14
|
+
"url": "https://rocm.docs.amd.com/en/latest/compatibility/compatibility-matrix.html",
|
|
15
|
+
"page_date": "2026-08-26",
|
|
16
|
+
"describes": "10.1.0"
|
|
17
|
+
},
|
|
18
|
+
"releases": {
|
|
19
|
+
"title": "ROCm release history",
|
|
20
|
+
"url": "https://rocm.docs.amd.com/en/latest/release/versions.html",
|
|
21
|
+
"describes": "latest listed release 10.1.0 (2026-10-05)"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"notes": [
|
|
25
|
+
"Transcribed by hand from the pages above on the retrieval date. Always confirm against the live AMD documentation before relying on a result.",
|
|
26
|
+
"The system-requirements page (7.14-era) and the 10.1.0 compatibility matrix disagree on some OS point releases (e.g. Ubuntu 24.04.4 vs 24.04.5). Both are recorded and either source counts as a match.",
|
|
27
|
+
"Some GPU-to-target mappings in the 10.1.0 matrix (Radeon series rows, Ryzen APUs) were ambiguous in the published table; those targets are listed under targets_uncertain and produce WARNING, never PASS.",
|
|
28
|
+
"Per AMD: if a GPU is not listed it is not officially supported."
|
|
29
|
+
],
|
|
30
|
+
"release_versions": ["10.1.0", "10.0.0", "7.14.1", "7.14.0"],
|
|
31
|
+
"gpus": [
|
|
32
|
+
{"name": "AMD Instinct MI355X", "class": "instinct", "arch": "CDNA4", "gfx": "gfx950", "status": "supported", "source": "sysreq"},
|
|
33
|
+
{"name": "AMD Instinct MI350X", "class": "instinct", "arch": "CDNA4", "gfx": "gfx950", "status": "supported", "source": "sysreq"},
|
|
34
|
+
{"name": "AMD Instinct MI325X", "class": "instinct", "arch": "CDNA3", "gfx": "gfx942", "status": "supported", "source": "sysreq"},
|
|
35
|
+
{"name": "AMD Instinct MI300X", "class": "instinct", "arch": "CDNA3", "gfx": "gfx942", "status": "supported", "source": "sysreq"},
|
|
36
|
+
{"name": "AMD Instinct MI300A", "class": "instinct", "arch": "CDNA3", "gfx": "gfx942", "status": "supported", "source": "sysreq"},
|
|
37
|
+
{"name": "AMD Instinct MI250X", "class": "instinct", "arch": "CDNA2", "gfx": "gfx90a", "status": "supported", "source": "sysreq"},
|
|
38
|
+
{"name": "AMD Instinct MI250", "class": "instinct", "arch": "CDNA2", "gfx": "gfx90a", "status": "supported", "source": "sysreq"},
|
|
39
|
+
{"name": "AMD Instinct MI210", "class": "instinct", "arch": "CDNA2", "gfx": "gfx90a", "status": "supported", "source": "sysreq"},
|
|
40
|
+
{"name": "AMD Instinct MI100", "class": "instinct", "arch": "CDNA", "gfx": "gfx908", "status": "supported", "source": "sysreq"},
|
|
41
|
+
{"name": "AMD Instinct MI50", "class": "instinct", "arch": "GCN5.1", "gfx": "gfx906", "status": "unsupported", "source": "sysreq"},
|
|
42
|
+
{"name": "AMD Instinct MI25", "class": "instinct", "arch": "GCN5.0", "gfx": "gfx900", "status": "unsupported", "source": "sysreq"},
|
|
43
|
+
{"name": "AMD Radeon AI PRO R9700", "class": "radeon", "arch": "RDNA4", "gfx": "gfx1201", "status": "supported", "source": "sysreq"},
|
|
44
|
+
{"name": "AMD Radeon AI PRO R9600D", "class": "radeon", "arch": "RDNA4", "gfx": "gfx1201", "status": "supported", "source": "sysreq"},
|
|
45
|
+
{"name": "AMD Radeon PRO V710", "class": "radeon", "arch": "RDNA3", "gfx": "gfx1101", "status": "supported", "source": "sysreq"},
|
|
46
|
+
{"name": "AMD Radeon PRO W7900 Dual Slot", "class": "radeon", "arch": "RDNA3", "gfx": "gfx1100", "status": "supported", "source": "sysreq"},
|
|
47
|
+
{"name": "AMD Radeon PRO W7900", "class": "radeon", "arch": "RDNA3", "gfx": "gfx1100", "status": "supported", "source": "sysreq"},
|
|
48
|
+
{"name": "AMD Radeon PRO W7800 48GB", "class": "radeon", "arch": "RDNA3", "gfx": "gfx1100", "status": "supported", "source": "sysreq"},
|
|
49
|
+
{"name": "AMD Radeon PRO W7800", "class": "radeon", "arch": "RDNA3", "gfx": "gfx1100", "status": "supported", "source": "sysreq"},
|
|
50
|
+
{"name": "AMD Radeon PRO W7700", "class": "radeon", "arch": "RDNA3", "gfx": "gfx1101", "status": "supported", "source": "sysreq"},
|
|
51
|
+
{"name": "AMD Radeon PRO W6800", "class": "radeon", "arch": "RDNA2", "gfx": "gfx1030", "status": "supported", "source": "sysreq"},
|
|
52
|
+
{"name": "AMD Radeon PRO V620", "class": "radeon", "arch": "RDNA2", "gfx": "gfx1030", "status": "supported", "source": "sysreq", "note": "Ubuntu 24.04.4 and 22.04.5 only"},
|
|
53
|
+
{"name": "AMD Radeon PRO VII", "class": "radeon", "arch": "GCN5.1", "gfx": "gfx906", "status": "unsupported", "source": "sysreq"},
|
|
54
|
+
{"name": "AMD Radeon RX 9070 XT", "class": "radeon", "arch": "RDNA4", "gfx": "gfx1201", "status": "supported", "source": "sysreq"},
|
|
55
|
+
{"name": "AMD Radeon RX 9070 GRE", "class": "radeon", "arch": "RDNA4", "gfx": "gfx1201", "status": "supported", "source": "sysreq"},
|
|
56
|
+
{"name": "AMD Radeon RX 9070", "class": "radeon", "arch": "RDNA4", "gfx": "gfx1201", "status": "supported", "source": "sysreq"},
|
|
57
|
+
{"name": "AMD Radeon RX 9060 XT LP", "class": "radeon", "arch": "RDNA4", "gfx": "gfx1200", "status": "supported", "source": "sysreq"},
|
|
58
|
+
{"name": "AMD Radeon RX 9060 XT", "class": "radeon", "arch": "RDNA4", "gfx": "gfx1200", "status": "supported", "source": "sysreq"},
|
|
59
|
+
{"name": "AMD Radeon RX 9060", "class": "radeon", "arch": "RDNA4", "gfx": "gfx1200", "status": "supported", "source": "sysreq"},
|
|
60
|
+
{"name": "AMD Radeon RX 7900 XTX", "class": "radeon", "arch": "RDNA3", "gfx": "gfx1100", "status": "supported", "source": "sysreq"},
|
|
61
|
+
{"name": "AMD Radeon RX 7900 XT", "class": "radeon", "arch": "RDNA3", "gfx": "gfx1100", "status": "supported", "source": "sysreq"},
|
|
62
|
+
{"name": "AMD Radeon RX 7900 GRE", "class": "radeon", "arch": "RDNA3", "gfx": "gfx1100", "status": "supported", "source": "sysreq"},
|
|
63
|
+
{"name": "AMD Radeon RX 7800 XT", "class": "radeon", "arch": "RDNA3", "gfx": "gfx1101", "status": "supported", "source": "sysreq"},
|
|
64
|
+
{"name": "AMD Radeon RX 7700 XT", "class": "radeon", "arch": "RDNA3", "gfx": "gfx1101", "status": "supported", "source": "sysreq"},
|
|
65
|
+
{"name": "AMD Radeon RX 7700", "class": "radeon", "arch": "RDNA3", "gfx": "gfx1101", "status": "supported", "source": "sysreq"},
|
|
66
|
+
{"name": "AMD Radeon VII", "class": "radeon", "arch": "GCN5.1", "gfx": "gfx906", "status": "unsupported", "source": "sysreq"}
|
|
67
|
+
],
|
|
68
|
+
"targets_uncertain": {
|
|
69
|
+
"gfx1102": "10.1.0 matrix lists gfx1102 (Radeon PRO V series / RX 7600); row mapping was ambiguous",
|
|
70
|
+
"gfx1151": "10.1.0 matrix lists Ryzen APU targets; product mapping was ambiguous",
|
|
71
|
+
"gfx1150": "10.1.0 matrix lists Ryzen APU targets; product mapping was ambiguous",
|
|
72
|
+
"gfx1152": "10.1.0 matrix lists Ryzen APU targets; product mapping was ambiguous",
|
|
73
|
+
"gfx1153": "10.1.0 matrix lists Ryzen APU targets; product mapping was ambiguous",
|
|
74
|
+
"gfx1103": "10.1.0 matrix lists Ryzen APU targets; product mapping was ambiguous"
|
|
75
|
+
},
|
|
76
|
+
"os": {
|
|
77
|
+
"instinct": [
|
|
78
|
+
{"id": "ubuntu", "version": "26.04", "label": "Ubuntu 26.04.1", "kernels": ["7.0"], "source": "matrix"},
|
|
79
|
+
{"id": "ubuntu", "version": "24.04", "label": "Ubuntu 24.04.5 / 24.04.4", "kernels": ["6.8", "6.17"], "source": "matrix+sysreq"},
|
|
80
|
+
{"id": "ubuntu", "version": "22.04", "label": "Ubuntu 22.04.5", "kernels": ["5.15", "6.8"], "source": "matrix+sysreq"},
|
|
81
|
+
{"id": "rhel", "version": "10.2", "label": "RHEL 10.2", "kernels": ["6.12"], "source": "matrix"},
|
|
82
|
+
{"id": "rhel", "version": "10.1", "label": "RHEL 10.1", "kernels": ["6.12"], "source": "sysreq"},
|
|
83
|
+
{"id": "rhel", "version": "10.0", "label": "RHEL 10.0", "kernels": ["6.12"], "source": "matrix+sysreq"},
|
|
84
|
+
{"id": "rhel", "version": "9.8", "label": "RHEL 9.8", "kernels": ["5.14"], "source": "matrix"},
|
|
85
|
+
{"id": "rhel", "version": "9.7", "label": "RHEL 9.7", "kernels": ["5.14"], "source": "sysreq"},
|
|
86
|
+
{"id": "rhel", "version": "9.6", "label": "RHEL 9.6", "kernels": ["5.14"], "source": "matrix+sysreq"},
|
|
87
|
+
{"id": "rhel", "version": "9.4", "label": "RHEL 9.4", "kernels": ["5.14"], "source": "matrix+sysreq"},
|
|
88
|
+
{"id": "rhel", "version": "8.10", "label": "RHEL 8.10", "kernels": ["4.18"], "source": "matrix+sysreq"},
|
|
89
|
+
{"id": "sles", "version": "16.0", "label": "SLES 16.0", "kernels": ["6.12"], "source": "matrix"},
|
|
90
|
+
{"id": "sles", "version": "15.7", "label": "SLES 15 SP7", "kernels": ["6.4"], "source": "matrix+sysreq"},
|
|
91
|
+
{"id": "debian", "version": "13", "label": "Debian 13", "kernels": ["6.12"], "source": "matrix+sysreq"},
|
|
92
|
+
{"id": "debian", "version": "12", "label": "Debian 12", "kernels": ["6.1"], "source": "matrix+sysreq"},
|
|
93
|
+
{"id": "rocky", "version": "9", "label": "Rocky Linux 9", "kernels": ["5.14"], "source": "matrix+sysreq"},
|
|
94
|
+
{"id": "ol", "version": "10", "label": "Oracle Linux 10 (UEK)", "kernels": [], "source": "matrix+sysreq"},
|
|
95
|
+
{"id": "ol", "version": "9", "label": "Oracle Linux 9 (UEK)", "kernels": [], "source": "matrix+sysreq"},
|
|
96
|
+
{"id": "ol", "version": "8", "label": "Oracle Linux 8 (UEK)", "kernels": [], "source": "matrix+sysreq"}
|
|
97
|
+
],
|
|
98
|
+
"radeon": [
|
|
99
|
+
{"id": "ubuntu", "version": "26.04", "label": "Ubuntu 26.04.1", "kernels": ["7.0"], "source": "matrix"},
|
|
100
|
+
{"id": "ubuntu", "version": "24.04", "label": "Ubuntu 24.04.5 / 24.04.4", "kernels": ["7.0", "6.8", "6.17"], "source": "matrix+sysreq"},
|
|
101
|
+
{"id": "ubuntu", "version": "22.04", "label": "Ubuntu 22.04.5", "kernels": ["6.8", "5.15"], "source": "matrix+sysreq"},
|
|
102
|
+
{"id": "rhel", "version": "10.2", "label": "RHEL 10.2", "kernels": ["6.12"], "source": "matrix"},
|
|
103
|
+
{"id": "rhel", "version": "10.1", "label": "RHEL 10.1", "kernels": ["6.12"], "source": "sysreq"},
|
|
104
|
+
{"id": "rhel", "version": "9.8", "label": "RHEL 9.8", "kernels": ["5.14"], "source": "matrix"},
|
|
105
|
+
{"id": "rhel", "version": "9.7", "label": "RHEL 9.7", "kernels": ["5.14"], "source": "sysreq"}
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
"os_gpu_restrictions": [
|
|
109
|
+
{"os": "debian:13", "gfx": ["gfx950", "gfx942"], "note": "Debian 13: MI355X/MI350X/MI325X/MI300X only", "source": "sysreq"},
|
|
110
|
+
{"os": "rocky:9", "gfx": ["gfx942"], "note": "Rocky Linux 9: MI300X/MI300A only", "source": "sysreq"},
|
|
111
|
+
{"os": "rhel:8.10", "gfx": ["gfx942", "gfx90a", "gfx908"], "note": "RHEL 8.10: MI300X/MI300A/MI250X/MI250/MI210/MI100 only", "source": "sysreq"}
|
|
112
|
+
],
|
|
113
|
+
"amdgpu_driver": {
|
|
114
|
+
"instinct": ["31.60.0", "31.50.0", "31.40.1", "31.40.0", "31.30.0", "31.20.0", "31.10.0", "30.30.3", "30.30.2", "30.30.1", "30.30.0", "30.20.1", "30.20.0", "30.10.2"],
|
|
115
|
+
"radeon": ["31.60.0", "31.50.0"],
|
|
116
|
+
"source": "matrix"
|
|
117
|
+
},
|
|
118
|
+
"frameworks": {
|
|
119
|
+
"pytorch": {"versions": ["2.14", "2.13", "2.12"], "source": "matrix"},
|
|
120
|
+
"jax": {"versions": ["0.11.1", "0.11.0", "0.10.2"], "source": "matrix"},
|
|
121
|
+
"tensorflow": {"versions": ["2.21", "2.20"], "source": "matrix"}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Evaluate a detected system against the compatibility matrix."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from kernelvet.compatibility.matrix import CompatibilityMatrix, load_matrix
|
|
6
|
+
from kernelvet.compatibility.validators import VALIDATORS, CompatibilityInput
|
|
7
|
+
from kernelvet.models.report import CompatibilityReport
|
|
8
|
+
from kernelvet.models.system import GpuDevice, HostInfo, SoftwareInfo
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def evaluate(
|
|
12
|
+
host: HostInfo,
|
|
13
|
+
gpus: list[GpuDevice],
|
|
14
|
+
software: SoftwareInfo,
|
|
15
|
+
matrix: CompatibilityMatrix | None = None,
|
|
16
|
+
) -> CompatibilityReport:
|
|
17
|
+
m = matrix or load_matrix()
|
|
18
|
+
inp = CompatibilityInput(host=host, gpus=gpus, software=software)
|
|
19
|
+
return CompatibilityReport(
|
|
20
|
+
matrix_version=m.rocm_version,
|
|
21
|
+
matrix_sources=m.source_urls(),
|
|
22
|
+
matrix_retrieved=m.retrieved,
|
|
23
|
+
checks=[v(inp, m) for v in VALIDATORS],
|
|
24
|
+
)
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"""Compatibility reference data.
|
|
2
|
+
|
|
3
|
+
The bundled matrix (``data/rocm_matrix.json``) is a hand-transcribed snapshot of
|
|
4
|
+
AMD's published ROCm documentation. It records its source URLs, retrieval date
|
|
5
|
+
and known discrepancies, and can be replaced with ``--matrix path.json`` or the
|
|
6
|
+
``compatibility_matrix`` setting without changing any code.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import json
|
|
12
|
+
from functools import lru_cache
|
|
13
|
+
from importlib import resources
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
from typing import Literal
|
|
16
|
+
|
|
17
|
+
from pydantic import BaseModel, Field, ValidationError
|
|
18
|
+
|
|
19
|
+
GpuClass = Literal["instinct", "radeon"]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class MatrixError(ValueError):
|
|
23
|
+
"""A compatibility matrix file that cannot be read, is not JSON, or does not match the schema."""
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class MatrixSource(BaseModel):
|
|
27
|
+
title: str
|
|
28
|
+
url: str
|
|
29
|
+
page_date: str | None = None
|
|
30
|
+
describes: str | None = None
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class GpuEntry(BaseModel):
|
|
34
|
+
name: str
|
|
35
|
+
gpu_class: GpuClass = Field(alias="class")
|
|
36
|
+
arch: str
|
|
37
|
+
gfx: str
|
|
38
|
+
status: Literal["supported", "deprecated", "unsupported"]
|
|
39
|
+
source: str
|
|
40
|
+
note: str | None = None
|
|
41
|
+
|
|
42
|
+
model_config = {"populate_by_name": True}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class OsEntry(BaseModel):
|
|
46
|
+
id: str
|
|
47
|
+
version: str
|
|
48
|
+
label: str
|
|
49
|
+
kernels: list[str] = Field(default_factory=list)
|
|
50
|
+
source: str
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class OsRestriction(BaseModel):
|
|
54
|
+
os: str # "debian:13"
|
|
55
|
+
gfx: list[str]
|
|
56
|
+
note: str
|
|
57
|
+
source: str
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class FrameworkEntry(BaseModel):
|
|
61
|
+
versions: list[str]
|
|
62
|
+
source: str
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class DriverTable(BaseModel):
|
|
66
|
+
instinct: list[str] = Field(default_factory=list)
|
|
67
|
+
radeon: list[str] = Field(default_factory=list)
|
|
68
|
+
source: str
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class CompatibilityMatrix(BaseModel):
|
|
72
|
+
schema_version: int = Field(alias="schema")
|
|
73
|
+
rocm_version: str
|
|
74
|
+
retrieved: str
|
|
75
|
+
sources: dict[str, MatrixSource]
|
|
76
|
+
notes: list[str] = Field(default_factory=list)
|
|
77
|
+
release_versions: list[str] = Field(default_factory=list)
|
|
78
|
+
gpus: list[GpuEntry]
|
|
79
|
+
targets_uncertain: dict[str, str] = Field(default_factory=dict)
|
|
80
|
+
os: dict[GpuClass, list[OsEntry]]
|
|
81
|
+
os_gpu_restrictions: list[OsRestriction] = Field(default_factory=list)
|
|
82
|
+
amdgpu_driver: DriverTable
|
|
83
|
+
frameworks: dict[str, FrameworkEntry] = Field(default_factory=dict)
|
|
84
|
+
|
|
85
|
+
model_config = {"populate_by_name": True}
|
|
86
|
+
|
|
87
|
+
def source_url(self, key: str) -> str:
|
|
88
|
+
urls = [self.sources[k].url for k in key.split("+") if k in self.sources]
|
|
89
|
+
return ", ".join(urls) if urls else key
|
|
90
|
+
|
|
91
|
+
def entries_for_gfx(self, gfx: str) -> list[GpuEntry]:
|
|
92
|
+
return [g for g in self.gpus if g.gfx == gfx]
|
|
93
|
+
|
|
94
|
+
def class_for_gfx(self, gfx: str | None) -> GpuClass | None:
|
|
95
|
+
if not gfx:
|
|
96
|
+
return None
|
|
97
|
+
entries = self.entries_for_gfx(gfx)
|
|
98
|
+
return entries[0].gpu_class if entries else None
|
|
99
|
+
|
|
100
|
+
def source_urls(self) -> list[str]:
|
|
101
|
+
return [s.url for s in self.sources.values()]
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@lru_cache(maxsize=8)
|
|
105
|
+
def _load_cached(path: str | None) -> CompatibilityMatrix:
|
|
106
|
+
where = path or "the bundled compatibility matrix"
|
|
107
|
+
try:
|
|
108
|
+
if path:
|
|
109
|
+
raw = Path(path).read_text()
|
|
110
|
+
else:
|
|
111
|
+
raw = resources.files("kernelvet.compatibility").joinpath("data/rocm_matrix.json").read_text()
|
|
112
|
+
return CompatibilityMatrix.model_validate(json.loads(raw))
|
|
113
|
+
except OSError as exc:
|
|
114
|
+
raise MatrixError(f"could not read {where}: {exc.strerror or exc}") from exc
|
|
115
|
+
except json.JSONDecodeError as exc:
|
|
116
|
+
raise MatrixError(
|
|
117
|
+
f"{where} is not valid JSON (line {exc.lineno}, column {exc.colno}: {exc.msg})"
|
|
118
|
+
) from exc
|
|
119
|
+
except ValidationError as exc:
|
|
120
|
+
problems = "; ".join(
|
|
121
|
+
f"{'.'.join(str(x) for x in e['loc']) or '(top level)'}: {e['msg']}" for e in exc.errors()[:5]
|
|
122
|
+
)
|
|
123
|
+
more = f" (and {exc.error_count() - 5} more)" if exc.error_count() > 5 else ""
|
|
124
|
+
raise MatrixError(f"{where} does not match the matrix schema: {problems}{more}") from exc
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def load_matrix(path: str | Path | None = None) -> CompatibilityMatrix:
|
|
128
|
+
return _load_cached(str(path) if path else None)
|