Repository navigation
d3d12: title write-back ranges merge into disjoint ranges, none dropped (RT-TITLE-WRITE-NOTE-MERGE) - #2517
d3d12: title write-back ranges merge into disjoint ranges, none dropped (RT-TITLE-WRITE-NOTE-MERGE)#2517Tyrannys wants to merge 2 commits into
Conversation
DeviceState::note_title_write kept the reached title-memory ranges of a submission in a map, but its merge lost data (kevincommits' finding in ProjectLeonida#1608): - a range that began before an entry only extended that entry's end, so its prefix was never copied back ([200,300) then [100,250) kept only [200,300)); - a range spanning entries extended one without absorbing the others, leaving the map overlapping ([100,350) and [300,400)); - merged bytes were never counted, so kTitleWriteBackBytes could be passed. The merge moves to src/title_write_ranges.h (add_reached_range): a new range joins every entry it overlaps or touches, the byte count stays the union's, and the byte cap applies to merges that add bytes. The range cap still refuses only new entries. write_back_titles also checked `!&context`, the address of a member, which is never null; it now checks `!context`. New CPU test title_write_ranges follows the repros; 11 of its checks fail with the old merge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
PortBridge traced the byte accounting at The title-free CPU controls also cover a new range bridging two existing ranges without losing the prefix. Vice-Tay #388 uses the same half-open comparisons for a different operation, invalidation, so its state transition should remain separate. |
The byte cap stays soft, as note_title_write had it before the merge moved: it is checked before a range goes in, so the range that crosses it is kept whole (cutting it would drop GPU writes inside it) and the next range that adds bytes is refused. The header now says so, and the test pins akimfomin's case from ProjectLeonida#2517: cap 64, [0,63) then [128,132) goes 63 -> 67 bytes, the next new byte and a merge that adds bytes are refused, refusals leave the map unchanged, and a covered range fits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @akimfomin. The overshoot is intentional: the cap stays soft, as 7ec666e states this in
The test passes. AI-assisted (Claude Code). |
|
Reviewed at updated head Verification
Notes
Approve as-is; the node-reuse tweak is optional. AI-assisted review + local MSVC verification. |
lixonik
left a comment
There was a problem hiding this comment.
Reviewed the diff and tested merged onto main (493867366) with Ninja Release (MSVC) and LEONIDA_VK_VALIDATION=1.
Extracting leonida::add_reached_range into runtime/src/title_write_ranges.h cleanly keeps the map disjoint across prefix/multi-entry merges, tracks the exact union byte count ((hi - lo) - covered), and respects both range and soft byte caps; fixing if (!&context) to if (!context) in write_back_titles is a nice catch too.
Tests run
ctest --output-on-failure -R "^(title_write_ranges|d3d12_placed_write_back)$"(withLEONIDA_VK_VALIDATION=1): 2/2 passed (title_write_ranges,d3d12_placed_write_back0.25 s).
GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88, Vulkan 1.4.341, VK_LAYER_KHRONOS_validation 1.4.363).
AI-assisted (Antigravity, Gemini).
|
#2517 | head 7ec666e (merged cleanly with main 3ca0707) | |
Claimed in the coordination issue as: RT-TITLE-WRITE-NOTE-MERGE (#1608 (comment))
What and why
kevincommits' finding in #1608 (item 1 of #1608 (comment)).
DeviceState::note_title_writekeeps the title-memory ranges a submission reached, for the copy back after it. Its merge lost data:[200,300)then[100,250)kept only[200,300).[100,200),[300,400)then[150,350)left[100,350)and[300,400).kTitleWriteBackBytescould be exceeded (200 counted against a 300-byte union).The merge moves to
src/title_write_ranges.h(leonida::add_reached_range):write_back_titlesalso checkedif (!&context). That is the address of astd::unique_ptrmember, so it is never null. It now checksif (!context).This touches different lines of
d3d12_vulkan_device.cppthan #2470 and #2461. It merges cleanly with #2461. #2470 conflicts with currentmainon its own, before this PR.Tested
title_write_rangesfollows kevincommits' repros, plus cases for touching ranges, multi-entry spans and both caps. It passes. With the old merge put back, 11 of its checks fail.d3d12_vulkan_device.cppbuilds (MSVC, Release).ctest -R "title_write_ranges|d3d12_title|d3d12_placed_write_back|d3d12_shadow": 14/14 pass.GPUs tested: profile M: NVIDIA GeForce RTX 4070 SUPER, 12 GB, desktop, driver 621.01, Windows 11
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code