diff --git a/scratchpad/d3d12-run/runner_options.ps1 b/scratchpad/d3d12-run/runner_options.ps1 index 7144c0452..d4e364ab6 100644 --- a/scratchpad/d3d12-run/runner_options.ps1 +++ b/scratchpad/d3d12-run/runner_options.ps1 @@ -4,7 +4,7 @@ $unattendedExperimentToggles = @( 'LEONIDA_INDEX_HEAP_SPANS', 'LEONIDA_COMPACT_FRAME_LOG', 'LEONIDA_PORT_GUARD', 'LEONIDA_PORT_GUARD_PLAN', 'LEONIDA_FSR_FRAMEGEN', 'LEONIDA_FULLSCREEN' ) -$unattendedOptions = @('LEONIDA_LOG', 'LEONIDA_AB', 'LEONIDA_KBM') + $unattendedExperimentToggles + $unattendedPaths +$unattendedOptions = @('LEONIDA_LOG', 'LEONIDA_AB', 'LEONIDA_KBM', 'LEONIDA_PAGE_WRITES') + $unattendedExperimentToggles + $unattendedPaths # Scalar entries written by the D3D12 F1 menu. Review new entries for storage effects before adding them. $unattendedMenuScalars = @( 'LEONIDA_UPSCALE', 'LEONIDA_RENDER_SCALE', 'LEONIDA_FRAME_GEN', 'LEONIDA_ASPECT', 'LEONIDA_PRESENT_SCALE', @@ -34,6 +34,9 @@ function Assert-UnattendedScalarValue([string]$Name, [string]$Value, [string]$So if ($Name -in $unattendedExperimentToggles -and $Value -cnotmatch '\A[01]\z') { throw "$Source $Name needs 0 or 1." } + if ($Name -eq 'LEONIDA_PAGE_WRITES' -and $Value -cnotmatch '\A(?:0|1|slots|guards|all)\z') { + throw "$Source $Name needs 0, 1, slots, guards, or all." + } if ($Name -eq 'LEONIDA_AB') { # The renderer needs more than one second per phase. Pairs put the planner on bit 0. $switches = 'LEONIDA_BATCH_KEPT|LEONIDA_WIDE_HALF|LEONIDA_NULL_VIEW_SOURCE|' + diff --git a/scratchpad/d3d12-run/test_runner.py b/scratchpad/d3d12-run/test_runner.py index 82a8b5e3d..d55be8b92 100644 --- a/scratchpad/d3d12-run/test_runner.py +++ b/scratchpad/d3d12-run/test_runner.py @@ -224,6 +224,34 @@ class RunnerTests(unittest.TestCase): self.assertEqual(self.read("effective-options.json"), options) self.assertEqual(self.read("space.json")["estimates"], []) + def test_accepts_fixed_page_write_modes(self): + for value in ("0", "1", "slots", "guards", "all"): + with self.subTest(value=value): + options = {"LEONIDA_PAGE_WRITES": value} + self.options(options) + result = self.call_preflight() + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual(self.read("effective-options.json"), options) + self.assertEqual(self.read("space.json")["estimates"], []) + + def test_rejects_invalid_page_write_modes_and_a_b(self): + cases = ( + ({"LEONIDA_PAGE_WRITES": "2"}, "", "Unattended option LEONIDA_PAGE_WRITES needs 0, 1, slots, guards, or all"), + ({"LEONIDA_PAGE_WRITES": "ALL"}, "", "Unattended option LEONIDA_PAGE_WRITES needs 0, 1, slots, guards, or all"), + ({"LEONIDA_PAGE_WRITES": 1}, "", "Unattended option LEONIDA_PAGE_WRITES needs a nonempty string"), + ({"LEONIDA_AB": "30,LEONIDA_PAGE_WRITES"}, "", "Unattended option LEONIDA_AB"), + ({}, "LEONIDA_PAGE_WRITES=2\n", "Saved menu setting LEONIDA_PAGE_WRITES needs 0, 1, slots, guards, or all"), + ) + menu = self.source / "d3d12/leonida-settings.txt" + for options, contents, error in cases: + with self.subTest(options=options, menu=contents): + self.options(options) + menu.write_text(contents, encoding="utf-8", newline="\n") + result = self.call_preflight() + self.assertNotEqual(result.returncode, 0) + self.assertIn(error, result.stderr) + self.assertFalse((self.attempt / "space.json").exists()) + def test_rejects_invalid_write_watch_guard_options(self): menu = self.source / "d3d12/leonida-settings.txt" for option in ("LEONIDA_PORT_GUARD", "LEONIDA_PORT_GUARD_PLAN"):