From 8ed454d2fa3e0b4bb2906f0ef947ed9bdd72a164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Franch?= Date: Thu, 1 Oct 2026 21:37:45 +0200 Subject: [PATCH] ci: run the shader execution tests on lavapipe MixPrecision and SdwaDestination dispatch hand-assembled RDNA through the recompiler and compare every lane with a CPU model, but were never in ctest. Move them to tests/execution/, which is globbed into one test per file with the same target names, so new execution tests add a file and no CMake lines. They exit 77 (skipped) when the host has no Vulkan device; the Linux runner installs lavapipe and sets ANYPS5_REQUIRE_VULKAN=1 so they cannot skip there. Co-Authored-By: Claude --- .github/workflows/build.yml | 4 ++ core/libs/prx/libSceAgcDriver/CMakeLists.txt | 44 ++++++++----------- .../tests/{ => execution}/MixPrecision.cpp | 6 ++- .../tests/{ => execution}/SdwaDestination.cpp | 6 ++- .../tests/execution/VulkanTestDevice.hpp | 22 ++++++++++ 5 files changed, 53 insertions(+), 29 deletions(-) rename core/libs/prx/libSceAgcDriver/tests/{ => execution}/MixPrecision.cpp (97%) rename core/libs/prx/libSceAgcDriver/tests/{ => execution}/SdwaDestination.cpp (97%) create mode 100644 core/libs/prx/libSceAgcDriver/tests/execution/VulkanTestDevice.hpp diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4fc884a5b..3c5428bbd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,10 +32,14 @@ jobs: key: linux save: ${{ github.event_name == 'push' }} evict-old-files: job + - name: Install lavapipe for the GPU execution tests + run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libvulkan1 mesa-vulkan-drivers - run: cmake -S . -B build $CONFIGURE - run: cmake --build build - run: cmake --build build --target libs - run: ctest --test-dir build --output-on-failure --timeout 120 + env: + ANYPS5_REQUIRE_VULKAN: 1 windows: runs-on: windows-latest diff --git a/core/libs/prx/libSceAgcDriver/CMakeLists.txt b/core/libs/prx/libSceAgcDriver/CMakeLists.txt index 38e55c2e2..efb804cfb 100644 --- a/core/libs/prx/libSceAgcDriver/CMakeLists.txt +++ b/core/libs/prx/libSceAgcDriver/CMakeLists.txt @@ -392,36 +392,30 @@ target_link_libraries(agc_driver_mesh_tests PRIVATE shader_recompiler_agc_driver set_target_properties(agc_driver_mesh_tests PROPERTIES CXX_EXTENSIONS OFF) configure_windows_unwind(agc_driver_mesh_tests) -add_test_executable(agc_driver_mix_precision_tests EXCLUDE_FROM_ALL - tests/MixPrecision.cpp -) -target_include_directories(agc_driver_mix_precision_tests PRIVATE - ${LIBS_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/core/shader/recompiler - ${CMAKE_SOURCE_DIR}/3rdparty/Vulkan-Headers/include -) -target_link_libraries(agc_driver_mix_precision_tests PRIVATE libSceAgcDriver SDL2-static libc) -set_target_properties(agc_driver_mix_precision_tests PROPERTIES CXX_EXTENSIONS OFF) -configure_windows_unwind(agc_driver_mix_precision_tests) - -add_test_executable(agc_driver_sdwa_destination_tests EXCLUDE_FROM_ALL - tests/SdwaDestination.cpp -) -target_include_directories(agc_driver_sdwa_destination_tests PRIVATE - ${LIBS_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/core/shader/recompiler - ${CMAKE_SOURCE_DIR}/3rdparty/Vulkan-Headers/include -) -target_link_libraries(agc_driver_sdwa_destination_tests PRIVATE libSceAgcDriver SDL2-static libc) -set_target_properties(agc_driver_sdwa_destination_tests PROPERTIES CXX_EXTENSIONS OFF) -configure_windows_unwind(agc_driver_sdwa_destination_tests) +file(GLOB agcExecutionTestSources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tests/execution/*.cpp) +set(agcExecutionTests) +foreach(agcExecutionTestSource IN LISTS agcExecutionTestSources) + get_filename_component(agcExecutionTestName ${agcExecutionTestSource} NAME_WE) + string(REGEX REPLACE "([a-z0-9])([A-Z])" "\\1_\\2" agcExecutionTestName "${agcExecutionTestName}") + string(TOLOWER "agc_driver_${agcExecutionTestName}_tests" agcExecutionTest) + add_test_executable(${agcExecutionTest} EXCLUDE_FROM_ALL ${agcExecutionTestSource}) + target_include_directories(${agcExecutionTest} PRIVATE + ${LIBS_INCLUDE_DIR} + ${CMAKE_SOURCE_DIR}/core/shader/recompiler + ${CMAKE_SOURCE_DIR}/3rdparty/Vulkan-Headers/include + ) + target_link_libraries(${agcExecutionTest} PRIVATE libSceAgcDriver SDL2-static libc) + set_target_properties(${agcExecutionTest} PROPERTIES CXX_EXTENSIONS OFF) + configure_windows_unwind(${agcExecutionTest}) + list(APPEND agcExecutionTests ${agcExecutionTest}) +endforeach() if(BUILD_TESTING) - foreach(agcTest IN ITEMS agc_driver_tests agc_shader_memory_tests agc_structurizer_tests agc_dpp_write_tests agc_shader_disk_cache_tests agc_shader_control_flow_tests agc_driver_flip_tests agc_driver_pm4_tests agc_driver_graphics_tests) + foreach(agcTest IN ITEMS agc_driver_tests agc_shader_memory_tests agc_structurizer_tests agc_dpp_write_tests agc_shader_disk_cache_tests agc_shader_control_flow_tests agc_driver_flip_tests agc_driver_pm4_tests agc_driver_graphics_tests ${agcExecutionTests}) string(REGEX REPLACE "_tests$" "" agcTestName "${agcTest}") set_target_properties(${agcTest} PROPERTIES EXCLUDE_FROM_ALL OFF) add_test(NAME ${agcTestName} COMMAND ${agcTest}) - set_tests_properties(${agcTestName} PROPERTIES ENVIRONMENT "ANYPS5_NO_SHADER_CACHE=1") + set_tests_properties(${agcTestName} PROPERTIES ENVIRONMENT "ANYPS5_NO_SHADER_CACHE=1" SKIP_RETURN_CODE 77) if(WIN32) set_tests_properties(${agcTestName} PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$") diff --git a/core/libs/prx/libSceAgcDriver/tests/MixPrecision.cpp b/core/libs/prx/libSceAgcDriver/tests/execution/MixPrecision.cpp similarity index 97% rename from core/libs/prx/libSceAgcDriver/tests/MixPrecision.cpp rename to core/libs/prx/libSceAgcDriver/tests/execution/MixPrecision.cpp index ae7338b1b..339dff87d 100644 --- a/core/libs/prx/libSceAgcDriver/tests/MixPrecision.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/execution/MixPrecision.cpp @@ -1,6 +1,7 @@ #include "prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp" #include "prx/libSceAgcDriver/Graphics/include/Draw.hpp" #include "Recompiler.hpp" +#include "VulkanTestDevice.hpp" #include #include #include @@ -134,9 +135,10 @@ void Check() { int main() { try { - AgcDriver::VulkanDevice device; + const auto device = OpenVulkanTestDevice(); + if (!device) return VulkanTestSkipped; FillInput(); - Run(device); + Run(*device); Check(); std::puts("mix precision tests passed"); return 0; diff --git a/core/libs/prx/libSceAgcDriver/tests/SdwaDestination.cpp b/core/libs/prx/libSceAgcDriver/tests/execution/SdwaDestination.cpp similarity index 97% rename from core/libs/prx/libSceAgcDriver/tests/SdwaDestination.cpp rename to core/libs/prx/libSceAgcDriver/tests/execution/SdwaDestination.cpp index 355dfa2b1..991ad47d8 100644 --- a/core/libs/prx/libSceAgcDriver/tests/SdwaDestination.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/execution/SdwaDestination.cpp @@ -1,6 +1,7 @@ #include "prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp" #include "prx/libSceAgcDriver/Graphics/include/Draw.hpp" #include "Recompiler.hpp" +#include "VulkanTestDevice.hpp" #include #include #include @@ -105,9 +106,10 @@ void Check() { int main() { try { - AgcDriver::VulkanDevice device; + const auto device = OpenVulkanTestDevice(); + if (!device) return VulkanTestSkipped; FillInput(); - Run(device); + Run(*device); Check(); std::puts("sdwa destination tests passed"); return 0; diff --git a/core/libs/prx/libSceAgcDriver/tests/execution/VulkanTestDevice.hpp b/core/libs/prx/libSceAgcDriver/tests/execution/VulkanTestDevice.hpp new file mode 100644 index 000000000..a7908412e --- /dev/null +++ b/core/libs/prx/libSceAgcDriver/tests/execution/VulkanTestDevice.hpp @@ -0,0 +1,22 @@ +#ifndef CORE_LIBS_PRX_LIBSCEAGCDRIVER_TESTS_VULKANTESTDEVICE_HPP +#define CORE_LIBS_PRX_LIBSCEAGCDRIVER_TESTS_VULKANTESTDEVICE_HPP + +#include "prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp" +#include +#include +#include +#include + +constexpr int VulkanTestSkipped = 77; + +inline std::unique_ptr OpenVulkanTestDevice() { + try { + return std::make_unique(); + } catch (const std::exception& error) { + if (std::getenv("ANYPS5_REQUIRE_VULKAN") != nullptr) throw; + std::printf("skipped, no usable Vulkan device: %s\n", error.what()); + return nullptr; + } +} + +#endif