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
4 changes: 0 additions & 4 deletions src/gpgmm/common/BuddyBlockAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,4 @@ namespace gpgmm {
SafeDelete(block);
}

const char* BuddyBlockAllocator::GetTypename() const {
return "BuddyBlockAllocator";
}

} // namespace gpgmm
2 changes: 1 addition & 1 deletion src/gpgmm/common/BuddyBlockAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace gpgmm {

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

uint32_t ComputeLevelFromBlockSize(uint64_t blockSize) const;
uint64_t GetNextFreeAlignedBlock(size_t allocationBlockLevel, uint64_t alignment) const;
Expand Down
4 changes: 0 additions & 4 deletions src/gpgmm/common/BuddyMemoryAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,4 @@ namespace gpgmm {
return result;
}

const char* BuddyMemoryAllocator::GetTypename() const {
return "BuddyMemoryAllocator";
}

} // namespace gpgmm
2 changes: 1 addition & 1 deletion src/gpgmm/common/BuddyMemoryAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace gpgmm {

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

uint64_t GetMemoryIndex(uint64_t offset) const;

Expand Down
4 changes: 0 additions & 4 deletions src/gpgmm/common/ConditionalMemoryAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ namespace gpgmm {
return result;
}

const char* ConditionalMemoryAllocator::GetTypename() const {
return "ConditionalMemoryAllocator";
}

MemoryAllocator* ConditionalMemoryAllocator::GetFirstAllocatorForTesting() const {
return mFirstAllocator.get();
}
Expand Down
2 changes: 1 addition & 1 deletion src/gpgmm/common/ConditionalMemoryAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace gpgmm {

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

std::unique_ptr<MemoryAllocator> mFirstAllocator;
std::unique_ptr<MemoryAllocator> mSecondAllocator;
Expand Down
4 changes: 0 additions & 4 deletions src/gpgmm/common/DedicatedMemoryAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,4 @@ namespace gpgmm {
uint64_t DedicatedMemoryAllocator::GetMemoryAlignment() const {
return mMemoryAlignment;
}

const char* DedicatedMemoryAllocator::GetTypename() const {
return "DedicatedMemoryAllocator";
}
} // namespace gpgmm
2 changes: 1 addition & 1 deletion src/gpgmm/common/DedicatedMemoryAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace gpgmm {

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

const uint64_t mMemoryAlignment;
};
Expand Down
4 changes: 0 additions & 4 deletions src/gpgmm/common/Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,4 @@ namespace gpgmm {
return mSubAllocationRefs.Unref();
}

const char* MemoryBase::GetTypename() const {
return "Memory";
}

} // namespace gpgmm
2 changes: 1 addition & 1 deletion src/gpgmm/common/Memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace gpgmm {

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

RefCounted mSubAllocationRefs;

Expand Down
4 changes: 0 additions & 4 deletions src/gpgmm/common/MemoryAllocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,4 @@ namespace gpgmm {
return mBlock;
}

const char* MemoryAllocation::GetTypename() const {
return "Allocation";
}

} // namespace gpgmm
2 changes: 1 addition & 1 deletion src/gpgmm/common/MemoryAllocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ namespace gpgmm {

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

MemoryBase* mMemory;
uint64_t mOffset; // Offset always local to the memory.
Expand Down
4 changes: 0 additions & 4 deletions src/gpgmm/common/MemoryAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,6 @@ namespace gpgmm {
return mStats;
}

const char* MemoryAllocator::GetTypename() const {
return "MemoryAllocator";
}

bool MemoryAllocator::ValidateRequest(const MemoryAllocationRequest& request) const {
ASSERT(request.SizeInBytes > 0 && request.Alignment > 0);

Expand Down
2 changes: 1 addition & 1 deletion src/gpgmm/common/MemoryAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ namespace gpgmm {

The type is used for profiling and debugging purposes only.
*/
const char* GetTypename() const override;
DEFINE_OBJECT_BASE_OVERRIDES(MemoryAllocator)

/** \brief Checks if the request is valid.

Expand Down
5 changes: 5 additions & 0 deletions src/gpgmm/common/Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ namespace gpgmm {
virtual const char* GetTypename() const = 0;
};

// Helper to provide ObjectBase-based object types the type name based on class name.
#define DEFINE_OBJECT_BASE_OVERRIDES(type) \
inline const char* GetTypename() const override { \
return #type; \
}
} // namespace gpgmm

#endif // GPGMM_COMMON_OBJECT_H_
4 changes: 0 additions & 4 deletions src/gpgmm/common/PooledMemoryAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,4 @@ namespace gpgmm {
return mMemoryAlignment;
}

const char* PooledMemoryAllocator::GetTypename() const {
return "PooledMemoryAllocator";
}

} // namespace gpgmm
2 changes: 1 addition & 1 deletion src/gpgmm/common/PooledMemoryAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace gpgmm {

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

std::unique_ptr<MemoryPoolBase> mPool;
uint64_t mMemoryAlignment;
Expand Down
4 changes: 0 additions & 4 deletions src/gpgmm/common/SegmentedMemoryAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,4 @@ namespace gpgmm {
return std::distance(mFreeSegments.begin(), mFreeSegments.end());
}

const char* SegmentedMemoryAllocator::GetTypename() const {
return "SegmentedMemoryAllocator";
}

} // namespace gpgmm
2 changes: 1 addition & 1 deletion src/gpgmm/common/SegmentedMemoryAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace gpgmm {

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

MemorySegment* GetOrCreateFreeSegment(uint64_t memorySize);

Expand Down
4 changes: 0 additions & 4 deletions src/gpgmm/common/SlabBlockAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,4 @@ namespace gpgmm {
return mBlockCount;
}

const char* SlabBlockAllocator::GetTypename() const {
return "SlabBlockAllocator";
}

} // namespace gpgmm
2 changes: 1 addition & 1 deletion src/gpgmm/common/SlabBlockAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace gpgmm {

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

struct BlockList {
SlabBlock* pHead = nullptr; // First free block in slab.
Expand Down
8 changes: 0 additions & 8 deletions src/gpgmm/common/SlabMemoryAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,6 @@ namespace gpgmm {
return result;
}

const char* SlabMemoryAllocator::GetTypename() const {
return "SlabMemoryAllocator";
}

bool SlabMemoryAllocator::IsPrefetchCoverageBelowThreshold() const {
if (mStats.PrefetchedMemoryMissesEliminated >= mStats.PrefetchedMemoryMisses) {
return true;
Expand Down Expand Up @@ -595,8 +591,4 @@ namespace gpgmm {
return GetNextInChain()->GetMemorySize();
}

const char* SlabCacheAllocator::GetTypename() const {
return "SlabCacheAllocator";
}

} // namespace gpgmm
4 changes: 2 additions & 2 deletions src/gpgmm/common/SlabMemoryAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace gpgmm {

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

uint64_t ComputeSlabSize(uint64_t requestSize,
uint64_t baseSlabSize,
Expand Down Expand Up @@ -132,7 +132,7 @@ namespace gpgmm {

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

class SlabAllocatorCacheEntry : public NonCopyable {
public:
Expand Down
4 changes: 0 additions & 4 deletions src/gpgmm/d3d12/DebugResourceAllocatorD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,4 @@ namespace gpgmm::d3d12 {
entry->GetValue().GetAllocator()->DeallocateMemory(std::move(allocation));
}

const char* DebugResourceAllocator::GetTypename() const {
return "DebugResourceAllocator";
}

} // namespace gpgmm::d3d12
2 changes: 1 addition & 1 deletion src/gpgmm/d3d12/DebugResourceAllocatorD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace gpgmm::d3d12 {

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

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

Expand Down
4 changes: 0 additions & 4 deletions src/gpgmm/d3d12/HeapD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,6 @@ namespace gpgmm::d3d12 {
GPGMM_TRACE_EVENT_OBJECT_DESTROY(this);
}

const char* Heap::GetTypename() const {
return "IHeap";
}

uint64_t Heap::GetLastUsedFenceValue() const {
return mLastUsedFenceValue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/gpgmm/d3d12/HeapD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace gpgmm::d3d12 {
bool isResidencyDisabled);

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

HRESULT SetDebugNameImpl(LPCWSTR name) override;
DXGI_MEMORY_SEGMENT_GROUP GetHeapSegment() const;
Expand Down
4 changes: 0 additions & 4 deletions src/gpgmm/d3d12/ResidencyManagerD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,6 @@ namespace gpgmm::d3d12 {
}
}

const char* ResidencyManager::GetTypename() const {
return "IResidencyManager";
}

// Increments number of locks on a heap to ensure the heap remains resident.
HRESULT ResidencyManager::LockHeap(IHeap* pHeap) {
GPGMM_RETURN_IF_NULLPTR(pHeap);
Expand Down
2 changes: 1 addition & 1 deletion src/gpgmm/d3d12/ResidencyManagerD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ namespace gpgmm::d3d12 {
bool IsUMA() const;

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

using LRUCache = LinkedList<Heap>;

Expand Down
4 changes: 0 additions & 4 deletions src/gpgmm/d3d12/ResourceAllocationD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,6 @@ namespace gpgmm::d3d12 {
return {GetSize(), GetAlignment(), static_cast<ALLOCATION_METHOD>(GetMethod())};
}

const char* ResourceAllocation::GetTypename() const {
return "IResourceAllocation";
}

IHeap* ResourceAllocation::GetMemory() const {
return static_cast<Heap*>(MemoryAllocation::GetMemory());
}
Expand Down
2 changes: 1 addition & 1 deletion src/gpgmm/d3d12/ResourceAllocationD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace gpgmm::d3d12 {
void DeleteThis() override;

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

ResidencyManager* const mResidencyManager;
ComPtr<ID3D12Resource> mResource;
Expand Down
4 changes: 0 additions & 4 deletions src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,10 +834,6 @@ namespace gpgmm::d3d12 {
}
}

const char* ResourceAllocator::GetTypename() const {
return "IResourceAllocator";
}

HRESULT ResourceAllocator::ReleaseResourceHeaps(uint64_t bytesToRelease,
uint64_t* pBytesReleased) {
std::lock_guard<std::mutex> lock(mMutex);
Expand Down
2 changes: 1 addition & 1 deletion src/gpgmm/d3d12/ResourceAllocatorD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace gpgmm::d3d12 {
friend ResourceAllocation;

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

HRESULT CreateResourceInternal(const ALLOCATION_DESC& allocationDescriptor,
const D3D12_RESOURCE_DESC& resourceDescriptor,
Expand Down
4 changes: 0 additions & 4 deletions src/gpgmm/d3d12/ResourceHeapAllocatorD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@ namespace gpgmm::d3d12 {
SafeRelease(allocation);
}

const char* ResourceHeapAllocator::GetTypename() const {
return "ResourceHeapAllocator";
}

CreateResourceHeapCallbackContext::CreateResourceHeapCallbackContext(ID3D12Device* device,
D3D12_HEAP_DESC* heapDesc)
: mDevice(device), mHeapDesc(heapDesc) {
Expand Down
2 changes: 1 addition & 1 deletion src/gpgmm/d3d12/ResourceHeapAllocatorD3D12.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace gpgmm::d3d12 {

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

ResidencyManager* const mResidencyManager;
ID3D12Device* const mDevice;
Expand Down