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: 2 additions & 2 deletions core/libs/prx/libSceAgcDriver/tools/FrameReplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1759,12 +1759,12 @@ int run(const Options& options) {
frames += measured.frames;
}
const auto slowest = frameMs.empty() ? 0.0 : *std::max_element(frameMs.begin(), frameMs.end());
std::printf("{\"frames\":%zu,\"replay_s\":%.3f,\"fps\":%.3f,\"frame_ms\":{\"p50\":%.3f,\"p90\":%.3f,\"max\":%.3f,\"each\":[%s]},\"passes\":[%s],\"kept_reservations\":%llu,\"submits\":%llu,\"delta_mib\":%.1f,\"kept_words\":%llu,\"park_restores\":%llu,\"pace_timeouts\":%llu,\"pace_wait_s\":%.3f,\"stale_registrations\":%llu,\"failed_registrations\":%llu,\"skipped_mib\":%.1f,\"threads\":%zu,\"released_waits\":%llu,\"of_them_from_earlier_writes\":%llu,\"of_them_synthesized\":%llu,\"unfinished\":%llu,\"frames_compared\":%zu,\"pixels_identical\":%.6f,\"max_channel_diff\":%d,\"load_s\":%.3f,\"journal_s\":%.3f}\n",
std::printf("{\"frames\":%zu,\"replay_s\":%.3f,\"fps\":%.3f,\"frame_ms\":{\"p50\":%.3f,\"p90\":%.3f,\"max\":%.3f,\"each\":[%s]},\"passes\":[%s],\"kept_reservations\":%llu,\"submits\":%llu,\"delta_mib\":%.1f,\"kept_words\":%llu,\"park_restores\":%llu,\"pace_timeouts\":%llu,\"pace_wait_s\":%.3f,\"stale_registrations\":%llu,\"failed_registrations\":%llu,\"skipped_mib\":%.1f,\"skipped_bytes\":%llu,\"threads\":%zu,\"released_waits\":%llu,\"of_them_from_earlier_writes\":%llu,\"of_them_synthesized\":%llu,\"unfinished\":%llu,\"frames_compared\":%zu,\"pixels_identical\":%.6f,\"max_channel_diff\":%d,\"load_s\":%.3f,\"journal_s\":%.3f}\n",
frames, seconds, seconds > 0 ? static_cast<double>(frames) / seconds : 0.0, percentile(frameMs, 0.5), percentile(frameMs, 0.9), slowest, frameList.c_str(), passList.c_str(),
static_cast<unsigned long long>(replay.keptReservations.load()),
static_cast<unsigned long long>(replay.submits.load()), static_cast<double>(replay.deltaBytes.load()) / (1024.0 * 1024.0), static_cast<unsigned long long>(replay.keptWords.load()), static_cast<unsigned long long>(replay.parkRestores.load()), static_cast<unsigned long long>(replay.paceTimeouts.load()),
replay.paceWaitedSeconds(), static_cast<unsigned long long>(replay.staleRegistrations.load()), static_cast<unsigned long long>(replay.failedRegistrations.load()),
static_cast<double>(replay.skipped.bytes) / (1024.0 * 1024.0), replay.threads, static_cast<unsigned long long>(replay.earlyReleases.load()), static_cast<unsigned long long>(replay.lateReleases.load()),
static_cast<double>(replay.skipped.bytes) / (1024.0 * 1024.0), static_cast<unsigned long long>(replay.skipped.bytes), replay.threads, static_cast<unsigned long long>(replay.earlyReleases.load()), static_cast<unsigned long long>(replay.lateReleases.load()),
static_cast<unsigned long long>(replay.syntheticReleases.load()),
static_cast<unsigned long long>(replay.unfinished), check.compared, check.identical, check.maxDifference, std::chrono::duration<double>(loaded - loadStart).count(), journalSeconds);
std::fflush(stdout);
Expand Down
2 changes: 1 addition & 1 deletion docs/dev/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ Each invocation uses `--strict --no-synthesize --repeat 1`. Capture inspection r

To compare several saved cases, run `python tools/frame_replay_sweep.py --case case-a replay-a --case case-b replay-b`. The bundles must use identical staged capture files, staged baseline runtime files, baseline settings, and `trials`, `warmups`, `timeout`, and `log_mib` values. The command checks the retained evidence and prints a Markdown table of candidate revisions, changed environment keys, and trial outcomes without replaying the capture.

Replay throughput measures the captured driver workload, not title FPS. The native result rounds `skipped_mib` to 0.1 MiB and truncates its `frame_ms.each` values to whole milliseconds; zero reported skips cannot prove zero skipped bytes. Reference comparisons cover final recorded display buffers, not every frame. Capture omissions, original scheduling and mapping history can remain unknown even when all reported checks match. Fresh processes do not retain in-process draw/resource caches, and per-arm application-cache seeds do not control driver caches, GPU clocks or equal cache warmness across builds. Host reports identify the selected GPU and compiled AGC commit, but do not provide a physical-device UUID or dirty state. Staged file hashes do not independently enumerate every library the OS loaded. Live-title performance claims still need the project's same-machine, same-scene summaries and traces.
Replay throughput measures the captured driver workload, not title FPS. The report checks exact `skipped_bytes` when present and uses `skipped_mib` rounded to 0.1 MiB for older results. The native result truncates its `frame_ms.each` values to whole milliseconds. Reference comparisons cover final recorded display buffers, not every frame. Capture omissions, original scheduling and mapping history can remain unknown even when all reported checks match. Fresh processes do not retain in-process draw/resource caches, and per-arm application-cache seeds do not control driver caches, GPU clocks or equal cache warmness across builds. Host reports identify the selected GPU and compiled AGC commit, but do not provide a physical-device UUID or dirty state. Staged file hashes do not independently enumerate every library the OS loaded. Live-title performance claims still need the project's same-machine, same-scene summaries and traces.

## Repeated Vulkan validation

Expand Down
17 changes: 14 additions & 3 deletions tools/frame_replay_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
LIMITATIONS = (
"Replay throughput is not title FPS or a measurement of unrecorded title work.",
"Replay times are printed to 0.001 s; per-frame each values are truncated whole milliseconds.",
"skipped_mib is rounded to 0.1 MiB; zero does not prove that no memory was skipped.",
"Legacy native replay results round skipped_mib to 0.1 MiB, so zero does not prove that no memory was skipped.",
"Host format 1 does not identify a physical-device UUID or the compiled dirty state.",
"Final display-buffer comparisons do not establish every-frame or temporal correctness.",
"Descriptive observations do not establish statistical significance or a trusted speedup.",
Expand Down Expand Up @@ -191,6 +191,15 @@ def parse_replay_host_report(stderr, expected_commit=None):
return host


def _record_skipped_memory(native, issues):
skipped_bytes = native.get("skipped_bytes", 0)
if type(skipped_bytes) is not int or not 0 <= skipped_bytes <= (1 << 64) - 1:
raise ValueError("native replay skipped_bytes must be a nonnegative integer")
issue = "native replay skipped memory ranges"
if (skipped_bytes or native.get("skipped_mib")) and issue not in issues:
issues.append(issue)


def parse_replay_result(stdout, stderr="", expected_commit=None):
result = {"native": None, "host": None, "issues": [], "unknowns": list(LIMITATIONS)}
try:
Expand Down Expand Up @@ -246,6 +255,7 @@ def parse_replay_result(stdout, stderr="", expected_commit=None):
raise ValueError(f"pass.{key} must be a finite nonnegative number")
if len(passes) == 1 and (passes[0]["frames"] != native["frames"] or len(each) != max(0, native["frames"] - 1)):
raise ValueError("native replay pass/frame counts disagree")
_record_skipped_memory(native, result["issues"])
result["native"] = native
for key in ("stale_registrations", "failed_registrations", "pace_timeouts", "of_them_synthesized", "unfinished"):
if native[key]:
Expand All @@ -259,8 +269,6 @@ def parse_replay_result(stdout, stderr="", expected_commit=None):
result["issues"].append("native replay duration is not positive")
if native["fps"] == 0:
result["issues"].append("native replay throughput is not positive")
if native["skipped_mib"]:
result["issues"].append("native replay skipped memory ranges")
if native["frames_compared"] == 0:
result["unknowns"].append("no display reference was compared; pixel fidelity is unavailable")
result["issues"].append("native replay has no compared display reference")
Expand Down Expand Up @@ -449,6 +457,9 @@ def replay_comparison_report(report, markdown=False):
raise ValueError("comparison run assessment is malformed")
if any(not isinstance(item, str) for key in ("issues", "unknowns") for item in assessment[key]):
raise ValueError("comparison assessment diagnostics must be text")
native = assessment.get("native")
if isinstance(native, dict):
_record_skipped_memory(native, assessment["issues"])
observations = {}
healthy = {}
for arm in ("baseline", "candidate"):
Expand Down
36 changes: 36 additions & 0 deletions tools/tests/test_frame_replay_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,42 @@ def test_host_report_preserves_unicode_separators_inside_values(self):
self.assertEqual(parsed["environment"]["VK_LOADER_DEBUG"], "info")
self.assertEqual(parsed["raw"], raw)

def test_exact_skipped_page_disqualifies_an_otherwise_healthy_run(self):
for native, skipped in (
(NATIVE, False),
({**NATIVE, "skipped_bytes": 0}, False),
({**NATIVE, "skipped_bytes": 4096}, True),
({**NATIVE, "skipped_mib": 0.1}, True),
):
with self.subTest(skipped_bytes=native.get("skipped_bytes"), skipped_mib=native["skipped_mib"]):
assessment = report.parse_replay_result(json.dumps(native), HOST, COMMIT)
self.assertEqual(assessment["native"], native)
expected = ["native replay skipped memory ranges"] if skipped else []
self.assertEqual(assessment["issues"], expected)

def test_saved_assessment_cannot_count_a_skipped_page_as_healthy(self):
baseline = report.parse_replay_result(json.dumps(NATIVE), HOST, COMMIT)
candidate = copy.deepcopy(baseline)
candidate["native"]["skipped_bytes"] = 4096
trial = {"phase": "trial", "iteration": 1, "returncode": 0, "timed_out": False, "log_limit": False}
payload = {"format": "aps5-frame-replay-comparison/1", "complete": True,
"runs": [{**trial, "arm": "baseline", "assessment": baseline},
{**trial, "arm": "candidate", "assessment": candidate}]}
result = report.replay_comparison_report(payload)
self.assertEqual(result["observations"]["baseline"]["healthy_trials"], 1)
self.assertEqual(result["observations"]["candidate"]["healthy_trials"], 0)
self.assertEqual(result["runs"][1]["assessment"]["issues"], ["native replay skipped memory ranges"])
self.assertEqual(candidate["issues"], [])

def test_invalid_exact_skip_count_fails_native_result_validation(self):
for skipped_bytes in (-1, 0.0, False, None, 1 << 64):
with self.subTest(skipped_bytes=skipped_bytes):
native = {**NATIVE, "skipped_bytes": skipped_bytes}
assessment = report.parse_replay_result(json.dumps(native), HOST, COMMIT)
self.assertIsNone(assessment["native"])
self.assertIn("native replay result: native replay skipped_bytes must be a nonnegative integer",
assessment["issues"])

def test_native_unavailable_reasons_belong_to_the_host_report(self):
reasons = ["cpu: cpuid", "memory: no source", "os: uname failed"]
raw = HOST + "[unavailable]\n" + "\n".join(reasons) + "\n"
Expand Down
Loading