VICTORY_HEAP_SYNC_AT_SUBMIT=1: the heaps' records asked for at the title's submit
Ported from Belobug/VIctory-Belobug-AMD 673be0e and a609a2f (renderer port 7, its heaps' records part; the journal in 64 parts, which shares the switch VICTORY_PORT_JOURNAL there, is not taken). There the lane waited 4.5-5.2 ms a frame for the heaps' records and port 7 took 2.4 ms off it. Here the submitting thread waited 2.7-5.8 ms a frame for them (release run 233354). A round of the heap-sync thread is asked for when the title submits (Lane::push, round_after), so it runs while the submission waits in the line (12-15 are in it when one is added), and the submitting thread waits for that round (begin_sync_heaps_after), or for a later one if a wait of its queue that was met in memory went since (the queue's floor in the line), or a step of ours wrote, or may have written, a heap's title memory while preparing an earlier submission (heap_marks::prep_wrote: buffer copies into a heap, copies at their place, our own steps). Added here: a submission that waited for flights to land begins a round of its own after the wait, as without the switch. With the switch off nothing is marked, asked or counted. VICTORY_HEAP_SYNC_FIRST applies only to a submission without a mark. Not behaviour-neutral in timing: a record the title writes for a submission after submitting it (or after a wait behind which the submission stands was met) is left to a later round, as the console's card could miss it too. Off by default. The frame line "the heaps' records asked for at the title's submit" gives the wait per frame, the rounds asked at a submit, the preparings that found theirs asked earlier or had to ask, and those that wrote a heap's memory. Tests: the round given begins after the call (heap_marks), and the line's marks with waits and parts taken along (queue::behind). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
96dfd9bb89
commit
d2e24b3bc3
5 files changed
+458
-13
No files matched your search
@@ -5646,9 +5646,12 @@ impl Host {
|
||||
}
|
||||
let was_working = working(true);
|
||||
submitting(1, runs.len());
|
||||
// With [`heap_sync_first`]: the heaps' records begun now, beside the
|
||||
// planning of steps done on the card and the look at flights.
|
||||
let first_heaps = (late && heap_sync_first()).then(crate::descriptor::begin_sync_heaps);
|
||||
// The round of the heaps' records asked for when the title submitted
|
||||
// these lists, if that is known (`crate::heap_marks`, 0: not).
|
||||
let heaps_mark = if late { crate::heap_marks::needed() } else { 0 };
|
||||
// Else with [`heap_sync_first`]: the heaps' records begun now, beside
|
||||
// the planning of steps done on the card and the look at flights.
|
||||
let first_heaps = (late && heaps_mark == 0 && heap_sync_first()).then(crate::descriptor::begin_sync_heaps);
|
||||
let ahead = Split::begin();
|
||||
SPLIT[11].fetch_add(called.elapsed().as_nanos() as u64, Ordering::Relaxed);
|
||||
stage.next("submit: steps given to the card");
|
||||
@@ -5681,6 +5684,8 @@ impl Host {
|
||||
// command lists that index those slots are submitted. (Begun first:
|
||||
// again after a wait for flights, whose landings wrote title memory,
|
||||
// as the round began here saw them; the first is not waited for.)
|
||||
// With a mark (`crate::heap_marks`): that round, unless the
|
||||
// submission waited for flights, whose landings came after it.
|
||||
let heaps_synced = match first_heaps {
|
||||
Some(first) if !waited_for_flights => {
|
||||
HEAP_SYNC_FIRST[0].fetch_add(1, Ordering::Relaxed);
|
||||
@@ -5691,7 +5696,11 @@ impl Host {
|
||||
HEAP_SYNC_FIRST[1].fetch_add(1, Ordering::Relaxed);
|
||||
std::mem::forget(first);
|
||||
}
|
||||
crate::descriptor::begin_sync_heaps()
|
||||
if heaps_mark != 0 && !waited_for_flights {
|
||||
crate::descriptor::begin_sync_heaps_after(heaps_mark)
|
||||
} else {
|
||||
crate::descriptor::begin_sync_heaps()
|
||||
}
|
||||
}
|
||||
};
|
||||
// That list runs first, and is one of the submission's from here on.
|
||||
@@ -5850,7 +5859,11 @@ impl Host {
|
||||
}
|
||||
split.part(4);
|
||||
stage.next("submit: waiting for the heaps' records");
|
||||
let heaps_began = std::time::Instant::now();
|
||||
drop(heaps_synced);
|
||||
if crate::heap_marks::on() {
|
||||
crate::heap_marks::heaps_waited(heaps_began.elapsed().as_nanos() as u64);
|
||||
}
|
||||
// The slots that waited for a texture's host copy, before the
|
||||
// lists that may read them run.
|
||||
crate::descriptor::make_waiting();
|
||||
@@ -7614,6 +7627,11 @@ impl HostList {
|
||||
}
|
||||
batch.fill();
|
||||
batch.title_written();
|
||||
// Into a heap's records: the rounds asked for earlier
|
||||
// did not see it (`crate::heap_marks`).
|
||||
if crate::heap_marks::on() && crate::descriptor::in_shader_heap(dst, len) {
|
||||
crate::heap_marks::prep_wrote();
|
||||
}
|
||||
copy_mapped(dst as *mut u8, src as *const u8, len, true);
|
||||
// With the submission's one asking: the journal learns it.
|
||||
crate::watch::wrote(dst, len);
|
||||
@@ -7640,6 +7658,9 @@ impl HostList {
|
||||
}
|
||||
Step::Placed(p) => {
|
||||
let started = std::time::Instant::now();
|
||||
if crate::heap_marks::on() && crate::descriptor::in_shader_heap(p.dst, p.len) {
|
||||
crate::heap_marks::prep_wrote();
|
||||
}
|
||||
let free = !touches(air, p.src, p.src + p.len) && !touches(air, p.dst, p.dst + p.len);
|
||||
batch.fill();
|
||||
if free {
|
||||
@@ -7665,6 +7686,10 @@ impl HostList {
|
||||
let started = std::time::Instant::now();
|
||||
if matches!(step, Step::Run(_)) {
|
||||
batch.title_written();
|
||||
// (It may write anywhere, a heap's records too.)
|
||||
if crate::heap_marks::on() {
|
||||
crate::heap_marks::prep_wrote();
|
||||
}
|
||||
}
|
||||
let _step = crate::timeline::span("a step of ours");
|
||||
work();
|
||||
@@ -9197,6 +9222,7 @@ impl Meter {
|
||||
crate::shadow::back_line(frames);
|
||||
submit_split_line(frames);
|
||||
fresh_open_line(frames);
|
||||
crate::heap_marks::line(frames);
|
||||
#[cfg(feature = "diagnostics")]
|
||||
split_line(frames);
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user