fix: Add asserts to ensure NonCopyable and NonMovable 3/n

Related-To: NEO-14068

Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2025-02-18 14:35:36 +00:00
committed by Compute-Runtime-Automation
parent ff9d0d7ea0
commit 6b6202446b
33 changed files with 191 additions and 164 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019-2021 Intel Corporation * Copyright (C) 2019-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -7,6 +7,8 @@
#pragma once #pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "igfxfmid.h" #include "igfxfmid.h"
#include <memory> #include <memory>
@@ -14,15 +16,10 @@
class MessagePrinter; class MessagePrinter;
struct IgaWrapper { struct IgaWrapper : NEO::NonCopyableAndNonMovableClass {
IgaWrapper(); IgaWrapper();
MOCKABLE_VIRTUAL ~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 tryDisassembleGenISA(const void *kernelPtr, uint32_t kernelSize, std::string &out);
MOCKABLE_VIRTUAL bool tryAssembleGenISA(const std::string &inAsm, std::string &outBinary); MOCKABLE_VIRTUAL bool tryAssembleGenISA(const std::string &inAsm, std::string &outBinary);
@@ -41,3 +38,5 @@ struct IgaWrapper {
MessagePrinter *messagePrinter = nullptr; MessagePrinter *messagePrinter = nullptr;
}; };
static_assert(NEO::NonCopyableAndNonMovable<IgaWrapper>);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2020-2023 Intel Corporation * Copyright (C) 2020-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -7,6 +7,8 @@
#pragma once #pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <vector> #include <vector>
@@ -15,10 +17,8 @@ class OclocArgHelper;
namespace NEO { namespace NEO {
class MultiCommand { class MultiCommand : NEO::NonCopyableAndNonMovableClass {
public: public:
MultiCommand &operator=(const MultiCommand &) = delete;
MultiCommand(const MultiCommand &) = delete;
MOCKABLE_VIRTUAL ~MultiCommand() = default; MOCKABLE_VIRTUAL ~MultiCommand() = default;
static MultiCommand *create(const std::vector<std::string> &args, int &retVal, OclocArgHelper *helper); static MultiCommand *create(const std::vector<std::string> &args, int &retVal, OclocArgHelper *helper);
@@ -45,4 +45,7 @@ class MultiCommand {
std::stringstream outputFile; std::stringstream outputFile;
bool quiet = false; bool quiet = false;
}; };
static_assert(NEO::NonCopyableAndNonMovable<MultiCommand>);
} // namespace NEO } // namespace NEO

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2022-2023 Intel Corporation * Copyright (C) 2022-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -7,6 +7,7 @@
#pragma once #pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "shared/source/utilities/arrayref.h" #include "shared/source/utilities/arrayref.h"
#include "shared/source/utilities/const_stringref.h" #include "shared/source/utilities/const_stringref.h"
@@ -23,14 +24,11 @@ namespace Ar {
struct Ar; struct Ar;
} }
class OclocConcat { class OclocConcat : NEO::NonCopyableAndNonMovableClass {
public: public:
using ErrorCode = uint32_t; using ErrorCode = uint32_t;
OclocConcat() = delete; OclocConcat() = delete;
OclocConcat(const OclocConcat &) = delete;
OclocConcat &operator=(const OclocConcat &) = delete;
OclocConcat(OclocArgHelper *argHelper) : argHelper(argHelper){}; OclocConcat(OclocArgHelper *argHelper) : argHelper(argHelper){};
ErrorCode initialize(const std::vector<std::string> &args); ErrorCode initialize(const std::vector<std::string> &args);
ErrorCode concatenate(); ErrorCode concatenate();
@@ -53,4 +51,7 @@ Usage: ocloc concat <fat binary> <fat binary> ... [-out <concatenated fat binary
std::vector<std::string> fileNamesToConcat; std::vector<std::string> fileNamesToConcat;
std::string fatBinaryName = "concat.ar"; std::string fatBinaryName = "concat.ar";
}; };
static_assert(NEO::NonCopyableAndNonMovable<OclocConcat>);
} // namespace NEO } // namespace NEO

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2022-2023 Intel Corporation * Copyright (C) 2022-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -7,6 +7,8 @@
#pragma once #pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "cif/common/cif_main.h" #include "cif/common/cif_main.h"
#include "cif/import/library_api.h" #include "cif/import/library_api.h"
#include "igfxfmid.h" #include "igfxfmid.h"
@@ -25,16 +27,11 @@ class OsLibrary;
struct HardwareInfo; struct HardwareInfo;
class OclocFclFacade { class OclocFclFacade : NEO::NonCopyableAndNonMovableClass {
public: public:
OclocFclFacade(OclocArgHelper *argHelper); OclocFclFacade(OclocArgHelper *argHelper);
MOCKABLE_VIRTUAL ~OclocFclFacade(); MOCKABLE_VIRTUAL ~OclocFclFacade();
OclocFclFacade(OclocFclFacade &) = delete;
OclocFclFacade(const OclocFclFacade &&) = delete;
OclocFclFacade &operator=(const OclocFclFacade &) = delete;
OclocFclFacade &operator=(OclocFclFacade &&) = delete;
int initialize(const HardwareInfo &hwInfo); int initialize(const HardwareInfo &hwInfo);
bool isInitialized() const; bool isInitialized() const;
IGC::CodeType::CodeType_t getPreferredIntermediateRepresentation() const; IGC::CodeType::CodeType_t getPreferredIntermediateRepresentation() const;
@@ -59,4 +56,6 @@ class OclocFclFacade {
bool initialized{false}; bool initialized{false};
}; };
static_assert(NEO::NonCopyableAndNonMovable<OclocFclFacade>);
} // namespace NEO } // namespace NEO

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2022-2024 Intel Corporation * Copyright (C) 2022-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -7,6 +7,8 @@
#pragma once #pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "cif/common/cif_main.h" #include "cif/common/cif_main.h"
#include "cif/import/library_api.h" #include "cif/import/library_api.h"
#include "ocl_igc_interface/code_type.h" #include "ocl_igc_interface/code_type.h"
@@ -24,16 +26,11 @@ class OsLibrary;
struct HardwareInfo; struct HardwareInfo;
class OclocIgcFacade { class OclocIgcFacade : NEO::NonCopyableAndNonMovableClass {
public: public:
OclocIgcFacade(OclocArgHelper *argHelper); OclocIgcFacade(OclocArgHelper *argHelper);
MOCKABLE_VIRTUAL ~OclocIgcFacade(); MOCKABLE_VIRTUAL ~OclocIgcFacade();
OclocIgcFacade(OclocIgcFacade &) = delete;
OclocIgcFacade(const OclocIgcFacade &&) = delete;
OclocIgcFacade &operator=(const OclocIgcFacade &) = delete;
OclocIgcFacade &operator=(OclocIgcFacade &&) = delete;
int initialize(const HardwareInfo &hwInfo); int initialize(const HardwareInfo &hwInfo);
bool isInitialized() const; bool isInitialized() const;
const char *getIgcRevision(); const char *getIgcRevision();
@@ -66,4 +63,6 @@ class OclocIgcFacade {
bool initialized{false}; bool initialized{false};
}; };
} // namespace NEO static_assert(NEO::NonCopyableAndNonMovable<OclocIgcFacade>);
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018-2024 Intel Corporation * Copyright (C) 2018-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -9,6 +9,7 @@
#include "shared/offline_compiler/source/ocloc_api.h" #include "shared/offline_compiler/source/ocloc_api.h"
#include "shared/source/helpers/hw_info.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/arrayref.h"
#include "shared/source/utilities/const_stringref.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); const HardwareInfo *getHwInfoForDeprecatedAcronym(const std::string &deviceName);
class OfflineCompiler { class OfflineCompiler : NEO::NonCopyableAndNonMovableClass {
public: public:
static std::vector<NameVersionPair> getExtensions(ConstStringRef product, bool needVersions, OclocArgHelper *helper); static std::vector<NameVersionPair> getExtensions(ConstStringRef product, bool needVersions, OclocArgHelper *helper);
static std::vector<NameVersionPair> getOpenCLCVersions(ConstStringRef product, OclocArgHelper *helper); static std::vector<NameVersionPair> getOpenCLCVersions(ConstStringRef product, OclocArgHelper *helper);
@@ -110,8 +111,6 @@ that correspond to the given name.
All supported acronyms: %s. All supported acronyms: %s.
)OCLOC_HELP"; )OCLOC_HELP";
OfflineCompiler &operator=(const OfflineCompiler &) = delete;
OfflineCompiler(const OfflineCompiler &) = delete;
MOCKABLE_VIRTUAL ~OfflineCompiler(); MOCKABLE_VIRTUAL ~OfflineCompiler();
bool isQuiet() const { bool isQuiet() const {
@@ -243,4 +242,6 @@ All supported acronyms: %s.
OclocArgHelper *argHelper = nullptr; OclocArgHelper *argHelper = nullptr;
}; };
static_assert(NEO::NonCopyableAndNonMovable<OfflineCompiler>);
} // namespace NEO } // namespace NEO

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018-2024 Intel Corporation * Copyright (C) 2018-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -8,6 +8,7 @@
#pragma once #pragma once
#include "shared/source/built_ins/sip_kernel_type.h" #include "shared/source/built_ins/sip_kernel_type.h"
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include <string> #include <string>
#include <vector> #include <vector>
@@ -22,14 +23,10 @@ class OsContext;
struct RootDeviceEnvironment; struct RootDeviceEnvironment;
class SipKernel { class SipKernel : NEO::NonCopyableAndNonMovableClass {
public: public:
SipKernel(SipKernelType type, GraphicsAllocation *sipAlloc, std::vector<char> ssah, std::vector<char> binary); SipKernel(SipKernelType type, GraphicsAllocation *sipAlloc, std::vector<char> ssah, std::vector<char> binary);
SipKernel(SipKernelType type, GraphicsAllocation *sipAlloc, std::vector<char> ssah); SipKernel(SipKernelType type, GraphicsAllocation *sipAlloc, std::vector<char> ssah);
SipKernel(const SipKernel &) = delete;
SipKernel &operator=(const SipKernel &) = delete;
SipKernel(SipKernel &&) = delete;
SipKernel &operator=(SipKernel &&) = delete;
virtual ~SipKernel(); virtual ~SipKernel();
SipKernelType getType() const { SipKernelType getType() const {
@@ -87,4 +84,6 @@ class SipKernel {
SipKernelType type = SipKernelType::count; SipKernelType type = SipKernelType::count;
}; };
static_assert(NEO::NonCopyableAndNonMovable<SipKernel>);
} // namespace NEO } // namespace NEO

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018-2023 Intel Corporation * Copyright (C) 2018-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -8,6 +8,7 @@
#pragma once #pragma once
#include "shared/source/command_container/cmdcontainer.h" #include "shared/source/command_container/cmdcontainer.h"
#include "shared/source/helpers/debug_helpers.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/helpers/ptr_math.h"
#include <cstdint> #include <cstdint>
@@ -15,7 +16,7 @@
namespace NEO { namespace NEO {
class GraphicsAllocation; class GraphicsAllocation;
class LinearStream { class LinearStream : NEO::NonCopyableAndNonMovableClass {
public: public:
virtual ~LinearStream() = default; virtual ~LinearStream() = default;
LinearStream() = default; LinearStream() = default;
@@ -24,9 +25,6 @@ class LinearStream {
LinearStream(GraphicsAllocation *gfxAllocation, void *buffer, size_t bufferSize); LinearStream(GraphicsAllocation *gfxAllocation, void *buffer, size_t bufferSize);
LinearStream(void *buffer, size_t bufferSize, CommandContainer *cmdContainer, size_t batchBufferEndSize); LinearStream(void *buffer, size_t bufferSize, CommandContainer *cmdContainer, size_t batchBufferEndSize);
LinearStream(const LinearStream &) = delete;
LinearStream &operator=(const LinearStream &) = delete;
void *getCpuBase() const; void *getCpuBase() const;
void *getSpace(size_t size); void *getSpace(size_t size);
size_t getMaxAvailableSpace() const; size_t getMaxAvailableSpace() const;
@@ -119,4 +117,6 @@ inline uint64_t LinearStream::getCurrentGpuAddressPosition() const {
return (getGpuBase() + getUsed()); return (getGpuBase() + getUsed());
} }
static_assert(NEO::NonCopyableAndNonMovable<LinearStream>);
} // namespace NEO } // namespace NEO

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018-2023 Intel Corporation * Copyright (C) 2018-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -8,13 +8,14 @@
#pragma once #pragma once
#include "shared/source/aub_mem_dump/aub_mem_dump.h" #include "shared/source/aub_mem_dump/aub_mem_dump.h"
#include "shared/source/helpers/device_bitfield.h" #include "shared/source/helpers/device_bitfield.h"
#include "shared/source/helpers/non_copyable_or_moveable.h"
namespace NEO { namespace NEO {
class CommandStreamReceiver; class CommandStreamReceiver;
class TbxSockets; class TbxSockets;
class ExecutionEnvironment; class ExecutionEnvironment;
class TbxStream : public AubMemDump::AubStream { class TbxStream : public AubMemDump::AubStream, NEO::NonCopyableAndNonMovableClass {
protected: protected:
TbxSockets *socket = nullptr; TbxSockets *socket = nullptr;
@@ -22,9 +23,6 @@ class TbxStream : public AubMemDump::AubStream {
TbxStream(); TbxStream();
~TbxStream() override; ~TbxStream() override;
TbxStream(const TbxStream &) = delete;
TbxStream &operator=(const TbxStream &) = delete;
void open(const char *options) override; void open(const char *options) override;
void close() override; void close() override;
bool init(uint32_t stepping, uint32_t device) 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); void readMemory(uint64_t physAddress, void *memory, size_t size);
}; };
static_assert(NEO::NonCopyableAndNonMovable<TbxStream>);
struct TbxCommandStreamReceiver { struct TbxCommandStreamReceiver {
static CommandStreamReceiver *create(const std::string &baseName, static CommandStreamReceiver *create(const std::string &baseName,
bool withAubDump, bool withAubDump,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019-2024 Intel Corporation * Copyright (C) 2019-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -7,6 +7,7 @@
#pragma once #pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "shared/source/os_interface/os_handle.h" #include "shared/source/os_interface/os_handle.h"
#include "shared/source/utilities/arrayref.h" #include "shared/source/utilities/arrayref.h"
@@ -26,15 +27,11 @@ struct CompilerCacheConfig {
size_t cacheSize = 0; size_t cacheSize = 0;
}; };
class CompilerCache { class CompilerCache : NEO::NonCopyableAndNonMovableClass {
public: public:
CompilerCache(const CompilerCacheConfig &config); CompilerCache(const CompilerCacheConfig &config);
virtual ~CompilerCache() = default; virtual ~CompilerCache() = default;
CompilerCache(const CompilerCache &) = delete;
CompilerCache(CompilerCache &&) = delete;
CompilerCache &operator=(const CompilerCache &) = delete;
CompilerCache &operator=(CompilerCache &&) = delete;
const CompilerCacheConfig &getConfig() { const CompilerCacheConfig &getConfig() {
return config; return config;
} }
@@ -56,4 +53,7 @@ class CompilerCache {
static std::mutex cacheAccessMtx; static std::mutex cacheAccessMtx;
CompilerCacheConfig config; CompilerCacheConfig config;
}; };
static_assert(NEO::NonCopyableAndNonMovable<CompilerCache>);
} // namespace NEO } // namespace NEO

View File

@@ -6,6 +6,7 @@
*/ */
#pragma once #pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "shared/source/utilities/arrayref.h" #include "shared/source/utilities/arrayref.h"
#include "shared/source/utilities/spinlock.h" #include "shared/source/utilities/spinlock.h"
#include "shared/source/utilities/stackvec.h" #include "shared/source/utilities/stackvec.h"
@@ -110,13 +111,9 @@ enum class CachingMode {
preProcess preProcess
}; };
class CompilerInterface { class CompilerInterface : NEO::NonCopyableAndNonMovableClass {
public: public:
CompilerInterface(); CompilerInterface();
CompilerInterface(const CompilerInterface &) = delete;
CompilerInterface &operator=(const CompilerInterface &) = delete;
CompilerInterface(CompilerInterface &&) = delete;
CompilerInterface &operator=(CompilerInterface &&) = delete;
virtual ~CompilerInterface(); virtual ~CompilerInterface();
template <typename CompilerInterfaceT = CompilerInterface> template <typename CompilerInterfaceT = CompilerInterface>
@@ -248,6 +245,8 @@ class CompilerInterface {
} }
}; };
static_assert(NEO::NonCopyableAndNonMovable<CompilerInterface>);
class CompilerCacheHelper { class CompilerCacheHelper {
public: public:
static void packAndCacheBinary(CompilerCache &compilerCache, const std::string &kernelFileHash, const NEO::TargetDevice &targetDevice, const NEO::TranslationOutput &translationOutput); static void packAndCacheBinary(CompilerCache &compilerCache, const std::string &kernelFileHash, const NEO::TargetDevice &targetDevice, const NEO::TranslationOutput &translationOutput);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019-2024 Intel Corporation * Copyright (C) 2019-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -7,6 +7,7 @@
#pragma once #pragma once
#include "shared/source/device_binary_format/elf/elf_decoder.h" #include "shared/source/device_binary_format/elf/elf_decoder.h"
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include <cstdint> #include <cstdint>
#include <limits> #include <limits>
@@ -63,7 +64,7 @@ struct SymbolInfo {
bool global = false; // Binding bool global = false; // Binding
}; };
struct LinkerInput { struct LinkerInput : NEO::NonCopyableAndNonMovableClass {
union Traits { union Traits {
enum PointerSize : uint8_t { enum PointerSize : uint8_t {
Ptr32bit = 0, Ptr32bit = 0,
@@ -111,10 +112,6 @@ struct LinkerInput {
LinkerInput(); LinkerInput();
virtual ~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); static SegmentType getSegmentForSection(ConstStringRef name);
@@ -273,6 +270,8 @@ struct Linker {
std::unordered_map<uint32_t /*ISA segment id*/, StackVec<uint32_t *, 2> /*implicit args relocation address to patch*/> pImplicitArgsRelocationAddresses; std::unordered_map<uint32_t /*ISA segment id*/, StackVec<uint32_t *, 2> /*implicit args relocation address to patch*/> pImplicitArgsRelocationAddresses;
}; };
static_assert(NEO::NonCopyableAndNonMovable<LinkerInput>);
std::string constructLinkerErrorMessage(const Linker::UnresolvedExternals &unresolvedExternals, const std::vector<std::string> &instructionsSegmentsNames); std::string constructLinkerErrorMessage(const Linker::UnresolvedExternals &unresolvedExternals, const std::vector<std::string> &instructionsSegmentsNames);
std::string constructRelocationsDebugMessage(const Linker::RelocatedSymbolsMap &relocatedSymbols); std::string constructRelocationsDebugMessage(const Linker::RelocatedSymbolsMap &relocatedSymbols);

View File

@@ -6,6 +6,7 @@
*/ */
#pragma once #pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "shared/source/helpers/options.h" #include "shared/source/helpers/options.h"
#include "shared/source/helpers/string.h" #include "shared/source/helpers/string.h"
#include "shared/source/utilities/io_functions.h" #include "shared/source/utilities/io_functions.h"
@@ -119,14 +120,11 @@ struct DebugVariables { // NOLINT(clang-analyzer
}; };
template <DebugFunctionalityLevel debugLevel> template <DebugFunctionalityLevel debugLevel>
class DebugSettingsManager { class DebugSettingsManager : NEO::NonCopyableAndNonMovableClass {
public: public:
DebugSettingsManager(const char *registryPath); DebugSettingsManager(const char *registryPath);
~DebugSettingsManager(); ~DebugSettingsManager();
DebugSettingsManager(const DebugSettingsManager &) = delete;
DebugSettingsManager &operator=(const DebugSettingsManager &) = delete;
static constexpr bool registryReadAvailable() { static constexpr bool registryReadAvailable() {
return (debugLevel == DebugFunctionalityLevel::full) || (debugLevel == DebugFunctionalityLevel::regKeys); return (debugLevel == DebugFunctionalityLevel::full) || (debugLevel == DebugFunctionalityLevel::regKeys);
} }
@@ -182,6 +180,10 @@ class DebugSettingsManager {
static const char *settingsDumpFileName; static const char *settingsDumpFileName;
}; };
static_assert(NEO::NonCopyableAndNonMovable<DebugSettingsManager<DebugFunctionalityLevel::none>>);
static_assert(NEO::NonCopyableAndNonMovable<DebugSettingsManager<DebugFunctionalityLevel::full>>);
static_assert(NEO::NonCopyableAndNonMovable<DebugSettingsManager<DebugFunctionalityLevel::regKeys>>);
extern DebugSettingsManager<globalDebugFunctionalityLevel> debugManager; extern DebugSettingsManager<globalDebugFunctionalityLevel> debugManager;
class DurationLog { class DurationLog {

View File

@@ -55,7 +55,7 @@ struct EngineGroupT {
using EngineGroupsT = std::vector<EngineGroupT>; using EngineGroupsT = std::vector<EngineGroupT>;
using CsrContainer = std::vector<std::unique_ptr<CommandStreamReceiver>>; using CsrContainer = std::vector<std::unique_ptr<CommandStreamReceiver>>;
struct SecondaryContexts { struct SecondaryContexts : NEO::NonCopyableAndNonMovableClass {
SecondaryContexts() = default; SecondaryContexts() = default;
SecondaryContexts(SecondaryContexts &&in) { SecondaryContexts(SecondaryContexts &&in) {
this->engines = std::move(in.engines); this->engines = std::move(in.engines);
@@ -64,8 +64,7 @@ struct SecondaryContexts {
this->regularEnginesTotal = in.regularEnginesTotal; this->regularEnginesTotal = in.regularEnginesTotal;
this->highPriorityEnginesTotal = in.highPriorityEnginesTotal; this->highPriorityEnginesTotal = in.highPriorityEnginesTotal;
} }
SecondaryContexts(const SecondaryContexts &in) = delete; SecondaryContexts &operator=(SecondaryContexts &&other) noexcept = delete;
SecondaryContexts &operator=(const SecondaryContexts &) = delete;
EngineControl *getEngine(const EngineUsage usage); EngineControl *getEngine(const EngineUsage usage);
@@ -81,15 +80,15 @@ struct SecondaryContexts {
std::mutex mutex; std::mutex mutex;
}; };
static_assert(NEO::NonCopyable<SecondaryContexts>);
struct RTDispatchGlobalsInfo { struct RTDispatchGlobalsInfo {
GraphicsAllocation *rtDispatchGlobalsArray = nullptr; GraphicsAllocation *rtDispatchGlobalsArray = nullptr;
std::vector<GraphicsAllocation *> rtStacks; // per tile std::vector<GraphicsAllocation *> rtStacks; // per tile
}; };
class Device : public ReferenceTrackedObject<Device> { class Device : public ReferenceTrackedObject<Device>, NEO::NonCopyableAndNonMovableClass {
public: public:
Device &operator=(const Device &) = delete;
Device(const Device &) = delete;
~Device() override; ~Device() override;
template <typename DeviceT, typename... ArgsT> template <typename DeviceT, typename... ArgsT>
@@ -359,4 +358,6 @@ inline SelectorCopyEngine &Device::getSelectorCopyEngine() {
return selectorCopyEngine; return selectorCopyEngine;
} }
static_assert(NEO::NonCopyableAndNonMovable<Device>);
} // namespace NEO } // namespace NEO

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2020-2024 Intel Corporation * Copyright (C) 2020-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -8,6 +8,7 @@
#pragma once #pragma once
#include "shared/source/helpers/constants.h" #include "shared/source/helpers/constants.h"
#include "shared/source/helpers/heap_helper.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 "shared/source/memory_manager/graphics_allocation.h"
#include <array> #include <array>
@@ -31,7 +32,7 @@ constexpr uint32_t redescribedImage = 3;
constexpr uint32_t max = 4; constexpr uint32_t max = 4;
}; // namespace BindlessImageSlot }; // namespace BindlessImageSlot
class BindlessHeapsHelper { class BindlessHeapsHelper : NEO::NonCopyableAndNonMovableClass {
public: public:
enum BindlesHeapType { enum BindlesHeapType {
specialSsh = 0, specialSsh = 0,
@@ -43,9 +44,6 @@ class BindlessHeapsHelper {
BindlessHeapsHelper(Device *rootDevice, bool isMultiOsContextCapable); BindlessHeapsHelper(Device *rootDevice, bool isMultiOsContextCapable);
MOCKABLE_VIRTUAL ~BindlessHeapsHelper(); MOCKABLE_VIRTUAL ~BindlessHeapsHelper();
BindlessHeapsHelper(const BindlessHeapsHelper &) = delete;
BindlessHeapsHelper &operator=(const BindlessHeapsHelper &) = delete;
GraphicsAllocation *getHeapAllocation(size_t heapSize, size_t alignment, bool allocInFrontWindow); GraphicsAllocation *getHeapAllocation(size_t heapSize, size_t alignment, bool allocInFrontWindow);
MOCKABLE_VIRTUAL SurfaceStateInHeapInfo allocateSSInHeap(size_t ssSize, GraphicsAllocation *surfaceAllocation, BindlesHeapType heapType); MOCKABLE_VIRTUAL SurfaceStateInHeapInfo allocateSSInHeap(size_t ssSize, GraphicsAllocation *surfaceAllocation, BindlesHeapType heapType);
@@ -108,4 +106,7 @@ class BindlessHeapsHelper {
std::vector<AddressRange> reservedRanges; std::vector<AddressRange> reservedRanges;
}; };
static_assert(NEO::NonCopyableAndNonMovable<BindlessHeapsHelper>);
} // namespace NEO } // namespace NEO

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019-2023 Intel Corporation * Copyright (C) 2019-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -8,6 +8,7 @@
#pragma once #pragma once
#include "shared/source/command_stream/linear_stream.h" #include "shared/source/command_stream/linear_stream.h"
#include "shared/source/helpers/aligned_memory.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/helpers/ptr_math.h"
#include "shared/source/indirect_heap/heap_size.h" #include "shared/source/indirect_heap/heap_size.h"
#include "shared/source/indirect_heap/indirect_heap_type.h" #include "shared/source/indirect_heap/indirect_heap_type.h"
@@ -25,10 +26,6 @@ class IndirectHeap : public LinearStream {
IndirectHeap(GraphicsAllocation *graphicsAllocation, bool canBeUtilizedAs4GbHeap) IndirectHeap(GraphicsAllocation *graphicsAllocation, bool canBeUtilizedAs4GbHeap)
: BaseClass(graphicsAllocation), canBeUtilizedAs4GbHeap(canBeUtilizedAs4GbHeap) {} : BaseClass(graphicsAllocation), canBeUtilizedAs4GbHeap(canBeUtilizedAs4GbHeap) {}
// Disallow copy'ing
IndirectHeap(const IndirectHeap &) = delete;
IndirectHeap &operator=(const IndirectHeap &) = delete;
void align(size_t alignment); void align(size_t alignment);
uint64_t getHeapGpuStartOffset() const; uint64_t getHeapGpuStartOffset() const;
uint64_t getHeapGpuBase() const; uint64_t getHeapGpuBase() const;
@@ -38,6 +35,8 @@ class IndirectHeap : public LinearStream {
bool canBeUtilizedAs4GbHeap = false; bool canBeUtilizedAs4GbHeap = false;
}; };
static_assert(NEO::NonCopyableAndNonMovable<IndirectHeap>);
inline void IndirectHeap::align(size_t alignment) { inline void IndirectHeap::align(size_t alignment) {
auto address = alignUp(ptrOffset(buffer, sizeUsed), alignment); auto address = alignUp(ptrOffset(buffer, sizeUsed), alignment);
sizeUsed = ptrDiff(address, buffer); sizeUsed = ptrDiff(address, buffer);
@@ -74,10 +73,6 @@ class ReservedIndirectHeap : public IndirectHeap {
ReservedIndirectHeap(GraphicsAllocation *graphicsAllocation, bool canBeUtilizedAs4GbHeap) ReservedIndirectHeap(GraphicsAllocation *graphicsAllocation, bool canBeUtilizedAs4GbHeap)
: IndirectHeap(graphicsAllocation, canBeUtilizedAs4GbHeap) {} : IndirectHeap(graphicsAllocation, canBeUtilizedAs4GbHeap) {}
// Disallow copy'ing
ReservedIndirectHeap(const ReservedIndirectHeap &) = delete;
ReservedIndirectHeap &operator=(const ReservedIndirectHeap &) = delete;
uint32_t getHeapSizeInPages() const override { uint32_t getHeapSizeInPages() const override {
return parentHeapSizeInPages; return parentHeapSizeInPages;
} }
@@ -89,4 +84,6 @@ class ReservedIndirectHeap : public IndirectHeap {
uint32_t parentHeapSizeInPages = 0; uint32_t parentHeapSizeInPages = 0;
}; };
static_assert(NEO::NonCopyableAndNonMovable<ReservedIndirectHeap>);
} // namespace NEO } // namespace NEO

View File

@@ -1,10 +1,11 @@
/* /*
* Copyright (C) 2022-2024 Intel Corporation * Copyright (C) 2022-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
*/ */
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "shared/source/helpers/vec.h" #include "shared/source/helpers/vec.h"
#include "shared/source/utilities/stackvec.h" #include "shared/source/utilities/stackvec.h"
@@ -13,7 +14,7 @@
namespace NEO { namespace NEO {
struct RootDeviceEnvironment; struct RootDeviceEnvironment;
class LocalIdsCache { class LocalIdsCache : NEO::NonCopyableAndNonMovableClass {
public: public:
struct LocalIdsCacheEntry { struct LocalIdsCacheEntry {
Vec3<uint16_t> groupSize = {0, 0, 0}; Vec3<uint16_t> groupSize = {0, 0, 0};
@@ -24,8 +25,6 @@ class LocalIdsCache {
}; };
LocalIdsCache() = delete; LocalIdsCache() = delete;
LocalIdsCache(LocalIdsCache &) = delete;
LocalIdsCache &operator=(const LocalIdsCache &other) = delete;
LocalIdsCache(size_t cacheSize, std::array<uint8_t, 3> wgDimOrder, uint32_t grfCount, uint8_t simdSize, uint8_t grfSize, bool usesOnlyImages = false); LocalIdsCache(size_t cacheSize, std::array<uint8_t, 3> wgDimOrder, uint32_t grfCount, uint8_t simdSize, uint8_t grfSize, bool usesOnlyImages = false);
~LocalIdsCache(); ~LocalIdsCache();
@@ -48,4 +47,7 @@ class LocalIdsCache {
const uint8_t simdSize; const uint8_t simdSize;
const bool usesOnlyImages; const bool usesOnlyImages;
}; };
} // namespace NEO
static_assert(NEO::NonCopyableAndNonMovable<LocalIdsCache>);
} // namespace NEO

View File

@@ -6,6 +6,7 @@
*/ */
#pragma once #pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "shared/source/utilities/idlist.h" #include "shared/source/utilities/idlist.h"
#include <atomic> #include <atomic>
@@ -15,14 +16,11 @@
namespace NEO { namespace NEO {
class DeferrableDeletion; class DeferrableDeletion;
class Thread; class Thread;
class DeferredDeleter { class DeferredDeleter : NEO::NonCopyableAndNonMovableClass {
public: public:
DeferredDeleter(); DeferredDeleter();
virtual ~DeferredDeleter(); virtual ~DeferredDeleter();
DeferredDeleter(const DeferredDeleter &) = delete;
DeferredDeleter &operator=(const DeferredDeleter &) = delete;
MOCKABLE_VIRTUAL void deferDeletion(DeferrableDeletion *deletion); MOCKABLE_VIRTUAL void deferDeletion(DeferrableDeletion *deletion);
MOCKABLE_VIRTUAL void addClient(); MOCKABLE_VIRTUAL void addClient();
@@ -52,4 +50,7 @@ class DeferredDeleter {
std::mutex threadMutex; std::mutex threadMutex;
std::condition_variable condition; std::condition_variable condition;
}; };
static_assert(NEO::NonCopyableAndNonMovable<DeferredDeleter>);
} // namespace NEO } // namespace NEO

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018-2024 Intel Corporation * Copyright (C) 2018-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -9,6 +9,7 @@
#include "shared/source/command_stream/task_count_helper.h" #include "shared/source/command_stream/task_count_helper.h"
#include "shared/source/helpers/debug_helpers.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/helpers/ptr_math.h"
#include "shared/source/memory_manager/allocation_type.h" #include "shared/source/memory_manager/allocation_type.h"
#include "shared/source/memory_manager/definitions/engine_limits.h" #include "shared/source/memory_manager/definitions/engine_limits.h"
@@ -56,7 +57,7 @@ struct SurfaceStateInHeapInfo {
size_t ssSize; size_t ssSize;
}; };
class GraphicsAllocation : public IDNode<GraphicsAllocation> { class GraphicsAllocation : public IDNode<GraphicsAllocation>, NEO::NonCopyableAndNonMovableClass {
public: public:
enum UsmInitialPlacement { enum UsmInitialPlacement {
DEFAULT, DEFAULT,
@@ -65,8 +66,6 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
}; };
~GraphicsAllocation() override; ~GraphicsAllocation() override;
GraphicsAllocation &operator=(const GraphicsAllocation &) = delete;
GraphicsAllocation(const GraphicsAllocation &) = delete;
GraphicsAllocation(uint32_t rootDeviceIndex, size_t numGmms, AllocationType allocationType, void *cpuPtrIn, 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); uint64_t canonizedGpuAddress, uint64_t baseAddress, size_t sizeIn, MemoryPool pool, size_t maxOsContextCount);
@@ -413,4 +412,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
bool cantBeReadOnly = false; bool cantBeReadOnly = false;
bool explicitlyMadeResident = false; bool explicitlyMadeResident = false;
}; };
static_assert(NEO::NonCopyableAndNonMovable<GraphicsAllocation>);
} // namespace NEO } // namespace NEO

View File

@@ -9,6 +9,7 @@
#include "shared/source/command_stream/task_count_helper.h" #include "shared/source/command_stream/task_count_helper.h"
#include "shared/source/helpers/constants.h" #include "shared/source/helpers/constants.h"
#include "shared/source/helpers/device_bitfield.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/multi_graphics_allocation.h"
#include "shared/source/memory_manager/residency_container.h" #include "shared/source/memory_manager/residency_container.h"
#include "shared/source/unified_memory/unified_memory.h" #include "shared/source/unified_memory/unified_memory.h"
@@ -32,7 +33,7 @@ class MemoryManager;
class Device; class Device;
struct VirtualMemoryReservation; struct VirtualMemoryReservation;
struct SvmAllocationData { struct SvmAllocationData : NEO::NonCopyableAndNonMovableClass {
SvmAllocationData(uint32_t maxRootDeviceIndex) : gpuAllocations(maxRootDeviceIndex), maxRootDeviceIndex(maxRootDeviceIndex){}; SvmAllocationData(uint32_t maxRootDeviceIndex) : gpuAllocations(maxRootDeviceIndex), maxRootDeviceIndex(maxRootDeviceIndex){};
SvmAllocationData(const SvmAllocationData &svmAllocData) : SvmAllocationData(svmAllocData.maxRootDeviceIndex) { SvmAllocationData(const SvmAllocationData &svmAllocData) : SvmAllocationData(svmAllocData.maxRootDeviceIndex) {
this->allocationFlagsProperty = svmAllocData.allocationFlagsProperty; this->allocationFlagsProperty = svmAllocData.allocationFlagsProperty;
@@ -52,7 +53,7 @@ struct SvmAllocationData {
this->mappedAllocData = svmAllocData.mappedAllocData; this->mappedAllocData = svmAllocData.mappedAllocData;
this->virtualReservationData = svmAllocData.virtualReservationData; this->virtualReservationData = svmAllocData.virtualReservationData;
} }
SvmAllocationData &operator=(const SvmAllocationData &) = delete; SvmAllocationData(SvmAllocationData &&other) noexcept = delete;
GraphicsAllocation *cpuAllocation = nullptr; GraphicsAllocation *cpuAllocation = nullptr;
MultiGraphicsAllocation gpuAllocations; MultiGraphicsAllocation gpuAllocations;
VirtualMemoryReservation *virtualReservationData = nullptr; VirtualMemoryReservation *virtualReservationData = nullptr;
@@ -79,6 +80,8 @@ struct SvmAllocationData {
uint32_t allocId = uninitializedAllocId; uint32_t allocId = uninitializedAllocId;
}; };
static_assert(NEO::NonMovable<SvmAllocationData>);
struct SvmMapOperation { struct SvmMapOperation {
void *regionSvmPtr = nullptr; void *regionSvmPtr = nullptr;
size_t regionSize = 0; size_t regionSize = 0;

View File

@@ -8,6 +8,7 @@
#pragma once #pragma once
#include "shared/source/helpers/common_types.h" #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/os_interface/linux/clos_cache.h"
#include "shared/source/utilities/spinlock.h" #include "shared/source/utilities/spinlock.h"
@@ -25,7 +26,7 @@ struct CacheReservationParameters {
uint16_t maxNumWays{0U}; uint16_t maxNumWays{0U};
}; };
struct CacheInfo { struct CacheInfo : NEO::NonCopyableAndNonMovableClass {
CacheInfo(IoctlHelper &ioctlHelper, const CacheReservationParameters l3Limits) CacheInfo(IoctlHelper &ioctlHelper, const CacheReservationParameters l3Limits)
: l3ReservationLimits{l3Limits}, : l3ReservationLimits{l3Limits},
cacheReserve{ioctlHelper} { cacheReserve{ioctlHelper} {
@@ -35,9 +36,6 @@ struct CacheInfo {
MOCKABLE_VIRTUAL ~CacheInfo(); MOCKABLE_VIRTUAL ~CacheInfo();
CacheInfo(const CacheInfo &) = delete;
CacheInfo &operator=(const CacheInfo &) = delete;
size_t getMaxReservationCacheSize() const { size_t getMaxReservationCacheSize() const {
const auto &limits{l3ReservationLimits}; const auto &limits{l3ReservationLimits};
return limits.maxSize; return limits.maxSize;
@@ -81,4 +79,6 @@ struct CacheInfo {
SpinLock mtx; SpinLock mtx;
}; };
static_assert(NEO::NonCopyableAndNonMovable<CacheInfo>);
} // namespace NEO } // namespace NEO

View File

@@ -10,6 +10,7 @@
#include "shared/source/command_stream/task_count_helper.h" #include "shared/source/command_stream/task_count_helper.h"
#include "shared/source/helpers/common_types.h" #include "shared/source/helpers/common_types.h"
#include "shared/source/helpers/constants.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/definitions/engine_limits.h"
#include "shared/source/memory_manager/memory_operations_status.h" #include "shared/source/memory_manager/memory_operations_status.h"
#include "shared/source/os_interface/linux/cache_info.h" #include "shared/source/os_interface/linux/cache_info.h"
@@ -31,7 +32,7 @@ class DrmMemoryManager;
class Drm; class Drm;
class OsContext; class OsContext;
class BufferObjectHandleWrapper { class BufferObjectHandleWrapper : NEO::NonCopyableClass {
private: private:
struct ControlBlock { struct ControlBlock {
int refCount{0}; int refCount{0};
@@ -53,8 +54,6 @@ class BufferObjectHandleWrapper {
~BufferObjectHandleWrapper(); ~BufferObjectHandleWrapper();
BufferObjectHandleWrapper(const BufferObjectHandleWrapper &) = delete;
BufferObjectHandleWrapper &operator=(const BufferObjectHandleWrapper &) = delete;
BufferObjectHandleWrapper &operator=(BufferObjectHandleWrapper &&) = delete; BufferObjectHandleWrapper &operator=(BufferObjectHandleWrapper &&) = delete;
BufferObjectHandleWrapper acquireSharedOwnership(); BufferObjectHandleWrapper acquireSharedOwnership();
@@ -86,6 +85,8 @@ class BufferObjectHandleWrapper {
ControlBlock *controlBlock{nullptr}; ControlBlock *controlBlock{nullptr};
}; };
static_assert(NEO::NonCopyable<BufferObjectHandleWrapper>);
class BufferObject { class BufferObject {
public: public:
BufferObject(uint32_t rootDeviceIndex, Drm *drm, uint64_t patIndex, int handle, size_t size, size_t maxOsContextCount); BufferObject(uint32_t rootDeviceIndex, Drm *drm, uint64_t patIndex, int handle, size_t size, size_t maxOsContextCount);

View File

@@ -1,11 +1,13 @@
/* /*
* Copyright (C) 2018-2023 Intel Corporation * Copyright (C) 2018-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
*/ */
#pragma once #pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include <atomic> #include <atomic>
#include <condition_variable> #include <condition_variable>
#include <cstdint> #include <cstdint>
@@ -24,14 +26,11 @@ enum class GemCloseWorkerMode {
gemCloseWorkerActive gemCloseWorkerActive
}; };
class DrmGemCloseWorker { class DrmGemCloseWorker : NEO::NonCopyableAndNonMovableClass {
public: public:
DrmGemCloseWorker(DrmMemoryManager &memoryManager); DrmGemCloseWorker(DrmMemoryManager &memoryManager);
MOCKABLE_VIRTUAL ~DrmGemCloseWorker(); MOCKABLE_VIRTUAL ~DrmGemCloseWorker();
DrmGemCloseWorker(const DrmGemCloseWorker &) = delete;
DrmGemCloseWorker &operator=(const DrmGemCloseWorker &) = delete;
void push(BufferObject *allocation); void push(BufferObject *allocation);
MOCKABLE_VIRTUAL void close(bool blocking); MOCKABLE_VIRTUAL void close(bool blocking);
@@ -55,4 +54,7 @@ class DrmGemCloseWorker {
std::condition_variable condition; std::condition_variable condition;
std::atomic<bool> workerDone{false}; std::atomic<bool> workerDone{false};
}; };
static_assert(NEO::NonCopyableAndNonMovable<DrmGemCloseWorker>);
} // namespace NEO } // namespace NEO

View File

@@ -1,11 +1,12 @@
/* /*
* Copyright (C) 2018-2024 Intel Corporation * Copyright (C) 2018-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
*/ */
#pragma once #pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "shared/source/memory_manager/deferrable_deletion.h" #include "shared/source/memory_manager/deferrable_deletion.h"
#include "shared/source/os_interface/os_context.h" #include "shared/source/os_interface/os_context.h"
#include "shared/source/os_interface/windows/d3dkmthk_wrapper.h" #include "shared/source/os_interface/windows/d3dkmthk_wrapper.h"
@@ -17,19 +18,19 @@ class OsContextWin;
class Wddm; class Wddm;
enum class AllocationType; enum class AllocationType;
class DeferrableDeletionImpl : public DeferrableDeletion { class DeferrableDeletionImpl : public DeferrableDeletion, NEO::NonCopyableAndNonMovableClass {
public: public:
DeferrableDeletionImpl(Wddm *wddm, const D3DKMT_HANDLE *handles, uint32_t allocationCount, D3DKMT_HANDLE resourceHandle, AllocationType type); DeferrableDeletionImpl(Wddm *wddm, const D3DKMT_HANDLE *handles, uint32_t allocationCount, D3DKMT_HANDLE resourceHandle, AllocationType type);
bool apply() override; bool apply() override;
~DeferrableDeletionImpl() override; ~DeferrableDeletionImpl() override;
DeferrableDeletionImpl(const DeferrableDeletionImpl &) = delete;
DeferrableDeletionImpl &operator=(const DeferrableDeletionImpl &) = delete;
protected: protected:
Wddm *wddm; Wddm *wddm;
D3DKMT_HANDLE *handles = nullptr; D3DKMT_HANDLE *handles = nullptr;
uint32_t allocationCount; uint32_t allocationCount;
D3DKMT_HANDLE resourceHandle; D3DKMT_HANDLE resourceHandle;
}; };
static_assert(NEO::NonCopyableAndNonMovable<DeferrableDeletionImpl>);
} // namespace NEO } // namespace NEO

View File

@@ -1,11 +1,12 @@
/* /*
* Copyright (C) 2018-2024 Intel Corporation * Copyright (C) 2018-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
*/ */
#pragma once #pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "shared/source/memory_manager/memory_manager.h" #include "shared/source/memory_manager/memory_manager.h"
#include "shared/source/os_interface/os_context.h" #include "shared/source/os_interface/os_context.h"
#include "shared/source/os_interface/os_memory.h" #include "shared/source/os_interface/os_memory.h"
@@ -22,16 +23,13 @@ class Wddm;
extern const GfxMemoryAllocationMethod preferredAllocationMethod; extern const GfxMemoryAllocationMethod preferredAllocationMethod;
class WddmMemoryManager : public MemoryManager { class WddmMemoryManager : public MemoryManager, NEO::NonCopyableAndNonMovableClass {
public: public:
using MemoryManager::allocateGraphicsMemoryWithProperties; using MemoryManager::allocateGraphicsMemoryWithProperties;
~WddmMemoryManager() override; ~WddmMemoryManager() override;
WddmMemoryManager(ExecutionEnvironment &executionEnvironment); WddmMemoryManager(ExecutionEnvironment &executionEnvironment);
WddmMemoryManager(const WddmMemoryManager &) = delete;
WddmMemoryManager &operator=(const WddmMemoryManager &) = delete;
void freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation) override; void freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation) override;
void freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation, bool isImportedAllocation) override; void freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation, bool isImportedAllocation) override;
void handleFenceCompletion(GraphicsAllocation *allocation) override; void handleFenceCompletion(GraphicsAllocation *allocation) override;
@@ -125,4 +123,7 @@ class WddmMemoryManager : public MemoryManager {
Wddm &getWddm(uint32_t rootDeviceIndex) const; Wddm &getWddm(uint32_t rootDeviceIndex) const;
}; };
static_assert(NEO::NonCopyableAndNonMovable<WddmMemoryManager>);
} // namespace NEO } // namespace NEO

View File

@@ -1,11 +1,12 @@
/* /*
* Copyright (C) 2018-2023 Intel Corporation * Copyright (C) 2018-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
*/ */
#pragma once #pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "shared/source/kernel/kernel_descriptor.h" #include "shared/source/kernel/kernel_descriptor.h"
#include "shared/source/program/heap_info.h" #include "shared/source/program/heap_info.h"
#include "shared/source/utilities/arrayref.h" #include "shared/source/utilities/arrayref.h"
@@ -39,11 +40,9 @@ struct DeviceInfoKernelPayloadConstants {
uint32_t maxWorkGroupSize = 0U; uint32_t maxWorkGroupSize = 0U;
}; };
struct KernelInfo { struct KernelInfo : NEO::NonCopyableAndNonMovableClass {
public: public:
KernelInfo() = default; KernelInfo() = default;
KernelInfo(const KernelInfo &) = delete;
KernelInfo &operator=(const KernelInfo &) = delete;
~KernelInfo(); ~KernelInfo();
GraphicsAllocation *getGraphicsAllocation() const { return this->kernelAllocation; } GraphicsAllocation *getGraphicsAllocation() const { return this->kernelAllocation; }
@@ -104,6 +103,8 @@ struct KernelInfo {
KernelDescriptor kernelDescriptor; KernelDescriptor kernelDescriptor;
}; };
static_assert(NEO::NonCopyableAndNonMovable<KernelInfo>);
std::string concatenateKernelNames(ArrayRef<KernelInfo *> kernelInfos); std::string concatenateKernelNames(ArrayRef<KernelInfo *> kernelInfos);
} // namespace NEO } // namespace NEO

View File

@@ -1,11 +1,12 @@
/* /*
* Copyright (C) 2020-2024 Intel Corporation * Copyright (C) 2020-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
*/ */
#pragma once #pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "shared/source/utilities/arrayref.h" #include "shared/source/utilities/arrayref.h"
#include <cstddef> #include <cstddef>
@@ -20,12 +21,10 @@ struct ExternalFunctionInfo;
struct LinkerInput; struct LinkerInput;
struct KernelInfo; struct KernelInfo;
struct ProgramInfo { struct ProgramInfo : NEO::NonCopyableClass {
ProgramInfo() = default; ProgramInfo() = default;
ProgramInfo(ProgramInfo &&) = default; ProgramInfo(ProgramInfo &&) = default;
ProgramInfo &operator=(ProgramInfo &&) = default; ProgramInfo &operator=(ProgramInfo &&) = default;
ProgramInfo(const ProgramInfo &) = delete;
ProgramInfo &operator=(const ProgramInfo &) = delete;
~ProgramInfo(); ~ProgramInfo();
struct GlobalSurfaceInfo { struct GlobalSurfaceInfo {
@@ -50,6 +49,8 @@ struct ProgramInfo {
size_t kernelMiscInfoPos = std::string::npos; size_t kernelMiscInfoPos = std::string::npos;
}; };
static_assert(NEO::NonCopyable<ProgramInfo>);
size_t getMaxInlineSlmNeeded(const ProgramInfo &programInfo); size_t getMaxInlineSlmNeeded(const ProgramInfo &programInfo);
bool requiresLocalMemoryWindowVA(const ProgramInfo &programInfo); bool requiresLocalMemoryWindowVA(const ProgramInfo &programInfo);
bool isRebuiltToPatchtokensRequired(Device *neoDevice, ArrayRef<const uint8_t> archive, std::string &optionsString, bool isBuiltin, bool isVmeUsed); bool isRebuiltToPatchtokensRequired(Device *neoDevice, ArrayRef<const uint8_t> archive, std::string &optionsString, bool isBuiltin, bool isVmeUsed);

View File

@@ -1,11 +1,13 @@
/* /*
* Copyright (C) 2018-2024 Intel Corporation * Copyright (C) 2018-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
*/ */
#pragma once #pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include <cinttypes> #include <cinttypes>
#include <optional> #include <optional>
#include <string.h> #include <string.h>
@@ -14,7 +16,7 @@
namespace NEO { namespace NEO {
class Directory { class Directory : NEO::NonCopyableAndNonMovableClass {
public: public:
static inline constexpr char returnDirs{1 << 0}; static inline constexpr char returnDirs{1 << 0};
static inline constexpr char createDirs{1 << 1}; static inline constexpr char createDirs{1 << 1};
@@ -24,10 +26,6 @@ class Directory {
Directory() = default; Directory() = default;
Directory(const std::string &path) : path(path) {} 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<std::vector<std::string>> parseDirectories(char flags) { inline std::optional<std::vector<std::string>> parseDirectories(char flags) {
std::optional<std::vector<std::string>> directories; std::optional<std::vector<std::string>> directories;
@@ -62,6 +60,8 @@ class Directory {
std::string path; std::string path;
}; };
static_assert(NEO::NonCopyableAndNonMovable<Directory>);
inline int parseBdfString(const std::string &pciBDF, uint16_t &domain, uint8_t &bus, uint8_t &device, uint8_t &function) { 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) { if (strlen(pciBDF.c_str()) == 12) {
domain = static_cast<uint16_t>(strtol((pciBDF.substr(0, 4)).c_str(), NULL, 16)); domain = static_cast<uint16_t>(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 } // namespace NEO

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2024 Intel Corporation * Copyright (C) 2024-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -8,6 +8,7 @@
#pragma once #pragma once
#include "shared/source/helpers/constants.h" #include "shared/source/helpers/constants.h"
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "shared/source/utilities/buffer_pool_allocator.h" #include "shared/source/utilities/buffer_pool_allocator.h"
#include <mutex> #include <mutex>
@@ -84,4 +85,6 @@ class ISAPoolAllocator : public AbstractBuffersAllocator<ISAPool, GraphicsAlloca
std::mutex allocatorMtx; std::mutex allocatorMtx;
}; };
static_assert(NEO::NonCopyable<ISAPool>);
} // namespace NEO } // namespace NEO

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019-2024 Intel Corporation * Copyright (C) 2019-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -7,6 +7,7 @@
#pragma once #pragma once
#include "shared/source/debug_settings/debug_settings_manager.h" #include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include <mutex> #include <mutex>
#include <sstream> #include <sstream>
@@ -27,14 +28,11 @@ const char *getAllocationTypeString(GraphicsAllocation const *graphicsAllocation
const char *getMemoryPoolString(GraphicsAllocation const *graphicsAllocation); const char *getMemoryPoolString(GraphicsAllocation const *graphicsAllocation);
template <DebugFunctionalityLevel debugLevel> template <DebugFunctionalityLevel debugLevel>
class FileLogger { class FileLogger : NEO::NonCopyableAndNonMovableClass {
public: public:
FileLogger(std::string filename, const DebugVariables &flags); FileLogger(std::string filename, const DebugVariables &flags);
MOCKABLE_VIRTUAL ~FileLogger(); MOCKABLE_VIRTUAL ~FileLogger();
FileLogger(const FileLogger &) = delete;
FileLogger &operator=(const FileLogger &) = delete;
static constexpr bool enabled() { static constexpr bool enabled() {
return debugLevel != DebugFunctionalityLevel::none; return debugLevel != DebugFunctionalityLevel::none;
} }
@@ -189,6 +187,10 @@ class FileLogger {
} }
}; };
static_assert(NEO::NonCopyableAndNonMovable<FileLogger<DebugFunctionalityLevel::none>>);
static_assert(NEO::NonCopyableAndNonMovable<FileLogger<DebugFunctionalityLevel::full>>);
static_assert(NEO::NonCopyableAndNonMovable<FileLogger<DebugFunctionalityLevel::regKeys>>);
extern FileLogger<globalDebugFunctionalityLevel> &fileLoggerInstance(); extern FileLogger<globalDebugFunctionalityLevel> &fileLoggerInstance();
template <bool enabled> template <bool enabled>

View File

@@ -1,17 +1,19 @@
/* /*
* Copyright (C) 2018-2023 Intel Corporation * Copyright (C) 2018-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
*/ */
#pragma once #pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include <iterator> #include <iterator>
namespace NEO { namespace NEO {
template <typename DataType> template <typename DataType>
struct Range { struct Range : NEO::NonCopyableAndNonMovableClass {
using iterator = DataType *; using iterator = DataType *;
using const_iterator = const DataType *; using const_iterator = const DataType *;
using reverse_iterator = std::reverse_iterator<iterator>; using reverse_iterator = std::reverse_iterator<iterator>;
@@ -34,7 +36,6 @@ struct Range {
Range(T (&base)[size]) Range(T (&base)[size])
: Range(&base[0], size) { : Range(&base[0], size) {
} }
Range &operator=(const Range &) = delete;
iterator begin() { iterator begin() {
return begIt; return begIt;
@@ -80,6 +81,8 @@ struct Range {
iterator endIt; iterator endIt;
}; };
static_assert(NEO::NonCopyableAndNonMovable<Range<int>>);
template <typename T> template <typename T>
inline Range<T> createRange(T *base, size_t count) { inline Range<T> createRange(T *base, size_t count) {
return Range<T>(base, count); return Range<T>(base, count);

View File

@@ -9,6 +9,7 @@
#include "shared/source/command_stream/wait_status.h" #include "shared/source/command_stream/wait_status.h"
#include "shared/source/helpers/constants.h" #include "shared/source/helpers/constants.h"
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "shared/source/utilities/stackvec.h" #include "shared/source/utilities/stackvec.h"
#include <functional> #include <functional>
@@ -27,13 +28,11 @@ class HeapAllocator;
using ChunkCopyFunction = std::function<int32_t(void *, void *, size_t)>; using ChunkCopyFunction = std::function<int32_t(void *, void *, size_t)>;
using ChunkTransferImageFunc = std::function<int32_t(void *, const size_t *, const size_t *)>; using ChunkTransferImageFunc = std::function<int32_t(void *, const size_t *, const size_t *)>;
using ChunkTransferBufferFunc = std::function<int32_t(void *, size_t, size_t)>; using ChunkTransferBufferFunc = std::function<int32_t(void *, size_t, size_t)>;
class StagingBuffer { class StagingBuffer : NEO::NonCopyableClass {
public: public:
StagingBuffer(void *baseAddress, size_t size); StagingBuffer(void *baseAddress, size_t size);
StagingBuffer(StagingBuffer &&other); StagingBuffer(StagingBuffer &&other);
StagingBuffer(const StagingBuffer &other) = delete;
StagingBuffer &operator=(StagingBuffer &&other) noexcept = delete; StagingBuffer &operator=(StagingBuffer &&other) noexcept = delete;
StagingBuffer &operator=(const StagingBuffer &other) = delete;
void *getBaseAddress() const { void *getBaseAddress() const {
return baseAddress; return baseAddress;
@@ -47,6 +46,8 @@ class StagingBuffer {
std::unique_ptr<HeapAllocator> allocator; std::unique_ptr<HeapAllocator> allocator;
}; };
static_assert(NEO::NonCopyable<StagingBuffer>);
struct StagingBufferTracker { struct StagingBufferTracker {
HeapAllocator *allocator = nullptr; HeapAllocator *allocator = nullptr;
uint64_t chunkAddress = 0; uint64_t chunkAddress = 0;
@@ -78,14 +79,10 @@ struct StagingTransferStatus {
constexpr size_t maxInFlightReads = 2u; constexpr size_t maxInFlightReads = 2u;
using StagingQueue = StackVec<std::pair<UserData, StagingBufferTracker>, maxInFlightReads>; using StagingQueue = StackVec<std::pair<UserData, StagingBufferTracker>, maxInFlightReads>;
class StagingBufferManager { class StagingBufferManager : NEO::NonCopyableAndNonMovableClass {
public: public:
StagingBufferManager(SVMAllocsManager *svmAllocsManager, const RootDeviceIndicesContainer &rootDeviceIndices, const std::map<uint32_t, DeviceBitfield> &deviceBitfields, bool requiresWritable); StagingBufferManager(SVMAllocsManager *svmAllocsManager, const RootDeviceIndicesContainer &rootDeviceIndices, const std::map<uint32_t, DeviceBitfield> &deviceBitfields, bool requiresWritable);
~StagingBufferManager(); ~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 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); bool isValidForStagingTransfer(const Device &device, const void *ptr, size_t size, bool hasDependencies);
@@ -126,4 +123,6 @@ class StagingBufferManager {
std::set<const void *> detectedHostPtrs; std::set<const void *> detectedHostPtrs;
}; };
static_assert(NEO::NonCopyableAndNonMovable<StagingBufferManager>);
} // namespace NEO } // namespace NEO

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018-2022 Intel Corporation * Copyright (C) 2018-2025 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -7,12 +7,14 @@
#pragma once #pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
namespace NEO { namespace NEO {
class Timer { class Timer : NEO::NonCopyableAndNonMovableClass {
public: public:
Timer(); Timer();
Timer(const Timer &) = delete; Timer &operator=(Timer &&) noexcept = delete;
~Timer(); ~Timer();
@@ -33,4 +35,7 @@ class Timer {
class TimerImpl; class TimerImpl;
TimerImpl *timerImpl; TimerImpl *timerImpl;
}; };
static_assert(NEO::NonMovable<Timer>);
}; // namespace NEO }; // namespace NEO