mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 08:58:36 +00:00
Merge pull request #935 from narekshaghoyandev/ubiq-retire-tickets-dedup-wait
Merging. **Why merged:** RT-RETIRE-TICKETS-DEDUP-WAIT: pending_through() merges entries per semaphore to the highest value, and completed_ can no longer move backwards. moffington (ASan/UBSan, with a differential test that fails on the base), Timon360SB, KernelSmoker and SweatierKey checked it independently. **Why it's good:** retire_tickets passes both plain and under validation. Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main32950551e, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #516, #535, #751, #935 and #662 merged onto main955d9be34. There the repo-consistency set gives 571 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 307/309. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same 11 skips. git merge-tree against current main71f99e224: no conflicts, and none of these touch the files #891/#882 changed. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes. AI-assisted (Claude Code, Claude Opus 5.5).
This commit is contained in:
@ -24,7 +24,7 @@ public:
|
||||
while (!pending_.empty()) {
|
||||
const Entry& front = pending_.front();
|
||||
if (!front.idle && !query(front.semaphore, front.value)) break;
|
||||
completed_ = front.ticket;
|
||||
if (front.ticket > completed_) completed_ = front.ticket;
|
||||
pending_.pop_front();
|
||||
}
|
||||
return completed_;
|
||||
@ -34,8 +34,18 @@ public:
|
||||
// that must have them done (and may not hold the lock that guards this object while it waits) waits for.
|
||||
std::vector<std::pair<Semaphore, std::uint64_t>> pending_through(std::uint64_t ticket) const {
|
||||
std::vector<std::pair<Semaphore, std::uint64_t>> out;
|
||||
for (const Entry& entry : pending_)
|
||||
if (entry.ticket <= ticket && !entry.idle) out.emplace_back(entry.semaphore, entry.value);
|
||||
for (const Entry& entry : pending_) {
|
||||
if (entry.ticket > ticket || entry.idle) continue;
|
||||
bool merged = false;
|
||||
for (auto& [sem, val] : out) {
|
||||
if (sem == entry.semaphore) {
|
||||
if (entry.value > val) val = entry.value;
|
||||
merged = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!merged) out.emplace_back(entry.semaphore, entry.value);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
@ -30,6 +30,24 @@ int main() {
|
||||
queue_one_destroyed = true;
|
||||
if (tickets.completed(query) != 4 || queried_destroyed) return 4;
|
||||
|
||||
// pending_through() must coalesce repeated submissions on the same queue to the highest
|
||||
// timeline value, omit idle queues, and exclude tickets past the requested cutoff.
|
||||
tickets.record(5, 1, 10);
|
||||
tickets.record(6, 2, 20);
|
||||
tickets.record(7, 1, 12);
|
||||
tickets.record(8, 1, 15);
|
||||
tickets.record(9, 2, 25);
|
||||
tickets.queue_idle(2);
|
||||
const auto wait_list = tickets.pending_through(7);
|
||||
if (wait_list.size() != 1 || wait_list[0].first != 1 || wait_list[0].second != 12) return 5;
|
||||
|
||||
// A non-monotonic ticket must not move the completed prefix backward.
|
||||
done[1] = 15;
|
||||
if (tickets.completed(query) != 9) return 6;
|
||||
tickets.record(3, 1, 16);
|
||||
done[1] = 16;
|
||||
if (tickets.completed(query) != 9) return 7;
|
||||
|
||||
std::puts("out-of-order queue completion kept the retirement prefix safe");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user