Two host queues: a plan for the title's compute queues (VICTORY_ASYNC_QUEUE=plan, off by default)
The gameplay frame is about 45 ms with the card busy most of it on about 11,000 small commands at 130-140 W of 220; a timeline (tl.190) had the submission the title waited for stand 7.2 ms sent and not begun behind other work on the one direct queue. The title runs part of its work on compute queues of its own, which on the console overlaps its drawing. The queue itself is not built: a D3D12 list runs only on a queue of its own type, the type is fixed when the list is made, every host list is a direct list, and what the layer records into the title's compute lists is not all something a compute list may hold (textures shaders read are put in both read states, 0x40|0x80; depth twins are copied through a drawn pass). A submission cannot fall back to the direct queue once its lists are compute lists. This is the half that can be had without that: - host/two_queues.rs: Plan::place, the order between a direct and a compute queue: the queue each host submission would go to, the value signalled behind it, and the one wait put before it (left out where the queue waits behind that value already, or the submission has finished), for copies in the card's memory (sends and compares in one order), steps on the card, textures named on both queues, memory values a flight of the other queue writes (late_met_by), tile mappings, a texture's drawing state moved on the direct queue first, and submissions of ours. - With VICTORY_ASYNC_QUEUE=plan (or =1, which says it is not built) the frame line "two host queues, planned per frame" counts submissions by the title queue's type, what keeps compute submissions on the direct queue, those that would go to a compute queue (with and without a wait) and the waits by reason. Nothing runs differently. - The title queue's type reaches Host::submit (two_queues::for_title from the line's thread and the older paths; the queues' types by address, queue::kind_of); a value job in the line knows its queue. - Diagnostics: the timeline's summary says how much of the card's running time was the title's compute queues' submissions (the most a queue of their own could run beside the rest). Tests: the plan's order (eight cases). The two failures in indirect::tests are as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
c0f627e4b5
commit
fa88dc7c84
7 files changed
+758
-29
No files matched your search
@@ -162,7 +162,7 @@ fn submit_cut(this: This, lists: &[This]) {
|
||||
// from the title's lists (which it may reset before they have run)
|
||||
// and come back, with their tables' slots, when they are settled.
|
||||
let (taken, order) = crate::list::detach(&lists[..first]);
|
||||
host.execute_late(taken, order);
|
||||
crate::host::two_queues::for_title(Some(queue(this).kind), 0, || host.execute_late(taken, order));
|
||||
} else if first > 0 {
|
||||
let now: Vec<_> = lists[..first]
|
||||
.iter()
|
||||
@@ -383,7 +383,7 @@ pub(crate) fn release_held(all: bool) {
|
||||
{
|
||||
// Not waited for: the host keeps the lists
|
||||
// until they are settled.
|
||||
host.execute_late(lists, order);
|
||||
crate::host::two_queues::for_title(kind_of(q), 0, || host.execute_late(lists, order));
|
||||
} else {
|
||||
let ran = {
|
||||
let runs: Vec<&crate::host::HostList> =
|
||||
@@ -499,6 +499,8 @@ pub(crate) extern "system" fn create(
|
||||
return E_INVALIDARG;
|
||||
};
|
||||
tracing::debug!(?desc, "command queue");
|
||||
#[cfg(windows)]
|
||||
let kind = desc.kind;
|
||||
let queue = Box::new(Queue {
|
||||
object: if crate::device::newer() {
|
||||
Object::new(&NEWER_FUNCTIONS)
|
||||
@@ -510,7 +512,29 @@ pub(crate) extern "system" fn create(
|
||||
#[cfg(windows)]
|
||||
held: Default::default(),
|
||||
});
|
||||
object::hand_out(QUEUE, queue, iid, &QUEUE_IIDS, out)
|
||||
let made = object::hand_out(QUEUE, queue, iid, &QUEUE_IIDS, out);
|
||||
#[cfg(windows)]
|
||||
if made == S_OK
|
||||
// SAFETY: the out pointer was written.
|
||||
&& let Some(&queue_at) = unsafe { out.as_ref() }
|
||||
{
|
||||
let mut kinds = lock(&KINDS);
|
||||
kinds.retain(|k| k.0 != queue_at as usize);
|
||||
kinds.push((queue_at as usize, kind));
|
||||
}
|
||||
made
|
||||
}
|
||||
|
||||
/// The title's queues (their addresses) and their list types, for what is
|
||||
/// done with a queue's submission later, on another thread, when the
|
||||
/// queue may have been let go ([`kind_of`]).
|
||||
#[cfg(windows)]
|
||||
static KINDS: std::sync::Mutex<Vec<(usize, u32)>> = std::sync::Mutex::new(Vec::new());
|
||||
|
||||
/// The list type of the title's queue at `queue`, if it is one.
|
||||
#[cfg(windows)]
|
||||
pub(crate) fn kind_of(queue: usize) -> Option<u32> {
|
||||
lock(&KINDS).iter().find(|k| k.0 == queue).map(|k| k.1)
|
||||
}
|
||||
|
||||
/// The console's queue description: an engine or pipe and a queue on it
|
||||
@@ -559,6 +583,7 @@ extern "system" fn release(this: This) -> u32 {
|
||||
#[cfg(windows)]
|
||||
if left == 0 {
|
||||
lock(&WAITING).retain(|&q| q != this as usize);
|
||||
lock(&KINDS).retain(|k| k.0 != this as usize);
|
||||
}
|
||||
left
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user