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
1 change: 1 addition & 0 deletions src/gpgmm/common/BuddyBlockAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ namespace gpgmm {
uint64_t ComputeTotalNumOfFreeBlocksForTesting() const;

private:
// ObjectBase interface
const char* GetTypename() const override;

uint32_t ComputeLevelFromBlockSize(uint64_t blockSize) const;
Expand Down
1 change: 1 addition & 0 deletions src/gpgmm/common/BuddyMemoryAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ namespace gpgmm {
MemoryAllocatorStats GetStats() const override;

private:
// ObjectBase interface
const char* GetTypename() const override;

uint64_t GetMemoryIndex(uint64_t offset) const;
Expand Down
1 change: 1 addition & 0 deletions src/gpgmm/common/ConditionalMemoryAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ namespace gpgmm {
MemoryAllocator* GetSecondAllocatorForTesting() const;

private:
// ObjectBase interface
const char* GetTypename() const override;

std::unique_ptr<MemoryAllocator> mFirstAllocator;
Expand Down
1 change: 1 addition & 0 deletions src/gpgmm/common/DedicatedMemoryAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ namespace gpgmm {
MemoryAllocatorStats GetStats() const override;

private:
// ObjectBase interface
const char* GetTypename() const override;
};

Expand Down
1 change: 1 addition & 0 deletions src/gpgmm/common/Memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace gpgmm {
bool RemoveSubAllocationRef();

private:
// ObjectBase interface
const char* GetTypename() const override;

RefCounted mSubAllocationRefs;
Expand Down
1 change: 1 addition & 0 deletions src/gpgmm/common/PooledMemoryAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace gpgmm {
uint64_t GetMemoryAlignment() const override;

private:
// ObjectBase interface
const char* GetTypename() const override;

std::unique_ptr<MemoryPoolBase> mPool;
Expand Down
1 change: 1 addition & 0 deletions src/gpgmm/common/SegmentedMemoryAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace gpgmm {
uint64_t GetSegmentSizeForTesting() const;

private:
// ObjectBase interface
const char* GetTypename() const override;

MemorySegment* GetOrCreateFreeSegment(uint64_t memorySize);
Expand Down
1 change: 1 addition & 0 deletions src/gpgmm/common/SlabBlockAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ namespace gpgmm {
uint64_t GetBlockCount() const;

private:
// ObjectBase interface
const char* GetTypename() const override;

struct BlockList {
Expand Down
2 changes: 2 additions & 0 deletions src/gpgmm/common/SlabMemoryAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ namespace gpgmm {
MemoryAllocatorStats GetStats() const override;

private:
// ObjectBase interface
const char* GetTypename() const override;

uint64_t ComputeSlabSize(uint64_t requestSize,
Expand Down Expand Up @@ -130,6 +131,7 @@ namespace gpgmm {
uint64_t GetMemorySize() const override;

private:
// ObjectBase interface
const char* GetTypename() const override;

class SlabAllocatorCacheEntry : public NonCopyable {
Expand Down
5 changes: 3 additions & 2 deletions src/gpgmm/d3d12/DebugResourceAllocatorD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ namespace gpgmm::d3d12 {
void ReleaseLiveAllocationsForTesting();

private:
void DeallocateMemory(std::unique_ptr<MemoryAllocation> allocation) override;

// ObjectBase interface
const char* GetTypename() const override;

void DeallocateMemory(std::unique_ptr<MemoryAllocation> allocation) override;

class ResourceAllocationEntry {
public:
explicit ResourceAllocationEntry(ResourceAllocation* allocation); // For lookup
Expand Down
4 changes: 3 additions & 1 deletion src/gpgmm/d3d12/HeapD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ namespace gpgmm::d3d12 {
const HEAP_DESC& descriptor,
bool isResidencyDisabled);

HRESULT SetDebugNameImpl(LPCWSTR name) override;
// ObjectBase interface
const char* GetTypename() const override;

HRESULT SetDebugNameImpl(LPCWSTR name) override;
DXGI_MEMORY_SEGMENT_GROUP GetMemorySegmentGroup() const;

// The residency manager must know the last fence value that any portion of the pageable was
Expand Down
9 changes: 3 additions & 6 deletions src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ namespace gpgmm::d3d12 {
(allocationDescriptor.Flags & ALLOCATION_FLAG_DISABLE_RESIDENCY)
? nullptr
: mResidencyManager.Get(),
ImportResourceCallbackContext::CreateHeap,
ImportResourceCallbackContext::GetHeap,
&importResourceCallbackContext, &resourceHeap));

const uint64_t& allocationSize = resourceInfo.SizeInBytes;
Expand Down Expand Up @@ -1481,12 +1481,9 @@ namespace gpgmm::d3d12 {
}

// static
HRESULT ImportResourceCallbackContext::CreateHeap(void* pContext,
HRESULT ImportResourceCallbackContext::GetHeap(void* pContext,
ID3D12Pageable** ppPageableOut) {
ImportResourceCallbackContext* importResourceCallbackContext =
static_cast<ImportResourceCallbackContext*>(pContext);

return importResourceCallbackContext->GetHeap(ppPageableOut);
return static_cast<ImportResourceCallbackContext*>(pContext)->GetHeap(ppPageableOut);
}

HRESULT ImportResourceCallbackContext::GetHeap(ID3D12Pageable** ppPageableOut) {
Expand Down
7 changes: 4 additions & 3 deletions src/gpgmm/d3d12/ResourceAllocatorD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace gpgmm::d3d12 {
class ImportResourceCallbackContext {
public:
ImportResourceCallbackContext(ComPtr<ID3D12Resource> resource);
static HRESULT CreateHeap(void* pContext, ID3D12Pageable** ppPageableOut);
static HRESULT GetHeap(void* pContext, ID3D12Pageable** ppPageableOut);

private:
HRESULT GetHeap(ID3D12Pageable** ppPageableOut);
Expand Down Expand Up @@ -101,12 +101,13 @@ namespace gpgmm::d3d12 {

DEFINE_IUNKNOWNIMPL_OVERRIDES()

const char* GetTypename() const override;

private:
friend BufferAllocator;
friend ResourceAllocation;

// ObjectBase interface
const char* GetTypename() const override;

HRESULT CreateResourceInternal(const ALLOCATION_DESC& allocationDescriptor,
const D3D12_RESOURCE_DESC& resourceDescriptor,
D3D12_RESOURCE_STATES initialResourceState,
Expand Down
6 changes: 4 additions & 2 deletions src/gpgmm/d3d12/ResourceHeapAllocatorD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

namespace gpgmm::d3d12 {

static const wchar_t* kResourceHeapDebugName = L"GPGMM Resource Heap";

ResourceHeapAllocator::ResourceHeapAllocator(ResidencyManager* residencyManager,
ID3D12Device* device,
D3D12_HEAP_PROPERTIES heapProperties,
Expand All @@ -51,8 +53,8 @@ namespace gpgmm::d3d12 {
// alignment to avoid wasting bytes.
// https://docs.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_HEAP_INFO
resourceHeapDesc.SizeInBytes = AlignTo(request.SizeInBytes, request.Alignment);
resourceHeapDesc.Alignment = request.Alignment;
resourceHeapDesc.DebugName = L"Resource heap";
resourceHeapDesc.Alignment = request.Alignment;
resourceHeapDesc.DebugName = kResourceHeapDebugName;

const bool isResidencyEnabled = (mResidencyManager != nullptr);
resourceHeapDesc.Flags |= GetHeapFlags(mHeapFlags, isResidencyEnabled);
Expand Down
1 change: 1 addition & 0 deletions src/gpgmm/d3d12/ResourceHeapAllocatorD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ namespace gpgmm::d3d12 {
void DeallocateMemory(std::unique_ptr<MemoryAllocation> allocation) override;

private:
// ObjectBase interface
const char* GetTypename() const override;

ResidencyManager* const mResidencyManager;
Expand Down