runtime: generate shared BCPack tables once in parallel builds #1628

Open
github-bot wants to merge 1 commit from github-bot/gh-1628 into main AGit
Owner

@⁠sodove on GitHub · 2026-11-25 06:18 UTC · original
sodove:fix/bcpack-tables-build-race → main · +6 −2 · 1 files · 1 commits · open

Claimed in the coordination issue as: RT-BCPACK-TABLES-BUILD-RACE.

What and why

On a clean parallel Visual Studio build, both the history trainer and the runtime decoder ran the generator for bcpack_tables.inc. One observed build failed with Python PermissionError and MSBuild MSB8066. A clean build of 42537e7b6 ran it twice even when the build succeeded.

Give the existing output rule a single CMake target and make both consumers depend on it. Their C++ compile steps can still run in parallel once the include exists. The generator, its inputs and the generated bytes are unchanged.

Tested

Native Windows 11 x64, MSVC, RelWithDebInfo. All inputs were synthetic or from the repository.

Check Result
Visual Studio 2022, clean parallel build One project owns the generator rule (two on base), one generator invocation
Rebuild with no changes, then rebuild after removing the generated include Zero invocations, then one. Both consumers recompiled and the regenerated include matched the clean build byte for byte.
Ninja, touch a generator input in a scratch source tree One invocation and both consumers recompiled. The next build did no work.
History trainer on one valid and one malformed synthetic stream Both builds accepted one, rejected one and produced identical output.
CPU-only runtime CTest 144 passed, including dstorage. Seven package-dependent tests skipped and two SDL tests were disabled.
Translator semantic suite 487 files, 6,279 tests, zero failing files.
BCPack table unit tests 55 passed.

GPUs tested: n/a (host build and CPU tests).

AI-assisted: yes (OpenAI Codex).

Checklist

  • Based on current main.
  • One topic.
  • No game data, keys or decryption.
  • Translator contract update is inapplicable to this build change.
**@⁠sodove** on GitHub · 2026-11-25 06:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1628) `sodove:fix/bcpack-tables-build-race` → `main` · +6 −2 · 1 files · 1 commits · open Claimed in the coordination issue as: [RT-BCPACK-TABLES-BUILD-RACE](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608). ### What and why On a clean parallel Visual Studio build, both the history trainer and the runtime decoder ran the generator for `bcpack_tables.inc`. One observed build failed with Python `PermissionError` and MSBuild `MSB8066`. A clean build of `42537e7b6` ran it twice even when the build succeeded. Give the existing output rule a single CMake target and make both consumers depend on it. Their C++ compile steps can still run in parallel once the include exists. The generator, its inputs and the generated bytes are unchanged. ### Tested Native Windows 11 x64, MSVC, RelWithDebInfo. All inputs were synthetic or from the repository. | Check | Result | | --- | --- | | Visual Studio 2022, clean parallel build | One project owns the generator rule (two on base), one generator invocation | | Rebuild with no changes, then rebuild after removing the generated include | Zero invocations, then one. Both consumers recompiled and the regenerated include matched the clean build byte for byte. | | Ninja, touch a generator input in a scratch source tree | One invocation and both consumers recompiled. The next build did no work. | | History trainer on one valid and one malformed synthetic stream | Both builds accepted one, rejected one and produced identical output. | | CPU-only runtime CTest | 144 passed, including `dstorage`. Seven package-dependent tests skipped and two SDL tests were disabled. | | Translator semantic suite | 487 files, 6,279 tests, zero failing files. | | BCPack table unit tests | 55 passed. | GPUs tested: n/a (host build and CPU tests). AI-assisted: yes (OpenAI Codex). ### Checklist - [x] Based on current `main`. - [x] One topic. - [x] No game data, keys or decryption. - [x] Translator contract update is inapplicable to this build change.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:58:37 +00:00
Author
Owner

@⁠whoalin1 on GitHub · 2026-11-25 10:35 UTC · original

Independent verification (Windows): CMakeLists-only change replacing ${bcpack_tables} as a source with phony gta6rt_bcpack_tables target + add_dependencies — the canonical fix for the MSBuild double-generation race. Verified live under Ninja: build.ninja has exactly one CUSTOM_COMMAND edge for bcpack_tables.inc; clean build generates once before both consumers; touch tools/bcpack_tables.py + ninja -n plans exactly one generation then parallel compiles+links — incremental correctness preserved. Full compile blocked by a sandbox /Zi debug-records issue (reproduced with trivial t.cpp — environmental, base fails identically); author's VS2022 clean-parallel claim is consistent with the standard pattern. AI-assisted verification.

**@⁠whoalin1** on GitHub · 2026-11-25 10:35 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1628#issuecomment-7159898497) Independent verification (Windows): CMakeLists-only change replacing `${bcpack_tables}` as a *source* with phony `gta6rt_bcpack_tables` target + `add_dependencies` — the canonical fix for the MSBuild double-generation race. Verified live under Ninja: build.ninja has exactly one CUSTOM_COMMAND edge for bcpack_tables.inc; clean build generates once before both consumers; `touch tools/bcpack_tables.py` + `ninja -n` plans exactly one generation then parallel compiles+links — incremental correctness preserved. Full compile blocked by a sandbox `/Zi` debug-records issue (reproduced with trivial t.cpp — environmental, base fails identically); author's VS2022 clean-parallel claim is consistent with the standard pattern. AI-assisted verification.
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/1628/head:github-bot/gh-1628'
git switch 'github-bot/gh-1628'

Merge

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