fix: correct gt id in context param engines in xe path

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski 2024-04-15 11:26:13 +00:00 committed by Compute-Runtime-Automation
parent 62390d3def
commit ff4a919004
4 changed files with 17 additions and 9 deletions

View File

@ -1388,7 +1388,7 @@ void IoctlHelperXe::insertEngineToContextParams(ContextParamEngines<> &contextPa
if (engineClassInstance) { if (engineClassInstance) {
engines[engineId].engine_class = engineClassInstance->engineClass; engines[engineId].engine_class = engineClassInstance->engineClass;
engines[engineId].engine_instance = engineClassInstance->engineInstance; engines[engineId].engine_instance = engineClassInstance->engineInstance;
engines[engineId].gt_id = tileId; engines[engineId].gt_id = tileIdToGtId[tileId];
contextParamEngines.numEnginesInContext = std::max(contextParamEngines.numEnginesInContext, engineId + 1); contextParamEngines.numEnginesInContext = std::max(contextParamEngines.numEnginesInContext, engineId + 1);
} }
} }

View File

@ -33,6 +33,7 @@ struct MockIoctlHelperXeDebug : IoctlHelperXe {
using IoctlHelperXe::freeDebugMetadata; using IoctlHelperXe::freeDebugMetadata;
using IoctlHelperXe::getRunaloneExtProperty; using IoctlHelperXe::getRunaloneExtProperty;
using IoctlHelperXe::IoctlHelperXe; using IoctlHelperXe::IoctlHelperXe;
using IoctlHelperXe::tileIdToGtId;
}; };
inline constexpr int testValueVmId = 0x5764; inline constexpr int testValueVmId = 0x5764;

View File

@ -219,6 +219,7 @@ HWTEST_F(IoctlHelperXeTestFixture, givenDeviceIndexWhenCreatingContextThenSetCor
DrmMockXeDebug drm{*executionEnvironment->rootDeviceEnvironments[0]}; DrmMockXeDebug drm{*executionEnvironment->rootDeviceEnvironments[0]};
drm.ioctlHelper = std::make_unique<MockIoctlHelperXeDebug>(drm); drm.ioctlHelper = std::make_unique<MockIoctlHelperXeDebug>(drm);
auto xeIoctlHelper = static_cast<MockIoctlHelperXeDebug *>(drm.getIoctlHelper()); auto xeIoctlHelper = static_cast<MockIoctlHelperXeDebug *>(drm.getIoctlHelper());
xeIoctlHelper->initialize();
auto engineInfo = xeIoctlHelper->createEngineInfo(false); auto engineInfo = xeIoctlHelper->createEngineInfo(false);
ASSERT_NE(nullptr, engineInfo); ASSERT_NE(nullptr, engineInfo);
@ -228,14 +229,15 @@ HWTEST_F(IoctlHelperXeTestFixture, givenDeviceIndexWhenCreatingContextThenSetCor
engineDescriptor.isEngineInstanced = true; engineDescriptor.isEngineInstanced = true;
OsContextLinux osContext(drm, 0, 0u, engineDescriptor); OsContextLinux osContext(drm, 0, 0u, engineDescriptor);
uint16_t deviceIndex = 1; uint16_t tileId = 1u;
uint16_t expectedGtId = xeIoctlHelper->tileIdToGtId[tileId];
xeIoctlHelper->createDrmContext(drm, osContext, 0, deviceIndex); xeIoctlHelper->createDrmContext(drm, osContext, 0, tileId);
EXPECT_EQ(1u, drm.execQueueCreateParams.num_placements); EXPECT_EQ(1u, drm.execQueueCreateParams.num_placements);
ASSERT_EQ(1u, drm.execQueueEngineInstances.size()); ASSERT_EQ(1u, drm.execQueueEngineInstances.size());
EXPECT_EQ(deviceIndex, drm.execQueueEngineInstances[0].gt_id); EXPECT_EQ(expectedGtId, drm.execQueueEngineInstances[0].gt_id);
} }
HWTEST_F(IoctlHelperXeTestFixture, GivenRunaloneModeRequiredReturnTrueWhenCreateDrmContextThenRunAloneContextIsRequested) { HWTEST_F(IoctlHelperXeTestFixture, GivenRunaloneModeRequiredReturnTrueWhenCreateDrmContextThenRunAloneContextIsRequested) {

View File

@ -1728,7 +1728,10 @@ TEST(IoctlHelperXeTest, whenBindingDrmContextWithoutVirtualEnginesThenProperEngi
drm.queryEngineInfo(); drm.queryEngineInfo();
unsigned int expectedValue = DRM_XE_ENGINE_CLASS_COMPUTE; unsigned int expectedValue = DRM_XE_ENGINE_CLASS_COMPUTE;
EXPECT_EQ(expectedValue, drm.bindDrmContext(0, 1, aub_stream::EngineType::ENGINE_CCS, true)); uint16_t tileId = 1u;
uint16_t expectedGtId = 2u;
EXPECT_EQ(expectedValue, drm.bindDrmContext(0, tileId, aub_stream::EngineType::ENGINE_CCS, true));
EXPECT_EQ(1u, ioctlHelper->contextParamEngine.size()); EXPECT_EQ(1u, ioctlHelper->contextParamEngine.size());
auto expectedEngine = drm.getEngineInfo()->getEngineInstance(1, aub_stream::EngineType::ENGINE_CCS); auto expectedEngine = drm.getEngineInfo()->getEngineInstance(1, aub_stream::EngineType::ENGINE_CCS);
@ -1736,7 +1739,7 @@ TEST(IoctlHelperXeTest, whenBindingDrmContextWithoutVirtualEnginesThenProperEngi
EXPECT_NE(expectedEngine->engineInstance, notExpectedEngine->engineInstance); EXPECT_NE(expectedEngine->engineInstance, notExpectedEngine->engineInstance);
EXPECT_EQ(expectedEngine->engineInstance, ioctlHelper->contextParamEngine[0].engine_instance); EXPECT_EQ(expectedEngine->engineInstance, ioctlHelper->contextParamEngine[0].engine_instance);
EXPECT_EQ(expectedEngine->engineClass, ioctlHelper->contextParamEngine[0].engine_class); EXPECT_EQ(expectedEngine->engineClass, ioctlHelper->contextParamEngine[0].engine_class);
EXPECT_EQ(1u, ioctlHelper->contextParamEngine[0].gt_id); EXPECT_EQ(expectedGtId, ioctlHelper->contextParamEngine[0].gt_id);
} }
TEST(IoctlHelperXeTest, whenBindingDrmContextWithVirtualEnginesThenProperEnginesAreSelected) { TEST(IoctlHelperXeTest, whenBindingDrmContextWithVirtualEnginesThenProperEnginesAreSelected) {
@ -1750,7 +1753,9 @@ TEST(IoctlHelperXeTest, whenBindingDrmContextWithVirtualEnginesThenProperEngines
executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo()->gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 2; executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo()->gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 2;
unsigned int expectedValue = DRM_XE_ENGINE_CLASS_COMPUTE; unsigned int expectedValue = DRM_XE_ENGINE_CLASS_COMPUTE;
EXPECT_EQ(expectedValue, drm.bindDrmContext(0, 1, aub_stream::EngineType::ENGINE_CCS, false)); uint16_t tileId = 1u;
uint16_t expectedGtId = 2u;
EXPECT_EQ(expectedValue, drm.bindDrmContext(0, tileId, aub_stream::EngineType::ENGINE_CCS, false));
EXPECT_EQ(2u, ioctlHelper->contextParamEngine.size()); EXPECT_EQ(2u, ioctlHelper->contextParamEngine.size());
{ {
@ -1759,7 +1764,7 @@ TEST(IoctlHelperXeTest, whenBindingDrmContextWithVirtualEnginesThenProperEngines
EXPECT_NE(expectedEngine->engineInstance, notExpectedEngine->engineInstance); EXPECT_NE(expectedEngine->engineInstance, notExpectedEngine->engineInstance);
EXPECT_EQ(expectedEngine->engineInstance, ioctlHelper->contextParamEngine[0].engine_instance); EXPECT_EQ(expectedEngine->engineInstance, ioctlHelper->contextParamEngine[0].engine_instance);
EXPECT_EQ(expectedEngine->engineClass, ioctlHelper->contextParamEngine[0].engine_class); EXPECT_EQ(expectedEngine->engineClass, ioctlHelper->contextParamEngine[0].engine_class);
EXPECT_EQ(1u, ioctlHelper->contextParamEngine[0].gt_id); EXPECT_EQ(expectedGtId, ioctlHelper->contextParamEngine[0].gt_id);
} }
{ {
auto expectedEngine = drm.getEngineInfo()->getEngineInstance(1, aub_stream::EngineType::ENGINE_CCS1); auto expectedEngine = drm.getEngineInfo()->getEngineInstance(1, aub_stream::EngineType::ENGINE_CCS1);
@ -1767,7 +1772,7 @@ TEST(IoctlHelperXeTest, whenBindingDrmContextWithVirtualEnginesThenProperEngines
EXPECT_NE(expectedEngine->engineInstance, notExpectedEngine->engineInstance); EXPECT_NE(expectedEngine->engineInstance, notExpectedEngine->engineInstance);
EXPECT_EQ(expectedEngine->engineInstance, ioctlHelper->contextParamEngine[1].engine_instance); EXPECT_EQ(expectedEngine->engineInstance, ioctlHelper->contextParamEngine[1].engine_instance);
EXPECT_EQ(expectedEngine->engineClass, ioctlHelper->contextParamEngine[1].engine_class); EXPECT_EQ(expectedEngine->engineClass, ioctlHelper->contextParamEngine[1].engine_class);
EXPECT_EQ(1u, ioctlHelper->contextParamEngine[1].gt_id); EXPECT_EQ(expectedGtId, ioctlHelper->contextParamEngine[1].gt_id);
} }
} }