mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 00:24:58 +08:00
Cleaned up files: shared/source/built_ins/built_ins.h shared/source/command_container/command_encoder.h shared/source/helpers/hw_helper.h shared/source/memory_manager/allocation_properties.h shared/source/xe_hpc_core/hw_cmds.h shared/test/common/test_macros/test_excludes.h Related-To: NEO-5548 Signed-off-by: Warchulski, Jaroslaw <jaroslaw.warchulski@intel.com>
44 lines
1.5 KiB
C++
44 lines
1.5 KiB
C++
/*
|
|
* Copyright (C) 2019-2022 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "shared/source/program/sync_buffer_handler.h"
|
|
|
|
#include "shared/source/command_stream/command_stream_receiver.h"
|
|
#include "shared/source/device/device.h"
|
|
#include "shared/source/memory_manager/allocation_properties.h"
|
|
#include "shared/source/memory_manager/graphics_allocation.h"
|
|
#include "shared/source/memory_manager/memory_manager.h"
|
|
|
|
namespace NEO {
|
|
|
|
SyncBufferHandler::~SyncBufferHandler() {
|
|
memoryManager.checkGpuUsageAndDestroyGraphicsAllocations(graphicsAllocation);
|
|
};
|
|
SyncBufferHandler::SyncBufferHandler(Device &device)
|
|
: device(device), memoryManager(*device.getMemoryManager()) {
|
|
|
|
allocateNewBuffer();
|
|
}
|
|
|
|
void SyncBufferHandler::makeResident(CommandStreamReceiver &csr) {
|
|
csr.makeResident(*graphicsAllocation);
|
|
}
|
|
|
|
void SyncBufferHandler::allocateNewBuffer() {
|
|
AllocationProperties allocationProperties{device.getRootDeviceIndex(), true, bufferSize,
|
|
AllocationType::LINEAR_STREAM,
|
|
(device.getNumGenericSubDevices() > 1u), /* multiOsContextCapable */
|
|
false, device.getDeviceBitfield()};
|
|
graphicsAllocation = memoryManager.allocateGraphicsMemoryWithProperties(allocationProperties);
|
|
UNRECOVERABLE_IF(graphicsAllocation == nullptr);
|
|
|
|
auto cpuPointer = graphicsAllocation->getUnderlyingBuffer();
|
|
std::memset(cpuPointer, 0, bufferSize);
|
|
}
|
|
|
|
} // namespace NEO
|