feature: add debug flag to ignore product specific ioctl helper creation

Related-To: NEO-13527
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2024-12-18 11:37:17 +00:00
committed by Compute-Runtime-Automation
parent ae9a4ba031
commit 593a6c54ea
4 changed files with 53 additions and 1 deletions

View File

@@ -89,6 +89,7 @@ DECLARE_DEBUG_VARIABLE(bool, DisableGemCreateExtSetPat, false, "Do not use I915_
DECLARE_DEBUG_VARIABLE(bool, SkipInOrderNonWalkerSignalingAllowed, false, "Allows for skipping non walker signalling in InOrder command lists, default: false") DECLARE_DEBUG_VARIABLE(bool, SkipInOrderNonWalkerSignalingAllowed, false, "Allows for skipping non walker signalling in InOrder command lists, default: false")
DECLARE_DEBUG_VARIABLE(bool, PipelinedPipelineSelect, false, "Restore usage of default pipeline select command") DECLARE_DEBUG_VARIABLE(bool, PipelinedPipelineSelect, false, "Restore usage of default pipeline select command")
DECLARE_DEBUG_VARIABLE(bool, AbortHostSyncOnNonHostVisibleEvent, false, "Aborts execution when user calls zeEventHostSynchronize on event without host signal scope") DECLARE_DEBUG_VARIABLE(bool, AbortHostSyncOnNonHostVisibleEvent, false, "Aborts execution when user calls zeEventHostSynchronize on event without host signal scope")
DECLARE_DEBUG_VARIABLE(bool, IgnoreProductSpecificIoctlHelper, false, "When set then product specific ioctl helper is not created even if available, generic one is used")
DECLARE_DEBUG_VARIABLE(std::string, ForceDeviceId, std::string("unk"), "Override device id in AUB/TBX mode") DECLARE_DEBUG_VARIABLE(std::string, ForceDeviceId, std::string("unk"), "Override device id in AUB/TBX mode")
DECLARE_DEBUG_VARIABLE(std::string, FilterDeviceId, std::string("unk"), "Device id filter, adapter matching device id will be opened; ignored when unk") DECLARE_DEBUG_VARIABLE(std::string, FilterDeviceId, std::string("unk"), "Device id filter, adapter matching device id will be opened; ignored when unk")
DECLARE_DEBUG_VARIABLE(std::string, FilterBdfPath, std::string("unk"), "Linux-only, BDF path filter, only matching paths will be opened; ignored when unk") DECLARE_DEBUG_VARIABLE(std::string, FilterBdfPath, std::string("unk"), "Linux-only, BDF path filter, only matching paths will be opened; ignored when unk")

View File

@@ -1092,7 +1092,7 @@ bool Drm::completionFenceSupport() {
void Drm::setupIoctlHelper(const PRODUCT_FAMILY productFamily) { void Drm::setupIoctlHelper(const PRODUCT_FAMILY productFamily) {
if (!this->ioctlHelper) { if (!this->ioctlHelper) {
auto productSpecificIoctlHelperCreator = ioctlHelperFactory[productFamily]; auto productSpecificIoctlHelperCreator = ioctlHelperFactory[productFamily];
if (productSpecificIoctlHelperCreator) { if (productSpecificIoctlHelperCreator && !debugManager.flags.IgnoreProductSpecificIoctlHelper.get()) {
this->ioctlHelper = productSpecificIoctlHelperCreator.value()(*this); this->ioctlHelper = productSpecificIoctlHelperCreator.value()(*this);
} else { } else {
std::string prelimVersion = ""; std::string prelimVersion = "";

View File

@@ -46,6 +46,7 @@ InjectInternalBuildOptions = unk
InjectApiBuildOptions = unk InjectApiBuildOptions = unk
OverrideCsrAllocationSize = -1 OverrideCsrAllocationSize = -1
AbortHostSyncOnNonHostVisibleEvent = 0 AbortHostSyncOnNonHostVisibleEvent = 0
IgnoreProductSpecificIoctlHelper = 0
ForceL1Caching = -1 ForceL1Caching = -1
UseKmdMigration = -1 UseKmdMigration = -1
CreateKmdMigratedSharedAllocationWithMultipleBOs = -1 CreateKmdMigratedSharedAllocationWithMultipleBOs = -1

View File

@@ -2230,3 +2230,53 @@ TEST(DistanceInfoTest, givenDistanceInfosWhenAssignRegionsFromDistancesThenCorre
EXPECT_EQ(1024u, memoryInfo->getMemoryRegionSize(2)); EXPECT_EQ(1024u, memoryInfo->getMemoryRegionSize(2));
EXPECT_ANY_THROW(memoryInfo->getMemoryRegionSize(4)); EXPECT_ANY_THROW(memoryInfo->getMemoryRegionSize(4));
} }
TEST(DrmTest, GivenProductSpecificIoctlHelperAvailableWhenSetupIoctlHelperThenCreateProductSpecificOne) {
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
drm.ioctlHelper.reset();
auto productFamily = defaultHwInfo->platform.eProductFamily;
VariableBackup<std::optional<std::function<std::unique_ptr<IoctlHelper>(Drm & drm)>>> createFuncBackup{&ioctlHelperFactory[productFamily]};
static uint32_t customFuncCalled = 0;
ioctlHelperFactory[productFamily] = [](Drm &drm) -> std::unique_ptr<IoctlHelper> {
EXPECT_EQ(0u, customFuncCalled);
customFuncCalled++;
return std::make_unique<MockIoctlHelper>(drm);
};
customFuncCalled = 0;
drm.setupIoctlHelper(productFamily);
EXPECT_EQ(1u, customFuncCalled);
}
TEST(DrmTest, GivenProductSpecificIoctlHelperAvailableAndDebugFlagToIgnoreIsSetWhenSetupIoctlHelperThenDontCreateProductSpecificOne) {
DebugManagerStateRestore restore;
debugManager.flags.IgnoreProductSpecificIoctlHelper.set(true);
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
drm.ioctlHelper.reset();
auto productFamily = defaultHwInfo->platform.eProductFamily;
VariableBackup<std::optional<std::function<std::unique_ptr<IoctlHelper>(Drm & drm)>>> createFuncBackup{&ioctlHelperFactory[productFamily]};
static uint32_t customFuncCalled = 0;
ioctlHelperFactory[productFamily] = [](Drm &drm) -> std::unique_ptr<IoctlHelper> {
EXPECT_EQ(0u, customFuncCalled);
customFuncCalled++;
return std::make_unique<MockIoctlHelper>(drm);
};
customFuncCalled = 0;
drm.setupIoctlHelper(productFamily);
EXPECT_EQ(0u, customFuncCalled);
}