mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
fix: respect gt id when getting engines for drm context under xe kmd
Related-To: NEO-10496 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
9736313d10
commit
0270cd6a5b
@@ -267,7 +267,7 @@ HWTEST_F(IoctlHelperXeTestFixture, GivenContextCreatedForCopyEngineWhenCreateDrm
|
||||
public:
|
||||
DrmMockXeDebugTest(RootDeviceEnvironment &rootDeviceEnvironment) : DrmMockXeDebug(rootDeviceEnvironment){};
|
||||
unsigned int bindDrmContext(uint32_t drmContextId, uint32_t deviceIndex, aub_stream::EngineType engineType, bool engineInstancedDevice) override {
|
||||
return static_cast<unsigned int>(DrmParam::execBlt);
|
||||
return DRM_XE_ENGINE_CLASS_COPY;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -321,9 +321,6 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingAnyMethodThenDummyValueIsRe
|
||||
|
||||
EXPECT_EQ(0, xeIoctlHelper->setContextDebugFlag(0));
|
||||
|
||||
// Default no translation:
|
||||
verifyDrmGetParamValue(static_cast<int>(DrmParam::execRender), DrmParam::execRender);
|
||||
// test exception:
|
||||
verifyDrmGetParamValue(DRM_XE_MEM_REGION_CLASS_VRAM, DrmParam::memoryClassDevice);
|
||||
verifyDrmGetParamValue(DRM_XE_MEM_REGION_CLASS_SYSMEM, DrmParam::memoryClassSystem);
|
||||
verifyDrmGetParamValue(DRM_XE_ENGINE_CLASS_RENDER, DrmParam::engineClassRender);
|
||||
@@ -332,6 +329,9 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingAnyMethodThenDummyValueIsRe
|
||||
verifyDrmGetParamValue(DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE, DrmParam::engineClassVideoEnhance);
|
||||
verifyDrmGetParamValue(DRM_XE_ENGINE_CLASS_COMPUTE, DrmParam::engineClassCompute);
|
||||
verifyDrmGetParamValue(-1, DrmParam::engineClassInvalid);
|
||||
verifyDrmGetParamValue(DRM_XE_ENGINE_CLASS_RENDER, DrmParam::execRender);
|
||||
verifyDrmGetParamValue(DRM_XE_ENGINE_CLASS_COPY, DrmParam::execBlt);
|
||||
verifyDrmGetParamValue(DRM_XE_ENGINE_CLASS_COMPUTE, DrmParam::execDefault);
|
||||
|
||||
// Expect stringify
|
||||
verifyDrmParamString("ContextCreateExtSetparam", DrmParam::contextCreateExtSetparam);
|
||||
@@ -1741,6 +1741,57 @@ TEST(IoctlHelperXeTest, whenCallingVmBindThenPatIndexIsSet) {
|
||||
EXPECT_EQ(drm.vmBindInputs[0].bind.pat_index, expectedPatIndex);
|
||||
}
|
||||
|
||||
TEST(IoctlHelperXeTest, whenBindingDrmContextWithoutVirtualEnginesThenProperEnginesAreSelected) {
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
DrmMockXe drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
||||
|
||||
drm.ioctlHelper = std::make_unique<MockIoctlHelperXe>(drm);
|
||||
auto ioctlHelper = static_cast<MockIoctlHelperXe *>(drm.ioctlHelper.get());
|
||||
drm.queryEngineInfo();
|
||||
|
||||
unsigned int expectedValue = DRM_XE_ENGINE_CLASS_COMPUTE;
|
||||
EXPECT_EQ(expectedValue, drm.bindDrmContext(0, 1, aub_stream::EngineType::ENGINE_CCS, true));
|
||||
|
||||
EXPECT_EQ(1u, ioctlHelper->contextParamEngine.size());
|
||||
auto expectedEngine = drm.getEngineInfo()->getEngineInstance(1, aub_stream::EngineType::ENGINE_CCS);
|
||||
auto notExpectedEngine = drm.getEngineInfo()->getEngineInstance(0, aub_stream::EngineType::ENGINE_CCS);
|
||||
EXPECT_NE(expectedEngine->engineInstance, notExpectedEngine->engineInstance);
|
||||
EXPECT_EQ(expectedEngine->engineInstance, ioctlHelper->contextParamEngine[0].engine_instance);
|
||||
EXPECT_EQ(expectedEngine->engineClass, ioctlHelper->contextParamEngine[0].engine_class);
|
||||
EXPECT_EQ(1u, ioctlHelper->contextParamEngine[0].gt_id);
|
||||
}
|
||||
|
||||
TEST(IoctlHelperXeTest, whenBindingDrmContextWithVirtualEnginesThenProperEnginesAreSelected) {
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
DrmMockXe drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
||||
|
||||
drm.ioctlHelper = std::make_unique<MockIoctlHelperXe>(drm);
|
||||
auto ioctlHelper = static_cast<MockIoctlHelperXe *>(drm.ioctlHelper.get());
|
||||
drm.queryEngineInfo();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo()->gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 2;
|
||||
|
||||
unsigned int expectedValue = DRM_XE_ENGINE_CLASS_COMPUTE;
|
||||
EXPECT_EQ(expectedValue, drm.bindDrmContext(0, 1, aub_stream::EngineType::ENGINE_CCS, false));
|
||||
|
||||
EXPECT_EQ(2u, ioctlHelper->contextParamEngine.size());
|
||||
{
|
||||
auto expectedEngine = drm.getEngineInfo()->getEngineInstance(1, aub_stream::EngineType::ENGINE_CCS);
|
||||
auto notExpectedEngine = drm.getEngineInfo()->getEngineInstance(0, aub_stream::EngineType::ENGINE_CCS);
|
||||
EXPECT_NE(expectedEngine->engineInstance, notExpectedEngine->engineInstance);
|
||||
EXPECT_EQ(expectedEngine->engineInstance, ioctlHelper->contextParamEngine[0].engine_instance);
|
||||
EXPECT_EQ(expectedEngine->engineClass, ioctlHelper->contextParamEngine[0].engine_class);
|
||||
EXPECT_EQ(1u, ioctlHelper->contextParamEngine[0].gt_id);
|
||||
}
|
||||
{
|
||||
auto expectedEngine = drm.getEngineInfo()->getEngineInstance(1, aub_stream::EngineType::ENGINE_CCS1);
|
||||
auto notExpectedEngine = drm.getEngineInfo()->getEngineInstance(0, aub_stream::EngineType::ENGINE_CCS1);
|
||||
EXPECT_NE(expectedEngine->engineInstance, notExpectedEngine->engineInstance);
|
||||
EXPECT_EQ(expectedEngine->engineInstance, ioctlHelper->contextParamEngine[1].engine_instance);
|
||||
EXPECT_EQ(expectedEngine->engineClass, ioctlHelper->contextParamEngine[1].engine_class);
|
||||
EXPECT_EQ(1u, ioctlHelper->contextParamEngine[1].gt_id);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(IoctlHelperXeTest, whenCallingGetResetStatsThenSuccessIsReturned) {
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
DrmMockXe drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
||||
|
||||
@@ -28,6 +28,7 @@ using namespace NEO;
|
||||
|
||||
struct MockIoctlHelperXe : IoctlHelperXe {
|
||||
using IoctlHelperXe::bindInfo;
|
||||
using IoctlHelperXe::contextParamEngine;
|
||||
using IoctlHelperXe::debugMetadata;
|
||||
using IoctlHelperXe::defaultEngine;
|
||||
using IoctlHelperXe::getFdFromVmExport;
|
||||
|
||||
Reference in New Issue
Block a user