Revert "fix: change gmm resource for externalHostPtr"

This reverts commit 63843862df.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2024-05-21 07:18:37 +02:00
committed by Compute-Runtime-Automation
parent b755a30919
commit 94a4bbac57
28 changed files with 56 additions and 119 deletions

View File

@@ -1862,7 +1862,7 @@ TEST(IoctlHelperTest, givenIoctlHelperWhenCallCreateGemThenProperValuesSet) {
uint32_t memoryBanks = 3u;
EXPECT_EQ(0, drm.ioctlCount.gemCreate);
uint32_t handle = ioctlHelper->createGem(size, memoryBanks, false);
uint32_t handle = ioctlHelper->createGem(size, memoryBanks);
EXPECT_EQ(1, drm.ioctlCount.gemCreate);
EXPECT_EQ(size, drm.createParamsSize);

View File

@@ -168,7 +168,7 @@ TEST_F(IoctlHelperPrelimFixture, givenPrelimsWhenCreateGemExtThenReturnSuccess)
uint32_t handle = 0;
MemRegionsVec memClassInstance = {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0}};
uint32_t numOfChunks = 0;
auto ret = ioctlHelper->createGemExt(memClassInstance, 1024, handle, 0, {}, -1, false, numOfChunks, std::nullopt, std::nullopt, std::nullopt);
auto ret = ioctlHelper->createGemExt(memClassInstance, 1024, handle, 0, {}, -1, false, numOfChunks, std::nullopt, std::nullopt);
EXPECT_EQ(1u, handle);
EXPECT_EQ(0, ret);
@@ -192,7 +192,7 @@ TEST_F(IoctlHelperPrelimFixture, givenPrelimsWhenCreateGemExtWithChunkingThenGet
uint32_t handle = 0;
uint32_t getNumOfChunks = 2;
MemRegionsVec memClassInstance = {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0}};
ioctlHelper->createGemExt(memClassInstance, allocSize, handle, 0, {}, -1, true, getNumOfChunks, std::nullopt, std::nullopt, std::nullopt);
ioctlHelper->createGemExt(memClassInstance, allocSize, handle, 0, {}, -1, true, getNumOfChunks, std::nullopt, std::nullopt);
std::string output = testing::internal::GetCapturedStdout();
std::string expectedOutput("GEM_CREATE_EXT BO-1 with BOChunkingSize 65536, chunkingParamRegion.param.data 65536, numOfChunks 2\n");
EXPECT_EQ(expectedOutput, output);
@@ -209,7 +209,7 @@ TEST_F(IoctlHelperPrelimFixture, givenPrelimsWhenCreateGemExtWithChunkingAndAllo
uint32_t handle = 0;
uint32_t getNumOfChunks = 2;
MemRegionsVec memClassInstance = {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0}};
EXPECT_THROW(ioctlHelper->createGemExt(memClassInstance, allocSize, handle, 0, {}, -1, true, getNumOfChunks, std::nullopt, std::nullopt, std::nullopt), std::runtime_error);
EXPECT_THROW(ioctlHelper->createGemExt(memClassInstance, allocSize, handle, 0, {}, -1, true, getNumOfChunks, std::nullopt, std::nullopt), std::runtime_error);
}
TEST_F(IoctlHelperPrelimFixture, givenPrelimsWhenCreateGemExtWithDebugFlagThenPrintDebugInfo) {
@@ -221,7 +221,7 @@ TEST_F(IoctlHelperPrelimFixture, givenPrelimsWhenCreateGemExtWithDebugFlagThenPr
uint32_t handle = 0;
MemRegionsVec memClassInstance = {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0}};
uint32_t numOfChunks = 0;
ioctlHelper->createGemExt(memClassInstance, 1024, handle, 0, {}, -1, false, numOfChunks, std::nullopt, std::nullopt, std::nullopt);
ioctlHelper->createGemExt(memClassInstance, 1024, handle, 0, {}, -1, false, numOfChunks, std::nullopt, std::nullopt);
std::string output = testing::internal::GetCapturedStdout();
std::string expectedOutput("Performing GEM_CREATE_EXT with { size: 1024, param: 0x1000000010001, memory class: 1, memory instance: 0 }\nGEM_CREATE_EXT has returned: 0 BO-1 with size: 1024\n");

View File

@@ -28,7 +28,7 @@ DG1TEST_F(IoctlHelperTestsDg1, givenDg1WhenCreateGemExtThenReturnCorrectValue) {
uint32_t handle = 0;
MemRegionsVec memClassInstance = {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0}};
uint32_t numOfChunks = 0;
auto ret = ioctlHelper->createGemExt(memClassInstance, 1024, handle, 0, {}, -1, false, numOfChunks, std::nullopt, std::nullopt, false);
auto ret = ioctlHelper->createGemExt(memClassInstance, 1024, handle, 0, {}, -1, false, numOfChunks, std::nullopt, std::nullopt);
EXPECT_EQ(0, ret);
EXPECT_EQ(1u, handle);
@@ -50,7 +50,7 @@ DG1TEST_F(IoctlHelperTestsDg1, givenDg1WithDrmTipWhenCreateGemExtWithDebugFlagTh
uint32_t handle = 0;
MemRegionsVec memClassInstance = {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0}};
uint32_t numOfChunks = 0;
auto ret = ioctlHelper->createGemExt(memClassInstance, 1024, handle, 0, {}, -1, false, numOfChunks, std::nullopt, std::nullopt, false);
auto ret = ioctlHelper->createGemExt(memClassInstance, 1024, handle, 0, {}, -1, false, numOfChunks, std::nullopt, std::nullopt);
std::string output = testing::internal::GetCapturedStdout();
std::string expectedOutput("Performing GEM_CREATE_EXT with { size: 1024, memory class: 1, memory instance: 0 }\nGEM_CREATE_EXT with EXT_MEMORY_REGIONS has returned: 0 BO-1 with size: 1024\n");
@@ -72,7 +72,7 @@ DG1TEST_F(IoctlHelperTestsDg1, givenDg1WhenCreateGemExtWithDebugFlagThenPrintDeb
uint32_t handle = 0;
MemRegionsVec memClassInstance = {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0}};
uint32_t numOfChunks = 0;
auto ret = ioctlHelper->createGemExt(memClassInstance, 1024, handle, 0, {}, -1, false, numOfChunks, std::nullopt, std::nullopt, false);
auto ret = ioctlHelper->createGemExt(memClassInstance, 1024, handle, 0, {}, -1, false, numOfChunks, std::nullopt, std::nullopt);
std::string output = testing::internal::GetCapturedStdout();
std::string expectedOutput("Performing GEM_CREATE_EXT with { size: 1024, memory class: 1, memory instance: 0 }\nGEM_CREATE_EXT with EXT_MEMORY_REGIONS has returned: -1 BO-0 with size: 1024\nGEM_CREATE_EXT with EXT_SETPARAM has returned: 0 BO-1 with size: 1024\n");

View File

@@ -498,7 +498,7 @@ TEST(IoctlPrelimHelperCreateGemExtTests, givenPrelimWhenCreateGemExtWithMemPolic
uint32_t memPolicyMode = 0;
mockIoctlHelper.overrideGemCreateExtReturnValue = 0;
mockIoctlHelper.initialize();
auto ret = mockIoctlHelper.createGemExt(memClassInstance, 1024, handle, 0, {}, -1, false, numOfChunks, memPolicyMode, memPolicy, false);
auto ret = mockIoctlHelper.createGemExt(memClassInstance, 1024, handle, 0, {}, -1, false, numOfChunks, memPolicyMode, memPolicy);
std::string output = testing::internal::GetCapturedStdout();
std::string expectedSubstring("memory policy:");
@@ -524,7 +524,7 @@ TEST(IoctlPrelimHelperCreateGemExtTests, givenPrelimWhenCreateGemExtWithMemPolic
uint32_t memPolicyMode = 0;
mockIoctlHelper.overrideGemCreateExtReturnValue = 0;
mockIoctlHelper.initialize();
auto ret = mockIoctlHelper.createGemExt(memClassInstance, size, handle, 0, {}, -1, true, numOfChunks, memPolicyMode, memPolicy, false);
auto ret = mockIoctlHelper.createGemExt(memClassInstance, size, handle, 0, {}, -1, true, numOfChunks, memPolicyMode, memPolicy);
EXPECT_EQ(0, ret);
EXPECT_TRUE(mockIoctlHelper.lastGemCreateContainedMemPolicy);

View File

@@ -346,7 +346,7 @@ TEST(IoctlHelperTestsUpstream, givenUpstreamWhenCreateGemExtThenReturnCorrectVal
uint32_t handle = 0;
MemRegionsVec memClassInstance = {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0}};
uint32_t numOfChunks = 0;
auto ret = ioctlHelper->createGemExt(memClassInstance, 1024, handle, 0, {}, -1, false, numOfChunks, std::nullopt, std::nullopt, false);
auto ret = ioctlHelper->createGemExt(memClassInstance, 1024, handle, 0, {}, -1, false, numOfChunks, std::nullopt, std::nullopt);
EXPECT_EQ(0, ret);
EXPECT_EQ(1u, handle);
@@ -368,7 +368,7 @@ TEST(IoctlHelperTestsUpstream, givenUpstreamWhenCreateGemExtWithDebugFlagThenPri
uint32_t handle = 0;
MemRegionsVec memClassInstance = {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0}};
uint32_t numOfChunks = 0;
ioctlHelper->createGemExt(memClassInstance, 1024, handle, 0, {}, -1, false, numOfChunks, std::nullopt, std::nullopt, false);
ioctlHelper->createGemExt(memClassInstance, 1024, handle, 0, {}, -1, false, numOfChunks, std::nullopt, std::nullopt);
std::string output = testing::internal::GetCapturedStdout();
std::string expectedOutput("Performing GEM_CREATE_EXT with { size: 1024, memory class: 1, memory instance: 0 }\nGEM_CREATE_EXT with EXT_MEMORY_REGIONS has returned: 0 BO-1 with size: 1024\n");
@@ -383,13 +383,13 @@ TEST(IoctlHelperTestsUpstream, givenSetPatSupportedWhenCreateGemExtThenSetPatExt
uint32_t handle = 0;
MemRegionsVec memClassInstance = {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0}};
mockIoctlHelper.isSetPatSupported = false;
auto ret = mockIoctlHelper.createGemExt(memClassInstance, 1, handle, 0, {}, -1, false, 0, std::nullopt, std::nullopt, false);
auto ret = mockIoctlHelper.createGemExt(memClassInstance, 1, handle, 0, {}, -1, false, 0, std::nullopt, std::nullopt);
EXPECT_EQ(0, ret);
EXPECT_EQ(1u, mockIoctlHelper.ioctlCallCount);
EXPECT_FALSE(mockIoctlHelper.lastGemCreateContainedSetPat);
mockIoctlHelper.isSetPatSupported = true;
ret = mockIoctlHelper.createGemExt(memClassInstance, 1, handle, 0, {}, -1, false, 0, std::nullopt, std::nullopt, false);
ret = mockIoctlHelper.createGemExt(memClassInstance, 1, handle, 0, {}, -1, false, 0, std::nullopt, std::nullopt);
EXPECT_EQ(0, ret);
EXPECT_EQ(2u, mockIoctlHelper.ioctlCallCount);
EXPECT_TRUE(mockIoctlHelper.lastGemCreateContainedSetPat);
@@ -404,13 +404,13 @@ TEST(IoctlHelperTestsUpstream, givenInvalidPatIndexWhenCreateGemExtThenSetPatExt
mockIoctlHelper.isSetPatSupported = true;
uint64_t invalidPatIndex = CommonConstants::unsupportedPatIndex;
MemRegionsVec memClassInstance = {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0}};
auto ret = mockIoctlHelper.createGemExt(memClassInstance, 1, handle, invalidPatIndex, {}, -1, false, 0, std::nullopt, std::nullopt, false);
auto ret = mockIoctlHelper.createGemExt(memClassInstance, 1, handle, invalidPatIndex, {}, -1, false, 0, std::nullopt, std::nullopt);
EXPECT_EQ(0, ret);
EXPECT_EQ(1u, mockIoctlHelper.ioctlCallCount);
EXPECT_FALSE(mockIoctlHelper.lastGemCreateContainedSetPat);
invalidPatIndex = static_cast<uint64_t>(std::numeric_limits<uint32_t>::max()) + 1;
ret = mockIoctlHelper.createGemExt(memClassInstance, 1, handle, invalidPatIndex, {}, -1, false, 0, std::nullopt, std::nullopt, false);
ret = mockIoctlHelper.createGemExt(memClassInstance, 1, handle, invalidPatIndex, {}, -1, false, 0, std::nullopt, std::nullopt);
EXPECT_EQ(0, ret);
EXPECT_EQ(2u, mockIoctlHelper.ioctlCallCount);
EXPECT_FALSE(mockIoctlHelper.lastGemCreateContainedSetPat);
@@ -432,7 +432,7 @@ TEST(IoctlHelperTestsUpstream, givenSetPatSupportedWhenCreateGemExtWithDebugFlag
MemRegionsVec memClassInstance = {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0}};
uint32_t numOfChunks = 0;
uint64_t patIndex = 5;
mockIoctlHelper.createGemExt(memClassInstance, 1024, handle, patIndex, {}, -1, false, numOfChunks, std::nullopt, std::nullopt, false);
mockIoctlHelper.createGemExt(memClassInstance, 1024, handle, patIndex, {}, -1, false, numOfChunks, std::nullopt, std::nullopt);
std::string output = testing::internal::GetCapturedStdout();
std::string expectedOutput("Performing GEM_CREATE_EXT with { size: 1024, memory class: 1, memory instance: 0, pat index: 5 }\nGEM_CREATE_EXT with EXT_MEMORY_REGIONS with EXT_SET_PAT has returned: 0 BO-1 with size: 1024\n");

View File

@@ -65,7 +65,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingGemCreateExtWithRegionsThen
uint32_t numOfChunks = 0;
EXPECT_TRUE(xeIoctlHelper->bindInfo.empty());
EXPECT_NE(0, xeIoctlHelper->createGemExt(memRegions, 0u, handle, 0, {}, -1, false, numOfChunks, std::nullopt, std::nullopt, false));
EXPECT_NE(0, xeIoctlHelper->createGemExt(memRegions, 0u, handle, 0, {}, -1, false, numOfChunks, std::nullopt, std::nullopt));
EXPECT_FALSE(xeIoctlHelper->bindInfo.empty());
EXPECT_EQ(DRM_XE_GEM_CPU_CACHING_WC, drm.createParamsCpuCaching);
}
@@ -88,7 +88,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingGemCreateExtWithRegionsAndV
GemVmControl test = {};
EXPECT_TRUE(xeIoctlHelper->bindInfo.empty());
EXPECT_NE(0, xeIoctlHelper->createGemExt(memRegions, 0u, handle, 0, test.vmId, -1, false, numOfChunks, std::nullopt, std::nullopt, false));
EXPECT_NE(0, xeIoctlHelper->createGemExt(memRegions, 0u, handle, 0, test.vmId, -1, false, numOfChunks, std::nullopt, std::nullopt));
EXPECT_FALSE(xeIoctlHelper->bindInfo.empty());
EXPECT_EQ(DRM_XE_GEM_CPU_CACHING_WC, drm.createParamsCpuCaching);
}
@@ -109,7 +109,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateAndNoLocalMemoryThenP
EXPECT_EQ(0, drm.ioctlCnt.gemCreate);
EXPECT_TRUE(xeIoctlHelper->bindInfo.empty());
uint32_t handle = xeIoctlHelper->createGem(size, memoryBanks, false);
uint32_t handle = xeIoctlHelper->createGem(size, memoryBanks);
EXPECT_EQ(1, drm.ioctlCnt.gemCreate);
EXPECT_FALSE(xeIoctlHelper->bindInfo.empty());
@@ -139,7 +139,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateWhenMemoryBanksZeroTh
EXPECT_EQ(0, drm.ioctlCnt.gemCreate);
EXPECT_TRUE(xeIoctlHelper->bindInfo.empty());
uint32_t handle = xeIoctlHelper->createGem(size, memoryBanks, false);
uint32_t handle = xeIoctlHelper->createGem(size, memoryBanks);
EXPECT_EQ(1, drm.ioctlCnt.gemCreate);
EXPECT_FALSE(xeIoctlHelper->bindInfo.empty());
@@ -169,7 +169,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateAndLocalMemoryThenPro
EXPECT_EQ(0, drm.ioctlCnt.gemCreate);
EXPECT_TRUE(xeIoctlHelper->bindInfo.empty());
uint32_t handle = xeIoctlHelper->createGem(size, memoryBanks, false);
uint32_t handle = xeIoctlHelper->createGem(size, memoryBanks);
EXPECT_EQ(1, drm.ioctlCnt.gemCreate);
EXPECT_FALSE(xeIoctlHelper->bindInfo.empty());
@@ -236,7 +236,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingAnyMethodThenDummyValueIsRe
MemRegionsVec memRegions{};
uint32_t handle = 0u;
uint32_t numOfChunks = 0;
EXPECT_NE(0, xeIoctlHelper->createGemExt(memRegions, 0u, handle, 0, {}, -1, false, numOfChunks, std::nullopt, std::nullopt, false));
EXPECT_NE(0, xeIoctlHelper->createGemExt(memRegions, 0u, handle, 0, {}, -1, false, numOfChunks, std::nullopt, std::nullopt));
EXPECT_TRUE(xeIoctlHelper->isVmBindAvailable());
@@ -1744,16 +1744,11 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenGetCpuCachingModeCalledThenCorrect
drm.memoryInfo.reset(xeIoctlHelper->createMemoryInfo().release());
ASSERT_NE(nullptr, xeIoctlHelper);
EXPECT_EQ(xeIoctlHelper->getCpuCachingMode(false, false), DRM_XE_GEM_CPU_CACHING_WC);
EXPECT_EQ(xeIoctlHelper->getCpuCachingMode(false, true), DRM_XE_GEM_CPU_CACHING_WC);
EXPECT_EQ(xeIoctlHelper->getCpuCachingMode(true, true), DRM_XE_GEM_CPU_CACHING_WB);
EXPECT_EQ(xeIoctlHelper->getCpuCachingMode(true, false), DRM_XE_GEM_CPU_CACHING_WB);
EXPECT_EQ(xeIoctlHelper->getCpuCachingMode(std::nullopt, false), DRM_XE_GEM_CPU_CACHING_WC);
EXPECT_EQ(xeIoctlHelper->getCpuCachingMode(std::nullopt, true), DRM_XE_GEM_CPU_CACHING_WB);
EXPECT_EQ(xeIoctlHelper->getCpuCachingMode(false), DRM_XE_GEM_CPU_CACHING_WC);
EXPECT_EQ(xeIoctlHelper->getCpuCachingMode(true), DRM_XE_GEM_CPU_CACHING_WB);
debugManager.flags.OverrideCpuCaching.set(DRM_XE_GEM_CPU_CACHING_WB);
EXPECT_EQ(xeIoctlHelper->getCpuCachingMode(false, false), DRM_XE_GEM_CPU_CACHING_WB);
EXPECT_EQ(xeIoctlHelper->getCpuCachingMode(false), DRM_XE_GEM_CPU_CACHING_WB);
}
TEST(IoctlHelperXeTest, whenCallingVmBindThenPatIndexIsSet) {

View File

@@ -948,10 +948,3 @@ HWTEST_F(ProductHelperTest, givenProductHelperWhenAskingForReadOnlyResourceSuppo
HWTEST_F(ProductHelperTest, givenProductHelperWhenAskingForDeviceToHostCopySignalingFenceFalseReturned) {
EXPECT_FALSE(productHelper->isDeviceToHostCopySignalingFenceRequired());
}
HWTEST2_F(ProductHelperTest, givenPatIndexWhenCheckIsCoherentAllocationThenReturnNullopt, IsAtMostPVC) {
std::array<uint64_t, 5> listOfCoherentPatIndexes = {0, 1, 2, 3, 4};
for (auto patIndex : listOfCoherentPatIndexes) {
EXPECT_EQ(std::nullopt, productHelper->isCoherentAllocation(patIndex));
}
}