fix(scripts): dev_packs builds a pack for a profile switch, and a renderer pack with the profile its base had #602

Merged
HumanBean merged 1 commit from HumanBean/Longshot:fix/dev-packs-profile into main 2026-11-14 23:08:40 +00:00
Owner

Why

Since the renderer's profile was committed (#569), every renderer-only pack of a base of main is built without the profile its base has, so renderer A/Bs made with scripts/dev_packs.py compare the change plus the profile's 3-5 %. And RX_VK_PGO=gen dev_packs.py pack, the documented way to make a counting renderer for recording a profile, builds nothing when no file changed, so a recording with it writes nothing (hit on the lab while recording #599).

How to reproduce

Before, on main:

  1. python -I scripts/dev_packs.py base <dir> ... of main: its log says the Vulkan back end: built with the profile .../work/longshot_vk.shipped.profdata.
  2. A pack of a renderer change: python -I scripts/dev_packs.py pack <dir> fix --tree <checkout>: its renderer is built with no RX_VK_PGO (no "built with the profile" line), so it differs from the base by the profile too.
  3. RX_VK_PGO=gen python -I scripts/dev_packs.py pack <dir> vk-count with the base's tree: 0 files changed since the base: nothing to build, pack vk-count: no module differs from the base's.

After: step 2's pack is built with the base's longshot_vk.shipped.profdata, and step 3 builds the renderer (the Vulkan back end: counting its branches for a profile).

What changed

  • scripts: renderer_profile() in scripts/dev_packs.py takes <base work>/longshot_vk.profdata when the base's checkout had its own profile, else longshot_vk.shipped.profdata, the committed one make_game.py unpacked and built the base with.
  • scripts: new pack_route(): cmd_pack builds the renderer when RX_VK_PGO is set and no file changed, and the game when RX_PGO is set; otherwise the route is the changed files' as before.
  • docs: docs/development.md, "The renderer's play profile": pack builds for RX_VK_PGO even when no file changed.
  • tests: tests/test_vk_pgo.py's check_dev_packs: the committed profile's name, the checkout's own first, a counting pack, and pack_route's table; cmd_pack routes through it.

Measurements

Nothing to measure: a development script; it changes which profile a pack is built with and whether a pack builds, not the game. Checked by its game-free checks.

Flags and settings

None (RX_VK_PGO and RX_PGO are existing switches; pack now acts on them).

Testing

Tested: the bug, on the lab (i7-9700K, Linux): RX_VK_PGO=gen dev_packs.py pack of an unchanged tree printed 0 files changed since the base: nothing to build, and the runtime's longshot_vk.so held no RX_VK_PGO_FILE (not a counting build). The fix itself is not run: no checks run on the author's PC (tests/run_all.py left to CI or a tester).

Not tested: a pack built with the fix.

Must be tested:

  • Linux, by hand: RX_VK_PGO=gen python -I scripts/dev_packs.py pack <base of main> vk-count, expecting the renderer alone and counting its branches for a profile in its output, and strings <pack>/longshot_vk.so | grep -c RX_VK_PGO_FILE at 1.
  • Either system, by hand: a renderer pack of a base of main, expecting built with the profile .../longshot_vk.shipped.profdata in its build output.

Risks

A renderer pack now differs from what it was (built with the base's profile, as intended): A/B numbers taken with packs since #569 merged included the profile's effect on the pack side's absence and should be taken again. A developer with RX_PGO in their shell gets a game pack where they got none. Reverting the commit restores the old behaviour.

Issues

See #505

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named). (not run here: left to CI or a tester)
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • A game-free test added for the fix, failing on main and passing here.
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Docs updated.

🤖 Generated with Claude Code

## Why Since the renderer's profile was committed (https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/569), every renderer-only pack of a base of main is built without the profile its base has, so renderer A/Bs made with `scripts/dev_packs.py` compare the change plus the profile's 3-5 %. And `RX_VK_PGO=gen dev_packs.py pack`, the documented way to make a counting renderer for recording a profile, builds nothing when no file changed, so a recording with it writes nothing (hit on the lab while recording https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/599). ## How to reproduce Before, on main: 1. `python -I scripts/dev_packs.py base <dir> ...` of main: its log says `the Vulkan back end: built with the profile .../work/longshot_vk.shipped.profdata`. 2. A pack of a renderer change: `python -I scripts/dev_packs.py pack <dir> fix --tree <checkout>`: its renderer is built with no `RX_VK_PGO` (no "built with the profile" line), so it differs from the base by the profile too. 3. `RX_VK_PGO=gen python -I scripts/dev_packs.py pack <dir> vk-count` with the base's tree: `0 files changed since the base: nothing to build`, `pack vk-count: no module differs from the base's`. After: step 2's pack is built with the base's `longshot_vk.shipped.profdata`, and step 3 builds the renderer (`the Vulkan back end: counting its branches for a profile`). ## What changed - scripts: `renderer_profile()` in `scripts/dev_packs.py` takes `<base work>/longshot_vk.profdata` when the base's checkout had its own profile, else `longshot_vk.shipped.profdata`, the committed one `make_game.py` unpacked and built the base with. - scripts: new `pack_route()`: `cmd_pack` builds the renderer when `RX_VK_PGO` is set and no file changed, and the game when `RX_PGO` is set; otherwise the route is the changed files' as before. - docs: `docs/development.md`, "The renderer's play profile": `pack` builds for `RX_VK_PGO` even when no file changed. - tests: `tests/test_vk_pgo.py`'s `check_dev_packs`: the committed profile's name, the checkout's own first, a counting pack, and `pack_route`'s table; `cmd_pack` routes through it. ## Measurements Nothing to measure: a development script; it changes which profile a pack is built with and whether a pack builds, not the game. Checked by its game-free checks. ### Flags and settings None (`RX_VK_PGO` and `RX_PGO` are existing switches; `pack` now acts on them). ## Testing **Tested:** the bug, on the lab (i7-9700K, Linux): `RX_VK_PGO=gen dev_packs.py pack` of an unchanged tree printed `0 files changed since the base: nothing to build`, and the runtime's `longshot_vk.so` held no `RX_VK_PGO_FILE` (not a counting build). The fix itself is not run: no checks run on the author's PC (`tests/run_all.py` left to CI or a tester). **Not tested:** a pack built with the fix. **Must be tested:** - Linux, by hand: `RX_VK_PGO=gen python -I scripts/dev_packs.py pack <base of main> vk-count`, expecting `the renderer alone` and `counting its branches for a profile` in its output, and `strings <pack>/longshot_vk.so | grep -c RX_VK_PGO_FILE` at 1. - Either system, by hand: a renderer pack of a base of main, expecting `built with the profile .../longshot_vk.shipped.profdata` in its build output. ## Risks A renderer pack now differs from what it was (built with the base's profile, as intended): A/B numbers taken with packs since https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/569 merged included the profile's effect on the pack side's absence and should be taken again. A developer with `RX_PGO` in their shell gets a game pack where they got none. Reverting the commit restores the old behaviour. ## Issues See https://git.magicbean.dev/MagicBeanDev/Longshot/issues/505 ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [ ] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). (not run here: left to CI or a tester) - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] A game-free test added for the fix, failing on `main` and passing here. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [x] Docs updated. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(scripts): dev_packs builds a pack for a profile switch, and a renderer pack with the profile its base had
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 3s
CI / Workflow lint (actionlint) (pull_request) Successful in 6s
Third-party parts / As their notes say (pull_request) Successful in 12s
PR description / Description follows the template (pull_request_target) Failing after 16s
fc16462010
Two bugs in scripts/dev_packs.py around the renderer's play profile:

- A renderer pack of a base of main was built without the profile its base had. renderer_profile()
  looked for <base work>/longshot_vk.profdata only, but since the profile was committed
  (#569) a base of main builds with the
  committed one, unpacked as longshot_vk.shipped.profdata. So every renderer A/B pack since then
  differed from its base by the profile as well as the change (about 3-5 % of frame time). It now
  takes the checkout's own profile when the base had one, else the committed one.
- RX_VK_PGO=gen dev_packs.py pack of an unchanged tree said "nothing to build" and the pack held the
  base's ordinary renderer: the counting renderer the profile recording steps ask for was never
  built, and a recording with it wrote nothing. pack_route() now builds the renderer for RX_VK_PGO
  (and the game for RX_PGO) even when no file changed.

tests/test_vk_pgo.py checks both; docs/development.md says pack builds for RX_VK_PGO.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean changed title from WIP: fix(scripts): dev_packs builds a pack for a profile switch, and a renderer pack with the profile its base had to fix(scripts): dev_packs builds a pack for a profile switch, and a renderer pack with the profile its base had 2026-11-14 23:08:35 +00:00
HumanBean deleted branch fix/dev-packs-profile 2026-11-14 23:08:40 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!602
No description provided.