2021-07-21 16:47:43 +08:00
|
|
|
/*
|
2023-01-12 00:46:43 +08:00
|
|
|
* Copyright (C) 2021-2023 Intel Corporation
|
2021-07-21 16:47:43 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2022-06-07 17:30:54 +08:00
|
|
|
#pragma once
|
|
|
|
|
2022-11-07 21:04:52 +08:00
|
|
|
#include "igfxfmid.h"
|
2021-07-21 16:47:43 +08:00
|
|
|
|
2023-02-18 00:53:57 +08:00
|
|
|
#include <cstdint>
|
2023-10-14 19:32:40 +08:00
|
|
|
#include <set>
|
2021-07-21 16:47:43 +08:00
|
|
|
#include <string>
|
|
|
|
|
2021-11-10 19:09:53 +08:00
|
|
|
/*
|
|
|
|
* AIL (Application Intelligence Layer) is a set of per-application controls that influence driver behavior.
|
|
|
|
* The primary goal is to improve user experience and/or performance.
|
|
|
|
*
|
|
|
|
* AIL provides application detection mechanism based on running processes in the system.
|
|
|
|
* Mechanism works on Windows and Linux, is flexible and easily extendable to new applications.
|
2022-06-07 17:30:54 +08:00
|
|
|
*
|
|
|
|
* E.g. AIL can detect running Blender application and enable fp64 emulation on hardware
|
2021-11-10 19:09:53 +08:00
|
|
|
* that does not support native fp64.
|
2022-06-07 17:30:54 +08:00
|
|
|
*
|
2021-11-10 19:09:53 +08:00
|
|
|
* Disclaimer: we should never use this for benchmarking or conformance purposes - this would be cheating.
|
2022-06-07 17:30:54 +08:00
|
|
|
*
|
2021-11-10 19:09:53 +08:00
|
|
|
*/
|
|
|
|
|
2021-07-21 16:47:43 +08:00
|
|
|
namespace NEO {
|
2021-08-09 16:38:18 +08:00
|
|
|
|
2023-09-12 05:29:01 +08:00
|
|
|
extern const char legacyPlatformName[];
|
|
|
|
|
2022-11-07 21:04:52 +08:00
|
|
|
struct RuntimeCapabilityTable;
|
|
|
|
|
2021-07-21 16:47:43 +08:00
|
|
|
enum class AILEnumeration : uint32_t {
|
2022-06-10 23:11:17 +08:00
|
|
|
DISABLE_BLITTER,
|
2021-08-09 16:38:18 +08:00
|
|
|
DISABLE_COMPRESSION,
|
2021-10-13 18:35:00 +08:00
|
|
|
ENABLE_FP64,
|
2022-11-23 19:29:58 +08:00
|
|
|
DISABLE_HOST_PTR_TRACKING,
|
2023-09-12 17:23:51 +08:00
|
|
|
ENABLE_LEGACY_PLATFORM_NAME,
|
2023-09-15 19:20:56 +08:00
|
|
|
DISABLE_DIRECT_SUBMISSION,
|
2021-07-21 16:47:43 +08:00
|
|
|
AIL_MAX_OPTIONS_COUNT
|
|
|
|
};
|
|
|
|
|
|
|
|
class AILConfiguration {
|
|
|
|
public:
|
|
|
|
AILConfiguration() = default;
|
|
|
|
|
|
|
|
MOCKABLE_VIRTUAL bool initProcessExecutableName();
|
|
|
|
|
2023-11-17 02:04:39 +08:00
|
|
|
static AILConfiguration *get(PRODUCT_FAMILY productFamily);
|
|
|
|
|
2021-07-21 16:47:43 +08:00
|
|
|
virtual void apply(RuntimeCapabilityTable &runtimeCapabilityTable);
|
|
|
|
|
2022-06-15 19:49:38 +08:00
|
|
|
virtual void modifyKernelIfRequired(std::string &kernel) = 0;
|
|
|
|
|
2023-03-03 21:23:24 +08:00
|
|
|
virtual bool isFallbackToPatchtokensRequired(const std::string &kernelSources) = 0;
|
2023-01-12 00:46:43 +08:00
|
|
|
|
2023-10-14 19:32:40 +08:00
|
|
|
virtual bool isContextSyncFlagRequired() = 0;
|
|
|
|
|
2021-07-21 16:47:43 +08:00
|
|
|
protected:
|
|
|
|
virtual void applyExt(RuntimeCapabilityTable &runtimeCapabilityTable) = 0;
|
|
|
|
std::string processName;
|
2022-06-15 19:49:38 +08:00
|
|
|
|
2023-01-12 00:46:43 +08:00
|
|
|
bool sourcesContain(const std::string &sources, std::string_view contentToFind) const;
|
2022-06-15 19:49:38 +08:00
|
|
|
MOCKABLE_VIRTUAL bool isKernelHashCorrect(const std::string &kernelSources, uint64_t expectedHash) const;
|
2021-07-21 16:47:43 +08:00
|
|
|
};
|
|
|
|
|
2023-11-17 02:04:39 +08:00
|
|
|
extern AILConfiguration *ailConfigurationTable[IGFX_MAX_PRODUCT];
|
|
|
|
|
2023-10-14 19:32:40 +08:00
|
|
|
extern const std::set<std::string_view> applicationsContextSyncFlag;
|
|
|
|
|
2021-07-21 16:47:43 +08:00
|
|
|
template <PRODUCT_FAMILY Product>
|
|
|
|
class AILConfigurationHw : public AILConfiguration {
|
|
|
|
public:
|
2023-11-17 02:04:39 +08:00
|
|
|
static AILConfigurationHw<Product> &get() {
|
|
|
|
static AILConfigurationHw<Product> ailConfiguration;
|
2021-07-21 16:47:43 +08:00
|
|
|
return ailConfiguration;
|
|
|
|
}
|
|
|
|
|
|
|
|
void applyExt(RuntimeCapabilityTable &runtimeCapabilityTable) override;
|
2022-06-15 19:49:38 +08:00
|
|
|
|
|
|
|
void modifyKernelIfRequired(std::string &kernel) override;
|
2023-03-03 21:23:24 +08:00
|
|
|
bool isFallbackToPatchtokensRequired(const std::string &kernelSources) override;
|
2023-10-14 19:32:40 +08:00
|
|
|
bool isContextSyncFlagRequired() override;
|
2021-07-21 16:47:43 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
template <PRODUCT_FAMILY product>
|
|
|
|
struct EnableAIL {
|
|
|
|
EnableAIL() {
|
2023-11-17 02:04:39 +08:00
|
|
|
ailConfigurationTable[product] = &AILConfigurationHw<product>::get();
|
2021-07-21 16:47:43 +08:00
|
|
|
}
|
|
|
|
};
|
2022-06-15 19:49:38 +08:00
|
|
|
|
2021-07-21 16:47:43 +08:00
|
|
|
} // namespace NEO
|