feature: Add logic to disable bindless addressing via AIL

Add mockable Device functions to get ReleaseHelper and AILConfiguration.

Resolves: NEO-12699

Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2024-09-18 12:38:06 +00:00
committed by Compute-Runtime-Automation
parent 9a44ac6779
commit ebc19b4a70
21 changed files with 103 additions and 28 deletions

View File

@@ -41,6 +41,7 @@ enum class AILEnumeration : uint32_t {
enableLegacyPlatformName,
disableDirectSubmission,
handleDivergentBarriers,
disableBindlessAddressing,
};
class AILConfiguration;
@@ -77,6 +78,8 @@ class AILConfiguration {
virtual bool handleDivergentBarriers() = 0;
virtual bool disableBindlessAddressing() = 0;
protected:
virtual void applyExt(RuntimeCapabilityTable &runtimeCapabilityTable) = 0;
std::string processName;
@@ -84,6 +87,7 @@ class AILConfiguration {
bool sourcesContain(const std::string &sources, std::string_view contentToFind) const;
MOCKABLE_VIRTUAL bool isKernelHashCorrect(const std::string &kernelSources, uint64_t expectedHash) const;
virtual void setHandleDivergentBarriers(bool val) = 0;
virtual void setDisableBindlessAddressing(bool val) = 0;
};
extern const std::set<std::string_view> applicationsContextSyncFlag;
@@ -106,12 +110,15 @@ class AILConfigurationHw : public AILConfiguration {
bool useLegacyValidationLogic() override;
bool forceRcs() override;
bool handleDivergentBarriers() override;
bool disableBindlessAddressing() override;
bool shouldForceRcs = false;
bool shouldHandleDivergentBarriers = false;
bool shouldDisableBindlessAddressing = false;
protected:
void setHandleDivergentBarriers(bool val) override;
void setDisableBindlessAddressing(bool val) override;
};
template <PRODUCT_FAMILY product>

View File

@@ -44,8 +44,16 @@ inline bool AILConfigurationHw<product>::handleDivergentBarriers() {
return shouldHandleDivergentBarriers;
}
template <PRODUCT_FAMILY product>
inline bool AILConfigurationHw<product>::disableBindlessAddressing() {
return shouldDisableBindlessAddressing;
}
template <PRODUCT_FAMILY product>
inline void AILConfigurationHw<product>::setHandleDivergentBarriers(bool val) {
shouldHandleDivergentBarriers = val;
}
template <PRODUCT_FAMILY product>
inline void AILConfigurationHw<product>::setDisableBindlessAddressing(bool val) {
shouldDisableBindlessAddressing = val;
}
} // namespace NEO

View File

@@ -83,7 +83,6 @@ std::string createBuiltinResourceName(EBuiltInOps::Type builtin, const std::stri
StackVec<std::string, 3> getBuiltinResourceNames(EBuiltInOps::Type builtin, BuiltinCode::ECodeType type, const Device &device) {
auto &hwInfo = device.getHardwareInfo();
auto &productHelper = device.getRootDeviceEnvironment().getHelper<ProductHelper>();
auto releaseHelper = device.getReleaseHelper();
auto createDeviceIdFilenameComponent = [](const NEO::HardwareIpVersion &hwIpVersion) {
std::ostringstream deviceId;
@@ -93,14 +92,14 @@ StackVec<std::string, 3> getBuiltinResourceNames(EBuiltInOps::Type builtin, Buil
const auto deviceIp = createDeviceIdFilenameComponent(hwInfo.ipVersion);
const auto builtinFilename = getBuiltinAsString(builtin);
const auto extension = BuiltinCode::getExtension(type);
auto getAddressingModePrefix = [type, &productHelper, releaseHelper, builtin]() {
auto getAddressingModePrefix = [type, &productHelper, &device, builtin]() {
if (type == BuiltinCode::ECodeType::binary) {
const bool requiresStatelessAddressing = (false == productHelper.isStatefulAddressingModeSupported());
const bool builtInUsesStatelessAddressing = EBuiltInOps::isStateless(builtin);
const bool heaplessEnabled = EBuiltInOps::isHeapless(builtin);
if (builtInUsesStatelessAddressing || requiresStatelessAddressing) {
return heaplessEnabled ? "stateless_heapless_" : "stateless_";
} else if (ApiSpecificConfig::getBindlessMode(releaseHelper)) {
} else if (ApiSpecificConfig::getBindlessMode(device)) {
return "bindless_";
} else {
return "bindful_";

View File

@@ -1139,6 +1139,10 @@ ReleaseHelper *Device::getReleaseHelper() const {
return getRootDeviceEnvironment().getReleaseHelper();
}
AILConfiguration *Device::getAilConfigurationHelper() const {
return getRootDeviceEnvironment().getAILConfigurationHelper();
}
void Device::stopDirectSubmissionAndWaitForCompletion() {
for (auto &engine : allEngines) {
auto csr = engine.commandStreamReceiver;

View File

@@ -21,24 +21,25 @@
#include <mutex>
namespace NEO {
class AILConfiguration;
class BindlessHeapsHelper;
class BuiltIns;
class CompilerInterface;
class ExecutionEnvironment;
class CompilerProductHelper;
class Debugger;
class DebuggerL0;
class ExecutionEnvironment;
class GfxCoreHelper;
class GmmClientContext;
class GmmHelper;
class SyncBufferHandler;
enum class EngineGroupType : uint32_t;
class DebuggerL0;
class OSTime;
class SubDevice;
struct PhysicalDevicePciBusInfo;
class GfxCoreHelper;
class ProductHelper;
class CompilerProductHelper;
class ReleaseHelper;
class SubDevice;
class SyncBufferHandler;
class UsmMemAllocPoolsManager;
enum class EngineGroupType : uint32_t;
struct PhysicalDevicePciBusInfo;
struct SelectorCopyEngine : NonCopyableOrMovableClass {
std::atomic<bool> isMainUsed = false;
@@ -191,7 +192,8 @@ class Device : public ReferenceTrackedObject<Device> {
const GfxCoreHelper &getGfxCoreHelper() const;
const ProductHelper &getProductHelper() const;
const CompilerProductHelper &getCompilerProductHelper() const;
ReleaseHelper *getReleaseHelper() const;
MOCKABLE_VIRTUAL ReleaseHelper *getReleaseHelper() const;
MOCKABLE_VIRTUAL AILConfiguration *getAilConfigurationHelper() const;
ISAPoolAllocator &getIsaPoolAllocator() {
return isaPoolAllocator;
}

View File

@@ -50,7 +50,7 @@ Device *RootDevice::getRootDevice() const {
void RootDevice::createBindlessHeapsHelper() {
if (ApiSpecificConfig::getGlobalBindlessHeapConfiguration(this->getReleaseHelper()) && ApiSpecificConfig::getBindlessMode(this->getReleaseHelper())) {
if (ApiSpecificConfig::getGlobalBindlessHeapConfiguration(this->getReleaseHelper()) && ApiSpecificConfig::getBindlessMode(*this)) {
this->executionEnvironment->rootDeviceEnvironments[getRootDeviceIndex()]->createBindlessHeapsHelper(this, getNumGenericSubDevices() > 1);
}
}

View File

@@ -14,6 +14,7 @@
#include <vector>
namespace NEO {
class Device;
class ReleaseHelper;
struct RootDeviceEnvironment;
@@ -22,7 +23,7 @@ struct ApiSpecificConfig {
L0 };
static bool isStatelessCompressionSupported();
static bool getGlobalBindlessHeapConfiguration(const ReleaseHelper *releaseHelper);
static bool getBindlessMode(const ReleaseHelper *);
static bool getBindlessMode(const Device &device);
static bool isDeviceAllocationCacheEnabled();
static bool isHostAllocationCacheEnabled();
static bool isDeviceUsmPoolingEnabled();