From 71eedb895d69314abf3a999fc10a44e7edd5ed59 Mon Sep 17 00:00:00 2001 From: rgba16f <82187279+rgba16f@users.noreply.github.com> Date: Wed, 10 Nov 2021 10:26:03 -0600 Subject: [PATCH 1/2] Move PipelineStateCache validation of set uniqeness to only be active in debug builds (#5472) Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com> --- Gems/Atom/RHI/Code/Source/RHI/PipelineStateCache.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gems/Atom/RHI/Code/Source/RHI/PipelineStateCache.cpp b/Gems/Atom/RHI/Code/Source/RHI/PipelineStateCache.cpp index 0c06887dd6..79c05c37da 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/PipelineStateCache.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/PipelineStateCache.cpp @@ -41,9 +41,12 @@ namespace AZ AZ_Assert(readOnlyCache.empty(), "Inactive library has pipeline states in its global entry."); } +#if defined(AZ_DEBUG_BUILD) + // the PipelineStateSet is expensive to duplicate, only do this in debug. PipelineStateSet readOnlyCacheCopy = readOnlyCache; AZ_Assert(AZStd::unique(readOnlyCacheCopy.begin(), readOnlyCacheCopy.end()) == readOnlyCacheCopy.end(), "'%d' Duplicates existed in the read-only cache!", readOnlyCache.size() - readOnlyCacheCopy.size()); +#endif } m_threadLibrarySet.ForEach([this](const ThreadLibrarySet& threadLibrarySet) From 394ba9a8bcb061be377a115f596dac834b753f85 Mon Sep 17 00:00:00 2001 From: rgba16f <82187279+rgba16f@users.noreply.github.com> Date: Wed, 10 Nov 2021 14:08:55 -0600 Subject: [PATCH 2/2] Atom CPU threading optimization (#5481) * Small change to make the RasterPass Scope jobs split the work more evenly over the cores Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com> * Update with PR feedback. Remove scale of EstimatedItemCount, modify the command list cost threshold instead Signed-off-by: rgba16f <82187279+rgba16f@users.noreply.github.com> --- .../Include/Atom/RHI.Reflect/DX12/PlatformLimitsDescriptor.h | 2 +- .../Include/Atom/RHI.Reflect/Metal/PlatformLimitsDescriptor.h | 2 +- .../Include/Atom/RHI.Reflect/Vulkan/PlatformLimitsDescriptor.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gems/Atom/RHI/DX12/Code/Include/Atom/RHI.Reflect/DX12/PlatformLimitsDescriptor.h b/Gems/Atom/RHI/DX12/Code/Include/Atom/RHI.Reflect/DX12/PlatformLimitsDescriptor.h index 63c2d69ea2..1a447693c2 100644 --- a/Gems/Atom/RHI/DX12/Code/Include/Atom/RHI.Reflect/DX12/PlatformLimitsDescriptor.h +++ b/Gems/Atom/RHI/DX12/Code/Include/Atom/RHI.Reflect/DX12/PlatformLimitsDescriptor.h @@ -40,7 +40,7 @@ namespace AZ uint32_t m_swapChainsPerCommandList = 8; // The maximum cost that can be associated with a single command list. - uint32_t m_commandListCostThresholdMin = 1000; + uint32_t m_commandListCostThresholdMin = 250; // The maximum number of command lists per scope. uint32_t m_commandListsPerScopeMax = 16; diff --git a/Gems/Atom/RHI/Metal/Code/Include/Atom/RHI.Reflect/Metal/PlatformLimitsDescriptor.h b/Gems/Atom/RHI/Metal/Code/Include/Atom/RHI.Reflect/Metal/PlatformLimitsDescriptor.h index 375b532d39..bd52c37a67 100644 --- a/Gems/Atom/RHI/Metal/Code/Include/Atom/RHI.Reflect/Metal/PlatformLimitsDescriptor.h +++ b/Gems/Atom/RHI/Metal/Code/Include/Atom/RHI.Reflect/Metal/PlatformLimitsDescriptor.h @@ -31,7 +31,7 @@ namespace AZ uint32_t m_swapChainsPerCommandList = 8; // The maximum cost that can be associated with a single command list. - uint32_t m_commandListCostThresholdMin = 1000; + uint32_t m_commandListCostThresholdMin = 250; // The maximum number of command lists per scope. uint32_t m_commandListsPerScopeMax = 16; diff --git a/Gems/Atom/RHI/Vulkan/Code/Include/Atom/RHI.Reflect/Vulkan/PlatformLimitsDescriptor.h b/Gems/Atom/RHI/Vulkan/Code/Include/Atom/RHI.Reflect/Vulkan/PlatformLimitsDescriptor.h index 5e41da9627..eaa4356796 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Include/Atom/RHI.Reflect/Vulkan/PlatformLimitsDescriptor.h +++ b/Gems/Atom/RHI/Vulkan/Code/Include/Atom/RHI.Reflect/Vulkan/PlatformLimitsDescriptor.h @@ -33,7 +33,7 @@ namespace AZ uint32_t m_swapChainsPerCommandList = 8; // The maximum cost that can be associated with a single command list. - uint32_t m_commandListCostThresholdMin = 1000; + uint32_t m_commandListCostThresholdMin = 250; // The maximum number of command lists per scope. uint32_t m_commandListsPerScopeMax = 16;