diff --git a/shared/offline_compiler/source/decoder/iga_wrapper.h b/shared/offline_compiler/source/decoder/iga_wrapper.h index 89bcd89021..82697e32cf 100644 --- a/shared/offline_compiler/source/decoder/iga_wrapper.h +++ b/shared/offline_compiler/source/decoder/iga_wrapper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 Intel Corporation + * Copyright (C) 2019-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,6 +7,8 @@ #pragma once +#include "shared/source/helpers/non_copyable_or_moveable.h" + #include "igfxfmid.h" #include @@ -14,15 +16,10 @@ class MessagePrinter; -struct IgaWrapper { +struct IgaWrapper : NEO::NonCopyableAndNonMovableClass { IgaWrapper(); MOCKABLE_VIRTUAL ~IgaWrapper(); - IgaWrapper(IgaWrapper &) = delete; - IgaWrapper(const IgaWrapper &&) = delete; - IgaWrapper &operator=(const IgaWrapper &) = delete; - IgaWrapper &operator=(IgaWrapper &&) = delete; - MOCKABLE_VIRTUAL bool tryDisassembleGenISA(const void *kernelPtr, uint32_t kernelSize, std::string &out); MOCKABLE_VIRTUAL bool tryAssembleGenISA(const std::string &inAsm, std::string &outBinary); @@ -41,3 +38,5 @@ struct IgaWrapper { MessagePrinter *messagePrinter = nullptr; }; + +static_assert(NEO::NonCopyableAndNonMovable); diff --git a/shared/offline_compiler/source/multi_command.h b/shared/offline_compiler/source/multi_command.h index c7cdf6de03..3c5f65d3f9 100644 --- a/shared/offline_compiler/source/multi_command.h +++ b/shared/offline_compiler/source/multi_command.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2023 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,6 +7,8 @@ #pragma once +#include "shared/source/helpers/non_copyable_or_moveable.h" + #include #include #include @@ -15,10 +17,8 @@ class OclocArgHelper; namespace NEO { -class MultiCommand { +class MultiCommand : NEO::NonCopyableAndNonMovableClass { public: - MultiCommand &operator=(const MultiCommand &) = delete; - MultiCommand(const MultiCommand &) = delete; MOCKABLE_VIRTUAL ~MultiCommand() = default; static MultiCommand *create(const std::vector &args, int &retVal, OclocArgHelper *helper); @@ -45,4 +45,7 @@ class MultiCommand { std::stringstream outputFile; bool quiet = false; }; + +static_assert(NEO::NonCopyableAndNonMovable); + } // namespace NEO diff --git a/shared/offline_compiler/source/ocloc_concat.h b/shared/offline_compiler/source/ocloc_concat.h index 19256d77f8..f96831e8ea 100644 --- a/shared/offline_compiler/source/ocloc_concat.h +++ b/shared/offline_compiler/source/ocloc_concat.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2023 Intel Corporation + * Copyright (C) 2022-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,6 +7,7 @@ #pragma once +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/utilities/arrayref.h" #include "shared/source/utilities/const_stringref.h" @@ -23,14 +24,11 @@ namespace Ar { struct Ar; } -class OclocConcat { +class OclocConcat : NEO::NonCopyableAndNonMovableClass { public: using ErrorCode = uint32_t; OclocConcat() = delete; - OclocConcat(const OclocConcat &) = delete; - OclocConcat &operator=(const OclocConcat &) = delete; - OclocConcat(OclocArgHelper *argHelper) : argHelper(argHelper){}; ErrorCode initialize(const std::vector &args); ErrorCode concatenate(); @@ -53,4 +51,7 @@ Usage: ocloc concat ... [-out fileNamesToConcat; std::string fatBinaryName = "concat.ar"; }; + +static_assert(NEO::NonCopyableAndNonMovable); + } // namespace NEO diff --git a/shared/offline_compiler/source/ocloc_fcl_facade.h b/shared/offline_compiler/source/ocloc_fcl_facade.h index 9bf727195f..1c9703989c 100644 --- a/shared/offline_compiler/source/ocloc_fcl_facade.h +++ b/shared/offline_compiler/source/ocloc_fcl_facade.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2023 Intel Corporation + * Copyright (C) 2022-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,6 +7,8 @@ #pragma once +#include "shared/source/helpers/non_copyable_or_moveable.h" + #include "cif/common/cif_main.h" #include "cif/import/library_api.h" #include "igfxfmid.h" @@ -25,16 +27,11 @@ class OsLibrary; struct HardwareInfo; -class OclocFclFacade { +class OclocFclFacade : NEO::NonCopyableAndNonMovableClass { public: OclocFclFacade(OclocArgHelper *argHelper); MOCKABLE_VIRTUAL ~OclocFclFacade(); - OclocFclFacade(OclocFclFacade &) = delete; - OclocFclFacade(const OclocFclFacade &&) = delete; - OclocFclFacade &operator=(const OclocFclFacade &) = delete; - OclocFclFacade &operator=(OclocFclFacade &&) = delete; - int initialize(const HardwareInfo &hwInfo); bool isInitialized() const; IGC::CodeType::CodeType_t getPreferredIntermediateRepresentation() const; @@ -59,4 +56,6 @@ class OclocFclFacade { bool initialized{false}; }; +static_assert(NEO::NonCopyableAndNonMovable); + } // namespace NEO diff --git a/shared/offline_compiler/source/ocloc_igc_facade.h b/shared/offline_compiler/source/ocloc_igc_facade.h index edb2b8faa2..64653df112 100644 --- a/shared/offline_compiler/source/ocloc_igc_facade.h +++ b/shared/offline_compiler/source/ocloc_igc_facade.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Intel Corporation + * Copyright (C) 2022-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,6 +7,8 @@ #pragma once +#include "shared/source/helpers/non_copyable_or_moveable.h" + #include "cif/common/cif_main.h" #include "cif/import/library_api.h" #include "ocl_igc_interface/code_type.h" @@ -24,16 +26,11 @@ class OsLibrary; struct HardwareInfo; -class OclocIgcFacade { +class OclocIgcFacade : NEO::NonCopyableAndNonMovableClass { public: OclocIgcFacade(OclocArgHelper *argHelper); MOCKABLE_VIRTUAL ~OclocIgcFacade(); - OclocIgcFacade(OclocIgcFacade &) = delete; - OclocIgcFacade(const OclocIgcFacade &&) = delete; - OclocIgcFacade &operator=(const OclocIgcFacade &) = delete; - OclocIgcFacade &operator=(OclocIgcFacade &&) = delete; - int initialize(const HardwareInfo &hwInfo); bool isInitialized() const; const char *getIgcRevision(); @@ -66,4 +63,6 @@ class OclocIgcFacade { bool initialized{false}; }; -} // namespace NEO \ No newline at end of file +static_assert(NEO::NonCopyableAndNonMovable); + +} // namespace NEO diff --git a/shared/offline_compiler/source/offline_compiler.h b/shared/offline_compiler/source/offline_compiler.h index 7ff4f8b0c4..cd8f74afcd 100644 --- a/shared/offline_compiler/source/offline_compiler.h +++ b/shared/offline_compiler/source/offline_compiler.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -9,6 +9,7 @@ #include "shared/offline_compiler/source/ocloc_api.h" #include "shared/source/helpers/hw_info.h" +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/utilities/arrayref.h" #include "shared/source/utilities/const_stringref.h" @@ -44,7 +45,7 @@ static_assert(sizeof(NameVersionPair) == sizeof(ocloc_name_version)); const HardwareInfo *getHwInfoForDeprecatedAcronym(const std::string &deviceName); -class OfflineCompiler { +class OfflineCompiler : NEO::NonCopyableAndNonMovableClass { public: static std::vector getExtensions(ConstStringRef product, bool needVersions, OclocArgHelper *helper); static std::vector getOpenCLCVersions(ConstStringRef product, OclocArgHelper *helper); @@ -110,8 +111,6 @@ that correspond to the given name. All supported acronyms: %s. )OCLOC_HELP"; - OfflineCompiler &operator=(const OfflineCompiler &) = delete; - OfflineCompiler(const OfflineCompiler &) = delete; MOCKABLE_VIRTUAL ~OfflineCompiler(); bool isQuiet() const { @@ -243,4 +242,6 @@ All supported acronyms: %s. OclocArgHelper *argHelper = nullptr; }; +static_assert(NEO::NonCopyableAndNonMovable); + } // namespace NEO diff --git a/shared/source/built_ins/sip.h b/shared/source/built_ins/sip.h index e8c467fd36..87a13ff0b7 100644 --- a/shared/source/built_ins/sip.h +++ b/shared/source/built_ins/sip.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,6 +8,7 @@ #pragma once #include "shared/source/built_ins/sip_kernel_type.h" +#include "shared/source/helpers/non_copyable_or_moveable.h" #include #include @@ -22,14 +23,10 @@ class OsContext; struct RootDeviceEnvironment; -class SipKernel { +class SipKernel : NEO::NonCopyableAndNonMovableClass { public: SipKernel(SipKernelType type, GraphicsAllocation *sipAlloc, std::vector ssah, std::vector binary); SipKernel(SipKernelType type, GraphicsAllocation *sipAlloc, std::vector ssah); - SipKernel(const SipKernel &) = delete; - SipKernel &operator=(const SipKernel &) = delete; - SipKernel(SipKernel &&) = delete; - SipKernel &operator=(SipKernel &&) = delete; virtual ~SipKernel(); SipKernelType getType() const { @@ -87,4 +84,6 @@ class SipKernel { SipKernelType type = SipKernelType::count; }; +static_assert(NEO::NonCopyableAndNonMovable); + } // namespace NEO diff --git a/shared/source/command_stream/linear_stream.h b/shared/source/command_stream/linear_stream.h index 9001a0e986..e75f054458 100644 --- a/shared/source/command_stream/linear_stream.h +++ b/shared/source/command_stream/linear_stream.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,6 +8,7 @@ #pragma once #include "shared/source/command_container/cmdcontainer.h" #include "shared/source/helpers/debug_helpers.h" +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/helpers/ptr_math.h" #include @@ -15,7 +16,7 @@ namespace NEO { class GraphicsAllocation; -class LinearStream { +class LinearStream : NEO::NonCopyableAndNonMovableClass { public: virtual ~LinearStream() = default; LinearStream() = default; @@ -24,9 +25,6 @@ class LinearStream { LinearStream(GraphicsAllocation *gfxAllocation, void *buffer, size_t bufferSize); LinearStream(void *buffer, size_t bufferSize, CommandContainer *cmdContainer, size_t batchBufferEndSize); - LinearStream(const LinearStream &) = delete; - LinearStream &operator=(const LinearStream &) = delete; - void *getCpuBase() const; void *getSpace(size_t size); size_t getMaxAvailableSpace() const; @@ -119,4 +117,6 @@ inline uint64_t LinearStream::getCurrentGpuAddressPosition() const { return (getGpuBase() + getUsed()); } +static_assert(NEO::NonCopyableAndNonMovable); + } // namespace NEO diff --git a/shared/source/command_stream/tbx_command_stream_receiver.h b/shared/source/command_stream/tbx_command_stream_receiver.h index 3cfeb06b5e..0a11f15992 100644 --- a/shared/source/command_stream/tbx_command_stream_receiver.h +++ b/shared/source/command_stream/tbx_command_stream_receiver.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,13 +8,14 @@ #pragma once #include "shared/source/aub_mem_dump/aub_mem_dump.h" #include "shared/source/helpers/device_bitfield.h" +#include "shared/source/helpers/non_copyable_or_moveable.h" namespace NEO { class CommandStreamReceiver; class TbxSockets; class ExecutionEnvironment; -class TbxStream : public AubMemDump::AubStream { +class TbxStream : public AubMemDump::AubStream, NEO::NonCopyableAndNonMovableClass { protected: TbxSockets *socket = nullptr; @@ -22,9 +23,6 @@ class TbxStream : public AubMemDump::AubStream { TbxStream(); ~TbxStream() override; - TbxStream(const TbxStream &) = delete; - TbxStream &operator=(const TbxStream &) = delete; - void open(const char *options) override; void close() override; bool init(uint32_t stepping, uint32_t device) override; @@ -37,6 +35,8 @@ class TbxStream : public AubMemDump::AubStream { void readMemory(uint64_t physAddress, void *memory, size_t size); }; +static_assert(NEO::NonCopyableAndNonMovable); + struct TbxCommandStreamReceiver { static CommandStreamReceiver *create(const std::string &baseName, bool withAubDump, diff --git a/shared/source/compiler_interface/compiler_cache.h b/shared/source/compiler_interface/compiler_cache.h index 549dd7d1d0..2e369c2b41 100644 --- a/shared/source/compiler_interface/compiler_cache.h +++ b/shared/source/compiler_interface/compiler_cache.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2024 Intel Corporation + * Copyright (C) 2019-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,6 +7,7 @@ #pragma once +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/os_interface/os_handle.h" #include "shared/source/utilities/arrayref.h" @@ -26,15 +27,11 @@ struct CompilerCacheConfig { size_t cacheSize = 0; }; -class CompilerCache { +class CompilerCache : NEO::NonCopyableAndNonMovableClass { public: CompilerCache(const CompilerCacheConfig &config); virtual ~CompilerCache() = default; - CompilerCache(const CompilerCache &) = delete; - CompilerCache(CompilerCache &&) = delete; - CompilerCache &operator=(const CompilerCache &) = delete; - CompilerCache &operator=(CompilerCache &&) = delete; const CompilerCacheConfig &getConfig() { return config; } @@ -56,4 +53,7 @@ class CompilerCache { static std::mutex cacheAccessMtx; CompilerCacheConfig config; }; + +static_assert(NEO::NonCopyableAndNonMovable); + } // namespace NEO diff --git a/shared/source/compiler_interface/compiler_interface.h b/shared/source/compiler_interface/compiler_interface.h index 8bbac331f3..469e5a7547 100644 --- a/shared/source/compiler_interface/compiler_interface.h +++ b/shared/source/compiler_interface/compiler_interface.h @@ -6,6 +6,7 @@ */ #pragma once +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/utilities/arrayref.h" #include "shared/source/utilities/spinlock.h" #include "shared/source/utilities/stackvec.h" @@ -110,13 +111,9 @@ enum class CachingMode { preProcess }; -class CompilerInterface { +class CompilerInterface : NEO::NonCopyableAndNonMovableClass { public: CompilerInterface(); - CompilerInterface(const CompilerInterface &) = delete; - CompilerInterface &operator=(const CompilerInterface &) = delete; - CompilerInterface(CompilerInterface &&) = delete; - CompilerInterface &operator=(CompilerInterface &&) = delete; virtual ~CompilerInterface(); template @@ -248,6 +245,8 @@ class CompilerInterface { } }; +static_assert(NEO::NonCopyableAndNonMovable); + class CompilerCacheHelper { public: static void packAndCacheBinary(CompilerCache &compilerCache, const std::string &kernelFileHash, const NEO::TargetDevice &targetDevice, const NEO::TranslationOutput &translationOutput); diff --git a/shared/source/compiler_interface/linker.h b/shared/source/compiler_interface/linker.h index 301f43f0ad..9b805ba8ac 100644 --- a/shared/source/compiler_interface/linker.h +++ b/shared/source/compiler_interface/linker.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2024 Intel Corporation + * Copyright (C) 2019-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,6 +7,7 @@ #pragma once #include "shared/source/device_binary_format/elf/elf_decoder.h" +#include "shared/source/helpers/non_copyable_or_moveable.h" #include #include @@ -63,7 +64,7 @@ struct SymbolInfo { bool global = false; // Binding }; -struct LinkerInput { +struct LinkerInput : NEO::NonCopyableAndNonMovableClass { union Traits { enum PointerSize : uint8_t { Ptr32bit = 0, @@ -111,10 +112,6 @@ struct LinkerInput { LinkerInput(); virtual ~LinkerInput(); - LinkerInput(LinkerInput &&other) noexcept = delete; - LinkerInput(const LinkerInput &other) = delete; - LinkerInput &operator=(LinkerInput &&other) noexcept = delete; - LinkerInput &operator=(const LinkerInput &other) = delete; static SegmentType getSegmentForSection(ConstStringRef name); @@ -273,6 +270,8 @@ struct Linker { std::unordered_map /*implicit args relocation address to patch*/> pImplicitArgsRelocationAddresses; }; +static_assert(NEO::NonCopyableAndNonMovable); + std::string constructLinkerErrorMessage(const Linker::UnresolvedExternals &unresolvedExternals, const std::vector &instructionsSegmentsNames); std::string constructRelocationsDebugMessage(const Linker::RelocatedSymbolsMap &relocatedSymbols); diff --git a/shared/source/debug_settings/debug_settings_manager.h b/shared/source/debug_settings/debug_settings_manager.h index 3c117b0de7..e362418164 100644 --- a/shared/source/debug_settings/debug_settings_manager.h +++ b/shared/source/debug_settings/debug_settings_manager.h @@ -6,6 +6,7 @@ */ #pragma once +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/helpers/options.h" #include "shared/source/helpers/string.h" #include "shared/source/utilities/io_functions.h" @@ -119,14 +120,11 @@ struct DebugVariables { // NOLINT(clang-analyzer }; template -class DebugSettingsManager { +class DebugSettingsManager : NEO::NonCopyableAndNonMovableClass { public: DebugSettingsManager(const char *registryPath); ~DebugSettingsManager(); - DebugSettingsManager(const DebugSettingsManager &) = delete; - DebugSettingsManager &operator=(const DebugSettingsManager &) = delete; - static constexpr bool registryReadAvailable() { return (debugLevel == DebugFunctionalityLevel::full) || (debugLevel == DebugFunctionalityLevel::regKeys); } @@ -182,6 +180,10 @@ class DebugSettingsManager { static const char *settingsDumpFileName; }; +static_assert(NEO::NonCopyableAndNonMovable>); +static_assert(NEO::NonCopyableAndNonMovable>); +static_assert(NEO::NonCopyableAndNonMovable>); + extern DebugSettingsManager debugManager; class DurationLog { diff --git a/shared/source/device/device.h b/shared/source/device/device.h index 62be551d74..05dc689ba6 100644 --- a/shared/source/device/device.h +++ b/shared/source/device/device.h @@ -55,7 +55,7 @@ struct EngineGroupT { using EngineGroupsT = std::vector; using CsrContainer = std::vector>; -struct SecondaryContexts { +struct SecondaryContexts : NEO::NonCopyableAndNonMovableClass { SecondaryContexts() = default; SecondaryContexts(SecondaryContexts &&in) { this->engines = std::move(in.engines); @@ -64,8 +64,7 @@ struct SecondaryContexts { this->regularEnginesTotal = in.regularEnginesTotal; this->highPriorityEnginesTotal = in.highPriorityEnginesTotal; } - SecondaryContexts(const SecondaryContexts &in) = delete; - SecondaryContexts &operator=(const SecondaryContexts &) = delete; + SecondaryContexts &operator=(SecondaryContexts &&other) noexcept = delete; EngineControl *getEngine(const EngineUsage usage); @@ -81,15 +80,15 @@ struct SecondaryContexts { std::mutex mutex; }; +static_assert(NEO::NonCopyable); + struct RTDispatchGlobalsInfo { GraphicsAllocation *rtDispatchGlobalsArray = nullptr; std::vector rtStacks; // per tile }; -class Device : public ReferenceTrackedObject { +class Device : public ReferenceTrackedObject, NEO::NonCopyableAndNonMovableClass { public: - Device &operator=(const Device &) = delete; - Device(const Device &) = delete; ~Device() override; template @@ -359,4 +358,6 @@ inline SelectorCopyEngine &Device::getSelectorCopyEngine() { return selectorCopyEngine; } +static_assert(NEO::NonCopyableAndNonMovable); + } // namespace NEO diff --git a/shared/source/helpers/bindless_heaps_helper.h b/shared/source/helpers/bindless_heaps_helper.h index 95414211b4..99b604ec39 100644 --- a/shared/source/helpers/bindless_heaps_helper.h +++ b/shared/source/helpers/bindless_heaps_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,6 +8,7 @@ #pragma once #include "shared/source/helpers/constants.h" #include "shared/source/helpers/heap_helper.h" +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/memory_manager/graphics_allocation.h" #include @@ -31,7 +32,7 @@ constexpr uint32_t redescribedImage = 3; constexpr uint32_t max = 4; }; // namespace BindlessImageSlot -class BindlessHeapsHelper { +class BindlessHeapsHelper : NEO::NonCopyableAndNonMovableClass { public: enum BindlesHeapType { specialSsh = 0, @@ -43,9 +44,6 @@ class BindlessHeapsHelper { BindlessHeapsHelper(Device *rootDevice, bool isMultiOsContextCapable); MOCKABLE_VIRTUAL ~BindlessHeapsHelper(); - BindlessHeapsHelper(const BindlessHeapsHelper &) = delete; - BindlessHeapsHelper &operator=(const BindlessHeapsHelper &) = delete; - GraphicsAllocation *getHeapAllocation(size_t heapSize, size_t alignment, bool allocInFrontWindow); MOCKABLE_VIRTUAL SurfaceStateInHeapInfo allocateSSInHeap(size_t ssSize, GraphicsAllocation *surfaceAllocation, BindlesHeapType heapType); @@ -108,4 +106,7 @@ class BindlessHeapsHelper { std::vector reservedRanges; }; + +static_assert(NEO::NonCopyableAndNonMovable); + } // namespace NEO diff --git a/shared/source/indirect_heap/indirect_heap.h b/shared/source/indirect_heap/indirect_heap.h index 0b9e072cd0..2646f17a02 100644 --- a/shared/source/indirect_heap/indirect_heap.h +++ b/shared/source/indirect_heap/indirect_heap.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2023 Intel Corporation + * Copyright (C) 2019-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,6 +8,7 @@ #pragma once #include "shared/source/command_stream/linear_stream.h" #include "shared/source/helpers/aligned_memory.h" +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/helpers/ptr_math.h" #include "shared/source/indirect_heap/heap_size.h" #include "shared/source/indirect_heap/indirect_heap_type.h" @@ -25,10 +26,6 @@ class IndirectHeap : public LinearStream { IndirectHeap(GraphicsAllocation *graphicsAllocation, bool canBeUtilizedAs4GbHeap) : BaseClass(graphicsAllocation), canBeUtilizedAs4GbHeap(canBeUtilizedAs4GbHeap) {} - // Disallow copy'ing - IndirectHeap(const IndirectHeap &) = delete; - IndirectHeap &operator=(const IndirectHeap &) = delete; - void align(size_t alignment); uint64_t getHeapGpuStartOffset() const; uint64_t getHeapGpuBase() const; @@ -38,6 +35,8 @@ class IndirectHeap : public LinearStream { bool canBeUtilizedAs4GbHeap = false; }; +static_assert(NEO::NonCopyableAndNonMovable); + inline void IndirectHeap::align(size_t alignment) { auto address = alignUp(ptrOffset(buffer, sizeUsed), alignment); sizeUsed = ptrDiff(address, buffer); @@ -74,10 +73,6 @@ class ReservedIndirectHeap : public IndirectHeap { ReservedIndirectHeap(GraphicsAllocation *graphicsAllocation, bool canBeUtilizedAs4GbHeap) : IndirectHeap(graphicsAllocation, canBeUtilizedAs4GbHeap) {} - // Disallow copy'ing - ReservedIndirectHeap(const ReservedIndirectHeap &) = delete; - ReservedIndirectHeap &operator=(const ReservedIndirectHeap &) = delete; - uint32_t getHeapSizeInPages() const override { return parentHeapSizeInPages; } @@ -89,4 +84,6 @@ class ReservedIndirectHeap : public IndirectHeap { uint32_t parentHeapSizeInPages = 0; }; +static_assert(NEO::NonCopyableAndNonMovable); + } // namespace NEO diff --git a/shared/source/kernel/local_ids_cache.h b/shared/source/kernel/local_ids_cache.h index e642f3f8b2..985288f8cb 100644 --- a/shared/source/kernel/local_ids_cache.h +++ b/shared/source/kernel/local_ids_cache.h @@ -1,10 +1,11 @@ /* - * Copyright (C) 2022-2024 Intel Corporation + * Copyright (C) 2022-2025 Intel Corporation * * SPDX-License-Identifier: MIT * */ +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/helpers/vec.h" #include "shared/source/utilities/stackvec.h" @@ -13,7 +14,7 @@ namespace NEO { struct RootDeviceEnvironment; -class LocalIdsCache { +class LocalIdsCache : NEO::NonCopyableAndNonMovableClass { public: struct LocalIdsCacheEntry { Vec3 groupSize = {0, 0, 0}; @@ -24,8 +25,6 @@ class LocalIdsCache { }; LocalIdsCache() = delete; - LocalIdsCache(LocalIdsCache &) = delete; - LocalIdsCache &operator=(const LocalIdsCache &other) = delete; LocalIdsCache(size_t cacheSize, std::array wgDimOrder, uint32_t grfCount, uint8_t simdSize, uint8_t grfSize, bool usesOnlyImages = false); ~LocalIdsCache(); @@ -48,4 +47,7 @@ class LocalIdsCache { const uint8_t simdSize; const bool usesOnlyImages; }; -} // namespace NEO \ No newline at end of file + +static_assert(NEO::NonCopyableAndNonMovable); + +} // namespace NEO diff --git a/shared/source/memory_manager/deferred_deleter.h b/shared/source/memory_manager/deferred_deleter.h index 8acf0a115c..006f57df78 100644 --- a/shared/source/memory_manager/deferred_deleter.h +++ b/shared/source/memory_manager/deferred_deleter.h @@ -6,6 +6,7 @@ */ #pragma once +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/utilities/idlist.h" #include @@ -15,14 +16,11 @@ namespace NEO { class DeferrableDeletion; class Thread; -class DeferredDeleter { +class DeferredDeleter : NEO::NonCopyableAndNonMovableClass { public: DeferredDeleter(); virtual ~DeferredDeleter(); - DeferredDeleter(const DeferredDeleter &) = delete; - DeferredDeleter &operator=(const DeferredDeleter &) = delete; - MOCKABLE_VIRTUAL void deferDeletion(DeferrableDeletion *deletion); MOCKABLE_VIRTUAL void addClient(); @@ -52,4 +50,7 @@ class DeferredDeleter { std::mutex threadMutex; std::condition_variable condition; }; + +static_assert(NEO::NonCopyableAndNonMovable); + } // namespace NEO diff --git a/shared/source/memory_manager/graphics_allocation.h b/shared/source/memory_manager/graphics_allocation.h index 645a686c12..8d928e24ad 100644 --- a/shared/source/memory_manager/graphics_allocation.h +++ b/shared/source/memory_manager/graphics_allocation.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -9,6 +9,7 @@ #include "shared/source/command_stream/task_count_helper.h" #include "shared/source/helpers/debug_helpers.h" +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/helpers/ptr_math.h" #include "shared/source/memory_manager/allocation_type.h" #include "shared/source/memory_manager/definitions/engine_limits.h" @@ -56,7 +57,7 @@ struct SurfaceStateInHeapInfo { size_t ssSize; }; -class GraphicsAllocation : public IDNode { +class GraphicsAllocation : public IDNode, NEO::NonCopyableAndNonMovableClass { public: enum UsmInitialPlacement { DEFAULT, @@ -65,8 +66,6 @@ class GraphicsAllocation : public IDNode { }; ~GraphicsAllocation() override; - GraphicsAllocation &operator=(const GraphicsAllocation &) = delete; - GraphicsAllocation(const GraphicsAllocation &) = delete; GraphicsAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *cpuPtrIn, uint64_t canonizedGpuAddress, uint64_t baseAddress, size_t sizeIn, MemoryPool pool, size_t maxOsContextCount); @@ -413,4 +412,7 @@ class GraphicsAllocation : public IDNode { bool cantBeReadOnly = false; bool explicitlyMadeResident = false; }; + +static_assert(NEO::NonCopyableAndNonMovable); + } // namespace NEO diff --git a/shared/source/memory_manager/unified_memory_manager.h b/shared/source/memory_manager/unified_memory_manager.h index b5f14a9563..35be1a7e10 100644 --- a/shared/source/memory_manager/unified_memory_manager.h +++ b/shared/source/memory_manager/unified_memory_manager.h @@ -9,6 +9,7 @@ #include "shared/source/command_stream/task_count_helper.h" #include "shared/source/helpers/constants.h" #include "shared/source/helpers/device_bitfield.h" +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/memory_manager/multi_graphics_allocation.h" #include "shared/source/memory_manager/residency_container.h" #include "shared/source/unified_memory/unified_memory.h" @@ -32,7 +33,7 @@ class MemoryManager; class Device; struct VirtualMemoryReservation; -struct SvmAllocationData { +struct SvmAllocationData : NEO::NonCopyableAndNonMovableClass { SvmAllocationData(uint32_t maxRootDeviceIndex) : gpuAllocations(maxRootDeviceIndex), maxRootDeviceIndex(maxRootDeviceIndex){}; SvmAllocationData(const SvmAllocationData &svmAllocData) : SvmAllocationData(svmAllocData.maxRootDeviceIndex) { this->allocationFlagsProperty = svmAllocData.allocationFlagsProperty; @@ -52,7 +53,7 @@ struct SvmAllocationData { this->mappedAllocData = svmAllocData.mappedAllocData; this->virtualReservationData = svmAllocData.virtualReservationData; } - SvmAllocationData &operator=(const SvmAllocationData &) = delete; + SvmAllocationData(SvmAllocationData &&other) noexcept = delete; GraphicsAllocation *cpuAllocation = nullptr; MultiGraphicsAllocation gpuAllocations; VirtualMemoryReservation *virtualReservationData = nullptr; @@ -79,6 +80,8 @@ struct SvmAllocationData { uint32_t allocId = uninitializedAllocId; }; +static_assert(NEO::NonMovable); + struct SvmMapOperation { void *regionSvmPtr = nullptr; size_t regionSize = 0; diff --git a/shared/source/os_interface/linux/cache_info.h b/shared/source/os_interface/linux/cache_info.h index 8415b29c73..5d35cd5eb3 100644 --- a/shared/source/os_interface/linux/cache_info.h +++ b/shared/source/os_interface/linux/cache_info.h @@ -8,6 +8,7 @@ #pragma once #include "shared/source/helpers/common_types.h" +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/os_interface/linux/clos_cache.h" #include "shared/source/utilities/spinlock.h" @@ -25,7 +26,7 @@ struct CacheReservationParameters { uint16_t maxNumWays{0U}; }; -struct CacheInfo { +struct CacheInfo : NEO::NonCopyableAndNonMovableClass { CacheInfo(IoctlHelper &ioctlHelper, const CacheReservationParameters l3Limits) : l3ReservationLimits{l3Limits}, cacheReserve{ioctlHelper} { @@ -35,9 +36,6 @@ struct CacheInfo { MOCKABLE_VIRTUAL ~CacheInfo(); - CacheInfo(const CacheInfo &) = delete; - CacheInfo &operator=(const CacheInfo &) = delete; - size_t getMaxReservationCacheSize() const { const auto &limits{l3ReservationLimits}; return limits.maxSize; @@ -81,4 +79,6 @@ struct CacheInfo { SpinLock mtx; }; +static_assert(NEO::NonCopyableAndNonMovable); + } // namespace NEO diff --git a/shared/source/os_interface/linux/drm_buffer_object.h b/shared/source/os_interface/linux/drm_buffer_object.h index 046e03ce53..7a99ab3bb8 100644 --- a/shared/source/os_interface/linux/drm_buffer_object.h +++ b/shared/source/os_interface/linux/drm_buffer_object.h @@ -10,6 +10,7 @@ #include "shared/source/command_stream/task_count_helper.h" #include "shared/source/helpers/common_types.h" #include "shared/source/helpers/constants.h" +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/memory_manager/definitions/engine_limits.h" #include "shared/source/memory_manager/memory_operations_status.h" #include "shared/source/os_interface/linux/cache_info.h" @@ -31,7 +32,7 @@ class DrmMemoryManager; class Drm; class OsContext; -class BufferObjectHandleWrapper { +class BufferObjectHandleWrapper : NEO::NonCopyableClass { private: struct ControlBlock { int refCount{0}; @@ -53,8 +54,6 @@ class BufferObjectHandleWrapper { ~BufferObjectHandleWrapper(); - BufferObjectHandleWrapper(const BufferObjectHandleWrapper &) = delete; - BufferObjectHandleWrapper &operator=(const BufferObjectHandleWrapper &) = delete; BufferObjectHandleWrapper &operator=(BufferObjectHandleWrapper &&) = delete; BufferObjectHandleWrapper acquireSharedOwnership(); @@ -86,6 +85,8 @@ class BufferObjectHandleWrapper { ControlBlock *controlBlock{nullptr}; }; +static_assert(NEO::NonCopyable); + class BufferObject { public: BufferObject(uint32_t rootDeviceIndex, Drm *drm, uint64_t patIndex, int handle, size_t size, size_t maxOsContextCount); diff --git a/shared/source/os_interface/linux/drm_gem_close_worker.h b/shared/source/os_interface/linux/drm_gem_close_worker.h index b9e7605751..dfd0e36d54 100644 --- a/shared/source/os_interface/linux/drm_gem_close_worker.h +++ b/shared/source/os_interface/linux/drm_gem_close_worker.h @@ -1,11 +1,13 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once +#include "shared/source/helpers/non_copyable_or_moveable.h" + #include #include #include @@ -24,14 +26,11 @@ enum class GemCloseWorkerMode { gemCloseWorkerActive }; -class DrmGemCloseWorker { +class DrmGemCloseWorker : NEO::NonCopyableAndNonMovableClass { public: DrmGemCloseWorker(DrmMemoryManager &memoryManager); MOCKABLE_VIRTUAL ~DrmGemCloseWorker(); - DrmGemCloseWorker(const DrmGemCloseWorker &) = delete; - DrmGemCloseWorker &operator=(const DrmGemCloseWorker &) = delete; - void push(BufferObject *allocation); MOCKABLE_VIRTUAL void close(bool blocking); @@ -55,4 +54,7 @@ class DrmGemCloseWorker { std::condition_variable condition; std::atomic workerDone{false}; }; + +static_assert(NEO::NonCopyableAndNonMovable); + } // namespace NEO diff --git a/shared/source/os_interface/windows/deferrable_deletion_win.h b/shared/source/os_interface/windows/deferrable_deletion_win.h index 9ccff56754..d4058e0d11 100644 --- a/shared/source/os_interface/windows/deferrable_deletion_win.h +++ b/shared/source/os_interface/windows/deferrable_deletion_win.h @@ -1,11 +1,12 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/memory_manager/deferrable_deletion.h" #include "shared/source/os_interface/os_context.h" #include "shared/source/os_interface/windows/d3dkmthk_wrapper.h" @@ -17,19 +18,19 @@ class OsContextWin; class Wddm; enum class AllocationType; -class DeferrableDeletionImpl : public DeferrableDeletion { +class DeferrableDeletionImpl : public DeferrableDeletion, NEO::NonCopyableAndNonMovableClass { public: DeferrableDeletionImpl(Wddm *wddm, const D3DKMT_HANDLE *handles, uint32_t allocationCount, D3DKMT_HANDLE resourceHandle, AllocationType type); bool apply() override; ~DeferrableDeletionImpl() override; - DeferrableDeletionImpl(const DeferrableDeletionImpl &) = delete; - DeferrableDeletionImpl &operator=(const DeferrableDeletionImpl &) = delete; - protected: Wddm *wddm; D3DKMT_HANDLE *handles = nullptr; uint32_t allocationCount; D3DKMT_HANDLE resourceHandle; }; + +static_assert(NEO::NonCopyableAndNonMovable); + } // namespace NEO diff --git a/shared/source/os_interface/windows/wddm_memory_manager.h b/shared/source/os_interface/windows/wddm_memory_manager.h index 53a257794c..9536b088f2 100644 --- a/shared/source/os_interface/windows/wddm_memory_manager.h +++ b/shared/source/os_interface/windows/wddm_memory_manager.h @@ -1,11 +1,12 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/memory_manager/memory_manager.h" #include "shared/source/os_interface/os_context.h" #include "shared/source/os_interface/os_memory.h" @@ -22,16 +23,13 @@ class Wddm; extern const GfxMemoryAllocationMethod preferredAllocationMethod; -class WddmMemoryManager : public MemoryManager { +class WddmMemoryManager : public MemoryManager, NEO::NonCopyableAndNonMovableClass { public: using MemoryManager::allocateGraphicsMemoryWithProperties; ~WddmMemoryManager() override; WddmMemoryManager(ExecutionEnvironment &executionEnvironment); - WddmMemoryManager(const WddmMemoryManager &) = delete; - WddmMemoryManager &operator=(const WddmMemoryManager &) = delete; - void freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation) override; void freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation, bool isImportedAllocation) override; void handleFenceCompletion(GraphicsAllocation *allocation) override; @@ -125,4 +123,7 @@ class WddmMemoryManager : public MemoryManager { Wddm &getWddm(uint32_t rootDeviceIndex) const; }; + +static_assert(NEO::NonCopyableAndNonMovable); + } // namespace NEO diff --git a/shared/source/program/kernel_info.h b/shared/source/program/kernel_info.h index b23021760c..cdc342eaf1 100644 --- a/shared/source/program/kernel_info.h +++ b/shared/source/program/kernel_info.h @@ -1,11 +1,12 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/kernel/kernel_descriptor.h" #include "shared/source/program/heap_info.h" #include "shared/source/utilities/arrayref.h" @@ -39,11 +40,9 @@ struct DeviceInfoKernelPayloadConstants { uint32_t maxWorkGroupSize = 0U; }; -struct KernelInfo { +struct KernelInfo : NEO::NonCopyableAndNonMovableClass { public: KernelInfo() = default; - KernelInfo(const KernelInfo &) = delete; - KernelInfo &operator=(const KernelInfo &) = delete; ~KernelInfo(); GraphicsAllocation *getGraphicsAllocation() const { return this->kernelAllocation; } @@ -104,6 +103,8 @@ struct KernelInfo { KernelDescriptor kernelDescriptor; }; +static_assert(NEO::NonCopyableAndNonMovable); + std::string concatenateKernelNames(ArrayRef kernelInfos); } // namespace NEO diff --git a/shared/source/program/program_info.h b/shared/source/program/program_info.h index afc906a79d..bd684f0278 100644 --- a/shared/source/program/program_info.h +++ b/shared/source/program/program_info.h @@ -1,11 +1,12 @@ /* - * Copyright (C) 2020-2024 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/utilities/arrayref.h" #include @@ -20,12 +21,10 @@ struct ExternalFunctionInfo; struct LinkerInput; struct KernelInfo; -struct ProgramInfo { +struct ProgramInfo : NEO::NonCopyableClass { ProgramInfo() = default; ProgramInfo(ProgramInfo &&) = default; ProgramInfo &operator=(ProgramInfo &&) = default; - ProgramInfo(const ProgramInfo &) = delete; - ProgramInfo &operator=(const ProgramInfo &) = delete; ~ProgramInfo(); struct GlobalSurfaceInfo { @@ -50,6 +49,8 @@ struct ProgramInfo { size_t kernelMiscInfoPos = std::string::npos; }; +static_assert(NEO::NonCopyable); + size_t getMaxInlineSlmNeeded(const ProgramInfo &programInfo); bool requiresLocalMemoryWindowVA(const ProgramInfo &programInfo); bool isRebuiltToPatchtokensRequired(Device *neoDevice, ArrayRef archive, std::string &optionsString, bool isBuiltin, bool isVmeUsed); diff --git a/shared/source/utilities/directory.h b/shared/source/utilities/directory.h index 7a71c8734f..d1c7716634 100644 --- a/shared/source/utilities/directory.h +++ b/shared/source/utilities/directory.h @@ -1,11 +1,13 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once +#include "shared/source/helpers/non_copyable_or_moveable.h" + #include #include #include @@ -14,7 +16,7 @@ namespace NEO { -class Directory { +class Directory : NEO::NonCopyableAndNonMovableClass { public: static inline constexpr char returnDirs{1 << 0}; static inline constexpr char createDirs{1 << 1}; @@ -24,10 +26,6 @@ class Directory { Directory() = default; Directory(const std::string &path) : path(path) {} - Directory(Directory &&other) noexcept = delete; - Directory(const Directory &other) = delete; - Directory &operator=(Directory &&other) noexcept = delete; - Directory &operator=(const Directory &other) = delete; inline std::optional> parseDirectories(char flags) { std::optional> directories; @@ -62,6 +60,8 @@ class Directory { std::string path; }; +static_assert(NEO::NonCopyableAndNonMovable); + inline int parseBdfString(const std::string &pciBDF, uint16_t &domain, uint8_t &bus, uint8_t &device, uint8_t &function) { if (strlen(pciBDF.c_str()) == 12) { domain = static_cast(strtol((pciBDF.substr(0, 4)).c_str(), NULL, 16)); @@ -74,4 +74,4 @@ inline int parseBdfString(const std::string &pciBDF, uint16_t &domain, uint8_t & } } -} // namespace NEO \ No newline at end of file +} // namespace NEO diff --git a/shared/source/utilities/isa_pool_allocator.h b/shared/source/utilities/isa_pool_allocator.h index 80d9d69cb1..fc42360cff 100644 --- a/shared/source/utilities/isa_pool_allocator.h +++ b/shared/source/utilities/isa_pool_allocator.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,6 +8,7 @@ #pragma once #include "shared/source/helpers/constants.h" +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/utilities/buffer_pool_allocator.h" #include @@ -84,4 +85,6 @@ class ISAPoolAllocator : public AbstractBuffersAllocator); + } // namespace NEO diff --git a/shared/source/utilities/logger.h b/shared/source/utilities/logger.h index 7d6a3a5dc8..b5e96aa3a4 100644 --- a/shared/source/utilities/logger.h +++ b/shared/source/utilities/logger.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2024 Intel Corporation + * Copyright (C) 2019-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,6 +7,7 @@ #pragma once #include "shared/source/debug_settings/debug_settings_manager.h" +#include "shared/source/helpers/non_copyable_or_moveable.h" #include #include @@ -27,14 +28,11 @@ const char *getAllocationTypeString(GraphicsAllocation const *graphicsAllocation const char *getMemoryPoolString(GraphicsAllocation const *graphicsAllocation); template -class FileLogger { +class FileLogger : NEO::NonCopyableAndNonMovableClass { public: FileLogger(std::string filename, const DebugVariables &flags); MOCKABLE_VIRTUAL ~FileLogger(); - FileLogger(const FileLogger &) = delete; - FileLogger &operator=(const FileLogger &) = delete; - static constexpr bool enabled() { return debugLevel != DebugFunctionalityLevel::none; } @@ -189,6 +187,10 @@ class FileLogger { } }; +static_assert(NEO::NonCopyableAndNonMovable>); +static_assert(NEO::NonCopyableAndNonMovable>); +static_assert(NEO::NonCopyableAndNonMovable>); + extern FileLogger &fileLoggerInstance(); template diff --git a/shared/source/utilities/range.h b/shared/source/utilities/range.h index 20b2ef50f0..9977636478 100644 --- a/shared/source/utilities/range.h +++ b/shared/source/utilities/range.h @@ -1,17 +1,19 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once +#include "shared/source/helpers/non_copyable_or_moveable.h" + #include namespace NEO { template -struct Range { +struct Range : NEO::NonCopyableAndNonMovableClass { using iterator = DataType *; using const_iterator = const DataType *; using reverse_iterator = std::reverse_iterator; @@ -34,7 +36,6 @@ struct Range { Range(T (&base)[size]) : Range(&base[0], size) { } - Range &operator=(const Range &) = delete; iterator begin() { return begIt; @@ -80,6 +81,8 @@ struct Range { iterator endIt; }; +static_assert(NEO::NonCopyableAndNonMovable>); + template inline Range createRange(T *base, size_t count) { return Range(base, count); diff --git a/shared/source/utilities/staging_buffer_manager.h b/shared/source/utilities/staging_buffer_manager.h index f6015ebabf..94a30b6642 100644 --- a/shared/source/utilities/staging_buffer_manager.h +++ b/shared/source/utilities/staging_buffer_manager.h @@ -9,6 +9,7 @@ #include "shared/source/command_stream/wait_status.h" #include "shared/source/helpers/constants.h" +#include "shared/source/helpers/non_copyable_or_moveable.h" #include "shared/source/utilities/stackvec.h" #include @@ -27,13 +28,11 @@ class HeapAllocator; using ChunkCopyFunction = std::function; using ChunkTransferImageFunc = std::function; using ChunkTransferBufferFunc = std::function; -class StagingBuffer { +class StagingBuffer : NEO::NonCopyableClass { public: StagingBuffer(void *baseAddress, size_t size); StagingBuffer(StagingBuffer &&other); - StagingBuffer(const StagingBuffer &other) = delete; StagingBuffer &operator=(StagingBuffer &&other) noexcept = delete; - StagingBuffer &operator=(const StagingBuffer &other) = delete; void *getBaseAddress() const { return baseAddress; @@ -47,6 +46,8 @@ class StagingBuffer { std::unique_ptr allocator; }; +static_assert(NEO::NonCopyable); + struct StagingBufferTracker { HeapAllocator *allocator = nullptr; uint64_t chunkAddress = 0; @@ -78,14 +79,10 @@ struct StagingTransferStatus { constexpr size_t maxInFlightReads = 2u; using StagingQueue = StackVec, maxInFlightReads>; -class StagingBufferManager { +class StagingBufferManager : NEO::NonCopyableAndNonMovableClass { public: StagingBufferManager(SVMAllocsManager *svmAllocsManager, const RootDeviceIndicesContainer &rootDeviceIndices, const std::map &deviceBitfields, bool requiresWritable); ~StagingBufferManager(); - StagingBufferManager(StagingBufferManager &&other) noexcept = delete; - StagingBufferManager(const StagingBufferManager &other) = delete; - StagingBufferManager &operator=(StagingBufferManager &&other) noexcept = delete; - StagingBufferManager &operator=(const StagingBufferManager &other) = delete; bool isValidForCopy(const Device &device, void *dstPtr, const void *srcPtr, size_t size, bool hasDependencies, uint32_t osContextId); bool isValidForStagingTransfer(const Device &device, const void *ptr, size_t size, bool hasDependencies); @@ -126,4 +123,6 @@ class StagingBufferManager { std::set detectedHostPtrs; }; +static_assert(NEO::NonCopyableAndNonMovable); + } // namespace NEO diff --git a/shared/source/utilities/timer_util.h b/shared/source/utilities/timer_util.h index 7eb04ee6cf..9c48df7b8c 100644 --- a/shared/source/utilities/timer_util.h +++ b/shared/source/utilities/timer_util.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2022 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,12 +7,14 @@ #pragma once +#include "shared/source/helpers/non_copyable_or_moveable.h" + namespace NEO { -class Timer { +class Timer : NEO::NonCopyableAndNonMovableClass { public: Timer(); - Timer(const Timer &) = delete; + Timer &operator=(Timer &&) noexcept = delete; ~Timer(); @@ -33,4 +35,7 @@ class Timer { class TimerImpl; TimerImpl *timerImpl; }; + +static_assert(NEO::NonMovable); + }; // namespace NEO