diff --git a/opencl/source/command_queue/command_queue.cpp b/opencl/source/command_queue/command_queue.cpp index 6f8c8f2dbe794..75df46ae23d06 100644 --- a/opencl/source/command_queue/command_queue.cpp +++ b/opencl/source/command_queue/command_queue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -903,7 +903,7 @@ void CommandQueue::enqueueBlockedMapUnmapOperation(const cl_event *eventWaitList } // store task data in event - auto cmd = std::unique_ptr(new CommandMapUnmap(opType, *memObj, copySize, copyOffset, readOnly, *this)); + auto cmd = std::make_unique(opType, *memObj, copySize, copyOffset, readOnly, *this); eventBuilder->getEvent()->setCommand(std::move(cmd)); // bind output event with input events diff --git a/opencl/source/sharings/va/va_sharing_functions.cpp b/opencl/source/sharings/va/va_sharing_functions.cpp index 6800170b7d122..f03cf1c192da0 100644 --- a/opencl/source/sharings/va/va_sharing_functions.cpp +++ b/opencl/source/sharings/va/va_sharing_functions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -78,7 +78,7 @@ void VASharingFunctions::initFunctions() { void VASharingFunctions::querySupportedVaImageFormats(VADisplay vaDisplay) { int maxFormats = this->maxNumImageFormats(vaDisplay); if (maxFormats > 0) { - std::unique_ptr allVaFormats(new VAImageFormat[maxFormats]); + auto allVaFormats = std::make_unique(maxFormats); auto result = this->queryImageFormats(vaDisplay, allVaFormats.get(), &maxFormats); if (result == VA_STATUS_SUCCESS) { for (int i = 0; i < maxFormats; i++) { diff --git a/opencl/source/utilities/cl_logger.cpp b/opencl/source/utilities/cl_logger.cpp index 9bb3114b82024..f598e68f418fd 100644 --- a/opencl/source/utilities/cl_logger.cpp +++ b/opencl/source/utilities/cl_logger.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -79,7 +79,7 @@ void ClFileLogger::dumpKernelArgs(const MultiDispatchInfo *multiDisp type = "immediate"; auto crossThreadData = kernel->getCrossThreadData(); auto crossThreadDataSize = kernel->getCrossThreadDataSize(); - argVal = std::unique_ptr(new char[crossThreadDataSize]); + argVal = std::make_unique(crossThreadDataSize); size_t totalArgSize = 0; for (const auto &element : arg.as().elements) { diff --git a/shared/offline_compiler/source/ocloc_arg_helper.cpp b/shared/offline_compiler/source/ocloc_arg_helper.cpp index 539263ba29a8e..c84c0c8513c88 100644 --- a/shared/offline_compiler/source/ocloc_arg_helper.cpp +++ b/shared/offline_compiler/source/ocloc_arg_helper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -143,7 +143,7 @@ std::vector OclocArgHelper::readBinaryFile(const std::string &filename) { std::unique_ptr OclocArgHelper::loadDataFromFile(const std::string &filename, size_t &retSize) { if (Source *s = findSourceFile(filename)) { auto size = s->length; - std::unique_ptr ret(new char[size]()); + auto ret = std::make_unique(size); memcpy_s(ret.get(), size, s->data, s->length); retSize = s->length; return ret; diff --git a/shared/source/ail/ail_configuration.h b/shared/source/ail/ail_configuration.h index bac17d4d4644f..db760fd6cbe15 100644 --- a/shared/source/ail/ail_configuration.h +++ b/shared/source/ail/ail_configuration.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2024 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -120,8 +120,7 @@ template class AILConfigurationHw : public AILConfiguration { public: static std::unique_ptr create() { - auto ailConfiguration = std::unique_ptr(new AILConfigurationHw()); - return ailConfiguration; + return std::make_unique(); } void applyExt(RuntimeCapabilityTable &runtimeCapabilityTable) override; diff --git a/shared/source/built_ins/built_ins_storage.cpp b/shared/source/built_ins/built_ins_storage.cpp index d44bb3f920ecf..63013d20231aa 100644 --- a/shared/source/built_ins/built_ins_storage.cpp +++ b/shared/source/built_ins/built_ins_storage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -173,8 +173,8 @@ BuiltinResourceT EmbeddedStorage::loadImpl(const std::string &fullResourceName) } BuiltinsLib::BuiltinsLib() { - allStorages.push_back(std::unique_ptr(new EmbeddedStorage(""))); - allStorages.push_back(std::unique_ptr(new FileStorage(getDriverInstallationPath()))); + allStorages.push_back(std::make_unique("")); + allStorages.push_back(std::make_unique(getDriverInstallationPath())); } BuiltinCode BuiltinsLib::getBuiltinCode(EBuiltInOps::Type builtin, BuiltinCode::ECodeType requestedCodeType, Device &device) { diff --git a/shared/source/command_container/cmdcontainer.cpp b/shared/source/command_container/cmdcontainer.cpp index 3814dad31cb52..6a827da85521a 100644 --- a/shared/source/command_container/cmdcontainer.cpp +++ b/shared/source/command_container/cmdcontainer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2024 Intel Corporation + * Copyright (C) 2019-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -120,7 +120,7 @@ CommandContainer::ErrorCode CommandContainer::initialize(Device *device, Allocat addToResidencyContainer(cmdBufferAllocation); if (requireHeaps) { - heapHelper = std::unique_ptr(new HeapHelper(device->getMemoryManager(), device->getDefaultEngine().commandStreamReceiver->getInternalAllocationStorage(), device->getNumGenericSubDevices() > 1u)); + heapHelper = std::make_unique(device->getMemoryManager(), device->getDefaultEngine().commandStreamReceiver->getInternalAllocationStorage(), device->getNumGenericSubDevices() > 1u); for (uint32_t i = 0; i < IndirectHeap::Type::numTypes; i++) { auto heapType = static_cast(i); diff --git a/shared/source/dll/create_deferred_deleter.cpp b/shared/source/dll/create_deferred_deleter.cpp index b40ccf175cc50..70428f5ab613b 100644 --- a/shared/source/dll/create_deferred_deleter.cpp +++ b/shared/source/dll/create_deferred_deleter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2022 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -9,6 +9,6 @@ namespace NEO { std::unique_ptr createDeferredDeleter() { - return std::unique_ptr(new DeferredDeleter()); + return std::make_unique(); } } // namespace NEO diff --git a/shared/source/os_interface/linux/drm_memory_manager.cpp b/shared/source/os_interface/linux/drm_memory_manager.cpp index 52b40dade3557..1ed9e029a95b6 100644 --- a/shared/source/os_interface/linux/drm_memory_manager.cpp +++ b/shared/source/os_interface/linux/drm_memory_manager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -793,7 +793,7 @@ GraphicsAllocation *DrmMemoryManager::allocatePhysicalDeviceMemory(const Allocat auto isCoherent = productHelper.isCoherentAllocation(patIndex); uint32_t handle = ioctlHelper->createGem(bufferSize, static_cast(allocationData.storageInfo.memoryBanks.to_ulong()), isCoherent); - std::unique_ptr bo(new BufferObject(allocationData.rootDeviceIndex, &drm, patIndex, handle, bufferSize, maxOsContextCount)); + auto bo = std::make_unique(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()); @@ -842,7 +842,7 @@ GraphicsAllocation *DrmMemoryManager::allocateMemoryByKMD(const AllocationData & boType = BufferObject::BOType::legacy; } - std::unique_ptr bo(new BufferObject(allocationData.rootDeviceIndex, &drm, patIndex, handle, bufferSize, maxOsContextCount)); + auto bo = std::make_unique(allocationData.rootDeviceIndex, &drm, patIndex, handle, bufferSize, maxOsContextCount); bo->setAddress(gpuRange); bo->setBOType(boType); @@ -2683,7 +2683,7 @@ GraphicsAllocation *DrmMemoryManager::createSharedUnifiedMemoryAllocation(const return nullptr; } - std::unique_ptr bo(new BufferObject(allocationData.rootDeviceIndex, &drm, patIndex, handle, currentSize, maxOsContextCount)); + auto bo = std::make_unique(allocationData.rootDeviceIndex, &drm, patIndex, handle, currentSize, maxOsContextCount); if (vmAdviseAttribute.has_value() && !ioctlHelper->setVmBoAdvise(bo->peekHandle(), vmAdviseAttribute.value(), nullptr)) { ioctlHelper->munmapFunction(*this, cpuBasePointer, totalSizeToAlloc); diff --git a/shared/source/os_interface/linux/ioctl_helper_prelim.cpp b/shared/source/os_interface/linux/ioctl_helper_prelim.cpp index b325a21c7b168..e190637fe8ee5 100644 --- a/shared/source/os_interface/linux/ioctl_helper_prelim.cpp +++ b/shared/source/os_interface/linux/ioctl_helper_prelim.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2024 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -503,7 +503,7 @@ std::unique_ptr 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()}; - std::unique_ptr extensionsBuffer{new uint8_t[bufferSize]}; + auto extensionsBuffer = std::make_unique(bufferSize); auto extensions = new (extensionsBuffer.get()) prelim_drm_i915_vm_bind_ext_uuid[bindExtHandles.size()]; std::memset(extensionsBuffer.get(), 0, bufferSize); diff --git a/shared/source/os_interface/linux/os_thread_linux.cpp b/shared/source/os_interface/linux/os_thread_linux.cpp index 15aaa01d0b9be..442da45cb5572 100644 --- a/shared/source/os_interface/linux/os_thread_linux.cpp +++ b/shared/source/os_interface/linux/os_thread_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -17,7 +17,7 @@ decltype(&Thread::create) Thread::createFunc = Thread::create; std::unique_ptr Thread::create(void *(*func)(void *), void *arg) { pthread_t threadId; pthread_create(&threadId, nullptr, func, arg); - return std::unique_ptr(new ThreadLinux(threadId)); + return std::make_unique(threadId); } void ThreadLinux::join() { diff --git a/shared/source/os_interface/linux/os_time_linux.cpp b/shared/source/os_interface/linux/os_time_linux.cpp index 0675ea5dbb992..c5fc4b4d6392e 100644 --- a/shared/source/os_interface/linux/os_time_linux.cpp +++ b/shared/source/os_interface/linux/os_time_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -72,7 +72,7 @@ uint64_t OSTimeLinux::getCpuRawTimestamp() { } std::unique_ptr OSTimeLinux::create(OSInterface &osInterface, std::unique_ptr deviceTime) { - return std::unique_ptr(new OSTimeLinux(osInterface, std::move(deviceTime))); + return std::make_unique(osInterface, std::move(deviceTime)); } } // namespace NEO diff --git a/shared/source/os_interface/windows/wddm/wddm.cpp b/shared/source/os_interface/windows/wddm/wddm.cpp index 2f3d8610b8638..d9d1d668dcc12 100644 --- a/shared/source/os_interface/windows/wddm/wddm.cpp +++ b/shared/source/os_interface/windows/wddm/wddm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -67,7 +67,7 @@ Wddm::Wddm(std::unique_ptr &&hwDeviceIdIn, RootDeviceEnvironment memset(gtSystemInfo.get(), 0, sizeof(*gtSystemInfo)); memset(gfxPlatform.get(), 0, sizeof(*gfxPlatform)); this->enablePreemptionRegValue = NEO::readEnablePreemptionRegKey(); - kmDafListener = std::unique_ptr(new KmDafListener); + kmDafListener = std::make_unique(); temporaryResources = std::make_unique(this); osMemory = OSMemory::create(); bool forceCheck = false; @@ -864,10 +864,10 @@ bool Wddm::openSharedHandle(const MemoryManager::OsHandleData &osHandleData, Wdd return false; } - std::unique_ptr allocPrivateData(new char[queryResourceInfo.TotalPrivateDriverDataSize]); - std::unique_ptr resPrivateData(new char[queryResourceInfo.ResourcePrivateDriverDataSize]); - std::unique_ptr resPrivateRuntimeData(new char[queryResourceInfo.PrivateRuntimeDataSize]); - std::unique_ptr allocationInfo(new D3DDDI_OPENALLOCATIONINFO[queryResourceInfo.NumAllocations]); + auto allocPrivateData = std::make_unique(queryResourceInfo.TotalPrivateDriverDataSize); + auto resPrivateData = std::make_unique(queryResourceInfo.ResourcePrivateDriverDataSize); + auto resPrivateRuntimeData = std::make_unique(queryResourceInfo.PrivateRuntimeDataSize); + auto allocationInfo = std::make_unique(queryResourceInfo.NumAllocations); D3DKMT_OPENRESOURCE openResource = {}; @@ -914,10 +914,10 @@ bool Wddm::openNTHandle(const MemoryManager::OsHandleData &osHandleData, WddmAll return false; } - std::unique_ptr allocPrivateData(new char[queryResourceInfoFromNtHandle.TotalPrivateDriverDataSize]); - std::unique_ptr resPrivateData(new char[queryResourceInfoFromNtHandle.ResourcePrivateDriverDataSize]); - std::unique_ptr resPrivateRuntimeData(new char[queryResourceInfoFromNtHandle.PrivateRuntimeDataSize]); - std::unique_ptr allocationInfo2(new D3DDDI_OPENALLOCATIONINFO2[queryResourceInfoFromNtHandle.NumAllocations]); + auto allocPrivateData = std::make_unique(queryResourceInfoFromNtHandle.TotalPrivateDriverDataSize); + auto resPrivateData = std::make_unique(queryResourceInfoFromNtHandle.ResourcePrivateDriverDataSize); + auto resPrivateRuntimeData = std::make_unique(queryResourceInfoFromNtHandle.PrivateRuntimeDataSize); + auto allocationInfo2 = std::make_unique(queryResourceInfoFromNtHandle.NumAllocations); D3DKMT_OPENRESOURCEFROMNTHANDLE openResourceFromNtHandle = {}; diff --git a/shared/source/program/print_formatter.cpp b/shared/source/program/print_formatter.cpp index 0535a480e4863..41f9ef36c6907 100644 --- a/shared/source/program/print_formatter.cpp +++ b/shared/source/program/print_formatter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -59,7 +59,7 @@ void PrintFormatter::printString(const char *formatString, const std::function dataFormat(new char[length + 1]); + auto dataFormat = std::make_unique(length + 1); for (size_t i = 0; i <= length; i++) { if (formatString[i] == '\\') diff --git a/shared/source/utilities/idlist.h b/shared/source/utilities/idlist.h index bdab7e59de11a..e20c97b0e6a4f 100644 --- a/shared/source/utilities/idlist.h +++ b/shared/source/utilities/idlist.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -463,7 +463,7 @@ template , threadSafe, ownsNodes> { public: void pushRefFrontOne(NodeObjectType &node) { - auto refNode = std::unique_ptr>(new IDNodeRef(&node)); + auto refNode = std::make_unique>(&node); this->pushFrontOne(*refNode); refNode.release(); } diff --git a/shared/source/utilities/iflist.h b/shared/source/utilities/iflist.h index 314daa1b5a083..b0d0cca2adc7b 100644 --- a/shared/source/utilities/iflist.h +++ b/shared/source/utilities/iflist.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -189,7 +189,7 @@ template , threadSafe, ownsNodes> { public: void pushRefFrontOne(NodeObjectType &node) { - auto up = std::unique_ptr>(new IFNodeRef(&node)); + auto up = std::make_unique>(&node); this->pushFrontOne(*up); up.release(); } // NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks) diff --git a/shared/source/utilities/perf_profiler.cpp b/shared/source/utilities/perf_profiler.cpp index a8d57bf7fc641..bdc08d20d629e 100644 --- a/shared/source/utilities/perf_profiler.cpp +++ b/shared/source/utilities/perf_profiler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -29,8 +29,8 @@ PerfProfiler *PerfProfiler::create(bool dumpToFile) { if (gPerfProfiler == nullptr) { int old = counter.fetch_add(1); if (!dumpToFile) { - std::unique_ptr logs = std::unique_ptr(new std::stringstream()); - std::unique_ptr sysLogs = std::unique_ptr(new std::stringstream()); + auto logs = std::make_unique(); + auto sysLogs = std::make_unique(); 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 &&logOut, std:: std::stringstream filename; filename << "PerfReport_Thread_" << id << ".xml"; - std::unique_ptr logToFile = std::unique_ptr(new std::ofstream()); + auto logToFile = std::make_unique(); 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 &&logOut, std:: std::stringstream filename; filename << "SysPerfReport_Thread_" << id << ".xml"; - std::unique_ptr sysLogToFile = std::unique_ptr(new std::ofstream()); + auto sysLogToFile = std::make_unique(); sysLogToFile->exceptions(std::ios::failbit | std::ios::badbit); sysLogToFile->open(filename.str().c_str(), std::ios::trunc); this->sysLogFile = std::move(sysLogToFile);