Different Pso cache per vendor/driver (#6893)
* Support to add a different PSO cache per vendor/driver version. Also added support to have a differnt cache for Warp Signed-off-by: moudgils <47460854+moudgils@users.noreply.github.com> * Added a way to reset PSO cache for everyone Signed-off-by: moudgils <47460854+moudgils@users.noreply.github.com> * Fix tabbing for one line which is failing validation Signed-off-by: moudgils <47460854+moudgils@users.noreply.github.com>
This commit is contained in:
@@ -28,7 +28,8 @@ namespace AZ
|
||||
(AMD, 0x1002),
|
||||
(Qualcomm, 0x5143),
|
||||
(Samsung, 0x1099),
|
||||
(ARM, 0x13B5)
|
||||
(ARM, 0x13B5),
|
||||
(Warp, 0x1414)
|
||||
);
|
||||
|
||||
void ReflectVendorIdEnums(ReflectContext* context);
|
||||
|
||||
@@ -164,23 +164,27 @@ namespace AZ
|
||||
//! it will defer to the platform for parallel dispatch support.
|
||||
void Execute(JobPolicy jobPolicy);
|
||||
|
||||
/// Returns the timing statistics for the previous frame.
|
||||
//! Returns the timing statistics for the previous frame.
|
||||
const TransientAttachmentStatistics* GetTransientAttachmentStatistics() const;
|
||||
|
||||
/// Returns current CPU frame to frame time in milliseconds.
|
||||
//! Returns current CPU frame to frame time in milliseconds.
|
||||
double GetCpuFrameTime() const;
|
||||
|
||||
/// Returns memory statistics for the previous frame.
|
||||
//! Returns memory statistics for the previous frame.
|
||||
const MemoryStatistics* GetMemoryStatistics() const;
|
||||
|
||||
/// Returns the implicit root scope id.
|
||||
//! Returns the implicit root scope id.
|
||||
ScopeId GetRootScopeId() const;
|
||||
|
||||
//! Returns the descriptor which has information on the properties of a TransientAttachmentPool.
|
||||
const TransientAttachmentPoolDescriptor* GetTransientAttachmentPoolDescriptor() const;
|
||||
|
||||
//! Adds a RayTracingShaderTable to be built this frame
|
||||
void QueueRayTracingShaderTableForBuild(RayTracingShaderTable* rayTracingShaderTable);
|
||||
|
||||
//! Returns PhysicalDeviceDescriptor which can be used to extract vendor/driver information
|
||||
const PhysicalDeviceDescriptor& GetPhysicalDeviceDescriptor();
|
||||
|
||||
private:
|
||||
const ScopeId m_rootScopeId{"Root"};
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ namespace AZ
|
||||
const RHI::TransientAttachmentPoolDescriptor* GetTransientAttachmentPoolDescriptor() const override;
|
||||
ConstPtr<PlatformLimitsDescriptor> GetPlatformLimitsDescriptor() const override;
|
||||
void QueueRayTracingShaderTableForBuild(RayTracingShaderTable* rayTracingShaderTable) override;
|
||||
const PhysicalDeviceDescriptor& GetPhysicalDeviceDescriptor() override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private:
|
||||
@@ -65,6 +66,8 @@ namespace AZ
|
||||
RHI::Ptr<RHI::PipelineStateCache> m_pipelineStateCache;
|
||||
RHI::FrameScheduler m_frameScheduler;
|
||||
RHI::FrameSchedulerCompileRequest m_compileRequest;
|
||||
PhysicalDeviceDescriptor m_physicalDeviceDescriptor;
|
||||
|
||||
};
|
||||
} // namespace RPI
|
||||
} // namespace AZ
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace AZ
|
||||
class PipelineState;
|
||||
class PipelineStateCache;
|
||||
class PlatformLimitsDescriptor;
|
||||
class PhysicalDeviceDescriptor;
|
||||
class RayTracingShaderTable;
|
||||
struct FrameSchedulerCompileRequest;
|
||||
struct TransientAttachmentStatistics;
|
||||
@@ -65,6 +66,8 @@ namespace AZ
|
||||
virtual ConstPtr<PlatformLimitsDescriptor> GetPlatformLimitsDescriptor() const = 0;
|
||||
|
||||
virtual void QueueRayTracingShaderTableForBuild(RayTracingShaderTable* rayTracingShaderTable) = 0;
|
||||
|
||||
virtual const PhysicalDeviceDescriptor& GetPhysicalDeviceDescriptor() = 0;
|
||||
};
|
||||
|
||||
//! This bus exists to give RHI samples the ability to slot in scopes manually
|
||||
|
||||
@@ -165,6 +165,7 @@ namespace AZ
|
||||
RHI::Ptr<RHI::Device> device = RHI::Factory::Get().CreateDevice();
|
||||
if (device->Init(*physicalDeviceFound) == RHI::ResultCode::Success)
|
||||
{
|
||||
m_physicalDeviceDescriptor = physicalDeviceFound->GetDescriptor();
|
||||
PlatformLimitsDescriptor::Create();
|
||||
return device;
|
||||
}
|
||||
@@ -279,5 +280,10 @@ namespace AZ
|
||||
{
|
||||
m_frameScheduler.QueueRayTracingShaderTableForBuild(rayTracingShaderTable);
|
||||
}
|
||||
|
||||
const PhysicalDeviceDescriptor& RHISystem::GetPhysicalDeviceDescriptor()
|
||||
{
|
||||
return m_physicalDeviceDescriptor;
|
||||
}
|
||||
} //namespace RPI
|
||||
} //namespace AZ
|
||||
|
||||
@@ -157,7 +157,10 @@ namespace AZ
|
||||
disabledMessages.push_back(D3D12_MESSAGE_ID_COPY_DESCRIPTORS_INVALID_RANGES);
|
||||
}
|
||||
|
||||
// [GFX TODO][ATOM-4712] - Fix PipelineLibrary Loading. These warnings were silenced for a release and need to be fixed properly.
|
||||
// We disable these warnings as the our current implementation of Pipeline Library will trigger these warnings unknowingly. For example
|
||||
// it will always first try to load a pso from pipelinelibrary triggering D3D12_MESSAGE_ID_LOADPIPELINE_NAMENOTFOUND (for the first time) before storing the PSO in a library.
|
||||
// Similarly when we merge multiple pipeline libraries (in multiple threads) we may trigger D3D12_MESSAGE_ID_STOREPIPELINE_DUPLICATENAME as it is possible to save
|
||||
// a PSO already saved in the main library.
|
||||
#if defined (AZ_DX12_USE_PIPELINE_LIBRARY)
|
||||
disabledMessages.push_back(D3D12_MESSAGE_ID_LOADPIPELINE_NAMENOTFOUND);
|
||||
disabledMessages.push_back(D3D12_MESSAGE_ID_STOREPIPELINE_DUPLICATENAME);
|
||||
|
||||
@@ -50,10 +50,9 @@ namespace AZ
|
||||
|
||||
bool shouldCreateLibFromSerializedData = true;
|
||||
if (RHI::Factory::Get().IsRenderDocModuleLoaded() ||
|
||||
RHI::Factory::Get().IsPixModuleLoaded() ||
|
||||
RHI::Factory::Get().UsingWarpDevice())
|
||||
RHI::Factory::Get().IsPixModuleLoaded())
|
||||
{
|
||||
// CreatePipelineLibrary api does not function properly if Renderdoc, Pix or Warp is enabled
|
||||
// CreatePipelineLibrary api does not function properly if Renderdoc or Pix is enabled
|
||||
shouldCreateLibFromSerializedData = false;
|
||||
}
|
||||
|
||||
@@ -218,10 +217,9 @@ namespace AZ
|
||||
RHI::ResultCode PipelineLibrary::MergeIntoInternal([[maybe_unused]] AZStd::array_view<const RHI::PipelineLibrary*> pipelineLibraries)
|
||||
{
|
||||
if (RHI::Factory::Get().IsRenderDocModuleLoaded() ||
|
||||
RHI::Factory::Get().IsPixModuleLoaded() ||
|
||||
RHI::Factory::Get().UsingWarpDevice())
|
||||
RHI::Factory::Get().IsPixModuleLoaded())
|
||||
{
|
||||
// StorePipeline api does not function properly if RenderDoc, Pix or Warp is enabled
|
||||
// StorePipeline api does not function properly if RenderDoc or Pix is enabled
|
||||
return RHI::ResultCode::Fail;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <AzCore/Component/TickBus.h>
|
||||
|
||||
#define PSOCacheVersion 0 // Bump this if you want to reset PSO cache for everyone
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
@@ -85,10 +86,17 @@ namespace AZ
|
||||
AZStd::string uuidString;
|
||||
assetId.m_guid.ToString<AZStd::string>(uuidString, false, false);
|
||||
|
||||
RHI::RHISystemInterface* rhiSystem = RHI::RHISystemInterface::Get();
|
||||
RHI::PhysicalDeviceDescriptor physicalDeviceDesc = rhiSystem->GetPhysicalDeviceDescriptor();
|
||||
|
||||
char pipelineLibraryPathTemp[AZ_MAX_PATH_LEN];
|
||||
azsnprintf(
|
||||
pipelineLibraryPathTemp, AZ_MAX_PATH_LEN, "@user@/Atom/PipelineStateCache/%s/%s_%s_%d.bin", platformName.GetCStr(),
|
||||
shaderName.GetCStr(), uuidString.data(), assetId.m_subId);
|
||||
pipelineLibraryPathTemp, AZ_MAX_PATH_LEN, "@user@/Atom/PipelineStateCache_%s_%i_%i _Ver_%i/%s/%s_%s_%d.bin",
|
||||
ToString(physicalDeviceDesc.m_vendorId).data(), physicalDeviceDesc.m_deviceId, physicalDeviceDesc.m_driverVersion, PSOCacheVersion,
|
||||
platformName.GetCStr(),
|
||||
shaderName.GetCStr(),
|
||||
uuidString.data(),
|
||||
assetId.m_subId);
|
||||
|
||||
fileIOBase->ResolvePath(pipelineLibraryPathTemp, pipelineLibraryPath, pipelineLibraryPathLength);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user