2018-06-22 18:54:33 +08:00
|
|
|
/*
|
2022-05-05 06:10:46 +08:00
|
|
|
* Copyright (C) 2018-2022 Intel Corporation
|
2018-09-18 15:11:08 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-06-27 17:35:37 +08:00
|
|
|
#pragma once
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/utilities/reference_tracked_object.h"
|
2018-06-22 18:54:33 +08:00
|
|
|
|
2022-09-22 16:48:55 +08:00
|
|
|
#include <unordered_map>
|
2019-11-05 20:38:20 +08:00
|
|
|
#include <vector>
|
2018-08-01 15:06:46 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2021-07-30 17:56:58 +08:00
|
|
|
class DirectSubmissionController;
|
2018-07-11 22:47:49 +08:00
|
|
|
class MemoryManager;
|
2020-03-17 14:26:46 +08:00
|
|
|
struct OsEnvironment;
|
2019-11-15 16:59:48 +08:00
|
|
|
struct RootDeviceEnvironment;
|
2018-08-21 21:47:21 +08:00
|
|
|
|
2018-06-22 18:54:33 +08:00
|
|
|
class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment> {
|
2018-07-12 17:45:02 +08:00
|
|
|
|
2018-06-27 17:35:37 +08:00
|
|
|
public:
|
2018-07-03 16:00:12 +08:00
|
|
|
ExecutionEnvironment();
|
2018-06-27 17:35:37 +08:00
|
|
|
~ExecutionEnvironment() override;
|
2018-07-23 18:23:48 +08:00
|
|
|
|
2020-09-18 22:19:41 +08:00
|
|
|
MOCKABLE_VIRTUAL bool initializeMemoryManager();
|
2019-12-17 15:11:16 +08:00
|
|
|
void calculateMaxOsContextCount();
|
2021-10-15 20:02:31 +08:00
|
|
|
virtual void prepareRootDeviceEnvironments(uint32_t numRootDevices);
|
2021-10-11 23:34:03 +08:00
|
|
|
void prepareRootDeviceEnvironment(const uint32_t rootDeviceIndexForReInit);
|
2021-01-25 17:24:00 +08:00
|
|
|
void parseAffinityMask();
|
2022-09-22 16:48:55 +08:00
|
|
|
void adjustCcsCount();
|
|
|
|
void adjustCcsCount(const uint32_t rootDeviceIndex) const;
|
2021-07-11 08:12:15 +08:00
|
|
|
void sortNeoDevices();
|
2022-05-05 06:10:46 +08:00
|
|
|
void sortNeoDevicesDRM();
|
|
|
|
void sortNeoDevicesWDDM();
|
2022-05-17 23:23:15 +08:00
|
|
|
void prepareForCleanup() const;
|
2020-11-23 22:31:20 +08:00
|
|
|
void setDebuggingEnabled() {
|
|
|
|
debuggingEnabled = true;
|
2020-07-13 21:14:16 +08:00
|
|
|
}
|
2020-11-23 22:31:20 +08:00
|
|
|
bool isDebuggingEnabled() { return debuggingEnabled; }
|
2021-10-25 23:33:38 +08:00
|
|
|
DirectSubmissionController *initializeDirectSubmissionController();
|
2018-07-23 18:23:48 +08:00
|
|
|
|
2018-07-11 22:47:49 +08:00
|
|
|
std::unique_ptr<MemoryManager> memoryManager;
|
2021-10-25 23:33:38 +08:00
|
|
|
std::unique_ptr<DirectSubmissionController> directSubmissionController;
|
2020-03-17 14:26:46 +08:00
|
|
|
std::unique_ptr<OsEnvironment> osEnvironment;
|
2019-11-15 16:59:48 +08:00
|
|
|
std::vector<std::unique_ptr<RootDeviceEnvironment>> rootDeviceEnvironments;
|
2021-10-11 23:34:03 +08:00
|
|
|
void releaseRootDeviceEnvironmentResources(RootDeviceEnvironment *rootDeviceEnvironment);
|
2020-07-13 21:14:16 +08:00
|
|
|
|
|
|
|
protected:
|
2022-09-22 16:48:55 +08:00
|
|
|
void parseCcsCountLimitations();
|
|
|
|
void adjustCcsCountImpl(RootDeviceEnvironment *rootDeviceEnvironment) const;
|
2020-11-23 22:31:20 +08:00
|
|
|
bool debuggingEnabled = false;
|
2022-09-22 16:48:55 +08:00
|
|
|
std::unordered_map<uint32_t, uint32_t> rootDeviceNumCcsMap;
|
2018-06-22 18:54:33 +08:00
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|