mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +08:00
fix: disallow copy and move
Related-To: NEO-15630 Signed-off-by: Jakub Nowacki <jakub.nowacki@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
3ab74c7fba
commit
259271f59d
@@ -1,11 +1,13 @@
|
||||
/*
|
||||
* 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 "level_zero/core/source/builtin/builtin_functions_lib.h"
|
||||
#include "level_zero/core/source/module/module.h"
|
||||
|
||||
@@ -23,7 +25,7 @@ namespace L0 {
|
||||
struct Kernel;
|
||||
struct Device;
|
||||
|
||||
struct BuiltinFunctionsLibImpl : BuiltinFunctionsLib {
|
||||
struct BuiltinFunctionsLibImpl : BuiltinFunctionsLib, NEO::NonCopyableClass {
|
||||
struct BuiltinData;
|
||||
BuiltinFunctionsLibImpl(Device *device, NEO::BuiltIns *builtInsLib);
|
||||
~BuiltinFunctionsLibImpl() override {
|
||||
@@ -50,7 +52,7 @@ struct BuiltinFunctionsLibImpl : BuiltinFunctionsLib {
|
||||
bool initAsyncComplete = true;
|
||||
std::atomic_bool initAsync = false;
|
||||
};
|
||||
struct BuiltinFunctionsLibImpl::BuiltinData {
|
||||
struct BuiltinFunctionsLibImpl::BuiltinData : NEO::NonCopyableClass {
|
||||
MOCKABLE_VIRTUAL ~BuiltinData();
|
||||
BuiltinData();
|
||||
BuiltinData(Module *module, std::unique_ptr<L0::Kernel> &&ker);
|
||||
@@ -58,4 +60,7 @@ struct BuiltinFunctionsLibImpl::BuiltinData {
|
||||
Module *module = nullptr;
|
||||
std::unique_ptr<Kernel> func;
|
||||
};
|
||||
|
||||
static_assert(NEO::NonCopyable<BuiltinFunctionsLibImpl>);
|
||||
static_assert(NEO::NonCopyable<BuiltinFunctionsLibImpl::BuiltinData>);
|
||||
} // namespace L0
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2023-2024 Intel Corporation
|
||||
* Copyright (C) 2023-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
||||
#include "shared/source/os_interface/linux/hw_device_id.h"
|
||||
|
||||
#include <mutex>
|
||||
|
||||
namespace L0 {
|
||||
namespace Sysman {
|
||||
class SysmanHwDeviceIdDrm : public NEO::HwDeviceIdDrm {
|
||||
class SysmanHwDeviceIdDrm : public NEO::HwDeviceIdDrm, NEO::NonCopyableAndNonMovableClass {
|
||||
public:
|
||||
using NEO::HwDeviceIdDrm::HwDeviceIdDrm;
|
||||
class SingleInstance {
|
||||
@@ -39,5 +40,7 @@ class SysmanHwDeviceIdDrm : public NEO::HwDeviceIdDrm {
|
||||
uint32_t fdRefCounter = 0;
|
||||
};
|
||||
|
||||
static_assert(NEO::NonCopyableAndNonMovable<SysmanHwDeviceIdDrm>);
|
||||
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/helpers/abort.h"
|
||||
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
@@ -16,7 +17,7 @@
|
||||
|
||||
static jmp_buf jmpbuf;
|
||||
|
||||
class SafetyGuardLinux {
|
||||
class SafetyGuardLinux : NEO::NonCopyableAndNonMovableClass {
|
||||
public:
|
||||
SafetyGuardLinux() {
|
||||
struct sigaction sigact {};
|
||||
@@ -75,3 +76,5 @@ class SafetyGuardLinux {
|
||||
struct sigaction previousSigSegvAction {};
|
||||
struct sigaction previousSigIllvAction {};
|
||||
};
|
||||
|
||||
static_assert(NEO::NonCopyableAndNonMovable<SafetyGuardLinux>);
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "shared/source/compiler_interface/os_compiler_cache_helper.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/helpers/file_io.h"
|
||||
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
||||
#include "shared/source/helpers/path.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
#include "shared/source/os_interface/linux/sys_calls.h"
|
||||
@@ -202,7 +203,7 @@ void CompilerCache::lockConfigFileAndReadSize(const std::string &configFilePath,
|
||||
}
|
||||
}
|
||||
|
||||
class HandleGuard {
|
||||
class HandleGuard : NonCopyableAndNonMovableClass {
|
||||
public:
|
||||
HandleGuard() = delete;
|
||||
explicit HandleGuard(int &fileDescriptor) : fd(fileDescriptor) {}
|
||||
@@ -216,6 +217,8 @@ class HandleGuard {
|
||||
int fd = -1;
|
||||
};
|
||||
|
||||
static_assert(NonCopyableAndNonMovable<HandleGuard>);
|
||||
|
||||
bool CompilerCache::cacheBinary(const std::string &kernelFileHash, const char *pBinary, size_t binarySize) {
|
||||
if (pBinary == nullptr || binarySize == 0 || binarySize > config.cacheSize) {
|
||||
return false;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2023-2024 Intel Corporation
|
||||
* Copyright (C) 2023-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "shared/source/compiler_interface/compiler_cache.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/helpers/file_io.h"
|
||||
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
||||
#include "shared/source/helpers/path.h"
|
||||
#include "shared/source/os_interface/windows/sys_calls.h"
|
||||
#include "shared/source/utilities/directory.h"
|
||||
@@ -220,7 +221,7 @@ bool CompilerCache::renameTempFileBinaryToProperName(const std::string &oldName,
|
||||
return NEO::SysCalls::moveFileExA(oldName.c_str(), kernelFileHash.c_str(), MOVEFILE_REPLACE_EXISTING);
|
||||
}
|
||||
|
||||
class HandleGuard {
|
||||
class HandleGuard : NonCopyableAndNonMovableClass {
|
||||
public:
|
||||
HandleGuard() = delete;
|
||||
explicit HandleGuard(void *&h) : handle(h) {}
|
||||
@@ -234,6 +235,8 @@ class HandleGuard {
|
||||
void *handle = nullptr;
|
||||
};
|
||||
|
||||
static_assert(NonCopyableAndNonMovable<HandleGuard>);
|
||||
|
||||
void writeDirSizeToConfigFile(void *hConfigFile, size_t directorySize) {
|
||||
DWORD sizeWritten = 0;
|
||||
OVERLAPPED overlapped = {0};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/gmm_helper/gmm_lib.h"
|
||||
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
||||
|
||||
#include "External/Common/GmmPageTableMgr.h"
|
||||
|
||||
@@ -14,7 +15,7 @@ namespace NEO {
|
||||
class Gmm;
|
||||
class GmmClientContext;
|
||||
class LinearStream;
|
||||
class GmmPageTableMngr {
|
||||
class GmmPageTableMngr : NonCopyableAndNonMovableClass {
|
||||
public:
|
||||
MOCKABLE_VIRTUAL ~GmmPageTableMngr();
|
||||
|
||||
@@ -40,4 +41,7 @@ class GmmPageTableMngr {
|
||||
GMM_CLIENT_CONTEXT *clientContext = nullptr;
|
||||
GMM_PAGETABLE_MGR *pageTableManager = nullptr;
|
||||
};
|
||||
|
||||
static_assert(NonCopyableAndNonMovable<GmmPageTableMngr>);
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -17,7 +17,7 @@ struct FlushStampTrackingObj : public ReferenceTrackedObject<FlushStampTrackingO
|
||||
std::atomic<bool> initialized{false};
|
||||
};
|
||||
|
||||
class FlushStampTracker {
|
||||
class FlushStampTracker : NonCopyableClass {
|
||||
public:
|
||||
FlushStampTracker() = delete;
|
||||
FlushStampTracker(bool allocateStamp);
|
||||
@@ -36,6 +36,8 @@ class FlushStampTracker {
|
||||
FlushStampTrackingObj *flushStampSharedHandle = nullptr;
|
||||
};
|
||||
|
||||
static_assert(NonCopyable<FlushStampTracker>);
|
||||
|
||||
class FlushStampUpdateHelper {
|
||||
public:
|
||||
void insert(FlushStampTrackingObj *stampObj);
|
||||
|
||||
@@ -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/utilities/timer_util.h"
|
||||
|
||||
#include <atomic>
|
||||
@@ -14,7 +15,7 @@
|
||||
#include <vector>
|
||||
|
||||
namespace NEO {
|
||||
class PerfProfiler {
|
||||
class PerfProfiler : NonCopyableAndNonMovableClass {
|
||||
|
||||
struct SystemLog {
|
||||
unsigned int id;
|
||||
@@ -95,4 +96,7 @@ class PerfProfiler {
|
||||
std::unique_ptr<std::ostream> sysLogFile;
|
||||
std::vector<SystemLog> systemLogs;
|
||||
};
|
||||
|
||||
static_assert(NonCopyableAndNonMovable<PerfProfiler>);
|
||||
|
||||
}; // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user