Revert "refactor: migration to std::make_unique C++17"
This reverts commit 4cf685cb7d
.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
parent
4cf685cb7d
commit
58707e0cf7
|
@ -903,7 +903,7 @@ void CommandQueue::enqueueBlockedMapUnmapOperation(const cl_event *eventWaitList
|
|||
}
|
||||
|
||||
// store task data in event
|
||||
auto cmd = std::make_unique<CommandMapUnmap>(opType, *memObj, copySize, copyOffset, readOnly, *this);
|
||||
auto cmd = std::unique_ptr<Command>(new CommandMapUnmap(opType, *memObj, copySize, copyOffset, readOnly, *this));
|
||||
eventBuilder->getEvent()->setCommand(std::move(cmd));
|
||||
|
||||
// bind output event with input events
|
||||
|
|
|
@ -78,7 +78,7 @@ void VASharingFunctions::initFunctions() {
|
|||
void VASharingFunctions::querySupportedVaImageFormats(VADisplay vaDisplay) {
|
||||
int maxFormats = this->maxNumImageFormats(vaDisplay);
|
||||
if (maxFormats > 0) {
|
||||
auto allVaFormats = std::make_unique<VAImageFormat[]>(maxFormats);
|
||||
std::unique_ptr<VAImageFormat[]> allVaFormats(new VAImageFormat[maxFormats]);
|
||||
auto result = this->queryImageFormats(vaDisplay, allVaFormats.get(), &maxFormats);
|
||||
if (result == VA_STATUS_SUCCESS) {
|
||||
for (int i = 0; i < maxFormats; i++) {
|
||||
|
|
|
@ -79,7 +79,7 @@ void ClFileLogger<debugLevel>::dumpKernelArgs(const MultiDispatchInfo *multiDisp
|
|||
type = "immediate";
|
||||
auto crossThreadData = kernel->getCrossThreadData();
|
||||
auto crossThreadDataSize = kernel->getCrossThreadDataSize();
|
||||
argVal = std::make_unique<char[]>(crossThreadDataSize);
|
||||
argVal = std::unique_ptr<char[]>(new char[crossThreadDataSize]);
|
||||
|
||||
size_t totalArgSize = 0;
|
||||
for (const auto &element : arg.as<ArgDescValue>().elements) {
|
||||
|
|
|
@ -143,7 +143,7 @@ std::vector<char> OclocArgHelper::readBinaryFile(const std::string &filename) {
|
|||
std::unique_ptr<char[]> OclocArgHelper::loadDataFromFile(const std::string &filename, size_t &retSize) {
|
||||
if (Source *s = findSourceFile(filename)) {
|
||||
auto size = s->length;
|
||||
auto ret = std::make_unique<char[]>(size);
|
||||
std::unique_ptr<char[]> ret(new char[size]());
|
||||
memcpy_s(ret.get(), size, s->data, s->length);
|
||||
retSize = s->length;
|
||||
return ret;
|
||||
|
|
|
@ -120,7 +120,8 @@ template <PRODUCT_FAMILY product>
|
|||
class AILConfigurationHw : public AILConfiguration {
|
||||
public:
|
||||
static std::unique_ptr<AILConfiguration> create() {
|
||||
return std::make_unique<AILConfigurationHw>();
|
||||
auto ailConfiguration = std::unique_ptr<AILConfiguration>(new AILConfigurationHw());
|
||||
return ailConfiguration;
|
||||
}
|
||||
|
||||
void applyExt(RuntimeCapabilityTable &runtimeCapabilityTable) override;
|
||||
|
|
|
@ -173,8 +173,8 @@ BuiltinResourceT EmbeddedStorage::loadImpl(const std::string &fullResourceName)
|
|||
}
|
||||
|
||||
BuiltinsLib::BuiltinsLib() {
|
||||
allStorages.push_back(std::make_unique<EmbeddedStorage>(""));
|
||||
allStorages.push_back(std::make_unique<FileStorage>(getDriverInstallationPath()));
|
||||
allStorages.push_back(std::unique_ptr<Storage>(new EmbeddedStorage("")));
|
||||
allStorages.push_back(std::unique_ptr<Storage>(new FileStorage(getDriverInstallationPath())));
|
||||
}
|
||||
|
||||
BuiltinCode BuiltinsLib::getBuiltinCode(EBuiltInOps::Type builtin, BuiltinCode::ECodeType requestedCodeType, Device &device) {
|
||||
|
|
|
@ -120,7 +120,7 @@ CommandContainer::ErrorCode CommandContainer::initialize(Device *device, Allocat
|
|||
|
||||
addToResidencyContainer(cmdBufferAllocation);
|
||||
if (requireHeaps) {
|
||||
heapHelper = std::make_unique<HeapHelper>(device->getMemoryManager(), device->getDefaultEngine().commandStreamReceiver->getInternalAllocationStorage(), device->getNumGenericSubDevices() > 1u);
|
||||
heapHelper = std::unique_ptr<HeapHelper>(new HeapHelper(device->getMemoryManager(), device->getDefaultEngine().commandStreamReceiver->getInternalAllocationStorage(), device->getNumGenericSubDevices() > 1u));
|
||||
|
||||
for (uint32_t i = 0; i < IndirectHeap::Type::numTypes; i++) {
|
||||
auto heapType = static_cast<HeapType>(i);
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
|
||||
namespace NEO {
|
||||
std::unique_ptr<DeferredDeleter> createDeferredDeleter() {
|
||||
return std::make_unique<DeferredDeleter>();
|
||||
return std::unique_ptr<DeferredDeleter>(new DeferredDeleter());
|
||||
}
|
||||
} // namespace NEO
|
||||
|
|
|
@ -792,7 +792,7 @@ GraphicsAllocation *DrmMemoryManager::allocatePhysicalDeviceMemory(const Allocat
|
|||
auto isCoherent = productHelper.isCoherentAllocation(patIndex);
|
||||
uint32_t handle = ioctlHelper->createGem(bufferSize, static_cast<uint32_t>(allocationData.storageInfo.memoryBanks.to_ulong()), isCoherent);
|
||||
|
||||
auto bo = std::make_unique<BufferObject>(allocationData.rootDeviceIndex, &drm, patIndex, handle, bufferSize, maxOsContextCount);
|
||||
std::unique_ptr<BufferObject, BufferObject::Deleter> bo(new BufferObject(allocationData.rootDeviceIndex, &drm, patIndex, handle, bufferSize, maxOsContextCount));
|
||||
|
||||
auto allocation = new DrmAllocation(allocationData.rootDeviceIndex, 1u /*num gmms*/, allocationData.type, bo.get(), nullptr, 0u, bufferSize, memoryPool);
|
||||
allocation->setDefaultGmm(gmm.release());
|
||||
|
@ -841,7 +841,7 @@ GraphicsAllocation *DrmMemoryManager::allocateMemoryByKMD(const AllocationData &
|
|||
boType = BufferObject::BOType::legacy;
|
||||
}
|
||||
|
||||
auto bo = std::make_unique<BufferObject>(allocationData.rootDeviceIndex, &drm, patIndex, handle, bufferSize, maxOsContextCount);
|
||||
std::unique_ptr<BufferObject, BufferObject::Deleter> bo(new BufferObject(allocationData.rootDeviceIndex, &drm, patIndex, handle, bufferSize, maxOsContextCount));
|
||||
bo->setAddress(gpuRange);
|
||||
bo->setBOType(boType);
|
||||
|
||||
|
@ -2682,7 +2682,7 @@ GraphicsAllocation *DrmMemoryManager::createSharedUnifiedMemoryAllocation(const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
auto bo = std::make_unique<BufferObject>(allocationData.rootDeviceIndex, &drm, patIndex, handle, currentSize, maxOsContextCount);
|
||||
std::unique_ptr<BufferObject, BufferObject::Deleter> bo(new BufferObject(allocationData.rootDeviceIndex, &drm, patIndex, handle, currentSize, maxOsContextCount));
|
||||
|
||||
if (vmAdviseAttribute.has_value() && !ioctlHelper->setVmBoAdvise(bo->peekHandle(), vmAdviseAttribute.value(), nullptr)) {
|
||||
ioctlHelper->munmapFunction(*this, cpuBasePointer, totalSizeToAlloc);
|
||||
|
|
|
@ -503,7 +503,7 @@ std::unique_ptr<uint8_t[]> IoctlHelperPrelim20::prepareVmBindExt(const StackVec<
|
|||
"Alignment of a buffer returned via new[] operator must allow storing the required type!");
|
||||
|
||||
const auto bufferSize{sizeof(prelim_drm_i915_vm_bind_ext_uuid) * bindExtHandles.size()};
|
||||
auto extensionsBuffer = std::make_unique<uint8_t[]>(bufferSize);
|
||||
std::unique_ptr<uint8_t[]> extensionsBuffer{new uint8_t[bufferSize]};
|
||||
|
||||
auto extensions = new (extensionsBuffer.get()) prelim_drm_i915_vm_bind_ext_uuid[bindExtHandles.size()];
|
||||
std::memset(extensionsBuffer.get(), 0, bufferSize);
|
||||
|
|
|
@ -17,7 +17,7 @@ decltype(&Thread::create) Thread::createFunc = Thread::create;
|
|||
std::unique_ptr<Thread> Thread::create(void *(*func)(void *), void *arg) {
|
||||
pthread_t threadId;
|
||||
pthread_create(&threadId, nullptr, func, arg);
|
||||
return std::make_unique<ThreadLinux>(threadId);
|
||||
return std::unique_ptr<Thread>(new ThreadLinux(threadId));
|
||||
}
|
||||
|
||||
void ThreadLinux::join() {
|
||||
|
|
|
@ -71,7 +71,7 @@ uint64_t OSTimeLinux::getCpuRawTimestamp() {
|
|||
}
|
||||
|
||||
std::unique_ptr<OSTime> OSTimeLinux::create(OSInterface &osInterface, std::unique_ptr<DeviceTime> deviceTime) {
|
||||
return std::make_unique<OSTimeLinux>(osInterface, std::move(deviceTime));
|
||||
return std::unique_ptr<OSTime>(new OSTimeLinux(osInterface, std::move(deviceTime)));
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -67,7 +67,7 @@ Wddm::Wddm(std::unique_ptr<HwDeviceIdWddm> &&hwDeviceIdIn, RootDeviceEnvironment
|
|||
memset(gtSystemInfo.get(), 0, sizeof(*gtSystemInfo));
|
||||
memset(gfxPlatform.get(), 0, sizeof(*gfxPlatform));
|
||||
this->enablePreemptionRegValue = NEO::readEnablePreemptionRegKey();
|
||||
kmDafListener = std::make_unique<KmDafListener>();
|
||||
kmDafListener = std::unique_ptr<KmDafListener>(new KmDafListener);
|
||||
temporaryResources = std::make_unique<WddmResidentAllocationsContainer>(this);
|
||||
osMemory = OSMemory::create();
|
||||
bool forceCheck = false;
|
||||
|
@ -864,10 +864,10 @@ bool Wddm::openSharedHandle(const MemoryManager::OsHandleData &osHandleData, Wdd
|
|||
return false;
|
||||
}
|
||||
|
||||
auto allocPrivateData = std::make_unique<char[]>(queryResourceInfo.TotalPrivateDriverDataSize);
|
||||
auto resPrivateData = std::make_unique<char[]>(queryResourceInfo.ResourcePrivateDriverDataSize);
|
||||
auto resPrivateRuntimeData = std::make_unique<char[]>(queryResourceInfo.PrivateRuntimeDataSize);
|
||||
auto allocationInfo = std::make_unique<D3DDDI_OPENALLOCATIONINFO[]>(queryResourceInfo.NumAllocations);
|
||||
std::unique_ptr<char[]> allocPrivateData(new char[queryResourceInfo.TotalPrivateDriverDataSize]);
|
||||
std::unique_ptr<char[]> resPrivateData(new char[queryResourceInfo.ResourcePrivateDriverDataSize]);
|
||||
std::unique_ptr<char[]> resPrivateRuntimeData(new char[queryResourceInfo.PrivateRuntimeDataSize]);
|
||||
std::unique_ptr<D3DDDI_OPENALLOCATIONINFO[]> allocationInfo(new D3DDDI_OPENALLOCATIONINFO[queryResourceInfo.NumAllocations]);
|
||||
|
||||
D3DKMT_OPENRESOURCE openResource = {};
|
||||
|
||||
|
@ -914,10 +914,10 @@ bool Wddm::openNTHandle(const MemoryManager::OsHandleData &osHandleData, WddmAll
|
|||
return false;
|
||||
}
|
||||
|
||||
auto allocPrivateData = std::make_unique<char>(queryResourceInfoFromNtHandle.TotalPrivateDriverDataSize);
|
||||
auto resPrivateData = std::make_unique<char>(queryResourceInfoFromNtHandle.ResourcePrivateDriverDataSize);
|
||||
auto resPrivateRuntimeData = std::make_unique<char>(queryResourceInfoFromNtHandle.PrivateRuntimeDataSize);
|
||||
auto allocationInfo2 = std::make_unique<D3DDDI_OPENALLOCATIONINFO2[]>(queryResourceInfoFromNtHandle.NumAllocations);
|
||||
std::unique_ptr<char[]> allocPrivateData(new char[queryResourceInfoFromNtHandle.TotalPrivateDriverDataSize]);
|
||||
std::unique_ptr<char[]> resPrivateData(new char[queryResourceInfoFromNtHandle.ResourcePrivateDriverDataSize]);
|
||||
std::unique_ptr<char[]> resPrivateRuntimeData(new char[queryResourceInfoFromNtHandle.PrivateRuntimeDataSize]);
|
||||
std::unique_ptr<D3DDDI_OPENALLOCATIONINFO2[]> allocationInfo2(new D3DDDI_OPENALLOCATIONINFO2[queryResourceInfoFromNtHandle.NumAllocations]);
|
||||
|
||||
D3DKMT_OPENRESOURCEFROMNTHANDLE openResourceFromNtHandle = {};
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ void PrintFormatter::printString(const char *formatString, const std::function<v
|
|||
size_t length = strnlen_s(formatString, maxSinglePrintStringLength - 1);
|
||||
|
||||
size_t cursor = 0;
|
||||
auto dataFormat = std::make_unique<char[]>(length + 1);
|
||||
std::unique_ptr<char[]> dataFormat(new char[length + 1]);
|
||||
|
||||
for (size_t i = 0; i <= length; i++) {
|
||||
if (formatString[i] == '\\')
|
||||
|
|
|
@ -463,7 +463,7 @@ template <typename NodeObjectType, bool threadSafe = true, bool ownsNodes = true
|
|||
class IDRefList : public IDList<IDNodeRef<NodeObjectType>, threadSafe, ownsNodes> {
|
||||
public:
|
||||
void pushRefFrontOne(NodeObjectType &node) {
|
||||
auto refNode = std::make_unique<IDNodeRef<NodeObjectType>>(&node);
|
||||
auto refNode = std::unique_ptr<IDNodeRef<NodeObjectType>>(new IDNodeRef<NodeObjectType>(&node));
|
||||
this->pushFrontOne(*refNode);
|
||||
refNode.release();
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ template <typename NodeObjectType, bool threadSafe = true, bool ownsNodes = true
|
|||
class IFRefList : public IFList<IFNodeRef<NodeObjectType>, threadSafe, ownsNodes> {
|
||||
public:
|
||||
void pushRefFrontOne(NodeObjectType &node) {
|
||||
auto up = std::make_unique<IFNodeRef<NodeObjectType>>(&node);
|
||||
auto up = std::unique_ptr<IFNodeRef<NodeObjectType>>(new IFNodeRef<NodeObjectType>(&node));
|
||||
this->pushFrontOne(*up);
|
||||
up.release();
|
||||
} // NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks)
|
||||
|
|
|
@ -29,8 +29,8 @@ PerfProfiler *PerfProfiler::create(bool dumpToFile) {
|
|||
if (gPerfProfiler == nullptr) {
|
||||
int old = counter.fetch_add(1);
|
||||
if (!dumpToFile) {
|
||||
auto logs = std::make_unique<std::stringstream>();
|
||||
auto sysLogs = std::make_unique<std::stringstream>();
|
||||
std::unique_ptr<std::stringstream> logs = std::unique_ptr<std::stringstream>(new std::stringstream());
|
||||
std::unique_ptr<std::stringstream> sysLogs = std::unique_ptr<std::stringstream>(new std::stringstream());
|
||||
gPerfProfiler = new PerfProfiler(old, std::move(logs), std::move(sysLogs));
|
||||
} else {
|
||||
gPerfProfiler = new PerfProfiler(old);
|
||||
|
@ -63,7 +63,7 @@ PerfProfiler::PerfProfiler(int id, std::unique_ptr<std::ostream> &&logOut, std::
|
|||
std::stringstream filename;
|
||||
filename << "PerfReport_Thread_" << id << ".xml";
|
||||
|
||||
auto logToFile = std::make_unique<std::ofstream>();
|
||||
std::unique_ptr<std::ofstream> logToFile = std::unique_ptr<std::ofstream>(new std::ofstream());
|
||||
logToFile->exceptions(std::ios::failbit | std::ios::badbit);
|
||||
logToFile->open(filename.str().c_str(), std::ios::trunc);
|
||||
this->logFile = std::move(logToFile);
|
||||
|
@ -77,7 +77,7 @@ PerfProfiler::PerfProfiler(int id, std::unique_ptr<std::ostream> &&logOut, std::
|
|||
std::stringstream filename;
|
||||
filename << "SysPerfReport_Thread_" << id << ".xml";
|
||||
|
||||
auto sysLogToFile = std::make_unique<std::ofstream>();
|
||||
std::unique_ptr<std::ofstream> sysLogToFile = std::unique_ptr<std::ofstream>(new std::ofstream());
|
||||
sysLogToFile->exceptions(std::ios::failbit | std::ios::badbit);
|
||||
sysLogToFile->open(filename.str().c_str(), std::ios::trunc);
|
||||
this->sysLogFile = std::move(sysLogToFile);
|
||||
|
|
Loading…
Reference in New Issue