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
9 changes: 5 additions & 4 deletions src/gpgmm/d3d12/ResidencyManagerD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ namespace gpgmm::d3d12 {

if (descriptor.IsUMA != caps->IsAdapterUMA()) {
gpgmm::WarningLog()
<< "Memory architecture does not match capabilities of the adapter (IsUMA:"
<< "Memory architecture did not match capabilities of the adapter (IsUMA:"
<< descriptor.IsUMA << " vs " << caps->IsAdapterUMA()
<< "). This is probably not what the developer intended. Please use "
"CheckFeatureSupport instead.";
Expand All @@ -182,8 +182,9 @@ namespace gpgmm::d3d12 {
}

if (descriptor.MaxPctOfVideoMemoryToBudget != 0 && descriptor.MaxBudgetInBytes != 0) {
gpgmm::WarningLog()
<< "OS based memory budget was ignored since a budget was specified.";
gpgmm::ErrorLog() << "Both the OS based memory budget and restricted budget were "
"specified but cannot be used at the same time.";
return E_UNEXPECTED;
}

if (descriptor.RecordOptions.Flags != EVENT_RECORD_FLAG_NONE) {
Expand All @@ -201,7 +202,7 @@ namespace gpgmm::d3d12 {
// Require automatic video memory budget updates.
if (!(descriptor.Flags & RESIDENCY_FLAG_NEVER_UPDATE_BUDGET_ON_WORKER_THREAD)) {
ReturnIfFailed(residencyManager->StartBudgetNotificationUpdates());
gpgmm::DebugLog() << "OS event based budget updates enabled.";
gpgmm::DebugLog() << "OS based memory budget updates were successfully enabled.";
}

// Set the initial video memory limits.
Expand Down
30 changes: 24 additions & 6 deletions src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,13 +420,21 @@ namespace gpgmm::d3d12 {
}

if (allocatorDescriptor.ResourceHeapTier > caps->GetMaxResourceHeapTierSupported()) {
gpgmm::ErrorLog() << "Resource heap tier does not match capabilities of the adapter "
gpgmm::ErrorLog() << "Resource heap tier exceeds the capabilities of the adapter "
"(ResourceHeapTier:"
<< allocatorDescriptor.ResourceHeapTier << " vs "
<< caps->GetMaxResourceHeapTierSupported() << ").";
<< caps->GetMaxResourceHeapTierSupported()
<< "). Please consider using a lower resource heap tier.";
return E_FAIL;
}

if (allocatorDescriptor.ResourceHeapTier < caps->GetMaxResourceHeapTierSupported()) {
gpgmm::DebugLog()
<< "Resource heap tier requested was lower than what the adapter "
"supports. This is allowed but not recommended because it prevents "
"resources of different categories from sharing the same heap.";
}

ALLOCATOR_DESC newDescriptor = allocatorDescriptor;
newDescriptor.MemoryGrowthFactor = (allocatorDescriptor.MemoryGrowthFactor >= 1.0)
? allocatorDescriptor.MemoryGrowthFactor
Expand All @@ -447,6 +455,10 @@ namespace gpgmm::d3d12 {
if (!(allocatorDescriptor.Flags & ALLOCATOR_FLAG_ALWAYS_IN_BUDGET) &&
!caps->IsCreateHeapNotResidentSupported()) {
newDescriptor.Flags |= ALLOCATOR_FLAG_ALWAYS_IN_BUDGET;

gpgmm::DebugLog()
<< "ALLOCATOR_FLAG_ALWAYS_IN_BUDGET was not requested but enabled "
"anyway because the adapter did not support creating non-resident heaps.";
}

newDescriptor.MaxResourceHeapSize =
Expand All @@ -464,6 +476,9 @@ namespace gpgmm::d3d12 {
: kDefaultFragmentationLimit;

if (newDescriptor.PreferredResourceHeapSize > newDescriptor.MaxResourceHeapSize) {
gpgmm::ErrorLog() << "Requested oreferred resource heap size exceeded the capabilities "
"of the adapter. This is probably not what the developer intended "
"to do. Please consider using a smaller resource heap size.";
return E_INVALIDARG;
}

Expand Down Expand Up @@ -491,14 +506,17 @@ namespace gpgmm::d3d12 {
ReturnIfFailed(leakMessageQueue->PushRetrievalFilter(&emptyFilter));
} else {
gpgmm::WarningLog()
<< "GPGMM_ENABLE_DEVICE_LEAK_CHECKS was specified but the D3D12 debug "
"layer was either not installed or enabled.";
<< "GPGMM_ENABLE_DEVICE_LEAK_CHECKS has not effect because the D3D12 debug "
"layer was either not installed or enabled. This is probably not what the "
"developer intended to do.";
}
#endif

if (newDescriptor.Flags & ALLOCATOR_FLAG_ALWAYS_IN_BUDGET && !pResidencyManager) {
gpgmm::WarningLog() << "ALLOCATOR_FLAG_ALWAYS_IN_BUDGET was specified but residency "
"management was not enabled.";
gpgmm::WarningLog() << "ALLOCATOR_FLAG_ALWAYS_IN_BUDGET has no effect when residency "
"management does not exist. This is probably not what the "
"developer intended to do. Please consider creating a residency "
"manager with this resource allocator before using this flag.";
}

std::unique_ptr<ResourceAllocator> resourceAllocator = std::unique_ptr<ResourceAllocator>(
Expand Down