Files
compute-runtime/shared/source/utilities/pool_allocator_traits.h
Fabian Zwoliński 3c43276dab feature: add global/const surface nonUSM allocation pooling
Related-To: NEO-12287
Signed-off-by: Fabian Zwoliński <fabian.zwolinski@intel.com>
2025-10-29 16:56:59 +01:00

55 lines
2.1 KiB
C++

/*
* Copyright (C) 2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/helpers/constants.h"
#include "shared/source/memory_manager/allocation_properties.h"
#include <concepts>
namespace NEO {
class Device;
template <typename T>
concept PoolTraits = requires(Device *d, size_t s) {
{ T::allocationType } -> std::convertible_to<AllocationType>;
{ T::maxAllocationSize } -> std::convertible_to<size_t>;
{ T::defaultPoolSize } -> std::convertible_to<size_t>;
{ T::poolAlignment } -> std::convertible_to<size_t>;
{ T::createAllocationProperties(d, s) } -> std::same_as<AllocationProperties>;
};
struct TimestampPoolTraits {
static constexpr AllocationType allocationType = AllocationType::gpuTimestampDeviceBuffer;
static constexpr size_t maxAllocationSize = 2 * MemoryConstants::megaByte;
static constexpr size_t defaultPoolSize = 4 * MemoryConstants::megaByte;
static constexpr size_t poolAlignment = MemoryConstants::pageSize2M;
static AllocationProperties createAllocationProperties(Device *device, size_t poolSize);
};
struct GlobalSurfacePoolTraits {
static constexpr AllocationType allocationType = AllocationType::globalSurface;
static constexpr size_t maxAllocationSize = 2 * MemoryConstants::megaByte;
static constexpr size_t defaultPoolSize = 2 * MemoryConstants::megaByte;
static constexpr size_t poolAlignment = MemoryConstants::pageSize2M;
static AllocationProperties createAllocationProperties(Device *device, size_t poolSize);
};
struct ConstantSurfacePoolTraits {
static constexpr AllocationType allocationType = AllocationType::constantSurface;
static constexpr size_t maxAllocationSize = 2 * MemoryConstants::megaByte;
static constexpr size_t defaultPoolSize = 2 * MemoryConstants::megaByte;
static constexpr size_t poolAlignment = MemoryConstants::pageSize2M;
static AllocationProperties createAllocationProperties(Device *device, size_t poolSize);
};
} // namespace NEO