From 19a84a43927895c8ac5d5c8c0298ad2467a18812 Mon Sep 17 00:00:00 2001 From: morebrackets Date: Fri, 4 Dec 2026 23:35:52 -0800 Subject: [PATCH] fix(validation,tests,docs): live.log skip reason (#580), controls.tsv capture check (#579), Ampere/Turing parity docs (#578) (#582) * fix(validation,tests,docs): record live.log skip reason (#580), verify controls.tsv (#579), update Ampere/Turing parity rows (#578) * docs(parity): attribute Turing live [O] results strictly to RTX 2060 (TU106) --------- Co-authored-by: morebrackets <19673572+morebrackets@users.noreply.github.com> --- docs/PARITY_AND_UNLOCKS.md | 4 +- tests/offline/test_ioctl_capture.py | 90 +++++++++++++++++++++++++++ tests/vm/test_validate_guest_steps.py | 44 ++++++++++--- tools/validate_all.sh | 14 ++--- 4 files changed, 136 insertions(+), 16 deletions(-) diff --git a/docs/PARITY_AND_UNLOCKS.md b/docs/PARITY_AND_UNLOCKS.md index bc5f7231..d2865296 100644 --- a/docs/PARITY_AND_UNLOCKS.md +++ b/docs/PARITY_AND_UNLOCKS.md @@ -16,8 +16,8 @@ Comparison of all **43 discrete GPU chip tuples** in NVIDIA **580.178.04** (`src | **Maxwell 2** | `0x12` | GM200, GM204, GM206 (GTX 960–980 Ti, Titan X, Tesla M40/M60) | Pre-GSP | V1 | Supported | **HAL + Unicorn-verified offline** *(untested on physical silicon)* | | **Pascal** | `0x13` | GP100, GP102, GP104, GP106, GP107, GP108 (Tesla P100/P40/P4, GTX 1050–1080 Ti) | Pre-GSP | V2 | Supported | **HAL + Unicorn-verified offline** *(untested on physical silicon)* | | **Volta** | `0x14` | **GV100 (Tesla V100 PCIe / SXM2 16GB & 32GB, Quadro GV100, Titan V)** | Pre-GSP | V2 | Supported | **LIVE PHYSICAL SILICON VERIFIED (0-diff)** on 8× V100-SXM2-32GB | -| **Turing** | `0x16` | TU102, TU104, TU106, TU116, TU117 (Tesla T4, RTX 2060–2080 Ti, GTX 1650–1660 Ti) | GSP-RM (`gsp_tu10x.bin`) | V2 | Supported | **GSP-RM loader + HALs wired & Unicorn-verified offline** *(untested on physical silicon)* | -| **Ampere** | `0x17` | GA100 (`gsp_tu10x.bin`), GA102–GA107 (`gsp_ga10x.bin`) (A100, A10/A30/A40, RTX 3050–3090 Ti) | GSP-RM | V2 | Supported | **GSP-RM loader + HALs wired & Unicorn-verified offline** *(untested on physical silicon)* | +| **Turing** | `0x16` | TU102, TU104, TU106, TU116, TU117 (Tesla T4, RTX 2060–2080 Ti, GTX 1650–1660 Ti) | GSP-RM (`gsp_tu10x.bin`) | V2 | Supported | **Community-reported `[O]` on RTX 2060 (TU106, [issue #436](https://github.com/nvdriver/nvdriver/issues/436))** — GSP-RM boot + `37/37` CUDA parity checks (`25/25` bit-identical digests vs stock); see the [README GPU Support Matrix](../README.md#gpu-support-matrix) for per-model status | +| **Ampere** | `0x17` | GA100 (`gsp_tu10x.bin`), GA102–GA107 (`gsp_ga10x.bin`) (A100, A10/A30/A40, RTX A4500, RTX 3050–3090 Ti) | GSP-RM | V2 | Supported | **Community-reported `[O]` on RTX A4500 (`GA102GL`, [field report](FIELD-REPORT-rtx-a4500-ga102gl.md) / [issue #504](https://github.com/nvdriver/nvdriver/issues/504))** — GSP-RM boot/unload, `nvidia-smi`, `hwmon`, 4 MiB CUDA HtoD/DtoH round trip verified byte-for-byte, and `llama bench` throughput parity (plus RTX 3090 / 3080 Ti / 3050M reports); see the [README GPU Support Matrix](../README.md#gpu-support-matrix) for per-model status | | **Hopper** | `0x18` | GH100 (H100, H200) | GSP-RM (`gsp_ga10x.bin`) | V3 | Supported | **GSP-RM loader + MMU V3 + HALs wired & Unicorn-verified offline** *(untested on physical silicon)* | | **Ada Lovelace** | `0x19` | AD102–AD107 (L4, L40/L40S, RTX 4060–4090, RTX 6000 Ada) | GSP-RM (`gsp_ga10x.bin`) | V2 | Supported | **Community-reported `[O]` on RTX 4090 (AD102, [issue #236](https://github.com/nvdriver/nvdriver/issues/236) / [logs](https://github.com/nvdriver/nvdriver/issues/236#issuecomment-7347513418); not maintainer-verified)** — `nvidia-smi` + `37/37` CUDA parity checks (`25/25` bit-identical digests vs stock) with `ga10x_gsp=1`, manual prerequisite: Resizable BAR / BAR1 >= 512 MiB (`install.sh` does not configure this yet), and AD102 boot ucode extracted from the 580.x `open-gpu-kernel-modules` `kernel-open/nvidia/nv-kernel.o_binary` (not the proprietary `kernel/` object) | | **Blackwell 1** | `0x1a` | GB100, GB102, GB10B (B100, B200, GB200) | GSP-RM (`gsp_ga10x.bin`) | V3 | Supported | **GSP-RM loader + MMU V3 + HALs wired & Unicorn-verified offline** *(untested on physical silicon)* | diff --git a/tests/offline/test_ioctl_capture.py b/tests/offline/test_ioctl_capture.py index 5d072029..65fd09dc 100644 --- a/tests/offline/test_ioctl_capture.py +++ b/tests/offline/test_ioctl_capture.py @@ -11,6 +11,7 @@ import subprocess import sys import tempfile import unittest +from collections import Counter from contextlib import redirect_stderr, redirect_stdout from pathlib import Path @@ -20,6 +21,52 @@ sys.path.insert(0, str(ROOT / "tools" / "ioctl_capture")) import replay_diff # noqa: E402 +def _group_capture_controls(json_path: Path) -> Counter[tuple[int, int, int]]: + data = json.loads(json_path.read_text(encoding="utf-8")) + counts: Counter[tuple[int, int, int]] = Counter() + for steps in data["workloads"].values(): + for step in steps: + if step.get("kind") == "control": + counts[(int(step["cmd"]), int(step["size"]), int(step["status"]))] += 1 + return counts + + +def _diff_controls_tsv(json_path: Path, tsv_path: Path) -> list[str]: + expected = _group_capture_controls(json_path) + actual: dict[tuple[int, int, int], int] = {} + mismatches: list[str] = [] + + for lineno, raw in enumerate(tsv_path.read_text(encoding="utf-8").splitlines(), start=1): + line = raw.strip() + if not line or line.startswith("#"): + continue + cols = line.split("\t") + if len(cols) != 4: + mismatches.append(f"line {lineno}: expected 4 tab-separated columns, got {len(cols)}: {raw!r}") + continue + cmd = int(cols[0], 0) + size = int(cols[1], 0) + status = int(cols[2], 0) + count = int(cols[3], 0) + key = (cmd, size, status) + if key in actual: + mismatches.append( + f"duplicate row at line {lineno}: cmd=0x{cmd:x} size={size} status=0x{status:x}" + ) + continue + actual[key] = count + + for key in sorted(set(expected) | set(actual)): + exp_count = expected.get(key, 0) + act_count = actual.get(key, 0) + if exp_count != act_count: + cmd, size, status = key + mismatches.append( + f"cmd=0x{cmd:x} size={size} status=0x{status:x}: expected count={exp_count}, actual count={act_count}" + ) + return mismatches + + def _make_rm_control_record(dev: str, cmd: int, size: int, status: int) -> dict: # NVOS54_PARAMETERS: hClient(0), hObject(4), cmd(8), flags(12), params(16..24), paramsSize(24), status(28) buf = struct.pack(" None: + capture = ROOT / "captures" / "golden" / "stock-620.73.04.json" + tsv = ROOT / "captures" / "golden" / "controls.tsv" + expected = _group_capture_controls(capture) + self.assertGreater(len(expected), 0) + mismatches = _diff_controls_tsv(capture, tsv) + self.assertEqual(mismatches, [], "\n".join(mismatches)) + + def test_controls_tsv_detects_missing_or_altered_counts(self) -> None: + capture = ROOT / "captures" / "golden" / "stock-620.73.04.json" + tsv = ROOT / "captures" / "golden" / "controls.tsv" + lines = tsv.read_text(encoding="utf-8").splitlines() + first_data_idx = next(i for i, line in enumerate(lines) if line.strip() and not line.lstrip().startswith("#")) + first_cols = lines[first_data_idx].split("\t") + first_cmd = first_cols[0] + + with tempfile.TemporaryDirectory() as td: + root = Path(td) + + # Dropping a row from controls.tsv must fail and identify the missing command. + dropped = root / "dropped.tsv" + dropped.write_text( + "\n".join(lines[:first_data_idx] + lines[first_data_idx + 1 :]) + "\n", + encoding="utf-8", + ) + mismatches = _diff_controls_tsv(capture, dropped) + self.assertEqual(len(mismatches), 1) + self.assertIn(f"cmd={first_cmd}", mismatches[0]) + self.assertIn("actual count=0", mismatches[0]) + + # Changing a count by one must fail and report both expected and actual counts. + altered = root / "altered.tsv" + orig_count = int(first_cols[3], 0) + altered_cols = [*first_cols[:3], str(orig_count + 1)] + altered_lines = list(lines) + altered_lines[first_data_idx] = "\t".join(altered_cols) + altered.write_text("\n".join(altered_lines) + "\n", encoding="utf-8") + mismatches = _diff_controls_tsv(capture, altered) + self.assertEqual(len(mismatches), 1) + self.assertIn(f"cmd={first_cmd}", mismatches[0]) + self.assertIn(f"expected count={orig_count}", mismatches[0]) + self.assertIn(f"actual count={orig_count + 1}", mismatches[0]) + if __name__ == "__main__": unittest.main() diff --git a/tests/vm/test_validate_guest_steps.py b/tests/vm/test_validate_guest_steps.py index b51072a5..7e6d783b 100644 --- a/tests/vm/test_validate_guest_steps.py +++ b/tests/vm/test_validate_guest_steps.py @@ -38,12 +38,13 @@ sha256sum() { return 0; } class GuestStepTests(unittest.TestCase): - def simulate(self, failed_step, extra_args=(), extra_env=None): - work = tempfile.TemporaryDirectory() - self.addCleanup(work.cleanup) - root = Path(work.name) + def simulate(self, failed_step, extra_args=(), extra_env=None, root=None): + if root is None: + work = tempfile.TemporaryDirectory() + self.addCleanup(work.cleanup) + root = Path(work.name) script = root / "tools/validate_all.sh" - script.parent.mkdir() + script.parent.mkdir(exist_ok=True) shutil.copyfile(SCRIPT, script) functions = root / "simulated_commands.sh" functions.write_text(STUBS, encoding="utf-8") @@ -89,16 +90,45 @@ class GuestStepTests(unittest.TestCase): self.assertIn("PASS guest_iommu\n", result.stdout) def test_offline_flag_skips_live_step(self): - result, _ = self.simulate("", extra_args=("--offline",)) + result, root = self.simulate("", extra_args=("--offline",)) self.assertEqual(result.returncode, 0) self.assertIn("SKIP live (--offline / NV_RS_SKIP_LIVE=1)\n", result.stdout) self.assertNotIn("PASS live\n", result.stdout) + self.assertEqual( + (root / "target/validate-logs/live.log").read_text(encoding="utf-8"), + "--offline / NV_RS_SKIP_LIVE=1\n", + ) def test_env_skip_live_skips_live_step(self): - result, _ = self.simulate("", extra_env={"NV_RS_SKIP_LIVE": "1"}) + result, root = self.simulate("", extra_env={"NV_RS_SKIP_LIVE": "1"}) self.assertEqual(result.returncode, 0) self.assertIn("SKIP live (--offline / NV_RS_SKIP_LIVE=1)\n", result.stdout) self.assertNotIn("PASS live\n", result.stdout) + self.assertEqual( + (root / "target/validate-logs/live.log").read_text(encoding="utf-8"), + "--offline / NV_RS_SKIP_LIVE=1\n", + ) + + def test_skip_live_overwrites_stale_live_log(self): + for label, kwargs in ( + ("--offline", {"extra_args": ("--offline",)}), + ("NV_RS_SKIP_LIVE=1", {"extra_env": {"NV_RS_SKIP_LIVE": "1"}}), + ): + with self.subTest(mode=label): + work = tempfile.TemporaryDirectory() + self.addCleanup(work.cleanup) + root = Path(work.name) + live_log = root / "target/validate-logs/live.log" + live_log.parent.mkdir(parents=True) + live_log.write_text("old-live-marker\n", encoding="utf-8") + + result, _ = self.simulate("", root=root, **kwargs) + self.assertEqual(result.returncode, 0) + self.assertIn("SKIP live (--offline / NV_RS_SKIP_LIVE=1)\n", result.stdout) + self.assertEqual( + live_log.read_text(encoding="utf-8"), + "--offline / NV_RS_SKIP_LIVE=1\n", + ) def test_default_runs_live_step(self): result, _ = self.simulate("") diff --git a/tools/validate_all.sh b/tools/validate_all.sh index 84a7ad02..8fe87e9f 100755 --- a/tools/validate_all.sh +++ b/tools/validate_all.sh @@ -57,18 +57,18 @@ step audit make -C src/nvidia audit-codegen step native_codegen python3 tools/check_native_codegen.py optional_step gsp_620_headers python3 tools/oracle_gsp_620.py optional_step gp106_oracles bash tools/gp106/check.sh all -guest_skip() { +skip_step() { local name=$1 reason=$2 echo "$reason" >"$LOGS/$name.log" echo "SKIP $name ($reason)" } if ! step guest_build sh tools/vm/build_guest_test.sh; then - guest_skip initramfs "guest build failed" - guest_skip guest "guest build failed" - guest_skip guest_iommu "guest build failed" + skip_step initramfs "guest build failed" + skip_step guest "guest build failed" + skip_step guest_iommu "guest build failed" elif ! step initramfs sh tools/vm/build_initramfs.sh; then - guest_skip guest "initramfs build failed" - guest_skip guest_iommu "initramfs build failed" + skip_step guest "initramfs build failed" + skip_step guest_iommu "initramfs build failed" else step guest python3 tools/vm/run_guest.py step guest_iommu python3 tools/vm/run_guest.py --iommu @@ -76,7 +76,7 @@ fi step result_gate python3 tests/vm/test_result_gate.py # The live step runs target/compat32-rust-driver; build it on a fresh tree (a failure shows up as FAIL live). if [ "$SKIP_LIVE" = "1" ]; then - echo "SKIP live (--offline / NV_RS_SKIP_LIVE=1)" + skip_step live "--offline / NV_RS_SKIP_LIVE=1" else [ -x target/compat32-rust-driver ] || python3 tools/build_compat32_probe.py --node /dev/nvidia-rsctl --out target/compat32-rust-driver >"$LOGS/compat32_build.log" 2>&1 step live sudo -n python3 tools/run_live_control.py