2023-09-27 22:02:30 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2023 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2023-12-11 20:10:56 +08:00
|
|
|
#include "shared/source/helpers/in_order_cmd_helpers.h"
|
2023-09-27 22:02:30 +08:00
|
|
|
|
|
|
|
#include "shared/source/memory_manager/memory_manager.h"
|
|
|
|
|
|
|
|
#include <cstdint>
|
2023-11-30 19:27:42 +08:00
|
|
|
#include <string.h>
|
2023-09-27 22:02:30 +08:00
|
|
|
#include <vector>
|
|
|
|
|
2023-12-11 20:10:56 +08:00
|
|
|
namespace NEO {
|
2023-09-27 22:02:30 +08:00
|
|
|
|
|
|
|
InOrderExecInfo::~InOrderExecInfo() {
|
2023-11-30 19:27:42 +08:00
|
|
|
memoryManager.freeGraphicsMemory(&deviceCounterAllocation);
|
2023-12-07 23:33:34 +08:00
|
|
|
memoryManager.freeGraphicsMemory(hostCounterAllocation);
|
2023-09-27 22:02:30 +08:00
|
|
|
}
|
|
|
|
|
2023-12-07 23:33:34 +08:00
|
|
|
InOrderExecInfo::InOrderExecInfo(NEO::GraphicsAllocation &deviceCounterAllocation, NEO::GraphicsAllocation *hostCounterAllocation, NEO::MemoryManager &memoryManager, uint32_t partitionCount, bool regularCmdList, bool atomicDeviceSignalling)
|
2023-12-13 19:47:42 +08:00
|
|
|
: deviceCounterAllocation(deviceCounterAllocation), memoryManager(memoryManager), hostCounterAllocation(hostCounterAllocation), regularCmdList(regularCmdList), atomicDeviceSignalling(atomicDeviceSignalling) {
|
2023-12-01 21:20:13 +08:00
|
|
|
|
|
|
|
numDevicePartitionsToWait = atomicDeviceSignalling ? 1 : partitionCount;
|
|
|
|
numHostPartitionsToWait = partitionCount;
|
|
|
|
|
2023-12-07 23:33:34 +08:00
|
|
|
if (hostCounterAllocation) {
|
|
|
|
hostAddress = reinterpret_cast<uint64_t *>(hostCounterAllocation->getUnderlyingBuffer());
|
|
|
|
duplicatedHostStorage = true;
|
|
|
|
} else {
|
|
|
|
hostAddress = reinterpret_cast<uint64_t *>(deviceCounterAllocation.getUnderlyingBuffer());
|
|
|
|
}
|
2023-12-01 21:20:13 +08:00
|
|
|
|
|
|
|
reset();
|
2023-11-30 19:27:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void InOrderExecInfo::reset() {
|
2023-12-11 20:10:56 +08:00
|
|
|
resetCounterValue();
|
2023-11-30 19:27:42 +08:00
|
|
|
regularCmdListSubmissionCounter = 0;
|
2023-12-11 19:45:58 +08:00
|
|
|
allocationOffset = 0;
|
2023-11-30 19:27:42 +08:00
|
|
|
|
|
|
|
memset(deviceCounterAllocation.getUnderlyingBuffer(), 0, deviceCounterAllocation.getUnderlyingBufferSize());
|
2023-12-07 23:33:34 +08:00
|
|
|
|
|
|
|
if (hostCounterAllocation) {
|
|
|
|
memset(hostCounterAllocation->getUnderlyingBuffer(), 0, hostCounterAllocation->getUnderlyingBufferSize());
|
|
|
|
}
|
2023-09-27 22:02:30 +08:00
|
|
|
}
|
|
|
|
|
2023-12-11 20:10:56 +08:00
|
|
|
} // namespace NEO
|