Files
compute-runtime/shared/source/helpers/in_order_cmd_helpers.cpp
Dunajski, Bartosz 717bc0c03f refactor: pass InOrderExecInfo to encode method
Related-To: NEO-7966

Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
2023-12-11 16:43:30 +01:00

52 lines
1.7 KiB
C++

/*
* Copyright (C) 2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/in_order_cmd_helpers.h"
#include "shared/source/memory_manager/memory_manager.h"
#include <cstdint>
#include <string.h>
#include <vector>
namespace NEO {
InOrderExecInfo::~InOrderExecInfo() {
memoryManager.freeGraphicsMemory(&deviceCounterAllocation);
memoryManager.freeGraphicsMemory(hostCounterAllocation);
}
InOrderExecInfo::InOrderExecInfo(NEO::GraphicsAllocation &deviceCounterAllocation, NEO::GraphicsAllocation *hostCounterAllocation, NEO::MemoryManager &memoryManager, uint32_t partitionCount, bool regularCmdList, bool atomicDeviceSignalling)
: deviceCounterAllocation(deviceCounterAllocation), memoryManager(memoryManager), hostCounterAllocation(hostCounterAllocation), regularCmdList(regularCmdList) {
numDevicePartitionsToWait = atomicDeviceSignalling ? 1 : partitionCount;
numHostPartitionsToWait = partitionCount;
if (hostCounterAllocation) {
hostAddress = reinterpret_cast<uint64_t *>(hostCounterAllocation->getUnderlyingBuffer());
duplicatedHostStorage = true;
} else {
hostAddress = reinterpret_cast<uint64_t *>(deviceCounterAllocation.getUnderlyingBuffer());
}
reset();
}
void InOrderExecInfo::reset() {
resetCounterValue();
regularCmdListSubmissionCounter = 0;
allocationOffset = 0;
memset(deviceCounterAllocation.getUnderlyingBuffer(), 0, deviceCounterAllocation.getUnderlyingBufferSize());
if (hostCounterAllocation) {
memset(hostCounterAllocation->getUnderlyingBuffer(), 0, hostCounterAllocation->getUnderlyingBufferSize());
}
}
} // namespace NEO