Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/.patches/dawn.diff
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 25b98595af5e7bcc4cc46d964be139601d3a4a70 Mon Sep 17 00:00:00 2001
From 94b1c6f30ff9d23f3c8734cffc8430765d5b6c39 Mon Sep 17 00:00:00 2001
From: Bryan Bernhart <bryan.bernhart@intel.com>
Date: Tue, 15 Feb 2022 17:25:29 -0800
Subject: [PATCH] Use GPGMM for D3D12 backend.
Expand Down Expand Up @@ -495,7 +495,7 @@ index 9747b41c0..50db56dbd 100644

AdapterDiscoveryOptions::AdapterDiscoveryOptions()
diff --git a/src/dawn/native/d3d12/DeviceD3D12.cpp b/src/dawn/native/d3d12/DeviceD3D12.cpp
index 90ddc3041..8d94ead35 100644
index 90ddc3041..62b8f28e1 100644
--- a/src/dawn/native/d3d12/DeviceD3D12.cpp
+++ b/src/dawn/native/d3d12/DeviceD3D12.cpp
@@ -130,8 +130,43 @@ MaybeError Device::Initialize(const DeviceDescriptor* descriptor) {
Expand All @@ -509,14 +509,14 @@ index 90ddc3041..8d94ead35 100644
+ gpgmm::d3d12::ALLOCATOR_DESC allocatorDesc = {};
+ allocatorDesc.Adapter = adapter->GetHardwareAdapter();
+ allocatorDesc.Device = mD3d12Device;
+ allocatorDesc.IsUMA = adapter->GetDeviceInfo().isUMA;
+ allocatorDesc.ResourceHeapTier =
+ static_cast<D3D12_RESOURCE_HEAP_TIER>(adapter->GetDeviceInfo().resourceHeapTier);
+ allocatorDesc.PreferredResourceHeapSize = 4ll * 1024ll * 1024ll; // 4MB
+
+ gpgmm::d3d12::RESIDENCY_DESC residencyDesc = {};
+ residencyDesc.Adapter = adapter->GetHardwareAdapter();
+ residencyDesc.Device = mD3d12Device;
+ residencyDesc.IsUMA = adapter->GetDeviceInfo().isUMA;
+
+ if (IsToggleEnabled(Toggle::UseD3D12SmallResidencyBudgetForTesting)) {
+ residencyDesc.UpdateBudgetByPolling = true;
Expand Down
11 changes: 10 additions & 1 deletion src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,20 @@ namespace gpgmm::d3d12 {
HRESULT ResourceAllocator::CreateAllocator(const ALLOCATOR_DESC& allocatorDescriptor,
ResourceAllocator** ppResourceAllocatorOut,
ResidencyManager** ppResidencyManagerOut) {
if (allocatorDescriptor.Device == nullptr || allocatorDescriptor.Adapter == nullptr) {
return E_INVALIDARG;
}

ComPtr<ResidencyManager> residencyManager;
if (ppResidencyManagerOut != nullptr) {
RESIDENCY_DESC residencyDesc = {};
residencyDesc.Device = allocatorDescriptor.Device;
residencyDesc.IsUMA = allocatorDescriptor.IsUMA;

D3D12_FEATURE_DATA_ARCHITECTURE arch = {};
ReturnIfFailed(residencyDesc.Device->CheckFeatureSupport(D3D12_FEATURE_ARCHITECTURE,
&arch, sizeof(arch)));
residencyDesc.IsUMA = arch.UMA;

residencyDesc.MinLogLevel = allocatorDescriptor.MinLogLevel;
residencyDesc.RecordOptions = allocatorDescriptor.RecordOptions;
ReturnIfFailed(allocatorDescriptor.Adapter.As(&residencyDesc.Adapter));
Expand Down