2019-10-22 11:44:06 +02:00
|
|
|
/*
|
2025-01-17 15:14:17 +00:00
|
|
|
* Copyright (C) 2019-2025 Intel Corporation
|
2019-10-22 11:44:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
2021-04-16 12:52:30 +00:00
|
|
|
#include "shared/source/built_ins/sip_kernel_type.h"
|
2021-05-05 08:07:53 +00:00
|
|
|
#include "shared/source/helpers/affinity_mask.h"
|
2023-10-05 12:10:01 +00:00
|
|
|
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/helpers/options.h"
|
2019-11-15 09:59:48 +01:00
|
|
|
|
2023-02-28 21:08:09 +00:00
|
|
|
#include <functional>
|
2019-11-05 13:38:20 +01:00
|
|
|
#include <memory>
|
2020-02-27 15:32:57 +01:00
|
|
|
#include <mutex>
|
2019-10-22 11:44:06 +02:00
|
|
|
|
|
|
|
|
namespace NEO {
|
2023-03-07 16:39:25 +00:00
|
|
|
class AssertHandler;
|
2020-03-11 08:56:55 +01:00
|
|
|
class AubCenter;
|
2021-01-27 14:31:29 +01:00
|
|
|
class BindlessHeapsHelper;
|
2020-02-27 15:32:57 +01:00
|
|
|
class BuiltIns;
|
|
|
|
|
class CompilerInterface;
|
2020-03-11 08:56:55 +01:00
|
|
|
class Debugger;
|
2022-07-07 12:01:53 +00:00
|
|
|
class Device;
|
2020-03-11 08:56:55 +01:00
|
|
|
class ExecutionEnvironment;
|
2020-02-24 18:04:30 +01:00
|
|
|
class GmmClientContext;
|
|
|
|
|
class GmmHelper;
|
2019-11-06 18:14:30 +01:00
|
|
|
class GmmPageTableMngr;
|
2020-03-11 08:56:55 +01:00
|
|
|
class HwDeviceId;
|
2021-01-27 14:31:29 +01:00
|
|
|
class MemoryManager;
|
2019-11-28 13:02:11 +01:00
|
|
|
class MemoryOperationsHandler;
|
2020-01-07 07:42:40 +01:00
|
|
|
class OSInterface;
|
2021-09-24 10:51:57 +00:00
|
|
|
class OSTime;
|
2021-04-16 12:52:30 +00:00
|
|
|
class SipKernel;
|
2021-01-26 11:22:10 +00:00
|
|
|
class SWTagsManager;
|
2022-12-12 16:43:41 +00:00
|
|
|
class ProductHelper;
|
2022-12-08 12:22:35 +00:00
|
|
|
class GfxCoreHelper;
|
2023-01-03 10:27:35 +00:00
|
|
|
class ApiGfxCoreHelper;
|
2023-01-31 12:34:59 +00:00
|
|
|
class CompilerProductHelper;
|
2023-02-28 21:08:09 +00:00
|
|
|
class GraphicsAllocation;
|
2023-04-13 14:16:49 +00:00
|
|
|
class ReleaseHelper;
|
2023-10-31 02:33:24 +00:00
|
|
|
class AILConfiguration;
|
2023-01-03 10:27:35 +00:00
|
|
|
|
2023-02-28 21:08:09 +00:00
|
|
|
struct AllocationProperties;
|
2020-01-30 15:04:19 +01:00
|
|
|
struct HardwareInfo;
|
2019-10-24 13:34:25 +02:00
|
|
|
|
2023-10-05 12:10:01 +00:00
|
|
|
struct RootDeviceEnvironment : NonCopyableClass {
|
2023-10-26 15:04:39 +02:00
|
|
|
protected:
|
|
|
|
|
std::unique_ptr<HardwareInfo> hwInfo;
|
|
|
|
|
|
2020-03-04 08:51:02 +01:00
|
|
|
public:
|
2019-11-15 09:59:48 +01:00
|
|
|
RootDeviceEnvironment(ExecutionEnvironment &executionEnvironment);
|
|
|
|
|
MOCKABLE_VIRTUAL ~RootDeviceEnvironment();
|
2020-03-04 08:51:02 +01:00
|
|
|
|
2020-02-18 16:02:26 +01:00
|
|
|
MOCKABLE_VIRTUAL const HardwareInfo *getHardwareInfo() const;
|
2020-03-04 08:51:02 +01:00
|
|
|
HardwareInfo *getMutableHardwareInfo() const;
|
2023-01-03 10:27:35 +00:00
|
|
|
void setHwInfoAndInitHelpers(const HardwareInfo *hwInfo);
|
2023-06-06 11:41:57 +00:00
|
|
|
void setHwInfo(const HardwareInfo *hwInfo);
|
2020-03-04 08:51:02 +01:00
|
|
|
bool isFullRangeSvm() const;
|
2023-05-29 11:11:44 +00:00
|
|
|
bool isWddmOnLinux() const;
|
2019-11-15 09:59:48 +01:00
|
|
|
|
|
|
|
|
MOCKABLE_VIRTUAL void initAubCenter(bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType);
|
2023-11-20 17:47:53 +00:00
|
|
|
MOCKABLE_VIRTUAL bool initOsInterface(std::unique_ptr<HwDeviceId> &&hwDeviceId, uint32_t rootDeviceIndex);
|
2021-09-24 10:51:57 +00:00
|
|
|
void initOsTime();
|
2020-02-25 16:38:47 +01:00
|
|
|
void initGmm();
|
2022-07-07 12:01:53 +00:00
|
|
|
void initDebuggerL0(Device *neoDevice);
|
2023-02-28 21:08:09 +00:00
|
|
|
MOCKABLE_VIRTUAL void initDummyAllocation();
|
|
|
|
|
void setDummyBlitProperties(uint32_t rootDeviceIndex);
|
2023-01-03 10:27:35 +00:00
|
|
|
|
2022-05-17 15:23:15 +00:00
|
|
|
MOCKABLE_VIRTUAL void prepareForCleanup() const;
|
2021-07-21 08:47:43 +00:00
|
|
|
MOCKABLE_VIRTUAL bool initAilConfiguration();
|
2020-02-24 18:04:30 +01:00
|
|
|
GmmHelper *getGmmHelper() const;
|
|
|
|
|
GmmClientContext *getGmmClientContext() const;
|
2020-02-27 15:32:57 +01:00
|
|
|
MOCKABLE_VIRTUAL CompilerInterface *getCompilerInterface();
|
|
|
|
|
BuiltIns *getBuiltIns();
|
2021-01-27 14:31:29 +01:00
|
|
|
BindlessHeapsHelper *getBindlessHeapsHelper() const;
|
2023-03-07 16:39:25 +00:00
|
|
|
AssertHandler *getAssertHandler(Device *neoDevice);
|
2024-03-20 11:45:31 +00:00
|
|
|
void createBindlessHeapsHelper(Device *rootDevice, bool availableDevices);
|
2022-07-25 12:13:27 +00:00
|
|
|
void limitNumberOfCcs(uint32_t numberOfCcs);
|
|
|
|
|
bool isNumberOfCcsLimited() const;
|
2023-09-15 10:28:08 +00:00
|
|
|
void setRcsExposure();
|
2023-02-01 03:12:09 +00:00
|
|
|
void initProductHelper();
|
2023-01-03 10:27:35 +00:00
|
|
|
void initHelpers();
|
2023-01-09 14:59:10 +00:00
|
|
|
void initGfxCoreHelper();
|
2024-09-12 13:00:25 +00:00
|
|
|
void initializeGfxCoreHelperFromHwInfo();
|
2025-01-24 10:50:51 +00:00
|
|
|
void initializeGfxCoreHelperFromProductHelper();
|
2023-01-03 10:27:35 +00:00
|
|
|
void initApiGfxCoreHelper();
|
2023-01-31 12:34:59 +00:00
|
|
|
void initCompilerProductHelper();
|
2023-04-13 14:16:49 +00:00
|
|
|
void initReleaseHelper();
|
2023-10-31 02:33:24 +00:00
|
|
|
void initAilConfigurationHelper();
|
2023-04-13 14:16:49 +00:00
|
|
|
ReleaseHelper *getReleaseHelper() const;
|
2023-10-31 02:33:24 +00:00
|
|
|
AILConfiguration *getAILConfigurationHelper() const;
|
2022-11-08 16:16:37 +00:00
|
|
|
template <typename HelperType>
|
|
|
|
|
HelperType &getHelper() const;
|
2023-01-03 10:27:35 +00:00
|
|
|
const ProductHelper &getProductHelper() const;
|
2023-02-28 21:08:09 +00:00
|
|
|
GraphicsAllocation *getDummyAllocation() const;
|
2024-05-15 17:26:24 +00:00
|
|
|
void releaseDummyAllocation();
|
2022-11-08 16:16:37 +00:00
|
|
|
|
2023-12-11 11:02:15 +00:00
|
|
|
std::unique_ptr<SipKernel> sipKernels[static_cast<uint32_t>(SipKernelType::count)];
|
2020-02-25 16:38:47 +01:00
|
|
|
std::unique_ptr<GmmHelper> gmmHelper;
|
2020-01-07 07:42:40 +01:00
|
|
|
std::unique_ptr<OSInterface> osInterface;
|
2019-11-28 13:02:11 +01:00
|
|
|
std::unique_ptr<MemoryOperationsHandler> memoryOperationsInterface;
|
2019-10-24 13:34:25 +02:00
|
|
|
std::unique_ptr<AubCenter> aubCenter;
|
2021-09-24 10:51:57 +00:00
|
|
|
std::unique_ptr<OSTime> osTime;
|
2020-02-27 15:32:57 +01:00
|
|
|
|
|
|
|
|
std::unique_ptr<CompilerInterface> compilerInterface;
|
2020-03-11 08:56:55 +01:00
|
|
|
std::unique_ptr<BuiltIns> builtins;
|
|
|
|
|
std::unique_ptr<Debugger> debugger;
|
2021-01-26 11:22:10 +00:00
|
|
|
std::unique_ptr<SWTagsManager> tagsManager;
|
2023-01-03 10:27:35 +00:00
|
|
|
std::unique_ptr<ApiGfxCoreHelper> apiGfxCoreHelper;
|
2023-01-09 14:59:10 +00:00
|
|
|
std::unique_ptr<GfxCoreHelper> gfxCoreHelper;
|
2023-02-01 03:12:09 +00:00
|
|
|
std::unique_ptr<ProductHelper> productHelper;
|
2023-01-31 12:34:59 +00:00
|
|
|
std::unique_ptr<CompilerProductHelper> compilerProductHelper;
|
2023-04-13 14:16:49 +00:00
|
|
|
std::unique_ptr<ReleaseHelper> releaseHelper;
|
2023-10-31 02:33:24 +00:00
|
|
|
std::unique_ptr<AILConfiguration> ailConfiguration;
|
2024-08-08 12:55:44 +00:00
|
|
|
std::unique_ptr<BindlessHeapsHelper> bindlessHeapsHelper;
|
2023-04-13 14:16:49 +00:00
|
|
|
|
2023-03-07 16:39:25 +00:00
|
|
|
std::unique_ptr<AssertHandler> assertHandler;
|
2023-01-09 14:59:10 +00:00
|
|
|
|
2019-11-15 09:59:48 +01:00
|
|
|
ExecutionEnvironment &executionEnvironment;
|
2020-02-27 15:32:57 +01:00
|
|
|
|
2021-05-05 08:07:53 +00:00
|
|
|
AffinityMaskHelper deviceAffinityMask{true};
|
2021-01-25 09:24:00 +00:00
|
|
|
|
2022-07-25 12:13:27 +00:00
|
|
|
protected:
|
2023-02-28 21:08:09 +00:00
|
|
|
using GraphicsAllocationUniquePtrType = std::unique_ptr<GraphicsAllocation, std::function<void(GraphicsAllocation *)>>;
|
|
|
|
|
GraphicsAllocationUniquePtrType dummyAllocation = nullptr;
|
|
|
|
|
|
2022-07-25 12:13:27 +00:00
|
|
|
bool limitedNumberOfCcs = false;
|
2023-05-29 11:11:44 +00:00
|
|
|
bool isWddmOnLinuxEnable = false;
|
2023-02-28 21:08:09 +00:00
|
|
|
std::once_flag isDummyAllocationInitialized;
|
|
|
|
|
std::unique_ptr<AllocationProperties> dummyBlitProperties;
|
2022-07-25 12:13:27 +00:00
|
|
|
|
2020-02-27 15:32:57 +01:00
|
|
|
private:
|
|
|
|
|
std::mutex mtx;
|
2019-10-22 11:44:06 +02:00
|
|
|
};
|
2022-11-08 16:16:37 +00:00
|
|
|
|
2019-10-22 11:44:06 +02:00
|
|
|
} // namespace NEO
|