mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-26 22:35:43 +00:00
Enable custom heaps based on query
This commit is contained in:
parent
d3345f3680
commit
7520974970
4 changed files with 34 additions and 2 deletions
|
|
@ -217,8 +217,7 @@ namespace DmlGraphFusionHelper
|
|||
{
|
||||
ComPtr<ID3D12Resource> initializeInputBuffer;
|
||||
|
||||
// D3D_FEATURE_LEVEL_1_0_CORE doesn't support Custom heaps
|
||||
if (providerImpl->IsMcdmDevice())
|
||||
if (!providerImpl->CustomHeapsSupported())
|
||||
{
|
||||
initializeInputBuffer = CreateResource(providerImpl, tensorPtr, tensorByteSize);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,6 +181,31 @@ namespace Dml
|
|||
}
|
||||
|
||||
m_isMcdmDevice = (featureLevels.MaxSupportedFeatureLevel == D3D_FEATURE_LEVEL_1_0_CORE_PRIVATE);
|
||||
m_areCustomHeapsSupported = !m_isMcdmDevice;
|
||||
|
||||
if (m_isMcdmDevice) {
|
||||
|
||||
// TODO: Ingest updated header file
|
||||
typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS19
|
||||
{
|
||||
BOOL MismatchingOutputDimensionsSupported;
|
||||
UINT SupportedSampleCountsWithNoOutputs;
|
||||
BOOL PointSamplingAddressesNeverRoundUp;
|
||||
BOOL RasterizerDesc2Supported;
|
||||
BOOL NarrowQuadrilateralLinesSupported;
|
||||
BOOL AnisoFilterWithPointMipSupported;
|
||||
UINT MaxSamplerDescriptorHeapSize;
|
||||
UINT MaxSamplerDescriptorHeapSizeWithStaticSamplers;
|
||||
UINT MaxViewDescriptorHeapSize;
|
||||
_Out_ BOOL ComputeOnlyCustomHeapSupported;
|
||||
} D3D12_FEATURE_DATA_D3D12_OPTIONS19;
|
||||
|
||||
D3D12_FEATURE_DATA_D3D12_OPTIONS19 options19 = {};
|
||||
|
||||
// The call may fail in which case the default value is false
|
||||
d3d12Device->CheckFeatureSupport((D3D12_FEATURE) 48 /*D3D12_FEATURE_D3D12_OPTIONS19*/, &options19, sizeof(options19));
|
||||
m_areCustomHeapsSupported = options19.ComputeOnlyCustomHeapSupported;
|
||||
}
|
||||
|
||||
m_context = std::make_shared<ExecutionContext>(m_d3d12Device.Get(), m_dmlDevice.Get(), queue);
|
||||
|
||||
|
|
@ -1088,6 +1113,11 @@ namespace Dml
|
|||
return m_isMcdmDevice;
|
||||
}
|
||||
|
||||
bool __stdcall ExecutionProviderImpl::CustomHeapsSupported() const noexcept
|
||||
{
|
||||
return m_areCustomHeapsSupported;
|
||||
}
|
||||
|
||||
bool __stdcall ExecutionProviderImpl::MetacommandsEnabled() const noexcept
|
||||
{
|
||||
return m_areMetacommandsEnabled;
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ namespace Dml
|
|||
}
|
||||
|
||||
STDMETHOD_(bool, IsMcdmDevice)() const noexcept final;
|
||||
STDMETHOD_(bool, CustomHeapsSupported)() const noexcept final;
|
||||
|
||||
STDMETHOD_(bool, MetacommandsEnabled)() const noexcept final;
|
||||
std::shared_ptr<onnxruntime::IAllocator> GetGpuAllocator();
|
||||
|
|
@ -183,6 +184,7 @@ namespace Dml
|
|||
ComPtr<ID3D12Device> m_d3d12Device;
|
||||
ComPtr<IDMLDevice> m_dmlDevice;
|
||||
bool m_isMcdmDevice = false;
|
||||
bool m_areCustomHeapsSupported = false;
|
||||
bool m_areMetacommandsEnabled = true;
|
||||
bool m_native16BitShaderOpsSupported = false;
|
||||
std::shared_ptr<ExecutionContext> m_context;
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ namespace Dml
|
|||
STDMETHOD(AllocatePooledResource(size_t size, AllocatorRoundingMode roundingMode, ID3D12Resource **d3dResource, IUnknown* *pooledResource)) const noexcept = 0;
|
||||
|
||||
STDMETHOD_(bool, IsMcdmDevice)() const noexcept = 0;
|
||||
STDMETHOD_(bool, CustomHeapsSupported)() const noexcept = 0;
|
||||
STDMETHOD_(bool, MetacommandsEnabled)() const noexcept = 0;
|
||||
};
|
||||
} // namespace Dml
|
||||
|
|
|
|||
Loading…
Reference in a new issue