From 6200b8c7b532d05e74c90ef6d48cc0ebcc7d35f4 Mon Sep 17 00:00:00 2001 From: David-cmrg <202826622+David-cmrg@users.noreply.github.com> Date: Sun, 11 Oct 2026 19:01:47 +0200 Subject: [PATCH] test(agc): split the gated dispatch producer spin into short dispatches --- .../tests/execution/GatedDispatchCapture.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/libs/prx/libSceAgcDriver/tests/execution/GatedDispatchCapture.cpp b/core/libs/prx/libSceAgcDriver/tests/execution/GatedDispatchCapture.cpp index fe73e2b3a..8fe09da45 100644 --- a/core/libs/prx/libSceAgcDriver/tests/execution/GatedDispatchCapture.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/execution/GatedDispatchCapture.cpp @@ -23,6 +23,7 @@ alignas(256) std::array ReaderCode{0xf4040100u, 0xfa000000u, constexpr std::uint32_t StaleValue = 0x57a1e000u; constexpr std::uint32_t FreshValue = 0xf7e54000u; +constexpr std::uint32_t SpinIterationsPerDispatch = 1u << 20u; struct Slot { alignas(256) std::array stale{}; @@ -81,14 +82,14 @@ void Submit(std::uint32_t queue, std::vector& words) { enum class Outcome { Fresh, Stale, Inconclusive }; -Outcome Run(Slot& slot, std::uint32_t iterations) { +Outcome Run(Slot& slot, std::uint32_t spinDispatches) { slot.stale[0] = StaleValue; slot.fresh[0] = FreshValue; slot.table = {Low(slot.stale.data()), High(slot.stale.data())}; slot.outputDescriptor = Descriptor(slot.output.data(), sizeof(slot.output)); slot.spinDescriptor = Descriptor(slot.spinOutput.data(), sizeof(slot.spinOutput)); std::vector producer; - Dispatch(producer, SpinCode.data(), {Low(slot.spinDescriptor.data()), High(slot.spinDescriptor.data()), iterations}); + for (std::uint32_t index = 0; index < spinDispatches; ++index) Dispatch(producer, SpinCode.data(), {Low(slot.spinDescriptor.data()), High(slot.spinDescriptor.data()), SpinIterationsPerDispatch}); WriteData(producer, &slot.label, 1); std::vector consumer; WaitEqual(consumer, &slot.label, 1); @@ -118,16 +119,16 @@ int main() { auto device = OpenVulkanTestDevice(); if (!device) return VulkanTestSkipped; device.reset(); - std::uint32_t iterations = 1u << 26u; + std::uint32_t spinDispatches = (1u << 26u) / SpinIterationsPerDispatch; for (auto& slot : Slots) { - const auto outcome = Run(slot, iterations); + const auto outcome = Run(slot, spinDispatches); Require(outcome != Outcome::Stale, "a dispatch behind a cross-queue WAIT_REG_MEM read its table before the producer's label reached memory, so it missed the table the CPU filled after submitting"); if (outcome == Outcome::Fresh) { - std::cout << "gated dispatch capture test passed (" << iterations << " producer iterations)\n"; + std::cout << "gated dispatch capture test passed (" << spinDispatches << " producer dispatches of " << SpinIterationsPerDispatch << " iterations)\n"; AgcDriverShutdown_nid_postfix(); return 0; } - iterations *= 2u; + spinDispatches *= 2u; } std::cout << "the producer's label always reached memory before the table was filled: gated dispatch capture not tested\n"; AgcDriverShutdown_nid_postfix();