Scripts: generate flamegraphs for Criterion benchmarks #1153

Open
github-bot wants to merge 3 commits from github-bot/gh-1153 into main AGit
Owner

@⁠bmjask on GitHub · 2026-11-24 12:35 UTC · original
bmjask:perf/benchmark-flamegraphs → main · +961 −0 · 9 files · 3 commits · open

Adds a Windows flamegraph wrapper for the benchmark targets, stacked on #1152. It validates the selected target, forwards an optional Criterion filter, and writes SVG output under target/flamegraphs by default.

What is in it

  • scripts/flamegraph.ps1: validated cargo-flamegraph wrapper and output handling
  • Cargo.toml and README.md: profiling configuration and usage
  • Includes the benchmark foundation and runtime targets from #1148 and #1152 because the branch is stacked

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB, driver 616.64; Ryzen 7 9800X3D; Windows 11 Home 26300; Rust 1.100.0 MSVC; debug
  • External report on exact head c09b78f: cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 741 passed, 0 failed, 41 ignored; skipped gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (no wave64)
  • cargo bench -p xcl --benches -- --test: all four targets built and all 68 benchmarks succeeded

Regression run

  • The diff adds Criterion as a dev-dependency, benchmark targets, documentation and generated lockfile entries. It also adds a bench-only debug-symbol profile and a profiling script. No production source files change. Requesting maintainer review for the documented test-only approval on this revision. No paired retail smoke results are available.

Not tested

  • scripts/flamegraph.ps1 end to end (requires cargo-flamegraph and an elevated shell), AMD, release, or a retail title; no benchmark timings were taken

AI use

  • OpenAI Codex with GPT-5 wrote the implementation. Claude Code with Claude Opus 5.5 ran the external validation and wrote the test report; the contributor checked it before posting.

  • OpenAI Codex (GPT-6.2 Astra) checked the changed files and CI logs and revised the title and regression-run explanation.

**@⁠bmjask** on GitHub · 2026-11-24 12:35 UTC · [original](https://github.com/xcl-dev/xcl/pull/1153) `bmjask:perf/benchmark-flamegraphs` → `main` · +961 −0 · 9 files · 3 commits · open Adds a Windows flamegraph wrapper for the benchmark targets, stacked on #1152. It validates the selected target, forwards an optional Criterion filter, and writes SVG output under `target/flamegraphs` by default. **What is in it** - `scripts/flamegraph.ps1`: validated `cargo-flamegraph` wrapper and output handling - `Cargo.toml` and `README.md`: profiling configuration and usage - Includes the benchmark foundation and runtime targets from #1148 and #1152 because the branch is stacked **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB, driver 616.64; Ryzen 7 9800X3D; Windows 11 Home 26300; Rust 1.100.0 MSVC; debug - External report on exact head `c09b78f`: `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: 741 passed, 0 failed, 41 ignored; skipped `gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware` (no wave64) - `cargo bench -p xcl --benches -- --test`: all four targets built and all 68 benchmarks succeeded **Regression run** - The diff adds Criterion as a dev-dependency, benchmark targets, documentation and generated lockfile entries. It also adds a bench-only debug-symbol profile and a profiling script. No production source files change. Requesting maintainer review for the documented `test-only` approval on this revision. No paired retail smoke results are available. **Not tested** - `scripts/flamegraph.ps1` end to end (requires `cargo-flamegraph` and an elevated shell), AMD, release, or a retail title; no benchmark timings were taken **AI use** - OpenAI Codex with GPT-5 wrote the implementation. Claude Code with Claude Opus 5.5 ran the external validation and wrote the test report; the contributor checked it before posting. - OpenAI Codex (GPT-6.2 Astra) checked the changed files and CI logs and revised the title and regression-run explanation.
Add Criterion targets for the RDNA2 decoder, descriptors, parsers, shader-pack scans, and PE parsing. Inputs are generated or come from the benchmark executable, so the suite does not require game data. Use std::hint::black_box with Criterion 0.7 to avoid deprecated benchmark APIs.\n\nAssisted-by: OpenAI Codex (GPT-5)
Add generated-input Criterion coverage for shader decoding and translation, mesh-wave analysis, descriptor conversion, configuration, utility, and VFS paths. Correct throughput units so benchmark reports describe the work each case actually processes.\n\nAssisted-by: OpenAI Codex (GPT-5)
Add a Windows wrapper for cargo-flamegraph with benchmark and Criterion-filter selection, symbolized bench builds, deterministic output paths, and early dependency/elevation checks. The wrapper never installs tools or requests elevation.\n\nAssisted-by: OpenAI Codex (GPT-5)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:45:17 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 14:30 UTC · original

Full-suite run, since this PR has no test report yet. Tested exact head c09b78f (on its base 47efa2e).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 741 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • cargo bench -p xcl --benches -- --test (each benchmark run once): all four bench targets (core, formats, gpu_cpu, runtime) build in the bench profile, and all 68 benchmarks report Success. No timings taken.

Not tested

  • scripts/flamegraph.ps1 (needs cargo-flamegraph and an elevated shell), AMD, a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-24 14:30 UTC · [original](https://github.com/xcl-dev/xcl/pull/1153#issuecomment-7134481028) Full-suite run, since this PR has no test report yet. Tested exact head `c09b78f` (on its base `47efa2e`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: **741 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - `cargo bench -p xcl --benches -- --test` (each benchmark run once): all four bench targets (`core`, `formats`, `gpu_cpu`, `runtime`) build in the bench profile, and all 68 benchmarks report `Success`. No timings taken. **Not tested** - `scripts/flamegraph.ps1` (needs `cargo-flamegraph` and an elevated shell), AMD, a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 08:02 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 08:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/1153#issuecomment-7156531899) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠ivall on GitHub · 2026-11-25 13:51 UTC · original

Review of head c09b78f (stacked on #1152 and #1148). I read the whole diff before building. The new parts beyond the benchmarks are scripts/flamegraph.ps1 and a [profile.bench] debug = 1 in the root Cargo.toml. The script runs cargo flamegraph --package xcl --bench <one of four validated names> --output <path> -- [filter] --bench; the bench name comes from a ValidateSet, arguments are passed as an array (no string evaluation), it installs nothing and does not elevate (it only checks). No network, no build.rs, no workflow changes, no binaries. The script itself has not been run end to end (needs cargo-flamegraph and an elevated shell; I did not run it) and has no test.

Tested on this tree (#1148 + #1152 + #1153 merged onto current main): AMD RDNA4, Windows, DXC 1.8.2502.11, debug.

  • cargo build --workspace: ok
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1263 passed, 2 failed, 46 ignored; the two failures are the known fuzz_validate_and_gpu_1 and _3 (#2115), also failing on main. The kernelx tests that failed once in #1152's CI passed here.
  • cargo bench -p xcl --bench core|formats|gpu_cpu|runtime -- --test: 2 + 19 + 18 + 29 = 68 benchmarks succeeded. No timings taken.

Dependencies: criterion 0.7 is dev-only, no existing crate bumped, but its transitive ciborium, ciborium-io, ciborium-ll are Apache-2.0 only, which CONTRIBUTING.md excludes. cargo-flamegraph is an external tool, not a dependency. Not merging until the licence question in #1148 is decided; leaving this PR open.

AI use: Claude Code (Claude Sonnet 5.5) read the diff, ran the tests and wrote this on the maintainer's behalf.

**@⁠ivall** on GitHub · 2026-11-25 13:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/1153#issuecomment-7164399821) Review of head c09b78f (stacked on #1152 and #1148). I read the whole diff before building. The new parts beyond the benchmarks are `scripts/flamegraph.ps1` and a `[profile.bench] debug = 1` in the root Cargo.toml. The script runs `cargo flamegraph --package xcl --bench <one of four validated names> --output <path> -- [filter] --bench`; the bench name comes from a ValidateSet, arguments are passed as an array (no string evaluation), it installs nothing and does not elevate (it only checks). No network, no build.rs, no workflow changes, no binaries. The script itself has not been run end to end (needs cargo-flamegraph and an elevated shell; I did not run it) and has no test. Tested on this tree (#1148 + #1152 + #1153 merged onto current main): AMD RDNA4, Windows, DXC 1.8.2502.11, debug. - `cargo build --workspace`: ok - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 1263 passed, 2 failed, 46 ignored; the two failures are the known `fuzz_validate_and_gpu_1` and `_3` (#2115), also failing on main. The kernelx tests that failed once in #1152's CI passed here. - `cargo bench -p xcl --bench core|formats|gpu_cpu|runtime -- --test`: 2 + 19 + 18 + 29 = 68 benchmarks succeeded. No timings taken. Dependencies: criterion 0.7 is dev-only, no existing crate bumped, but its transitive `ciborium`, `ciborium-io`, `ciborium-ll` are Apache-2.0 only, which CONTRIBUTING.md excludes. cargo-flamegraph is an external tool, not a dependency. Not merging until the licence question in #1148 is decided; leaving this PR open. AI use: Claude Code (Claude Sonnet 5.5) read the diff, ran the tests and wrote this on the maintainer's behalf.
Author
Owner

@⁠RavenCurseBurg on GitHub · 2026-11-26 00:06 UTC · original · edited 2026-11-26 00:13 UTC

I tested the Windows preflight on c09b78fe74856039e15bcbaf99993a2ba091e1f7 from an ordinary (non-administrator) account. With PATH limited to temporary native stand-ins, the real wrapper rejected an invalid benchmark name, a valid benchmark with no profiler installed, and a valid benchmark with the profiler visible but no administrator rights. In each case the diagnostic identified the corresponding cause, the caller remained in the original directory, no command stand-in ran, and no SVG appeared.

Test-only fixture. I ran -NoProfile -NonInteractive -ExecutionPolicy Bypass -File scripts/flamegraph-preflight.tests.ps1 under Windows PowerShell 5.1 and PowerShell 7.6.9; all three cases passed in each shell. Windows 11, Core i7-13700. No elevated profiling session, benchmark build, or flamegraph generation was run. OpenAI Codex (GPT-6) wrote the fixture and ran it.

**@⁠RavenCurseBurg** on GitHub · 2026-11-26 00:06 UTC · [original](https://github.com/xcl-dev/xcl/pull/1153#issuecomment-7178402867) · edited 2026-11-26 00:13 UTC I tested the Windows preflight on `c09b78fe74856039e15bcbaf99993a2ba091e1f7` from an ordinary (non-administrator) account. With PATH limited to temporary native stand-ins, the real wrapper rejected an invalid benchmark name, a valid benchmark with no profiler installed, and a valid benchmark with the profiler visible but no administrator rights. In each case the diagnostic identified the corresponding cause, the caller remained in the original directory, no command stand-in ran, and no SVG appeared. [Test-only fixture](https://github.com/RavenCurseBurg/xcl/commit/61ecbb56517bf95ff65365977d80865fc0a83e33). I ran `-NoProfile -NonInteractive -ExecutionPolicy Bypass -File scripts/flamegraph-preflight.tests.ps1` under Windows PowerShell 5.1 and PowerShell 7.6.9; all three cases passed in each shell. Windows 11, Core i7-13700. No elevated profiling session, benchmark build, or flamegraph generation was run. OpenAI Codex (GPT-6) wrote the fixture and ran it.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1153/head:github-bot/gh-1153'
git switch 'github-bot/gh-1153'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1153'
git switch 'github-bot/gh-1153'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1153'
git switch 'github-bot/gh-1153'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1153'
git switch 'main'
git merge --squash 'github-bot/gh-1153'
git switch 'main'
git merge --ff-only 'github-bot/gh-1153'
git switch 'main'
git merge 'github-bot/gh-1153'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.