reprend #2029: runtime: guard overflow/div-by-zero and remove duplicate passes in d3d12_xs_alloc_size #2739

Manually merged
github merged 3 commits from github-bot/gh-2739 into gh-pr/2739/base 2026-11-30 16:56:03 +00:00 AGit
Owner

@⁠OreoFR on GitHub · 2026-11-30 13:39 UTC · original
OreoFR:carry/pr-2029 → main · +281 −54 · 3 files · 3 commits · merged 2026-11-30 16:50 UTC

Carries #2029 by @⁠IlyassRS3, because it conflicts with main after #2566 and the reminder to merge main (#2029) got no answer within the delay of the carry rule. If the author comes back, this carry is dropped.

Item: RT-XS-ALLOC-SIZE-OVERFLOW-AND-SINGLE-PASS-CARRY (claimed in #2570; original item RT-XS-ALLOC-SIZE-OVERFLOW-AND-SINGLE-PASS).

What this branch is

  • The author's branch at 0c4bdde51, unchanged (no rebase, author commits kept).
  • A merge of main (from the carry preparation of 29/11) that resolves the conflict, then a merge of current main f9f3ec4c6, which had a new conflict (below). Both merge commits carry Co-authored-by the author.
  • Nothing else: the change itself is the original PR's; see #2029 for what and why, and the verifications posted there.

What conflicted and how it was resolved

  • runtime/shims/d3d12_xs_alloc_size.h: the PR's one-pass console_placement, with main's title_descs/title_layout and console_unordered_access_size added to the per-description overloads.
  • runtime/CMakeLists.txt (2 hunks): xs_alloc_size_test and appnotify_test both kept.
  • New with f9f3ec4c6: runtime/shims/d3d12_xs_alloc_size.h, align_up_saturating: main (#2027) returns value when to == 0, the PR when to <= 1; for to == 1 the rounding gives value as well, so both agree; the PR's guard and comment kept. main's d3d12_xs_alloc_size_test (#2027) and the PR's xs_alloc_size_test are both built: CI runs main's test against the PR's rewrite.

A function is rewritten (console_placement in one pass): please read it against main's version.

Tests

  • On this branch (main f9f3ec4c6 merged), Windows 11, Python 3.12, no GPU used: C++ only: left to this PR's CI (no local C++ build in this run).
  • Earlier merge: ctest 502 tests, xs_alloc_size passes; red (main's header): 6 FAIL.
  • python -I scripts/check_no_game_data.py on every file this PR changes: clean.
  • CI on this PR covers the rest (C++ build and ctest, the full translator suite).

Depends on: none.

Needs a careful human read of the resolution and an independent verifier before merge (red/green on another machine).

AI-assisted (Claude Code, oreofr-agent).

🤖 Generated with Claude Code

**@⁠OreoFR** on GitHub · 2026-11-30 13:39 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2739) `OreoFR:carry/pr-2029` → `main` · +281 −54 · 3 files · 3 commits · merged 2026-11-30 16:50 UTC Carries #2029 by @⁠IlyassRS3, because it conflicts with `main` after #2566 and the reminder to merge `main` (https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2029) got no answer within the delay of the carry rule. If the author comes back, this carry is dropped. Item: `RT-XS-ALLOC-SIZE-OVERFLOW-AND-SINGLE-PASS-CARRY` (claimed in https://git.gtahub.st/github/ubiquitarianism--leonida/issues/2570; original item `RT-XS-ALLOC-SIZE-OVERFLOW-AND-SINGLE-PASS`). ### What this branch is - The author's branch at `0c4bdde51`, unchanged (no rebase, author commits kept). - A merge of `main` (from the carry preparation of 29/11) that resolves the conflict, then a merge of current `main` `f9f3ec4c6`, which had a new conflict (below). Both merge commits carry `Co-authored-by` the author. - Nothing else: the change itself is the original PR's; see #2029 for what and why, and the verifications posted there. ### What conflicted and how it was resolved - `runtime/shims/d3d12_xs_alloc_size.h`: the PR's one-pass `console_placement`, with `main`'s `title_descs`/`title_layout` and `console_unordered_access_size` added to the per-description overloads. - `runtime/CMakeLists.txt` (2 hunks): `xs_alloc_size_test` and `appnotify_test` both kept. - New with `f9f3ec4c6`: `runtime/shims/d3d12_xs_alloc_size.h`, `align_up_saturating`: `main` (#2027) returns `value` when `to == 0`, the PR when `to <= 1`; for `to == 1` the rounding gives `value` as well, so both agree; the PR's guard and comment kept. `main`'s `d3d12_xs_alloc_size_test` (#2027) and the PR's `xs_alloc_size_test` are both built: CI runs `main`'s test against the PR's rewrite. **A function is rewritten** (`console_placement` in one pass): please read it against `main`'s version. ### Tests - On this branch (`main` `f9f3ec4c6` merged), Windows 11, Python 3.12, no GPU used: C++ only: left to this PR's CI (no local C++ build in this run). - Earlier merge: `ctest` 502 tests, `xs_alloc_size` passes; red (`main`'s header): 6 FAIL. - `python -I scripts/check_no_game_data.py` on every file this PR changes: clean. - CI on this PR covers the rest (C++ build and `ctest`, the full translator suite). Depends on: none. **Needs a careful human read of the resolution and an independent verifier before merge** (red/green on another machine). AI-assisted (Claude Code, oreofr-agent). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
d3d12_xs_alloc_size: the PR's single-pass console_placement with main's title_descs/title_layout and console_unordered_access_size added to the per-description overrides; CMakeLists: xs_alloc_size_test and appnotify_test both kept.

Co-authored-by: Ilyass Roussi <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Current main after #2566. New conflict on top of the earlier carry merge:
runtime/shims/d3d12_xs_alloc_size.h, align_up_saturating: main (#2027)
returns value when to == 0, the PR when to <= 1; for to == 1 the rounding
formula gives value as well, so both agree; the PR's guard and comment kept.

Co-authored-by: Ilyass Roussi <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 13:40:55 +00:00
Author
Owner

@⁠Kal0s-design on GitHub · 2026-11-30 14:13 UTC · original

Independent red/green on another machine, as the description asks. Head ff55c339e merged onto current main b17b22d33 (no conflict, tree d87fc9b6b). Native Windows 11, MSVC 19.50 x64. Each test was built alone with the CMake target's include dirs and defines (/Ishims /Isrc /DWIN32_LEAN_AND_MEAN /DNOMINMAX /W4 /permissive- /utf-8), under AddressSanitizer with the debug CRT (/Od /MDd /fsanitize=address).

  • Red: main's runtime + this PR's test/xs_alloc_size_test.cpp: FAILED (4 failures):

    • render target multi-mip slice accumulation overflow returns 0
    • depth-stencil multi-plane slice accumulation overflow returns 0
    • pc_one called exactly once per descriptor even when each is non-null
    • count > 16 heap-spill path calls pc_one once per entry

    (The earlier merge's "6 FAIL" was against an older main.) Same at /O2 /MD: exit 1.

  • Green: the merged tree: xs_alloc_size_test: OK (0 failures) under ASan, no report; also OK at /O2 /MD.

  • The rewritten console_placement against main's own test: main's test/d3d12_xs_alloc_size_test.cpp (#2027) built against this PR's header: 62/62 checks passed under ASan, the same as against main's header (62/62).

  • Only warnings: xg_xs_layout.h(163) C4996 (getenv) and (347) C4334, identical on main. Not in this PR's files.

I didn't do a line-by-line read of the conflict resolution beyond these two test files.

GPUs tested: n/a (CPU unit tests). AI-assisted: yes.

**@⁠Kal0s-design** on GitHub · 2026-11-30 14:13 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2739#issuecomment-7281033639) **Independent red/green on another machine**, as the description asks. Head `ff55c339e` merged onto current `main` `b17b22d33` (no conflict, tree `d87fc9b6b`). Native Windows 11, MSVC 19.50 x64. Each test was built alone with the CMake target's include dirs and defines (`/Ishims /Isrc /DWIN32_LEAN_AND_MEAN /DNOMINMAX /W4 /permissive- /utf-8`), under AddressSanitizer with the debug CRT (`/Od /MDd /fsanitize=address`). - **Red**: `main`'s runtime + this PR's `test/xs_alloc_size_test.cpp`: `FAILED (4 failures)`: - `render target multi-mip slice accumulation overflow returns 0` - `depth-stencil multi-plane slice accumulation overflow returns 0` - `pc_one called exactly once per descriptor even when each is non-null` - `count > 16 heap-spill path calls pc_one once per entry` (The earlier merge's "6 FAIL" was against an older `main`.) Same at `/O2 /MD`: exit 1. - **Green**: the merged tree: `xs_alloc_size_test: OK (0 failures)` under ASan, no report; also OK at `/O2 /MD`. - **The rewritten `console_placement` against `main`'s own test**: `main`'s `test/d3d12_xs_alloc_size_test.cpp` (#2027) built against this PR's header: `62/62 checks passed` under ASan, the same as against `main`'s header (62/62). - Only warnings: `xg_xs_layout.h(163)` C4996 (`getenv`) and `(347)` C4334, identical on `main`. Not in this PR's files. I didn't do a line-by-line read of the conflict resolution beyond these two test files. GPUs tested: n/a (CPU unit tests). AI-assisted: yes.
Author
Owner

@⁠KelboLive on GitHub · 2026-11-30 15:30 UTC · original

Independent check on Windows (not the author), at ff55c339e.

  • Configured the branch's runtime and built xs_alloc_size_test (MSVC 14.52.37025, Windows SDK 10.0.26100).
  • Ran it: xs_alloc_size_test: OK (0 failures) — exit 0.

Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711.

Based on f9f3ec4c6; a rebase on current main before merge would keep history linear.

AI-assisted: yes (opencode).

**@⁠KelboLive** on GitHub · 2026-11-30 15:30 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2739#issuecomment-7283104644) Independent check on Windows (not the author), at `ff55c339e`. - Configured the branch's `runtime` and built `xs_alloc_size_test` (MSVC 14.52.37025, Windows SDK 10.0.26100). - Ran it: `xs_alloc_size_test: OK (0 failures)` — exit 0. Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711. Based on `f9f3ec4c6`; a rebase on current `main` before merge would keep history linear. AI-assisted: yes (opencode).
Author
Owner

@⁠MoonEyes on GitHub · 2026-11-30 15:48 UTC · original

Verified by MoonEyes (another owner than OreoFR) on head ff55c339e merged with main be7690805: Windows 11, MSVC 2022 x64, RelWithDebInfo, RTX 4060 8 GB (NVIDIA). ctest -R ^xs_alloc_size$: 1/1 passed; with d3d12_xs_alloc_size.h of main 4 failures.

Unit test only: no run of the title (this is the Vulkan path).

AI-assisted (Claude Code).

**@⁠MoonEyes** on GitHub · 2026-11-30 15:48 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2739#issuecomment-7283614084) Verified by MoonEyes (another owner than OreoFR) on head `ff55c339e` merged with `main` `be7690805`: Windows 11, MSVC 2022 x64, RelWithDebInfo, RTX 4060 8 GB (NVIDIA). `ctest -R ^xs_alloc_size$`: 1/1 passed; with `d3d12_xs_alloc_size.h` of `main` 4 failures. Unit test only: no run of the title (this is the Vulkan path). AI-assisted (Claude Code).
github-bot changed target branch from main to gh-pr/2739/base 2026-11-30 16:55:56 +00:00
github manually merged commit ff55c339e8 into gh-pr/2739/base 2026-11-30 16:55:58 +00:00
Author
Owner

@⁠MoonEyes on GitHub · 2026-11-30 16:50 UTC · original · edited 2026-11-30 17:40 UTC

Merging. Head ff55c339e merges cleanly with main 6dbbe6df5 and does not force a rebase of #2566. Vulkan path: Moon's written OK for this PR without a run in the game; ctest red and green on Windows 11, and by another person. Merged by MoonEyes.

AI-assisted (Claude Code).

**@⁠MoonEyes** on GitHub · 2026-11-30 16:50 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2739#issuecomment-7285318732) · edited 2026-11-30 17:40 UTC Merging. Head `ff55c339e` merges cleanly with `main` `6dbbe6df5` and does not force a rebase of #2566. Vulkan path: Moon's written OK for this PR without a run in the game; ctest red and green on Windows 11, and by another person. Merged by MoonEyes. AI-assisted (Claude Code).
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
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
github/ubiquitarianism--leonida!2739
No description provided.