From 3b006f4fe28006d320c60fd2b4393fd3f27eacd7 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Tue, 27 Jul 2021 19:15:32 -0300 Subject: renderer_vulkan: Add setting to log pipeline statistics Use VK_KHR_pipeline_executable_properties when enabled and available to log statistics about the pipeline cache in a game. For example, this is on Turing GPUs when generating a pipeline cache from Super Smash Bros. Ultimate: Average pipeline statistics ========================================== Code size: 6433.167 Register count: 32.939 More advanced results could be presented, at the moment it's just an average of all 3D and compute pipelines. --- .../renderer_vulkan/pipeline_statistics.h | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/video_core/renderer_vulkan/pipeline_statistics.h (limited to 'src/video_core/renderer_vulkan/pipeline_statistics.h') diff --git a/src/video_core/renderer_vulkan/pipeline_statistics.h b/src/video_core/renderer_vulkan/pipeline_statistics.h new file mode 100644 index 000000000..b61840107 --- /dev/null +++ b/src/video_core/renderer_vulkan/pipeline_statistics.h @@ -0,0 +1,40 @@ +// Copyright 2021 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include +#include + +#include "common/common_types.h" +#include "video_core/vulkan_common/vulkan_wrapper.h" + +namespace Vulkan { + +class Device; + +class PipelineStatistics { +public: + explicit PipelineStatistics(const Device& device_); + + void Collect(VkPipeline pipeline); + + void Report() const; + +private: + struct Stats { + u64 code_size{}; + u64 register_count{}; + u64 sgpr_count{}; + u64 vgpr_count{}; + u64 branches_count{}; + u64 basic_block_count{}; + }; + + const Device& device; + mutable std::mutex mutex; + std::vector collected_stats; +}; + +} // namespace Vulkan -- cgit v1.2.3