The frame line says how many indirect records ran empty for want of their list's budget, and the largest cost; VICTORY_INDIRECT_REST=0: a record that does not fit takes nothing from the ones after it
Belobug (76387c2d) found draws flickering because the records past a list's budget were not the same ones from frame to frame. Whether ours are refused is not known: the count says it (atomics only when there is something to say). Off by default; the records' order and costs stay what they were. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
5e2394c2f4
commit
49f9aa034d
3 files changed
+87
-18
No files matched your search
@@ -1707,6 +1707,10 @@ fn list_number(name: &str) -> Option<u32> {
|
||||
/// budget buffers, a run late).
|
||||
static MESH_GROUPS: [std::sync::atomic::AtomicU64; 2] = [const { std::sync::atomic::AtomicU64::new(0) }; 2];
|
||||
|
||||
/// Indirect records that ran empty for want of their list's budget, and the
|
||||
/// largest cost of one (told from 2^22 on), likewise.
|
||||
static BUDGET_NOTES: [std::sync::atomic::AtomicU64; 2] = [const { std::sync::atomic::AtomicU64::new(0) }; 2];
|
||||
|
||||
/// Whether a list's indirect-work budget lives in the card's own memory
|
||||
/// (`VICTORY_INDIRECT_CARD_BUDGET=0` keeps it in memory the CPU maps, as
|
||||
/// before). The clamp charges it with atomics, at least two in a row for
|
||||
@@ -6846,14 +6850,18 @@ impl HostList {
|
||||
// SAFETY: the list's own mapped words, written before it runs.
|
||||
// The words after the budget hold what the clamp noted about the
|
||||
// list's last run (mesh dispatches: the largest group count
|
||||
// asked for, the groups asked in all; with the card's copy, as
|
||||
// asked for, the groups asked in all; the records refused, the
|
||||
// largest cost; with the card's copy, as
|
||||
// the list's end copied them here): taken, then zeroed.
|
||||
let notes = Box::new(move || unsafe {
|
||||
let words = at as *mut u32;
|
||||
let (largest, all) = (words.add(1).read_volatile(), words.add(2).read_volatile());
|
||||
MESH_GROUPS[0].fetch_max(u64::from(largest), Ordering::Relaxed);
|
||||
MESH_GROUPS[1].fetch_add(u64::from(all), Ordering::Relaxed);
|
||||
for k in 0..3 {
|
||||
let (refused, biggest) = (words.add(3).read_volatile(), words.add(4).read_volatile());
|
||||
BUDGET_NOTES[0].fetch_add(u64::from(refused), Ordering::Relaxed);
|
||||
BUDGET_NOTES[1].fetch_max(u64::from(biggest), Ordering::Relaxed);
|
||||
for k in 0..5 {
|
||||
words.add(k).write_volatile(0);
|
||||
}
|
||||
});
|
||||
@@ -6888,7 +6896,7 @@ impl HostList {
|
||||
};
|
||||
// SAFETY: a live buffer.
|
||||
let at = unsafe { card.GetGPUVirtualAddress() };
|
||||
let zeros = [0u64, 4, 8].map(|offset| D3D12_WRITEBUFFERIMMEDIATE_PARAMETER {
|
||||
let zeros = [0u64, 4, 8, 12, 16].map(|offset| D3D12_WRITEBUFFERIMMEDIATE_PARAMETER {
|
||||
Dest: at + offset,
|
||||
Value: 0,
|
||||
});
|
||||
@@ -6929,7 +6937,7 @@ impl HostList {
|
||||
D3D12_RESOURCE_STATE_UNORDERED_ACCESS,
|
||||
D3D12_RESOURCE_STATE_COPY_SOURCE,
|
||||
)]);
|
||||
self.list.CopyBufferRegion(mapped, 4, card, 4, 8);
|
||||
self.list.CopyBufferRegion(mapped, 4, card, 4, 16);
|
||||
self.list.ResourceBarrier(&[transition(
|
||||
card,
|
||||
D3D12_RESOURCE_STATE_COPY_SOURCE,
|
||||
@@ -8516,8 +8524,10 @@ impl Meter {
|
||||
let indirect = crate::list::take_indirect() as f64 / frames;
|
||||
let mesh_largest = MESH_GROUPS[0].swap(0, Ordering::Relaxed);
|
||||
let mesh_groups = MESH_GROUPS[1].swap(0, Ordering::Relaxed) as f64 / frames;
|
||||
let refused = BUDGET_NOTES[0].swap(0, Ordering::Relaxed) as f64 / frames;
|
||||
let biggest = BUDGET_NOTES[1].swap(0, Ordering::Relaxed);
|
||||
tracing::info!(
|
||||
"indirect mesh dispatches: the largest group count asked for {mesh_largest} (run: at most 65535), {mesh_groups:.0} groups asked per frame"
|
||||
"indirect mesh dispatches: the largest group count asked for {mesh_largest} (run: at most 65535), {mesh_groups:.0} groups asked per frame; {refused:.2} indirect records a frame ran empty for want of their list's budget (2^27), the largest cost of one {biggest} (0: under 2^22)"
|
||||
);
|
||||
crate::shadow::exact_line(frames);
|
||||
crate::descriptor::sync_line(frames);
|
||||
|
||||
Reference in new issue
Block a user