mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 15:53:45 +08:00
fix: add mock for staging buffer size
No need to allocate 2MB in unit tests. This commit changes this size to 4KB. Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
b9a3f712ed
commit
a2c41e4749
@@ -38,6 +38,7 @@ void StagingBufferTracker::freeChunk() const {
|
||||
|
||||
StagingBufferManager::StagingBufferManager(SVMAllocsManager *svmAllocsManager, const RootDeviceIndicesContainer &rootDeviceIndices, const std::map<uint32_t, DeviceBitfield> &deviceBitfields, bool requiresWritable)
|
||||
: svmAllocsManager(svmAllocsManager), rootDeviceIndices(rootDeviceIndices), deviceBitfields(deviceBitfields), requiresWritable(requiresWritable) {
|
||||
chunkSize = getDefaultStagingBufferSize();
|
||||
if (debugManager.flags.StagingBufferSize.get() != -1) {
|
||||
chunkSize = debugManager.flags.StagingBufferSize.get() * MemoryConstants::kiloByte;
|
||||
}
|
||||
@@ -346,7 +347,7 @@ std::pair<HeapAllocator *, uint64_t> StagingBufferManager::requestStagingBuffer(
|
||||
return {retriedAllocator, retriedChunkBuffer};
|
||||
}
|
||||
|
||||
auto stagingBufferSize = alignUp(std::max(chunkSize, size), MemoryConstants::pageSize2M);
|
||||
auto stagingBufferSize = alignUp(std::max(chunkSize, size), getDefaultStagingBufferSize());
|
||||
auto usmHost = allocateStagingBuffer(stagingBufferSize);
|
||||
if (usmHost != nullptr) {
|
||||
StagingBuffer stagingBuffer{usmHost, stagingBufferSize};
|
||||
|
||||
@@ -119,7 +119,7 @@ class StagingBufferManager : NEO::NonCopyableAndNonMovableClass {
|
||||
|
||||
bool isValidForStaging(const Device &device, const void *ptr, size_t size, bool hasDependencies);
|
||||
|
||||
size_t chunkSize = MemoryConstants::pageSize2M;
|
||||
size_t chunkSize = 0;
|
||||
std::mutex mtx;
|
||||
std::vector<StagingBuffer> stagingBuffers;
|
||||
std::vector<StagingBufferTracker> trackers;
|
||||
@@ -134,4 +134,6 @@ class StagingBufferManager : NEO::NonCopyableAndNonMovableClass {
|
||||
|
||||
static_assert(NEO::NonCopyableAndNonMovable<StagingBufferManager>);
|
||||
|
||||
size_t getDefaultStagingBufferSize();
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user