Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions core/libs/prx/libSceAgcDriver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1863,6 +1863,18 @@ if(BUILD_TESTING)
endforeach()
set_tests_properties(agc_driver_pixel_implicit_derivatives PROPERTIES TIMEOUT 30)
set_tests_properties(agc_driver_storage_file_write PROPERTIES TIMEOUT 30 ENVIRONMENT "ANYPS5_NO_SHADER_CACHE=1;APS5_SUSPEND_DRAIN=1")
set_tests_properties(agc_driver_draw_pipeline_trace PROPERTIES
ENVIRONMENT "ANYPS5_NO_SHADER_CACHE=1;APS5_PIPELINED_DRAWS=8;APS5_TRACE_FRAMES=0:1;APS5_TRACE_EVENTS=64" TIMEOUT 30)
set_property(TEST agc_driver_draw_pipeline_trace APPEND PROPERTY ENVIRONMENT_MODIFICATION
"APS5_TRACE_SECONDS=unset:" "APS5_TRACE_SUMMARY_EVERY=unset:")
add_test(NAME agc_driver_draw_pipeline_trace_disabled COMMAND ${CMAKE_COMMAND} -E env
--unset=APS5_TRACE_FRAMES --unset=APS5_TRACE_SECONDS --unset=APS5_TRACE_SUMMARY_EVERY
$<TARGET_FILE:agc_driver_draw_pipeline_trace_tests> disabled)
set_tests_properties(agc_driver_draw_pipeline_trace_disabled PROPERTIES ENVIRONMENT "APS5_PIPELINED_DRAWS=8" SKIP_RETURN_CODE 77 TIMEOUT 30)
if(WIN32)
set_tests_properties(agc_driver_draw_pipeline_trace_disabled PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
endif()
add_test(NAME agc_driver_partially_resident_pending_stores COMMAND agc_driver_partially_resident_snapshot_tests --pending-stores)
set_tests_properties(agc_driver_partially_resident_pending_stores PROPERTIES ENVIRONMENT "ANYPS5_NO_SHADER_CACHE=1" SKIP_RETURN_CODE 77 WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" TIMEOUT 30)
if(WIN32)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp"
#include "prx/libSceAgcDriver/Execution/include/GuestMemory.hpp"
#include "prx/libSceAgcDriver/Execution/include/HandoffSpin.hpp"
#include "prx/libSceAgcDriver/Execution/include/PerformanceTrace.hpp"
#include <algorithm>
#include <cstdio>
#include <cstdlib>
Expand Down Expand Up @@ -132,6 +133,7 @@ void DrawPipeline::report(std::chrono::steady_clock::time_point now) {
}

void DrawPipeline::run() {
PerformanceTrace::BindThread("draw committer");
for (;;) {
Commit* commit = nullptr;
SpinUntil(HandoffSpinWindow(), [&] { return outstanding.load(std::memory_order_acquire) != 0; });
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include "prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawPipeline.hpp"
#include "prx/libSceAgcDriver/Execution/include/PerformanceTimer.hpp"
#include <algorithm>
#include <chrono>
#include <iostream>
#include <stdexcept>
#include <string_view>
#include <thread>

int main(int argc, char** argv) {
try {
using namespace AgcDriver;
using DriverDetail::DrawPipeline;
if (DrawPipeline::Depth() == 0) return 77;
const bool disabled = argc > 1 && std::string_view(argv[1]) == "disabled";
if (PerformanceTrace::Configured() == disabled) throw std::runtime_error("unexpected trace configuration");
if (!disabled) PerformanceTrace::Present(1, 1, nullptr);
bool checked = false;
const char* failure = nullptr;
DrawPipeline::Queue0().Enqueue([&] {
auto* trace = PerformanceTrace::Thread();
if (disabled) {
if (trace != nullptr) { failure = "unconfigured draw committer allocated a trace buffer"; return; }
checked = true;
return;
}
if (trace == nullptr) { failure = "draw committer CPU spans are absent from the trace"; return; }
{
PerformanceTimer timer("DrawPipeline.TraceRegression");
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
const auto snapshot = trace->Collect();
if (snapshot.name != "draw committer" || snapshot.dropped) { failure = "draw committer trace identity or capacity is incorrect"; return; }
const auto found = [](const auto& event) { return event.scope != nullptr && std::string_view(event.scope) == "DrawPipeline.TraceRegression" && event.stage == nullptr && event.length > std::chrono::steady_clock::duration::zero(); };
if (std::none_of(snapshot.slices.begin(), snapshot.slices.end(), found) || std::none_of(snapshot.totals.begin(), snapshot.totals.end(), found))
{ failure = "committed work was missing from trace slices or totals"; return; }
checked = true;
}, {});
DrawPipeline::Queue0().Drain(DrawPipeline::DrainReason::Submission);
if (failure != nullptr) throw std::runtime_error(failure);
if (!checked) throw std::runtime_error("draw committer did not run the trace check");
std::cout << "Draw committer tracing checked\n";
return 0;
} catch (const std::exception& error) {
std::cerr << error.what() << '\n';
return 1;
}
}
Loading