Allow fixed page-write modes in the guarded launcher

This commit is contained in:
ubiquitarianism
2026-11-29 17:53:34 -05:00
parent 9725261095
commit a64661a1df
2 changed files with 32 additions and 1 deletions

View File

@ -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|' +

View File

@ -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"):