diff options
| author | thementorswtor <359662566+thementorswtor@users.noreply.github.com> | 2026-11-22 14:23:53 -0300 |
|---|---|---|
| committer | thementorswtor <359662566+thementorswtor@users.noreply.github.com> | 2026-11-22 14:23:53 -0300 |
| commit | 2de7683f43be84ee3c7c70c243d1e5bda8eaf653 (patch) | |
| tree | 61b12bb6894f70c5f1bdaf98120168a6d058ced1 /tools/progress_dashboard.py | |
| parent | 9a82abceb304b2d04ca6f3699207e2948c397227 (diff) | |
progress_dashboard: read make_game.py's shaders folder; add a GPU-test panel
- corpus: make_game.py writes <work>/shaders/dxbc and <work>/shaders/spirv; the tool
looked for <work>/dxbc and <work>/spirv and found nothing on a real work folder. The
shaders folder itself is accepted too. The test now builds that layout.
- GPU tests: --gpu-log <file>[=<GPU, driver, OS>] reads the saved output of
runtime/test/shaders/check.py, one group per GPU. ok is a pass, SKIP is not counted,
anything else is a failure with its one-line detail; a log older than the last commit
touching runtime/test/shaders or tools/rdna2spirv.py counts as needing a re-run.
Result lines are told from the other lines check.py prints by its {name:20} column.
Checked on a real work folder: 26,501 of 26,503 carved shaders pass spirv-val, and none
of the 26,503 shader names appears in the page or the JSON.
Diffstat (limited to 'tools/progress_dashboard.py')
| -rw-r--r-- | tools/progress_dashboard.py | 85 |
1 files changed, 77 insertions, 8 deletions
diff --git a/tools/progress_dashboard.py b/tools/progress_dashboard.py index d22b52284..9ac59e62e 100644 --- a/tools/progress_dashboard.py +++ b/tools/progress_dashboard.py | |||
| @@ -13,9 +13,10 @@ Sources, each optional and reported as missing rather than counted as zero when | |||
| 13 | unit tests --run-tests runs tests/test_*.py the way CI selects them (standard-library files with a | 13 | unit tests --run-tests runs tests/test_*.py the way CI selects them (standard-library files with a |
| 14 | __main__ block), one process each; the outcome and the commit it ran on are kept | 14 | __main__ block), one process each; the outcome and the commit it ran on are kept |
| 15 | ctest runtime/build/Testing/Temporary/LastTest.log, and any --junit file (CTest or pytest flavour) | 15 | ctest runtime/build/Testing/Temporary/LastTest.log, and any --junit file (CTest or pytest flavour) |
| 16 | gpu tests --gpu-log: saved output of runtime/test/shaders/check.py, one panel group per GPU | ||
| 16 | contract the translator contract table in docs/design.md, by how each row says it was confirmed | 17 | contract the translator contract table in docs/design.md, by how each row says it was confirmed |
| 17 | imports the measured import tables in docs/runtime_imports.md | 18 | imports the measured import tables in docs/runtime_imports.md |
| 18 | corpus --work: counts per stage from <work>/dxbc/index.json and <work>/spirv/index.json | 19 | corpus --work: counts per stage from <work>/shaders/dxbc/index.json and <work>/shaders/spirv/index.json |
| 19 | github --github, read-only through `gh`: latest CI runs on main, the D3D- table of #313, the | 20 | github --github, read-only through `gh`: latest CI runs on main, the D3D- table of #313, the |
| 20 | coordination issue's section sizes and, with --login, that account's claims and pull requests | 21 | coordination issue's section sizes and, with --login, that account's claims and pull requests |
| 21 | 22 | ||
| @@ -408,6 +409,69 @@ def collect_ctest(col, args): | |||
| 408 | "tests that passed after the last commit touching runtime/ / tests recorded") | 409 | "tests that passed after the last commit touching runtime/ / tests recorded") |
| 409 | 410 | ||
| 410 | 411 | ||
| 412 | # ----------------------------------------------------------------------------------------------- GPU tests | ||
| 413 | GPU_LINE = re.compile(r"^(\S+)\s+(ok|SKIP \(.*\)|.+)$") | ||
| 414 | GPU_SUMMARY = re.compile(r"^(\d+) of (\d+) pass, (\d+) skipped") | ||
| 415 | |||
| 416 | |||
| 417 | def parse_gpu_log(text): | ||
| 418 | """[(shader test, result, detail)] from the output of runtime/test/shaders/check.py (one line per test, | ||
| 419 | "<name> ok", "<name> SKIP (why)" or "<name> <what came back>", then "N of M pass, K skipped").""" | ||
| 420 | rows, summary = [], None | ||
| 421 | for line in text.splitlines(): | ||
| 422 | m = GPU_SUMMARY.match(line.strip()) | ||
| 423 | if m: | ||
| 424 | summary = tuple(int(x) for x in m.groups()) | ||
| 425 | continue | ||
| 426 | m = GPU_LINE.match(line.rstrip()) | ||
| 427 | # check.py prints f"{name:20} {result}": the result starts right after the name padded to 20 columns, | ||
| 428 | # which tells result lines from the other lines it prints (the build folder it picked, warnings) | ||
| 429 | if not m or not re.fullmatch(r"[A-Za-z0-9_.]+", m.group(1)) or m.start(2) != max(len(m.group(1)), 20) + 1: | ||
| 430 | continue | ||
| 431 | name, rest = m.group(1), m.group(2).strip() | ||
| 432 | if rest == "ok": | ||
| 433 | rows.append((name, "pass", "")) | ||
| 434 | elif rest.startswith("SKIP"): | ||
| 435 | rows.append((name, "skip", rest)) | ||
| 436 | else: | ||
| 437 | rows.append((name, "fail", scrub(rest))) | ||
| 438 | return rows, summary | ||
| 439 | |||
| 440 | |||
| 441 | def collect_gpu(col, logs): | ||
| 442 | col.panel("gpu", "GPU tests (hand-written RDNA2 programs)", "test programs") | ||
| 443 | if not logs: | ||
| 444 | col.source("gpu_logs", None, "missing", note="pass --gpu-log <saved check.py output>[=<GPU, driver, OS>]") | ||
| 445 | return | ||
| 446 | changed = max(t for t in (last_commit_time("runtime/test/shaders"), last_commit_time("tools/rdna2spirv.py"), 0) if t is not None) | ||
| 447 | for spec in logs: | ||
| 448 | path, _, label = spec.partition("=") | ||
| 449 | if not os.path.isfile(path): | ||
| 450 | col.source("gpu_log", path, "missing") | ||
| 451 | continue | ||
| 452 | rows, summary = parse_gpu_log(read_text(path)) | ||
| 453 | label = label or os.path.splitext(os.path.basename(path))[0] | ||
| 454 | note = None | ||
| 455 | if summary and summary[1] != len(rows): | ||
| 456 | note = f"summary says {summary[1]} tests, {len(rows)} lines parsed" | ||
| 457 | col.source("gpu_log", path, "ok" if rows else "invalid", len(rows), note=note) | ||
| 458 | ran = os.path.getmtime(path) | ||
| 459 | for name, res, detail in rows: | ||
| 460 | if res == "fail": | ||
| 461 | status, fresh = "failed", "failed" | ||
| 462 | elif res == "skip": | ||
| 463 | status, fresh = "unknown", "unknown" | ||
| 464 | elif changed and ran < changed: | ||
| 465 | status, fresh = "partial", "revalidation_required" | ||
| 466 | else: | ||
| 467 | status, fresh = "verified", "current" | ||
| 468 | col.add(f"gpu.{label}.{name}", "gpu", label, name, status, detail=detail or None, freshness=fresh, ran_at=iso(ran)) | ||
| 469 | tested = [c for c in col.components if c["panel"] == "gpu" and c["status"] != "unknown"] | ||
| 470 | if tested: | ||
| 471 | col.metric("gpu.current", "gpu", "GPU test programs passing on the current translator", sum(c["status"] == "verified" for c in tested), | ||
| 472 | len(tested), "programs ok after the last commit touching runtime/test/shaders or tools/rdna2spirv.py / programs run (skips excluded)") | ||
| 473 | |||
| 474 | |||
| 411 | # ----------------------------------------------------------------------------------------------- docs | 475 | # ----------------------------------------------------------------------------------------------- docs |
| 412 | def md_tables(text): | 476 | def md_tables(text): |
| 413 | """[(heading, header_cells, rows, first_line)] for every pipe table in a Markdown text.""" | 477 | """[(heading, header_cells, rows, first_line)] for every pipe table in a Markdown text.""" |
| @@ -548,9 +612,11 @@ def collect_corpus(col, work): | |||
| 548 | if not work: | 612 | if not work: |
| 549 | col.source("corpus", None, "missing", note="pass --work <work> to count your own translation run") | 613 | col.source("corpus", None, "missing", note="pass --work <work> to count your own translation run") |
| 550 | return | 614 | return |
| 551 | carved_p, spirv_p = os.path.join(work, "dxbc", "index.json"), os.path.join(work, "spirv", "index.json") | 615 | # make_game.py writes <work>/shaders/dxbc and <work>/shaders/spirv; the shaders folder itself is accepted too |
| 616 | shaders = os.path.join(work, "shaders") if os.path.isdir(os.path.join(work, "shaders", "dxbc")) else work | ||
| 617 | carved_p, spirv_p = os.path.join(shaders, "dxbc", "index.json"), os.path.join(shaders, "spirv", "index.json") | ||
| 552 | if not os.path.isfile(carved_p): | 618 | if not os.path.isfile(carved_p): |
| 553 | col.source("corpus", carved_p, "missing", note="no <work>/dxbc/index.json") | 619 | col.source("corpus", None, "missing", note="no <work>/shaders/dxbc/index.json (run make_game.py's shaders stage)") |
| 554 | return | 620 | return |
| 555 | carved = json.loads(read_text(carved_p)) | 621 | carved = json.loads(read_text(carved_p)) |
| 556 | entries = carved if isinstance(carved, list) else list(carved.values()) | 622 | entries = carved if isinstance(carved, list) else list(carved.values()) |
| @@ -566,10 +632,10 @@ def collect_corpus(col, work): | |||
| 566 | st = meta.get("stage") or "unknown" | 632 | st = meta.get("stage") or "unknown" |
| 567 | per_stage.setdefault(st, [0, 0])[1] += 1 | 633 | per_stage.setdefault(st, [0, 0])[1] += 1 |
| 568 | validated_total += 1 | 634 | validated_total += 1 |
| 569 | col.source("corpus_spirv", "<work>/spirv/index.json", "ok", len(spirv)) | 635 | col.source("corpus_spirv", "<work>/shaders/spirv/index.json", "ok", len(spirv)) |
| 570 | else: | 636 | else: |
| 571 | col.source("corpus_spirv", "<work>/spirv/index.json", "missing", note="translation not finished") | 637 | col.source("corpus_spirv", "<work>/shaders/spirv/index.json", "missing", note="translation not finished") |
| 572 | col.source("corpus_carved", "<work>/dxbc/index.json", "ok", len(entries)) | 638 | col.source("corpus_carved", "<work>/shaders/dxbc/index.json", "ok", len(entries)) |
| 573 | for st, (n_carved, n_valid) in sorted(per_stage.items()): | 639 | for st, (n_carved, n_valid) in sorted(per_stage.items()): |
| 574 | stage = str(st) | 640 | stage = str(st) |
| 575 | if n_valid: | 641 | if n_valid: |
| @@ -580,7 +646,7 @@ def collect_corpus(col, work): | |||
| 580 | col.add(f"corpus.{stage}.not_validated", "corpus", stage, f"{stage}: not translated or rejected by spirv-val", | 646 | col.add(f"corpus.{stage}.not_validated", "corpus", stage, f"{stage}: not translated or rejected by spirv-val", |
| 581 | "failed", detail=f"{rest:,} of {n_carved:,} carved", weight=rest, count=rest) | 647 | "failed", detail=f"{rest:,} of {n_carved:,} carved", weight=rest, count=rest) |
| 582 | col.metric("corpus.validated", "corpus", "Carved shaders that translate and pass spirv-val", validated_total, len(entries), | 648 | col.metric("corpus.validated", "corpus", "Carved shaders that translate and pass spirv-val", validated_total, len(entries), |
| 583 | "entries in <work>/spirv/index.json without an error / entries in <work>/dxbc/index.json", | 649 | "entries in <work>/shaders/spirv/index.json without an error / entries in <work>/shaders/dxbc/index.json", |
| 584 | note="validation is not execution: nothing here says a shader's output is right") | 650 | note="validation is not execution: nothing here says a shader's output is right") |
| 585 | col.notes.append("corpus: counts come from your own work folder; no shader name or path is stored") | 651 | col.notes.append("corpus: counts come from your own work folder; no shader name or path is stored") |
| 586 | 652 | ||
| @@ -702,6 +768,7 @@ def build(args, out_dir): | |||
| 702 | g = git_info() | 768 | g = git_info() |
| 703 | collect_unit(col, out_dir, args) | 769 | collect_unit(col, out_dir, args) |
| 704 | collect_ctest(col, args) | 770 | collect_ctest(col, args) |
| 771 | collect_gpu(col, args.gpu_log) | ||
| 705 | collect_contract(col) | 772 | collect_contract(col) |
| 706 | collect_imports(col) | 773 | collect_imports(col) |
| 707 | collect_corpus(col, args.work) | 774 | collect_corpus(col, args.work) |
| @@ -710,7 +777,7 @@ def build(args, out_dir): | |||
| 710 | col.source("github", None, "skipped", note="pass --github to read CI, #313 and the coordination issue") | 777 | col.source("github", None, "skipped", note="pass --github to read CI, #313 and the coordination issue") |
| 711 | snap = { | 778 | snap = { |
| 712 | "schema": SCHEMA, "generated_at": iso(now_utc()), "git": g, | 779 | "schema": SCHEMA, "generated_at": iso(now_utc()), "git": g, |
| 713 | "panels": [col.panels[k] for k in ("tests", "runtime", "contract", "imports", "corpus", "d3d12", "ci") if k in col.panels], | 780 | "panels": [col.panels[k] for k in ("tests", "runtime", "gpu", "contract", "imports", "corpus", "d3d12", "ci") if k in col.panels], |
| 714 | "counts": counts_by_panel(col.components), "components": col.components, "metrics": col.metrics, | 781 | "counts": counts_by_panel(col.components), "components": col.components, "metrics": col.metrics, |
| 715 | "sources": col.sources, "notes": col.notes, "github": gh, | 782 | "sources": col.sources, "notes": col.notes, "github": gh, |
| 716 | } | 783 | } |
| @@ -754,6 +821,8 @@ def main(argv=None): | |||
| 754 | ap.add_argument("--jobs", type=int, default=max(1, (os.cpu_count() or 2) // 2), help="test processes at a time") | 821 | ap.add_argument("--jobs", type=int, default=max(1, (os.cpu_count() or 2) // 2), help="test processes at a time") |
| 755 | ap.add_argument("--test-timeout", type=int, default=300, help="seconds per test file") | 822 | ap.add_argument("--test-timeout", type=int, default=300, help="seconds per test file") |
| 756 | ap.add_argument("--junit", nargs="*", metavar="FILE", help="CTest --output-junit or pytest --junitxml files") | 823 | ap.add_argument("--junit", nargs="*", metavar="FILE", help="CTest --output-junit or pytest --junitxml files") |
| 824 | ap.add_argument("--gpu-log", nargs="*", metavar="FILE[=LABEL]", | ||
| 825 | help="saved output of runtime/test/shaders/check.py; LABEL names the GPU, driver and OS") | ||
| 757 | ap.add_argument("--github", action="store_true", help="read CI runs, #313 and the coordination issue through gh") | 826 | ap.add_argument("--github", action="store_true", help="read CI runs, #313 and the coordination issue through gh") |
| 758 | ap.add_argument("--repo", default=DEFAULT_REPO, help=f"GitHub repository (default {DEFAULT_REPO})") | 827 | ap.add_argument("--repo", default=DEFAULT_REPO, help=f"GitHub repository (default {DEFAULT_REPO})") |
| 759 | ap.add_argument("--login", help="with --github, show this account's claims and pull requests") | 828 | ap.add_argument("--login", help="with --github, show this account's claims and pull requests") |