Skip to content
Merged
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
4 changes: 4 additions & 0 deletions docs/startup-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ hex HRESULT/format/flag codes, slot numbers and known shader-failure categories
refusals, unhandled `x2w-d3d12` / trap slots, `x2w-d3d12-debug` severity/ID counts, `x2w-dstorage`
failures and status HRESULTs, `x2w-runtime` failing slots, and `.fail` shader categories). Any other
text is grouped as `other (text omitted)` and never copied; raw snippets stay in the local logs.
`Device::slot133` (the console placed-resource call) logs each handled placement with a trailing
`aliased` or `not aliased` field. Those lines are not counted as unhandled; they are counted by
outcome (`aliased`, `not_aliased`, `failed`) in a separate table, and a line with an HRESULT other than 0
(or an uncommitted address) still counts as `failed` and as an unhandled `Device::slot133` event.
Check with `python3 -B tests/startup_triage_run_check.py` (ctest
`startup_triage_run`).

Expand Down
39 changes: 39 additions & 0 deletions tests/startup_triage_run_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

from pathlib import Path
import re
import subprocess
import sys
import tempfile
Expand Down Expand Up @@ -203,6 +204,43 @@ def check_empty_and_missing_dirs(failures: list[str]) -> None:
failures.append(f"expected '_None observed._' for {target}")


def check_slot133_outcomes(failures: list[str]) -> None:
# Device::slot133 logs every handled placement with a trailing "aliased|not aliased gpuva=..." field.
prefix = "x2w-d3d12 Device::slot133(CreatePlacedResourceX?) "
lines = [
prefix + "address=0x1000 base=0x1000 offset=0x0 width=0x100 flags=0x0 state=0x0 clear=0x0 riid=ID3D12Resource -> 0x00000000 aliased gpuva=0x2000\n",
prefix + "address=0x3000 base=0x3000 offset=0x0 width=0x100 flags=0x0 state=0x0 clear=0x0 riid=ID3D12Resource -> 0x00000000 not aliased gpuva=0x4000\n",
prefix + "address=0x5000 base=0x5000 offset=0x0 width=0x100 flags=0x0 state=0x0 clear=0x0 riid=ID3D12Resource -> 0x80070057 not aliased gpuva=0x0\n",
prefix + "texture address=0x6000 dim=3 64x64x1 mips=1 fmt=28 samples=1 flags=0x0 layout=0x0 state=0x0 clear=0x0 -> 0x00000000 not aliased []\n",
prefix + "address=0x7000 not committed -> E_INVALIDARG\n",
"x2w-d3d12 Device::slot15 not implemented\n",
]
summary = triage_run.summarize_lines(lines)
outcomes = dict(summary["slot133_outcomes"])
if outcomes != {"aliased": 1, "not_aliased": 2, "failed": 2}:
failures.append(f"slot133 outcomes wrong: {outcomes}")
unhandled = dict(summary["d3d12_unhandled"])
if unhandled != {"Device::slot133": 2, "Device::slot15": 1}:
failures.append(f"slot133 successes counted as unhandled, or failures dropped: {unhandled}")
with tempfile.TemporaryDirectory() as tmp:
(Path(tmp) / "stderr.txt").write_text("".join(lines), encoding="utf-8")
report = triage_run.triage_run(Path(tmp))
if "| 2 | not_aliased |" not in report or "| 1 | aliased |" not in report or "| 2 | failed |" not in report:
failures.append("slot133 outcome table missing from the report:\n" + report)
if "gpuva" in report or "0x4000" in report:
failures.append("slot133 addresses leaked into the report:\n" + report)
# Control: with the old classification (no slot133 rule) the same log counts the successes as unhandled.
saved = (triage_run.RE_D3D12_SLOT133, triage_run.RE_D3D12_SLOT133_UNCOMMITTED)
never = re.compile(r"(?!)")
triage_run.RE_D3D12_SLOT133 = triage_run.RE_D3D12_SLOT133_UNCOMMITTED = never
try:
old = triage_run.summarize_lines(lines)["d3d12_unhandled"]
finally:
triage_run.RE_D3D12_SLOT133, triage_run.RE_D3D12_SLOT133_UNCOMMITTED = saved
if old.get("Device::slot133") != 5:
failures.append(f"control did not reproduce the old unhandled noise: {dict(old)}")


def check_cli_invocation(failures: list[str]) -> None:
with tempfile.TemporaryDirectory() as tmp:
log_file = Path(tmp) / "single.log"
Expand Down Expand Up @@ -230,6 +268,7 @@ def main() -> int:
check_review_regressions(failures)
check_empty_and_missing_dirs(failures)
check_cli_invocation(failures)
check_slot133_outcomes(failures)
for item in failures:
print("FAIL", item)
print(f"startup triage_run checks: {len(failures)} failed")
Expand Down
25 changes: 25 additions & 0 deletions tools/startup/triage_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ def classify_shader_reason(line: str) -> str:
RE_D3D12_IID_PASS = re.compile(r'x2w-d3d12\s+Device::slot([0-9]{1,4})\s+passes an IID:')
RE_D3D12_VIEW_SKIPPED = re.compile(r'x2w-d3d12\s+Device::slot(\d+)\s+view skipped:\s+(.+)$')
RE_D3D12_FORWARDED_RESULT = re.compile(r'::slot\d+\(.*\)\s*->\s*(0x[0-9a-fA-F]+)\s*$')
# Device::slot133 (console CreatePlacedResource at a title address) logs every handled call as
# "... -> 0x<hresult> aliased|not aliased [gpuva=0x...]", so the line does not end at the HRESULT.
RE_D3D12_SLOT133 = re.compile(
r'x2w-d3d12\s+Device::slot133\(CreatePlacedResourceX\?\)\s.*?->\s*(0x[0-9a-fA-F]+)\s+(not aliased|aliased)\b'
)
RE_D3D12_SLOT133_UNCOMMITTED = re.compile(r'x2w-d3d12\s+Device::slot133\(CreatePlacedResourceX\?\)\s+address=\S+\s+not committed\b')
SLOT133_OUTCOMES = ("aliased", "not_aliased", "failed")
RE_D3D12_SLOT_CALL = re.compile(r'x2w-d3d12\s+([A-Za-z0-9_]+::slot\d+)\b')
RE_D3D12_REMOVED = re.compile(
r'x2w-d3d12\s+DEVICE REMOVED,\s+reason\s+(0x[0-9a-fA-F]+),\s+first noticed after\s+(.+)$'
Expand Down Expand Up @@ -180,6 +187,7 @@ def summarize_lines(lines: Iterable[str]) -> dict[str, Counter]:
"""Aggregate startup telemetry counters from an iterable of log lines."""
slot70_refusals: Counter[tuple[str, str, str, str, str, str, str]] = Counter()
d3d12_unhandled: Counter[str] = Counter()
slot133_outcomes: Counter[str] = Counter()
d3d12_debug: Counter[tuple[str, str]] = Counter()
dstorage_failures: Counter[str] = Counter()
dstorage_hresults: Counter[str] = Counter()
Expand Down Expand Up @@ -245,6 +253,15 @@ def summarize_lines(lines: Iterable[str]) -> dict[str, Counter]:
if m:
d3d12_unhandled[f"Device::slot{_dec(m.group(1))} view skipped"] += 1
continue
m = RE_D3D12_SLOT133.search(line)
if m:
_, norm_hr = _is_failed_hresult(m.group(1))
if norm_hr == "0x00000000":
slot133_outcomes[m.group(2).replace(" ", "_")] += 1
continue # a handled placement; only an HRESULT other than 0 is a finding
slot133_outcomes["failed"] += 1 # and falls through to the unhandled count below
elif RE_D3D12_SLOT133_UNCOMMITTED.search(line):
slot133_outcomes["failed"] += 1 # E_INVALIDARG for an uncommitted address, no HRESULT text
m = RE_D3D12_FORWARDED_RESULT.search(line)
if m and not _is_failed_hresult(m.group(1))[0]:
continue # forward_slot()/create_slot() telemetry of a call the desktop device implemented
Expand Down Expand Up @@ -309,6 +326,7 @@ def summarize_lines(lines: Iterable[str]) -> dict[str, Counter]:
return {
"slot70_refusals": slot70_refusals,
"d3d12_unhandled": d3d12_unhandled,
"slot133_outcomes": slot133_outcomes,
"d3d12_debug": d3d12_debug,
"dstorage_failures": dstorage_failures,
"dstorage_hresults": dstorage_hresults,
Expand Down Expand Up @@ -422,6 +440,13 @@ def format_markdown(
)
)

# 2b. Device::slot133 placed resources, by outcome
s133 = summary["slot133_outcomes"]
if s133:
out.extend(["### `Device::slot133` Placed Resources", ""])
s133_rows = [[s133[name], name] for name in SLOT133_OUTCOMES if s133[name]]
out.extend(_format_table(["Count", "Outcome"], s133_rows, len(s133_rows), sum(s133.values()), max_items))

# 3. x2w-d3d12-debug
dbg = summary["d3d12_debug"]
if dbg:
Expand Down
Loading