Skip to content

Budget: split upload= by creator (Part of #3676 item c) - #3715

Merged
R0Y00 merged 10 commits into
R0Y00:mainfrom
SimSalabimse:local/upload-budget-by-creator
Dec 3, 2026
Merged

R0Y00 merged 10 commits into
R0Y00:mainfrom
SimSalabimse:local/upload-budget-by-creator

Conversation

@SimSalabimse

Copy link
Copy Markdown
Contributor

Part of #3676 item (c). Claim: #3676 (comment)

The x2w-budget line keeps upload= as the total and adds seven creator columns between upload= and readback=: upload_ring, upload_slot27, upload_slot70, upload_slot148, upload_linear, upload_mesh86 and upload_other, each in the live/retained form. They add up to upload=.

Linux: upload_budget_check passes on g++ and clang++ with -Werror=narrowing, and startup_triage_run_check.py passes. resource_budget.h needs d3d12.h, so the live/retained charge sites have not been compiled yet. The Windows test PC build and WARP run of startup_resource_budget_creators_warp are still to come. This PR is a draft until then.

#3491 changes report_budget's signature and the local/nonlocal sources. This change leaves both alone, but it shares the category buffer (640 to 2048 bytes) and the print loop, so a small rebase may be needed if #3491 merges first.

AI-assisted (Cursor)

The x2w-budget upload column stays the total. Columns beside it
attribute that total to the ring, device slots 27 and 127, the slot 70
fallback, slot 148 pages, linear staging, the Mesh86 slot map, and
every other upload heap.

AI-assisted (Cursor)

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
@SimSalabimse

Copy link
Copy Markdown
Contributor Author

Windows test at b45c0ad: first Windows build of the resource_budget.h changes succeeded.

WARP: 8/8 passed (startup_resource_budget_creators_warp, startup_resource_budget_warp_debug0/1 with their inline controls, upload_budget, startup_triage_run, and the triage CLI check).

Hardware twins: 5/5 passed.

AI-Assisted

@SimSalabimse
SimSalabimse marked this pull request as ready for review December 1, 2026 09:49
@SimSalabimse

Copy link
Copy Markdown
Contributor Author

Measured the creator split on the Windows test PC with this branch combined with #3716 on main a061032, gfx2hlsl translate mode, about 7 minutes from startup into the first playable 3D area (prologue).

Live upload heap by creator, x2w-budget line:

point upload total upload_ring upload_slot27 upload_slot70
early startup 34,144,256 B / 11 objects 33,554,432 B 0 589,824 B
menu 106,954,752 B / 571 50,331,648 B 524,288 B 56,098,816 B
in the 3D area (last line) 1,080,033,280 B / 14,164 117,440,512 B 524,288 B 961,740,800 B

So in-world, the slot-70 creator holds about 89% of live upload memory, and the ring stays small. Local GPU memory at the last line was 9,746,374,656 of a 11,187,499,008 budget. No device removal in the run.

AI-Assisted

@Leyukaka Leyukaka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Windows PR job ran startup_triage_run, but its 257 tests do not include upload_budget or startup_resource_budget_creators_warp. Could both targets and tests be added to the pr presets so subsequent changes exercise the creator accounting on WARP?

check_creators takes its final snapshot while created27 is still live. Releasing that wrapper and taking one more snapshot would exercise the other half of the log contract: one object and its allocation size should move from live to retained in both upload and upload_slot27, with the other creator counts unchanged.

Build and run the portable upload budget check and the WARP creator
fixture in the pull request preset. Verify that releasing slot 27 moves
its aggregate and creator charge from live to retained.

AI-assisted (Cursor)

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
@SimSalabimse

Copy link
Copy Markdown
Contributor Author

Added both targets and tests to the PR presets; the test selection now adds exactly upload_budget and startup_resource_budget_creators_warp. The creator fixture also releases the slot 27 wrapper and checks the exact live-to-retained move while all other creator columns stay unchanged. Tested on the Windows test PC: upload_budget, startup_resource_budget_creators_warp, startup_resource_budget_warp_debug0, startup_resource_budget_warp_debug1.

AI-Assisted

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I merged current main into the PR branch and resolved CMakePresets.json, preserving its new targets and test selections alongside upload_budget_check, startup_resource_budget, upload_budget, and startup_resource_budget_creators_warp. Both new tests are listed by the pr preset. The Windows Debug run of ctest --preset dev --no-tests=error -j 1 -R '^(upload_budget|startup_resource_budget_creators_warp)$' --output-on-failure passed 2/2. The GPU case used WARP (10.0.26100.9818) on Windows 11 26300.9974 with the preset's debug layer off. New hosted checks are running on the integrated head.

@R0Y00
R0Y00 requested a review from Leyukaka December 2, 2026 05:45

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Linux failure was the export census (d3d12_xs entries 80 != 79). I pushed a test-only follow-up that counts and checks the source evidence of the existing test hook x2w_budget_mesh86_upload_for_test. python -B tests/standin_exports_check.py now passes 472 cases with 6/6 mutations killed, and python -B tests/startup_triage_run_check.py passes. No budget runtime code was changed in this follow-up. Please review 2638480a once CI has run.

@SimSalabimse

Copy link
Copy Markdown
Contributor Author

I reviewed 2638480. It's test-only: d3d12_xs is now 80 with 45 unmeasured, and x2w_budget_mesh86_upload_for_test is checked by name with its source in src/startup_stubs/d3d12_xs_device.cpp. I ran tests/standin_exports_check.py (472 cases, 6/6 mutations killed) and tests/startup_triage_run_check.py; both passed. It looks right, and CI is green.

AI-Assisted

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revalidated 7477451 with MSVC Debug on Windows 11 build 26300. The local upload_budget, both startup_resource_budget_creators cases, and startup_triage_run passed 4/4 (WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656 for the GPU cases). The trial merge into 2398613 conflicts only in CMakePresets.json. Please keep the upload budget target and both creator selections alongside the Mesh86 additions now on main. The export catalog change is still awaiting another reviewer.

@SimSalabimse

Copy link
Copy Markdown
Contributor Author

Reply to #3715 (review):

Merged current main into this branch. The only textual conflict was CMakePresets.json: I kept upload_budget_check and startup_resource_budget in the build targets and upload_budget plus startup_resource_budget_creators_warp in the PR test selection, alongside main's Mesh86 entries. Main's export inventory also moved, so tests/standin_exports_check.py now expects 85 d3d12_xs entries (35 implemented, 50 unmeasured) with this PR's Mesh86 upload test export, and its evidence check is kept.

Run on the Windows test PC (Debug build of the merged head): resource_budget, upload_budget, triage_run and standin_exports_check selections, warp and hardware: 14 of 14 pass.

AI-Assisted

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I independently checked 0e300171 with MSVC Debug. ctest --preset dev --no-tests=error -j 1 -R '^(startup_resource_budget_creators_(warp|hardware)|upload_budget|startup_triage_run|standin_exports_check)$' passed 5/5 on Windows 11 build 26300, WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656. The catalog passed 477 checks and caught six mutations. A trial merge onto 75759370 still conflicts in CMakePresets.json and tests/standin_exports_check.py. Please keep the new XMem selection from #3697 and the existing Mesh86 material resolver export alongside this branch's upload-budget coverage.

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I resolved the conflicts on c4b0a933 after #3728 landed. The PR preset lists both upload-budget tests alongside the existing XMem and Mesh86 selections. The catalog retained checks for the main-branch Mesh86 material resolver and this PR's upload test export. Independent MSVC Debug ctest --preset dev --no-tests=error -j 1 --output-on-failure -R '^(startup_resource_budget_creators_(warp|hardware)|upload_budget|startup_triage_run|standin_exports_check)$' passed 5/5, including WARP and RTX 4060 Laptop. The integrated export census passed 478 checks with six mutations caught. The current review request is still open for the integration.

R0Y00 commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Integration note for #3715 and #3716: each adds one export and bumps the same census counts. The current heads merge cleanly in Git, but I tested the combined tree and python -B tests/standin_exports_check.py fails with d3d12_xs entries 86 != 85. Please land #3716 first if its checks and review clear, then update this PR on the new main to expect 86 entries, including 51 unmeasured, while keeping both export-specific checks. I'll check the combined census again before the second merge.

R0Y00 commented Dec 3, 2026

Copy link
Copy Markdown
Owner

#3716 has landed in main at 2710917d. I tested merging that baseline with b382db96: tests/standin_exports_check.py reproduced d3d12_xs entries 86 != 85. On the trial merge, changing the two expectations to 86 entries and 51 unmeasured was sufficient: all 480 cases passed and all six mutations were caught, with both export-specific assertions active. Please include those two expectation updates when refreshing this branch.

R0Y00 commented Dec 3, 2026 •

Copy link
Copy Markdown
Owner

After #3732 landed, the only Git conflict against main at 29bb2aed is now CMakePresets.json. I resolved it locally by keeping startup_upload_reserve in the build and test selections alongside upload_budget_check, startup_resource_budget, upload_budget and startup_resource_budget_creators_warp. With the two catalog counts from my previous note, the trial merge passed the triage script, stand-in catalog (480 cases and all six mutations), the MSVC upload budget check, and the MSVC slot 148 reserve check. The allocator and budget files merge cleanly.

I also rebuilt the same trial merge and ran all ten startup_resource_budget_* tests plus upload_budget and startup_upload_reserve with MSVC Debug: 12/12 passed, including creator accounting on WARP and RTX 4060 Laptop, with no skips. This is still the local trial merge.

cursoragent and others added 2 commits December 3, 2026 10:48
…-by-creator

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>

# Conflicts:
#	CMakePresets.json
The upload-budget export and the GPU-to-CPU census export are both unmeasured, so the catalog is 86 entries with 51 unmeasured.

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed ec6de0f. The PR preset retains both the creator check and main's slot-148 reserve check, and the export catalog now counts 86 entries. Independent MSVC Debug on Windows build 26300: ctest --preset dev -j 1 --no-tests=error --output-on-failure -R '^(startup_resource_budget_.*|upload_budget|startup_upload_reserve|startup_triage_run|standin_exports_check)$' passed 14/14 with no skips. That includes WARP and RTX 4060 Laptop 32.0.16.1656 creator accounting, debug on/off and inline controls, the reserve fixture, and triage/catalog checks. I used /DEBUG:NONE for the local linker after a PDB limit. Compilation and test settings stayed in the Debug preset.

@R0Y00
R0Y00 merged commit d31b664 into R0Y00:main Dec 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants