Disable SET_PAIR by default.

To use, applications need to set EnableSetPair=1 explicitly.

When disabled, implicit scaling allocations require two IPC handles
to be exchanged with other processes using the zexMemGetIpcHandles
APIs.

When enabled, implicit scaling allocations only require one IPC
handle to be exchanged with other process using the zeMemGetIpcHandle
APIs. This is only available when allocation is imported in a different
device than the one in the exporter.

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
Jaime Arteaga
2022-12-07 20:54:48 +00:00
committed by Compute-Runtime-Automation
parent e1900c240e
commit 3bf416212b
2 changed files with 48 additions and 8 deletions

View File

@@ -1194,7 +1194,24 @@ TEST(DrmResidencyHandlerTests, givenDebugFlagUseVmBindSetDefaultWhenQueryingIsVm
EXPECT_EQ(1u, drm.context.vmBindQueryCalled);
}
TEST(DrmSetPairTests, whenQueryingForSetPairAvailableAndNoSupportAvailableThenExpectedValueIsReturned) {
TEST(DrmSetPairTests, whenQueryingForSetPairAvailableAndNoDebugKeyThenFalseIsReturned) {
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
drm.context.setPairQueryValue = 0;
drm.context.setPairQueryReturn = 0;
EXPECT_FALSE(drm.setPairAvailable);
EXPECT_EQ(0u, drm.context.setPairQueryCalled);
drm.callBaseIsSetPairAvailable = true;
EXPECT_FALSE(drm.isSetPairAvailable());
EXPECT_FALSE(drm.setPairAvailable);
EXPECT_EQ(0u, drm.context.setPairQueryCalled);
}
TEST(DrmSetPairTests, whenQueryingForSetPairAvailableAndDebugKeySetAndNoSupportAvailableThenFalseIsReturned) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableSetPair.set(1);
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
drm.context.setPairQueryValue = 0;
@@ -1227,6 +1244,7 @@ TEST(DrmSetPairTests, whenQueryingForSetPairAvailableAndDebugKeyNotSetThenNoSupp
TEST(DrmResidencyHandlerTests, whenQueryingForSetPairAvailableAndVmBindAvailableThenBothExpectedValueIsReturned) {
DebugManagerStateRestore restorer;
DebugManager.flags.UseVmBind.set(-1);
DebugManager.flags.EnableSetPair.set(1);
VariableBackup<bool> disableBindBackup(&disableBindDefaultInTests, false);
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
@@ -1256,6 +1274,9 @@ TEST(DrmResidencyHandlerTests, whenQueryingForSetPairAvailableAndVmBindAvailable
}
TEST(DrmResidencyHandlerTests, whenQueryingForSetPairAvailableAndSupportAvailableThenExpectedValueIsReturned) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableSetPair.set(1);
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
drm.context.setPairQueryValue = 1;
@@ -1269,7 +1290,10 @@ TEST(DrmResidencyHandlerTests, whenQueryingForSetPairAvailableAndSupportAvailabl
EXPECT_EQ(1u, drm.context.setPairQueryCalled);
}
TEST(DrmResidencyHandlerTests, whenQueryingForSetPairAvailableAndFailureInQueryThenValueIsReturned) {
TEST(DrmResidencyHandlerTests, whenQueryingForSetPairAvailableAndFailureInQueryThenFalseIsReturned) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableSetPair.set(1);
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
drm.context.setPairQueryValue = 1;
@@ -1281,4 +1305,21 @@ TEST(DrmResidencyHandlerTests, whenQueryingForSetPairAvailableAndFailureInQueryT
EXPECT_FALSE(drm.isSetPairAvailable());
EXPECT_FALSE(drm.setPairAvailable);
EXPECT_EQ(1u, drm.context.setPairQueryCalled);
}
TEST(DrmResidencyHandlerTests, whenQueryingForSetPairAvailableWithDebugKeySetToZeroThenFalseIsReturned) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableSetPair.set(0);
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
drm.context.setPairQueryValue = 1;
drm.context.setPairQueryReturn = 1;
EXPECT_FALSE(drm.setPairAvailable);
EXPECT_EQ(0u, drm.context.setPairQueryCalled);
drm.callBaseIsSetPairAvailable = true;
EXPECT_FALSE(drm.isSetPairAvailable());
EXPECT_FALSE(drm.setPairAvailable);
EXPECT_EQ(0u, drm.context.setPairQueryCalled);
}