diff --git a/src/gpgmm/common/BUILD.gn b/src/gpgmm/common/BUILD.gn index ff4463b71..718246aa6 100644 --- a/src/gpgmm/common/BUILD.gn +++ b/src/gpgmm/common/BUILD.gn @@ -189,6 +189,8 @@ source_set("gpgmm_common_sources") { "BuddyMemoryAllocator.h", "ConditionalMemoryAllocator.cpp", "ConditionalMemoryAllocator.h", + "DedicatedMemoryAllocator.cpp", + "DedicatedMemoryAllocator.h", "Defaults.h", "Error.h", "EventMessage.cpp", @@ -219,8 +221,6 @@ source_set("gpgmm_common_sources") { "SlabBlockAllocator.h", "SlabMemoryAllocator.cpp", "SlabMemoryAllocator.h", - "StandaloneMemoryAllocator.cpp", - "StandaloneMemoryAllocator.h", "TraceEvent.cpp", "TraceEvent.h", "WorkerThread.cpp", diff --git a/src/gpgmm/common/CMakeLists.txt b/src/gpgmm/common/CMakeLists.txt index 2d2e945d3..d783aae8e 100644 --- a/src/gpgmm/common/CMakeLists.txt +++ b/src/gpgmm/common/CMakeLists.txt @@ -21,6 +21,8 @@ target_sources(gpgmm_common PRIVATE "BuddyMemoryAllocator.h" "ConditionalMemoryAllocator.cpp" "ConditionalMemoryAllocator.h" + "DedicatedMemoryAllocator.cpp" + "DedicatedMemoryAllocator.h" "Defaults.h" "Error.h" "EventTraceWriter.cpp" @@ -52,8 +54,6 @@ target_sources(gpgmm_common PRIVATE "SlabBlockAllocator.h" "SlabMemoryAllocator.cpp" "SlabMemoryAllocator.h" - "StandaloneMemoryAllocator.cpp" - "StandaloneMemoryAllocator.h" "TraceEvent.cpp" "TraceEvent.h" "WorkerThread.cpp" diff --git a/src/gpgmm/common/StandaloneMemoryAllocator.cpp b/src/gpgmm/common/DedicatedMemoryAllocator.cpp similarity index 72% rename from src/gpgmm/common/StandaloneMemoryAllocator.cpp rename to src/gpgmm/common/DedicatedMemoryAllocator.cpp index c746d55ce..f5b5241b6 100644 --- a/src/gpgmm/common/StandaloneMemoryAllocator.cpp +++ b/src/gpgmm/common/DedicatedMemoryAllocator.cpp @@ -12,20 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "gpgmm/common/StandaloneMemoryAllocator.h" +#include "gpgmm/common/DedicatedMemoryAllocator.h" #include "gpgmm/common/TraceEvent.h" namespace gpgmm { - StandaloneMemoryAllocator::StandaloneMemoryAllocator( + DedicatedMemoryAllocator::DedicatedMemoryAllocator( std::unique_ptr memoryAllocator) : MemoryAllocator(std::move(memoryAllocator)) { } - std::unique_ptr StandaloneMemoryAllocator::TryAllocateMemory( + std::unique_ptr DedicatedMemoryAllocator::TryAllocateMemory( const MemoryAllocationRequest& request) { - TRACE_EVENT0(TraceEventCategory::Default, "StandaloneMemoryAllocator.TryAllocateMemory"); + TRACE_EVENT0(TraceEventCategory::Default, "DedicatedMemoryAllocator.TryAllocateMemory"); std::lock_guard lock(mMutex); @@ -42,8 +42,8 @@ namespace gpgmm { new MemoryBlock{0, request.SizeInBytes}, request.SizeInBytes); } - void StandaloneMemoryAllocator::DeallocateMemory(std::unique_ptr allocation) { - TRACE_EVENT0(TraceEventCategory::Default, "StandaloneMemoryAllocator.DeallocateMemory"); + void DedicatedMemoryAllocator::DeallocateMemory(std::unique_ptr allocation) { + TRACE_EVENT0(TraceEventCategory::Default, "DedicatedMemoryAllocator.DeallocateMemory"); std::lock_guard lock(mMutex); @@ -55,18 +55,18 @@ namespace gpgmm { GetNextInChain()->DeallocateMemory(std::move(allocation)); } - MemoryAllocatorInfo StandaloneMemoryAllocator::GetInfo() const { + MemoryAllocatorInfo DedicatedMemoryAllocator::GetInfo() const { std::lock_guard lock(mMutex); MemoryAllocatorInfo result = mInfo; result += GetNextInChain()->GetInfo(); return result; } - uint64_t StandaloneMemoryAllocator::GetMemoryAlignment() const { + uint64_t DedicatedMemoryAllocator::GetMemoryAlignment() const { return GetNextInChain()->GetMemoryAlignment(); } - const char* StandaloneMemoryAllocator::GetTypename() const { - return "StandaloneMemoryAllocator"; + const char* DedicatedMemoryAllocator::GetTypename() const { + return "DedicatedMemoryAllocator"; } } // namespace gpgmm diff --git a/src/gpgmm/common/StandaloneMemoryAllocator.h b/src/gpgmm/common/DedicatedMemoryAllocator.h similarity index 74% rename from src/gpgmm/common/StandaloneMemoryAllocator.h rename to src/gpgmm/common/DedicatedMemoryAllocator.h index 171b684bd..3c89f3f1e 100644 --- a/src/gpgmm/common/StandaloneMemoryAllocator.h +++ b/src/gpgmm/common/DedicatedMemoryAllocator.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef GPGMM_COMMON_STANDALONEMEMORYALLOCATOR_H_ -#define GPGMM_COMMON_STANDALONEMEMORYALLOCATOR_H_ +#ifndef GPGMM_COMMON_DEDICATEDMEMORYALLOCATOR_H_ +#define GPGMM_COMMON_DEDICATEDMEMORYALLOCATOR_H_ #include "gpgmm/common/MemoryAllocator.h" @@ -21,10 +21,10 @@ namespace gpgmm { - // StandaloneMemoryAllocator sub-allocates memory with exactly one block. - class StandaloneMemoryAllocator final : public MemoryAllocator { + // DedicatedMemoryAllocator sub-allocates memory with exactly one block. + class DedicatedMemoryAllocator final : public MemoryAllocator { public: - StandaloneMemoryAllocator(std::unique_ptr memoryAllocator); + DedicatedMemoryAllocator(std::unique_ptr memoryAllocator); // MemoryAllocator interface std::unique_ptr TryAllocateMemory( @@ -38,4 +38,4 @@ namespace gpgmm { } // namespace gpgmm -#endif // GPGMM_COMMON_STANDALONEMEMORYALLOCATOR_H_ +#endif // GPGMM_COMMON_DEDICATEDMEMORYALLOCATOR_H_ diff --git a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp index ff47caa7a..964b81b66 100644 --- a/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp +++ b/src/gpgmm/d3d12/ResourceAllocatorD3D12.cpp @@ -16,12 +16,12 @@ #include "gpgmm/d3d12/ResourceAllocatorD3D12.h" #include "gpgmm/common/BuddyMemoryAllocator.h" +#include "gpgmm/common/DedicatedMemoryAllocator.h" #include "gpgmm/common/Defaults.h" #include "gpgmm/common/EventMessage.h" #include "gpgmm/common/PooledMemoryAllocator.h" #include "gpgmm/common/SegmentedMemoryAllocator.h" #include "gpgmm/common/SlabMemoryAllocator.h" -#include "gpgmm/common/StandaloneMemoryAllocator.h" #include "gpgmm/common/TraceEvent.h" #include "gpgmm/d3d12/BackendD3D12.h" #include "gpgmm/d3d12/BufferAllocatorD3D12.h" diff --git a/src/tests/perftests/MemoryAllocatorPerfTests.cpp b/src/tests/perftests/MemoryAllocatorPerfTests.cpp index d18bf26d6..5cd8f7812 100644 --- a/src/tests/perftests/MemoryAllocatorPerfTests.cpp +++ b/src/tests/perftests/MemoryAllocatorPerfTests.cpp @@ -15,10 +15,10 @@ #include #include "gpgmm/common/BuddyMemoryAllocator.h" +#include "gpgmm/common/DedicatedMemoryAllocator.h" #include "gpgmm/common/SegmentedMemoryAllocator.h" #include "gpgmm/common/SizeClass.h" #include "gpgmm/common/SlabMemoryAllocator.h" -#include "gpgmm/common/StandaloneMemoryAllocator.h" #include "tests/DummyMemoryAllocator.h" #include @@ -128,7 +128,7 @@ BENCHMARK_DEFINE_F(SingleSizeAllocationPerfTests, BuddySystem)(benchmark::State& } BENCHMARK_DEFINE_F(SingleSizeAllocationPerfTests, Standalone)(benchmark::State& state) { - StandaloneMemoryAllocator allocator(std::make_unique()); + DedicatedMemoryAllocator allocator(std::make_unique()); for (auto _ : state) { SingleStep(state, &allocator, CreateBasicRequest(state.range(2)));