Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions scripts/pr_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@


def smoke_blocks(body):
"""The `xcl-smoke v1` blocks of `body`: each a dict of its `key: value` lines. A block ends at
a code fence or at the next block's header (both blocks pasted in one fence)."""
"""The `xcl-smoke v1`/`v2` blocks of `body`: each a dict of its `key: value` lines. A block
ends at a code fence or at the next block's header (both blocks pasted in one fence)."""
out = []
for m in re.finditer(r"xcl-smoke v1\s*\n(.*?)(?=xcl-smoke v1|```|\Z)", body, re.S):
for m in re.finditer(r"xcl-smoke v[12]\s*\n(.*?)(?=xcl-smoke v[12]|```|\Z)", body, re.S):
block = {}
for line in m.group(1).splitlines():
k, sep, v = line.partition(":")
Expand Down
30 changes: 23 additions & 7 deletions scripts/smoke.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -74,28 +74,44 @@ $commits = [regex]::Matches($text, 'memory: (\d+) MB committed') | ForEach-Objec
$peak = if ($commits) { ($commits | Measure-Object -Maximum).Maximum } else { 'n/a' }
$removals = ([regex]::Matches($text, 'device removed')).Count
$crashes = ([regex]::Matches($text, 'unhandled exception|process ends with status')).Count
# the adapter XCL ran on (report.json next to the log; XCL removes the last run's at start),
# not the first one Windows lists – on a machine with an iGPU that is often not the one used
$gpu = $null
# report.json next to the log (XCL removes the last run's at start): the adapter XCL ran on –
# not the first one Windows lists, which on an iGPU machine is often not the one used – and the pipeline counters
$rep = $null
$report = Join-Path (Split-Path $log -Parent) 'report.json'
if (Test-Path $report) {
try { $gpu = ((Get-Content $report -Raw -Encoding utf8 | ConvertFrom-Json).d3d12.adapter -replace '\s*\([^()]*VRAM\)$', '') } catch { }
}
if (Test-Path $report) { try { $rep = Get-Content $report -Raw -Encoding utf8 | ConvertFrom-Json } catch { } }
$gpu = if ($rep) { $rep.d3d12.adapter -replace '\s*\([^()]*VRAM\)$', '' } else { $null }
if (-not $gpu) { $gpu = (Get-CimInstance Win32_VideoController | Where-Object { $_.Name -notmatch 'Basic' } | Select-Object -First 1).Name }
$code = if ($timedOut) { 'killed (no exit)' } else { '0x{0:x}' -f $p.ExitCode }
# counts, not speed: draws keep the screen shape, the pipeline counters say what the run refused
$draws = [regex]::Matches($text, 'activity \(2 s\): \d+ presents, \d+ submits, (\d+) draws') | ForEach-Object { [int]$_.Groups[1].Value }
$lastDraws = if ($draws) { ($draws | Select-Object -Last 3) -join ' ' } else { 'n/a' }
$d = if ($rep) { $rep.d3d12 } else { $null }
$translated = if ($d) { $d.translated_pipelines } else { 'n/a' }
$refused = if ($d -and $d.translation_errors) { @($d.translation_errors).Count } else { 0 }
$fallback = if ($d) { $d.fallback_pipelines } else { 'n/a' }
$failed = if ($d) { $d.failed_pipelines } else { 'n/a' }
$vm = [regex]::Matches($text, 'video memory (\d+) MB local, (\d+) MB non-local')
$vlocal = if ($vm) { ($vm | ForEach-Object { [int]$_.Groups[1].Value } | Measure-Object -Maximum).Maximum } else { 'n/a' }
$vnon = if ($vm) { ($vm | ForEach-Object { [int]$_.Groups[2].Value } | Measure-Object -Maximum).Maximum } else { 'n/a' }

@"
``````
xcl-smoke v1
xcl-smoke v2
commit: $commit$(if ($dirty) { ' (uncommitted changes)' })
gpu: $gpu
title: $Title
seconds: $Seconds
exit: $code
frames shown: $frames
presents per 2 s (last 3): $lastPresents
draws per 2 s (last 3): $lastDraws
device removals: $removals
crashes: $crashes
peak commit: $peak MB
video memory peak: $vlocal MB local, $vnon MB non-local
translated pipelines: $translated
refused pipelines: $refused
fallback pipelines: $fallback
failed pipelines: $failed
``````
"@
12 changes: 12 additions & 0 deletions scripts/test_pr_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ def test_blocks_in_separate_fences_stay_separate(self):
"```\nxcl-smoke v1\ncommit: 1234567890\ntitle: G\n```\n")
self.assertEqual(["1111111aaaa", "1234567890"], [b["commit"] for b in smoke_blocks(body)])

def test_v2_blocks_with_counter_lines_parse_and_pass(self):
run = ("title: G\nseconds: 150\nframes shown: 1600\npresents per 2 s (last 3): 28 30 29\n"
"draws per 2 s (last 3): 120 130 125\ndevice removals: 0\ncrashes: 0\npeak commit: 34000 MB\n"
"video memory peak: 14090 MB local, 4903 MB non-local\ntranslated pipelines: 1786\n"
"refused pipelines: 40\nfallback pipelines: 0\nfailed pipelines: 0\n")
body = ("```\nxcl-smoke v2\ncommit: 1111111aaaa\n" + run + "\n"
"xcl-smoke v2\ncommit: 1234567890\n" + run + "```\n")
blocks = smoke_blocks(body)
self.assertEqual(["1111111aaaa", "1234567890"], [b["commit"] for b in blocks])
self.assertEqual("40", blocks[0]["refused pipelines"])
self.assertEqual([], check(BODY + body, HEAD, [changed("crates/xcl/src/hle/d3d12x/vram.rs")], lambda sha: sha == "1111111aaaa"))

def smoke_problems(self, main_run, pr_run):
body = ("```\nxcl-smoke v1\ncommit: 1111111aaaa\n" + main_run + "```\n"
"```\nxcl-smoke v1\ncommit: 1234567890\n" + pr_run + "```\n")
Expand Down
Loading