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
2 changes: 1 addition & 1 deletion src/gpgmm/d3d12/JSONSerializerD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace gpgmm { namespace d3d12 {
dict.AddItem("MaxVideoMemoryBudget", desc.MaxVideoMemoryBudget);
dict.AddItem("TotalResourceBudgetLimit", desc.TotalResourceBudgetLimit);
dict.AddItem("VideoMemoryEvictSize", desc.VideoMemoryEvictSize);
dict.AddItem("ResourceFragmentationLimit", desc.ResourceFragmentationLimit);
dict.AddItem("MemoryFragmentationLimit", desc.MemoryFragmentationLimit);
return dict;
}

Expand Down
8 changes: 4 additions & 4 deletions src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,9 @@ namespace gpgmm { namespace d3d12 {
? std::min(descriptor.MaxResourceHeapSize, caps->GetMaxResourceHeapSize())
: caps->GetMaxResourceHeapSize();

newDescriptor.ResourceFragmentationLimit = (descriptor.ResourceFragmentationLimit > 0)
? descriptor.ResourceFragmentationLimit
: kDefaultFragmentationLimit;
newDescriptor.MemoryFragmentationLimit = (descriptor.MemoryFragmentationLimit > 0)
? descriptor.MemoryFragmentationLimit
: kDefaultFragmentationLimit;

if (newDescriptor.PreferredResourceHeapSize > newDescriptor.MaxResourceHeapSize) {
return E_INVALIDARG;
Expand Down Expand Up @@ -459,7 +459,7 @@ namespace gpgmm { namespace d3d12 {
/*maxSlabSize*/ PrevPowerOfTwo(mMaxResourceHeapSize),
/*slabSize*/ descriptor.PreferredResourceHeapSize,
/*slabAlignment*/ heapAlignment,
/*slabFragmentationLimit*/ descriptor.ResourceFragmentationLimit,
/*slabFragmentationLimit*/ descriptor.MemoryFragmentationLimit,
/*enablePrefetch*/ !(descriptor.Flags & ALLOCATOR_FLAG_DISABLE_MEMORY_PREFETCH),
std::move(buddyAllocator));
}
Expand Down
6 changes: 3 additions & 3 deletions src/gpgmm/d3d12/ResourceAllocatorD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,20 +190,20 @@ namespace gpgmm { namespace d3d12 {
// evict size to 50MB.
uint64_t VideoMemoryEvictSize;

// Resource fragmentation limit, expressed as a percentage of the resource heap size, that
// Memory fragmentation limit, expressed as a percentage of the resource heap size, that
// is acceptable to be wasted due to internal fragmentation.
//
// Internal fragmentation is when the resource allocation size is larger then the resource
// size requested. This occurs when the type of resource (buffer or texture) and
// sub-allocation algorithm (buddy, slab, etc) have different alignment requirements. For
// example, a 192KB page-aligned resource may need to allocate 256KB of binary-allocated
// space, which if allowed, has a fragmentation limit of 1/3rd.
// When |PreferredResourceHeapSize| is non-zero, |ResourceFragmentationLimit| could be
// When |PreferredResourceHeapSize| is non-zero, |MemoryFragmentationLimit| could be
// exceeded.
//
// Optional parameter. When 0 is specified, the API will automatically set the resource
// fragmentation limit to 1/8th the resource heap size.
double ResourceFragmentationLimit;
double MemoryFragmentationLimit;
};

enum ALLOCATION_FLAGS {
Expand Down
8 changes: 4 additions & 4 deletions src/tests/capture_replay_tests/D3D12EventTraceReplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,16 +312,16 @@ class D3D12EventTraceReplay : public D3D12TestBase, public CaptureReplayTestWith
snapshot["TotalResourceBudgetLimit"].asUInt64();
allocatorDesc.VideoMemoryEvictSize =
snapshot["VideoMemoryEvictSize"].asUInt64();
allocatorDesc.ResourceFragmentationLimit =
snapshot["ResourceFragmentationLimit"].asDouble();
allocatorDesc.MemoryFragmentationLimit =
snapshot["MemoryFragmentationLimit"].asDouble();
} else if (envParams.AllocatorProfile ==
AllocatorProfile::ALLOCATOR_PROFILE_MAX_PERFORMANCE) {
// Any amount of (internal) fragmentation is acceptable.
allocatorDesc.ResourceFragmentationLimit = 1.0f;
allocatorDesc.MemoryFragmentationLimit = 1.0f;
} else if (envParams.AllocatorProfile ==
AllocatorProfile::ALLOCATOR_PROFILE_LOW_MEMORY) {
allocatorDesc.Flags |= ALLOCATOR_FLAG_ALWAYS_ON_DEMAND;
allocatorDesc.ResourceFragmentationLimit = 0.125; // 1/8th of 4MB
allocatorDesc.MemoryFragmentationLimit = 0.125; // 1/8th of 4MB
}

if (envParams.IsStandaloneOnly) {
Expand Down