mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Remove unnecessary platform() uses from gmm tests
Related-To: NEO-4207 Change-Id: I047726edd7f0847510b350ac514072f25ff1b8b3 Signed-off-by: Andrzej Swierczynski <andrzej.swierczynski@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
eacbd527ba
commit
495bc4024e
@ -34,6 +34,8 @@ set(IGDRCL_SRCS_tests_fixtures
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/memory_manager_fixture.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/memory_manager_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_aub_center_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_execution_environment_gmm_fixture.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_execution_environment_gmm_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/multi_root_device_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/platform_fixture.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/platform_fixture.h
|
||||
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/mock_execution_environment_gmm_fixture.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
|
||||
namespace NEO {
|
||||
void MockExecutionEnvironmentGmmFixture::SetUp() {
|
||||
executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
|
||||
executionEnvironment->incRefInternal();
|
||||
}
|
||||
void MockExecutionEnvironmentGmmFixture::TearDown() {}
|
||||
|
||||
GmmHelper *MockExecutionEnvironmentGmmFixture::getGmmHelper() {
|
||||
return executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper();
|
||||
}
|
||||
|
||||
GmmClientContext *MockExecutionEnvironmentGmmFixture::getGmmClientContext() {
|
||||
return executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext();
|
||||
}
|
||||
} // namespace NEO
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
struct MockExecutionEnvironment;
|
||||
class GmmHelper;
|
||||
class GmmClientContext;
|
||||
|
||||
class MockExecutionEnvironmentGmmFixture {
|
||||
protected:
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
|
||||
std::unique_ptr<MockExecutionEnvironment> executionEnvironment;
|
||||
|
||||
public:
|
||||
GmmHelper *getGmmHelper();
|
||||
GmmClientContext *getGmmClientContext();
|
||||
};
|
||||
} // namespace NEO
|
@ -17,12 +17,12 @@
|
||||
|
||||
#include "opencl/source/helpers/gmm_types_converter.h"
|
||||
#include "opencl/source/memory_manager/os_agnostic_memory_manager.h"
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "opencl/test/unit_test/fixtures/mock_execution_environment_gmm_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_graphics_allocation.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_memory_manager.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "GL/gl.h"
|
||||
#include "GL/glext.h"
|
||||
@ -30,6 +30,8 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include "igfxfmid.h"
|
||||
|
||||
using MockExecutionEnvironmentGmmFixtureTest = Test<NEO::MockExecutionEnvironmentGmmFixture>;
|
||||
|
||||
using namespace ::testing;
|
||||
|
||||
namespace NEO {
|
||||
@ -39,12 +41,11 @@ extern SKU_FEATURE_TABLE passedFtrTable;
|
||||
extern WA_TABLE passedWaTable;
|
||||
extern bool copyInputArgs;
|
||||
|
||||
struct GmmTests : public ::testing::Test {
|
||||
struct GmmTests : public MockExecutionEnvironmentGmmFixtureTest {
|
||||
void SetUp() override {
|
||||
executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
MockExecutionEnvironmentGmmFixture::SetUp();
|
||||
rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
}
|
||||
ExecutionEnvironment *executionEnvironment = nullptr;
|
||||
RootDeviceEnvironment *rootDeviceEnvironment = nullptr;
|
||||
};
|
||||
|
||||
@ -68,7 +69,7 @@ TEST(GmmGlTests, givenGmmWhenAskedforCubeFaceIndexThenProperValueIsReturned) {
|
||||
TEST_F(GmmTests, WhenGmmIsCreatedThenAllResourceAreCreated) {
|
||||
std::unique_ptr<MemoryManager> mm(new MemoryManagerCreate<OsAgnosticMemoryManager>(false, false, *executionEnvironment));
|
||||
void *pSysMem = mm->allocateSystemMemory(4096, 4096);
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, false));
|
||||
|
||||
ASSERT_TRUE(gmm->gmmResourceInfo.get() != nullptr);
|
||||
|
||||
@ -83,7 +84,7 @@ TEST_F(GmmTests, GivenUncacheableWhenGmmIsCreatedThenAllResourceAreCreated) {
|
||||
std::unique_ptr<MemoryManager> mm(new MemoryManagerCreate<OsAgnosticMemoryManager>(false, false, *executionEnvironment));
|
||||
void *pSysMem = mm->allocateSystemMemory(4096, 4096);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096, true));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, true));
|
||||
|
||||
ASSERT_TRUE(gmm->gmmResourceInfo.get() != nullptr);
|
||||
|
||||
@ -100,7 +101,7 @@ TEST_F(GmmTests, givenHostPointerWithHighestBitSetWhenGmmIsCreatedItHasTheSameAd
|
||||
auto address = reinterpret_cast<void *>(addressWithHighestBitSet);
|
||||
auto expectedAddress = castToUint64(address);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), address, 4096, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), address, 4096, false));
|
||||
EXPECT_EQ(gmm->resourceParams.pExistingSysMem, expectedAddress);
|
||||
}
|
||||
|
||||
@ -110,7 +111,7 @@ TEST_F(GmmTests, GivenBufferSizeLargerThenMaxPitchWhenAskedForGmmCreationThenGmm
|
||||
MemoryManager *mm = new MemoryManagerCreate<OsAgnosticMemoryManager>(false, false, *executionEnvironment);
|
||||
void *pSysMem = mm->allocateSystemMemory(4096, 4096);
|
||||
|
||||
auto gmmRes = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, maxSize, false);
|
||||
auto gmmRes = new Gmm(getGmmClientContext(), pSysMem, maxSize, false);
|
||||
|
||||
ASSERT_TRUE(gmmRes->gmmResourceInfo.get() != nullptr);
|
||||
|
||||
@ -124,8 +125,8 @@ TEST_F(GmmTests, GivenBufferSizeLargerThenMaxPitchWhenAskedForGmmCreationThenGmm
|
||||
TEST_F(GmmTests, givenGmmCreatedFromExistingGmmThenHelperDoesNotReleaseParentGmm) {
|
||||
auto size = 4096u;
|
||||
void *incomingPtr = (void *)0x1000;
|
||||
auto gmmRes = new Gmm(rootDeviceEnvironment->getGmmClientContext(), incomingPtr, size, false);
|
||||
auto gmmRes2 = new Gmm(rootDeviceEnvironment->getGmmClientContext(), gmmRes->gmmResourceInfo->peekHandle());
|
||||
auto gmmRes = new Gmm(getGmmClientContext(), incomingPtr, size, false);
|
||||
auto gmmRes2 = new Gmm(getGmmClientContext(), gmmRes->gmmResourceInfo->peekHandle());
|
||||
|
||||
//copy is being made
|
||||
EXPECT_NE(gmmRes2->gmmResourceInfo->peekHandle(), gmmRes->gmmResourceInfo->peekHandle());
|
||||
@ -145,7 +146,7 @@ TEST_F(GmmTests, GivenInvalidImageSizeWhenQueryingImgParamsThenImageInfoReturnsS
|
||||
cl_image_desc imgDesc = {CL_MEM_OBJECT_IMAGE2D};
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
auto queryGmm = MockGmm::queryImgParams(rootDeviceEnvironment->getGmmClientContext(), imgInfo);
|
||||
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo);
|
||||
|
||||
EXPECT_EQ(imgInfo.size, 0u);
|
||||
}
|
||||
@ -156,7 +157,7 @@ TEST_F(GmmTests, GivenInvalidImageTypeWhenQueryingImgParamsThenExceptionIsThrown
|
||||
imgDesc.image_type = 0; // invalid
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
EXPECT_THROW(MockGmm::queryImgParams(rootDeviceEnvironment->getGmmClientContext(), imgInfo), std::exception);
|
||||
EXPECT_THROW(MockGmm::queryImgParams(getGmmClientContext(), imgInfo), std::exception);
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, WhenQueryingImgParamsThenCorrectValuesAreReturned) {
|
||||
@ -171,7 +172,7 @@ TEST_F(GmmTests, WhenQueryingImgParamsThenCorrectValuesAreReturned) {
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
auto queryGmm = MockGmm::queryImgParams(rootDeviceEnvironment->getGmmClientContext(), imgInfo);
|
||||
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo);
|
||||
|
||||
EXPECT_GT(imgInfo.size, minSize);
|
||||
EXPECT_GT(imgInfo.rowPitch, 0u);
|
||||
@ -201,20 +202,20 @@ TEST_F(GmmTests, WhenQueryingImgParamsThenCorrectValuesAreReturned) {
|
||||
TEST_F(GmmTests, givenWidthWhenCreatingResourceThenSetWidth64Field) {
|
||||
const void *dummyPtr = reinterpret_cast<void *>(0x123);
|
||||
size_t allocationSize = std::numeric_limits<size_t>::max();
|
||||
Gmm gmm(rootDeviceEnvironment->getGmmClientContext(), dummyPtr, allocationSize, false);
|
||||
Gmm gmm(getGmmClientContext(), dummyPtr, allocationSize, false);
|
||||
EXPECT_EQ(static_cast<uint64_t>(allocationSize), gmm.resourceParams.BaseWidth64);
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, givenNullptrWhenGmmConstructorIsCalledThenNoGfxMemoryIsProperlySet) {
|
||||
void *pSysMem = nullptr;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, false));
|
||||
|
||||
EXPECT_EQ(gmm->resourceParams.NoGfxMemory, 1u);
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, givenPtrWhenGmmConstructorIsCalledThenNoGfxMemoryIsProperlySet) {
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1111);
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, false));
|
||||
|
||||
EXPECT_EQ(gmm->resourceParams.NoGfxMemory, 0u);
|
||||
}
|
||||
@ -231,7 +232,7 @@ TEST_F(GmmTests, given2DimageFromBufferParametersWhenGmmResourceIsCreatedThenItH
|
||||
ClSurfaceFormatInfo surfaceFormat = {{CL_RGBA, CL_FLOAT}, {GMM_FORMAT_R32G32B32A32_FLOAT_TYPE, (GFX3DSTATE_SURFACEFORMAT)0, 0, 4, 4, 16}};
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormat);
|
||||
auto queryGmm = MockGmm::queryImgParams(rootDeviceEnvironment->getGmmClientContext(), imgInfo);
|
||||
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo);
|
||||
auto renderSize = queryGmm->gmmResourceInfo->getSizeAllocation();
|
||||
|
||||
size_t expectedSize = imgDesc.image_row_pitch * imgDesc.image_height;
|
||||
@ -252,7 +253,7 @@ TEST_F(GmmTests, given2DimageFromBufferParametersWhenGmmResourceIsCreatedAndPitc
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormat);
|
||||
EXPECT_EQ(imgInfo.imgDesc.imageRowPitch, imgDesc.image_row_pitch);
|
||||
auto queryGmm = MockGmm::queryImgParams(rootDeviceEnvironment->getGmmClientContext(), imgInfo);
|
||||
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo);
|
||||
auto renderSize = queryGmm->gmmResourceInfo->getSizeAllocation();
|
||||
|
||||
size_t expectedSize = imgDesc.image_row_pitch * imgDesc.image_height;
|
||||
@ -272,14 +273,14 @@ TEST_F(GmmTests, givenPlanarFormatsWhenQueryingImageParamsThenUvOffsetIsQueried)
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormatNV12);
|
||||
imgInfo.yOffsetForUVPlane = 0;
|
||||
MockGmm::queryImgParams(rootDeviceEnvironment->getGmmClientContext(), imgInfo);
|
||||
MockGmm::queryImgParams(getGmmClientContext(), imgInfo);
|
||||
|
||||
EXPECT_NE(0u, imgInfo.yOffsetForUVPlane);
|
||||
|
||||
imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormatP010);
|
||||
imgInfo.yOffsetForUVPlane = 0;
|
||||
|
||||
MockGmm::queryImgParams(rootDeviceEnvironment->getGmmClientContext(), imgInfo);
|
||||
MockGmm::queryImgParams(getGmmClientContext(), imgInfo);
|
||||
EXPECT_NE(0u, imgInfo.yOffsetForUVPlane);
|
||||
}
|
||||
|
||||
@ -292,7 +293,7 @@ TEST_F(GmmTests, givenTilingModeSetToTileYWhenHwSupportsTilingThenTileYFlagIsSet
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
imgInfo.linearStorage = false;
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), imgInfo, StorageInfo{});
|
||||
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), imgInfo, StorageInfo{});
|
||||
|
||||
EXPECT_EQ(gmm->resourceParams.Flags.Info.Linear, 0u);
|
||||
EXPECT_EQ(gmm->resourceParams.Flags.Info.TiledY, 0u);
|
||||
@ -307,7 +308,7 @@ TEST_F(GmmTests, givenTilingModeSetToNonTiledWhenCreatingGmmThenLinearFlagIsSet)
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
imgInfo.linearStorage = true;
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), imgInfo, StorageInfo{});
|
||||
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), imgInfo, StorageInfo{});
|
||||
|
||||
EXPECT_EQ(gmm->resourceParams.Flags.Info.Linear, 1u);
|
||||
EXPECT_EQ(gmm->resourceParams.Flags.Info.TiledY, 0u);
|
||||
@ -401,7 +402,7 @@ TEST_F(GmmTests, givenMipmapedInputWhenAskedForHalingThenNonDefaultValueIsReturn
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, mipLevel, nullptr);
|
||||
|
||||
auto queryGmm = MockGmm::queryImgParams(rootDeviceEnvironment->getGmmClientContext(), imgInfo);
|
||||
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo);
|
||||
|
||||
EXPECT_EQ(static_cast<int>(queryGmm->resourceParams.MaxLod), mipLevel);
|
||||
}
|
||||
@ -418,7 +419,7 @@ struct GmmMediaCompressedTests : public GmmTests {
|
||||
void SetUp() override {
|
||||
GmmTests::SetUp();
|
||||
StorageInfo info;
|
||||
gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 4, false, true, true, info);
|
||||
gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 4, false, true, true, info);
|
||||
flags = gmm->gmmResourceInfo->getResourceFlags();
|
||||
flags->Gpu.CCS = true;
|
||||
flags->Gpu.UnifiedAuxSurface = true;
|
||||
@ -534,7 +535,7 @@ TEST_P(GmmImgTest, updateImgInfoAndDesc) {
|
||||
}
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
auto queryGmm = MockGmm::queryImgParams(rootDeviceEnvironment->getGmmClientContext(), imgInfo);
|
||||
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo);
|
||||
|
||||
auto mockResInfo = new NiceMock<MyMockGmmResourceInfo>(&queryGmm->resourceParams);
|
||||
queryGmm->gmmResourceInfo.reset(mockResInfo);
|
||||
@ -559,7 +560,7 @@ TEST_P(GmmImgTest, updateImgInfoAndDesc) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST(GmmImgTest, givenImgInfoWhenUpdatingOffsetsCallGmmToGetOffsets) {
|
||||
TEST_F(GmmImgTest, givenImgInfoWhenUpdatingOffsetsCallGmmToGetOffsets) {
|
||||
struct GmmGetOffsetOutput {
|
||||
uint32_t Offset;
|
||||
uint32_t XOffset;
|
||||
@ -598,7 +599,7 @@ TEST(GmmImgTest, givenImgInfoWhenUpdatingOffsetsCallGmmToGetOffsets) {
|
||||
imgDesc.image_array_size = 10;
|
||||
|
||||
ImageInfo imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
std::unique_ptr<Gmm> gmm = MockGmm::queryImgParams(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), imgInfo);
|
||||
std::unique_ptr<Gmm> gmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo);
|
||||
MyMockGmmResourceInfo *mockGmmResourceInfo = new MyMockGmmResourceInfo(&gmm->resourceParams);
|
||||
gmm->gmmResourceInfo.reset(mockGmmResourceInfo);
|
||||
|
||||
@ -622,7 +623,7 @@ TEST_F(GmmTests, copyResourceBlt) {
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
auto gmm = MockGmm::queryImgParams(rootDeviceEnvironment->getGmmClientContext(), imgInfo);
|
||||
auto gmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo);
|
||||
auto mockResInfo = reinterpret_cast<NiceMock<MockGmmResourceInfo> *>(gmm->gmmResourceInfo.get());
|
||||
|
||||
GMM_RES_COPY_BLT requestedCpuBlt = {};
|
||||
@ -681,8 +682,8 @@ TEST_F(GmmTests, copyResourceBlt) {
|
||||
EXPECT_TRUE(memcmp(&expectedCpuBlt, &requestedCpuBlt, sizeof(GMM_RES_COPY_BLT)) == 0);
|
||||
}
|
||||
|
||||
TEST(GmmTest, givenAllValidFlagsWhenAskedForUnifiedAuxTranslationCapabilityThenReturnTrue) {
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, false));
|
||||
TEST_F(GmmTests, givenAllValidFlagsWhenAskedForUnifiedAuxTranslationCapabilityThenReturnTrue) {
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, false));
|
||||
auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||
|
||||
mockResource->setUnifiedAuxTranslationCapable();
|
||||
@ -693,8 +694,8 @@ TEST(GmmTest, givenAllValidFlagsWhenAskedForUnifiedAuxTranslationCapabilityThenR
|
||||
EXPECT_TRUE(gmm->unifiedAuxTranslationCapable());
|
||||
}
|
||||
|
||||
TEST(GmmTest, givenInvalidFlagsSetWhenAskedForUnifiedAuxTranslationCapabilityThenReturnFalse) {
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, false));
|
||||
TEST_F(GmmTests, givenInvalidFlagsSetWhenAskedForUnifiedAuxTranslationCapabilityThenReturnFalse) {
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, false));
|
||||
auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||
|
||||
mockResource->mockResourceCreateParams.Flags.Gpu.CCS = 0;
|
||||
@ -716,12 +717,12 @@ TEST(GmmTest, givenHwInfoWhenDeviceIsCreatedTheSetThisHwInfoToGmmHelper) {
|
||||
EXPECT_EQ(&device->getHardwareInfo(), device->getGmmHelper()->getHardwareInfo());
|
||||
}
|
||||
|
||||
TEST(GmmTest, whenResourceIsCreatedThenHandleItsOwnership) {
|
||||
TEST_F(GmmTests, whenResourceIsCreatedThenHandleItsOwnership) {
|
||||
struct MyMockResourecInfo : public GmmResourceInfo {
|
||||
using GmmResourceInfo::resourceInfo;
|
||||
|
||||
MyMockResourecInfo(GMM_RESCREATE_PARAMS *inputParams) : GmmResourceInfo(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), inputParams){};
|
||||
MyMockResourecInfo(GMM_RESOURCE_INFO *inputGmmResourceInfo) : GmmResourceInfo(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), inputGmmResourceInfo){};
|
||||
MyMockResourecInfo(GmmClientContext *clientContext, GMM_RESCREATE_PARAMS *inputParams) : GmmResourceInfo(clientContext, inputParams){};
|
||||
MyMockResourecInfo(GmmClientContext *clientContext, GMM_RESOURCE_INFO *inputGmmResourceInfo) : GmmResourceInfo(clientContext, inputGmmResourceInfo){};
|
||||
};
|
||||
|
||||
GMM_RESCREATE_PARAMS gmmParams = {};
|
||||
@ -735,64 +736,40 @@ TEST(GmmTest, whenResourceIsCreatedThenHandleItsOwnership) {
|
||||
gmmParams.Flags.Gpu.Texture = 1;
|
||||
gmmParams.Usage = GMM_RESOURCE_USAGE_OCL_BUFFER;
|
||||
|
||||
MyMockResourecInfo myMockResourceInfo1(&gmmParams);
|
||||
MyMockResourecInfo myMockResourceInfo1(getGmmClientContext(), &gmmParams);
|
||||
EXPECT_NE(nullptr, myMockResourceInfo1.resourceInfo.get());
|
||||
|
||||
MyMockResourecInfo myMockResourceInfo2(myMockResourceInfo1.resourceInfo.get());
|
||||
MyMockResourecInfo myMockResourceInfo2(getGmmClientContext(), myMockResourceInfo1.resourceInfo.get());
|
||||
EXPECT_NE(nullptr, myMockResourceInfo2.resourceInfo.get());
|
||||
|
||||
EXPECT_NE(myMockResourceInfo1.resourceInfo.get(), myMockResourceInfo2.resourceInfo.get());
|
||||
}
|
||||
|
||||
TEST(GmmTest, givenGmmWithNotSetMCSInResourceInfoGpuFlagsWhenCallHasMultisampleControlSurfaceThenReturnFalse) {
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, false));
|
||||
using GmmEnvironmentTest = MockExecutionEnvironmentGmmFixtureTest;
|
||||
|
||||
TEST_F(GmmEnvironmentTest, givenGmmWithNotSetMCSInResourceInfoGpuFlagsWhenCallHasMultisampleControlSurfaceThenReturnFalse) {
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, false));
|
||||
EXPECT_FALSE(gmm->hasMultisampleControlSurface());
|
||||
}
|
||||
|
||||
TEST(GmmTest, givenGmmWithSetMCSInResourceInfoGpuFlagsWhenCallhasMultisampleControlSurfaceThenReturnTrue) {
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, false));
|
||||
TEST_F(GmmEnvironmentTest, givenGmmWithSetMCSInResourceInfoGpuFlagsWhenCallhasMultisampleControlSurfaceThenReturnTrue) {
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, false));
|
||||
auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||
mockResource->setMultisampleControlSurface();
|
||||
EXPECT_TRUE(gmm->hasMultisampleControlSurface());
|
||||
}
|
||||
|
||||
TEST(GmmHelperTest, whenGmmHelperIsInitializedThenClientContextIsSet) {
|
||||
ASSERT_NE(nullptr, platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmHelper());
|
||||
EXPECT_NE(nullptr, platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext()->getHandle());
|
||||
TEST_F(GmmEnvironmentTest, whenGmmHelperIsInitializedThenClientContextIsSet) {
|
||||
ASSERT_NE(nullptr, getGmmHelper());
|
||||
EXPECT_NE(nullptr, getGmmClientContext()->getHandle());
|
||||
}
|
||||
|
||||
TEST(GmmHelperTest, givenPlatformAlreadyDestroyedWhenResourceIsBeingDestroyedThenObserveNoExceptions) {
|
||||
struct MockGmmResourecInfo : public GmmResourceInfo {
|
||||
using GmmResourceInfo::resourceInfo;
|
||||
MockGmmResourecInfo(GMM_RESCREATE_PARAMS *inputParams) : GmmResourceInfo(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), inputParams){};
|
||||
};
|
||||
struct GmmHelperTests : MockExecutionEnvironmentGmmFixtureTest {
|
||||
using MockExecutionEnvironmentGmmFixture::executionEnvironment;
|
||||
};
|
||||
|
||||
GMM_RESCREATE_PARAMS gmmParams = {};
|
||||
gmmParams.Type = RESOURCE_BUFFER;
|
||||
gmmParams.Format = GMM_FORMAT_GENERIC_8BIT;
|
||||
gmmParams.BaseWidth64 = 1;
|
||||
gmmParams.BaseHeight = 1;
|
||||
gmmParams.Depth = 1;
|
||||
gmmParams.Flags.Info.Linear = 1;
|
||||
gmmParams.Flags.Info.Cacheable = 1;
|
||||
gmmParams.Flags.Gpu.Texture = 1;
|
||||
gmmParams.Usage = GMM_RESOURCE_USAGE_OCL_BUFFER;
|
||||
|
||||
auto gmmResourceInfo = new MockGmmResourecInfo(&gmmParams);
|
||||
|
||||
auto executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
executionEnvironment->incRefInternal();
|
||||
platformsImpl.clear();
|
||||
EXPECT_EQ(nullptr, platform());
|
||||
|
||||
EXPECT_NO_THROW(delete gmmResourceInfo);
|
||||
|
||||
executionEnvironment->decRefInternal();
|
||||
}
|
||||
|
||||
TEST(GmmHelperTest, givenValidGmmFunctionsWhenCreateGmmHelperWithInitializedOsInterfaceThenProperParametersArePassed) {
|
||||
TEST_F(GmmHelperTests, givenValidGmmFunctionsWhenCreateGmmHelperWithInitializedOsInterfaceThenProperParametersArePassed) {
|
||||
std::unique_ptr<GmmHelper> gmmHelper;
|
||||
auto executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
|
||||
VariableBackup<decltype(passedInputArgs)> passedInputArgsBackup(&passedInputArgs);
|
||||
VariableBackup<decltype(passedFtrTable)> passedFtrTableBackup(&passedFtrTable);
|
||||
|
@ -9,8 +9,6 @@
|
||||
|
||||
#include "shared/test/unit_test/mocks/mock_device.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
bool &MockClDevice::createSingleDevice = MockDevice::createSingleDevice;
|
||||
|
@ -8,15 +8,17 @@
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/gmm_helper/gmm.h"
|
||||
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "opencl/test/unit_test/fixtures/mock_execution_environment_gmm_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/mock_wddm_allocation.h"
|
||||
#include "opencl/test/unit_test/utilities/file_logger_tests.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
TEST(FileLogger, GivenLogAllocationMemoryPoolFlagThenLogsCorrectInfo) {
|
||||
using FileLoggerTests = Test<MockExecutionEnvironmentGmmFixture>;
|
||||
|
||||
TEST_F(FileLoggerTests, GivenLogAllocationMemoryPoolFlagThenLogsCorrectInfo) {
|
||||
std::string testFile = "testfile";
|
||||
DebugVariables flags;
|
||||
flags.LogAllocationMemoryPool.set(true);
|
||||
@ -30,7 +32,7 @@ TEST(FileLogger, GivenLogAllocationMemoryPoolFlagThenLogsCorrectInfo) {
|
||||
allocation.handle = 4;
|
||||
allocation.setAllocationType(GraphicsAllocation::AllocationType::BUFFER);
|
||||
allocation.memoryPool = MemoryPool::System64KBPages;
|
||||
auto gmm = std::make_unique<Gmm>(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 0, false);
|
||||
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 0, false);
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
allocation.getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly = 0;
|
||||
|
||||
@ -53,7 +55,7 @@ TEST(FileLogger, GivenLogAllocationMemoryPoolFlagThenLogsCorrectInfo) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST(FileLogger, GivenLogAllocationMemoryPoolFlagSetFalseThenAllocationIsNotLogged) {
|
||||
TEST_F(FileLoggerTests, GivenLogAllocationMemoryPoolFlagSetFalseThenAllocationIsNotLogged) {
|
||||
std::string testFile = "testfile";
|
||||
DebugVariables flags;
|
||||
flags.LogAllocationMemoryPool.set(false);
|
||||
@ -67,7 +69,7 @@ TEST(FileLogger, GivenLogAllocationMemoryPoolFlagSetFalseThenAllocationIsNotLogg
|
||||
allocation.handle = 4;
|
||||
allocation.setAllocationType(GraphicsAllocation::AllocationType::BUFFER);
|
||||
allocation.memoryPool = MemoryPool::System64KBPages;
|
||||
auto gmm = std::make_unique<Gmm>(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 0, false);
|
||||
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 0, false);
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
allocation.getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly = 0;
|
||||
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm_resource_info.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_io_functions.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_memory_manager.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm_residency_logger.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/mock_wddm_allocation.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/ult_dxgi_factory.h"
|
||||
@ -51,11 +50,11 @@ extern uint32_t numRootDevicesToEnum;
|
||||
using namespace NEO;
|
||||
|
||||
namespace GmmHelperFunctions {
|
||||
Gmm *getGmm(void *ptr, size_t size) {
|
||||
Gmm *getGmm(void *ptr, size_t size, GmmClientContext *clientContext) {
|
||||
size_t alignedSize = alignSizeWholePage(ptr, size);
|
||||
void *alignedPtr = alignUp(ptr, 4096);
|
||||
|
||||
Gmm *gmm = new Gmm(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), alignedPtr, alignedSize, false);
|
||||
Gmm *gmm = new Gmm(clientContext, alignedPtr, alignedSize, false);
|
||||
EXPECT_NE(gmm->gmmResourceInfo.get(), nullptr);
|
||||
return gmm;
|
||||
}
|
||||
@ -86,7 +85,7 @@ TEST_F(Wddm20Tests, doubleCreation) {
|
||||
}
|
||||
|
||||
TEST_F(Wddm20Tests, givenNullPageTableManagerAndRenderCompressedResourceWhenMappingGpuVaThenDontUpdateAuxTable) {
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(rootDeviceEnvironemnt->getGmmClientContext(), nullptr, 1, false));
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, false));
|
||||
auto mockGmmRes = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||
mockGmmRes->setUnifiedAuxTranslationCapable();
|
||||
|
||||
@ -195,7 +194,7 @@ TEST_F(Wddm20Tests, whenInitializeWddmThenContextIsCreated) {
|
||||
TEST_F(Wddm20Tests, allocation) {
|
||||
OsAgnosticMemoryManager mm(*executionEnvironment);
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmClientContext());
|
||||
|
||||
allocation.setDefaultGmm(gmm);
|
||||
auto status = wddm->createAllocation(&allocation);
|
||||
@ -219,7 +218,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenAllocationSmallerUnderlyingThanAlignedSiz
|
||||
size_t alignedPages = alignedSize / MemoryConstants::pageSize;
|
||||
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, ptr, 0x2100, nullptr, MemoryPool::MemoryNull);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize());
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize(), getGmmClientContext());
|
||||
|
||||
allocation.setDefaultGmm(gmm);
|
||||
auto status = wddm->createAllocation(&allocation);
|
||||
@ -260,7 +259,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenReserveCallWhenItIsCalledWithProperParamt
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenWddmAllocationWhenMappingGpuVaThenUseGmmSize) {
|
||||
void *fakePtr = reinterpret_cast<void *>(0x123);
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, fakePtr, 100, nullptr, MemoryPool::MemoryNull);
|
||||
std::unique_ptr<Gmm> gmm(GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize()));
|
||||
std::unique_ptr<Gmm> gmm(GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize(), getGmmClientContext()));
|
||||
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
auto status = wddm->createAllocation(&allocation);
|
||||
@ -278,7 +277,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenWddmAllocationWhenMappingGpuVaThenUseGmmS
|
||||
TEST_F(Wddm20Tests, givenGraphicsAllocationWhenItIsMappedInHeap0ThenItHasGpuAddressWithinHeapInternalLimits) {
|
||||
void *alignedPtr = (void *)0x12000;
|
||||
size_t alignedSize = 0x2000;
|
||||
std::unique_ptr<Gmm> gmm(GmmHelperFunctions::getGmm(alignedPtr, alignedSize));
|
||||
std::unique_ptr<Gmm> gmm(GmmHelperFunctions::getGmm(alignedPtr, alignedSize, getGmmClientContext()));
|
||||
uint64_t gpuAddress = 0u;
|
||||
auto heapBase = wddm->getGfxPartition().Heap32[static_cast<uint32_t>(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY)].Base;
|
||||
auto heapLimit = wddm->getGfxPartition().Heap32[static_cast<uint32_t>(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY)].Limit;
|
||||
@ -327,7 +326,7 @@ TEST_F(Wddm20WithMockGdiDllTests, GivenThreeOsHandlesWhenAskedForDestroyAllocati
|
||||
TEST_F(Wddm20Tests, mapAndFreeGpuVa) {
|
||||
OsAgnosticMemoryManager mm(*executionEnvironment);
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmClientContext());
|
||||
|
||||
allocation.setDefaultGmm(gmm);
|
||||
auto status = wddm->createAllocation(&allocation);
|
||||
@ -353,7 +352,7 @@ TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
|
||||
OsAgnosticMemoryManager mm(*executionEnvironment);
|
||||
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 100, nullptr, MemoryPool::MemoryNull);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmClientContext());
|
||||
|
||||
allocation.setDefaultGmm(gmm);
|
||||
auto status = wddm->createAllocation(&allocation);
|
||||
@ -372,7 +371,7 @@ TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
|
||||
TEST_F(WddmTestWithMockGdiDll, givenShareableAllocationWhenCreateThenCreateResourceFlagIsEnabled) {
|
||||
init();
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, MemoryConstants::pageSize, nullptr, MemoryPool::MemoryNull, true);
|
||||
auto gmm = std::unique_ptr<Gmm>(GmmHelperFunctions::getGmm(nullptr, MemoryConstants::pageSize));
|
||||
auto gmm = std::unique_ptr<Gmm>(GmmHelperFunctions::getGmm(nullptr, MemoryConstants::pageSize, getGmmClientContext()));
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
auto status = wddm->createAllocation(&allocation);
|
||||
EXPECT_EQ(STATUS_SUCCESS, status);
|
||||
@ -389,7 +388,7 @@ TEST_F(WddmTestWithMockGdiDll, givenShareableAllocationWhenCreateThenSharedHandl
|
||||
};
|
||||
MemoryManagerCreate<MockWddmMemoryManager> memoryManager(false, false, *executionEnvironment);
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, MemoryConstants::pageSize, nullptr, MemoryPool::MemoryNull, true);
|
||||
auto gmm = std::unique_ptr<Gmm>(GmmHelperFunctions::getGmm(nullptr, MemoryConstants::pageSize));
|
||||
auto gmm = std::unique_ptr<Gmm>(GmmHelperFunctions::getGmm(nullptr, MemoryConstants::pageSize, getGmmClientContext()));
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
auto status = memoryManager.createGpuAllocationsWithRetry(&allocation);
|
||||
EXPECT_TRUE(status);
|
||||
@ -414,7 +413,7 @@ TEST(WddmAllocationTest, whenAllocationIsNotShareableThenItDoesntReturnSharedHan
|
||||
TEST_F(Wddm20Tests, makeResidentNonResident) {
|
||||
OsAgnosticMemoryManager mm(*executionEnvironment);
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmClientContext());
|
||||
|
||||
allocation.setDefaultGmm(gmm);
|
||||
auto status = wddm->createAllocation(&allocation);
|
||||
@ -447,7 +446,7 @@ TEST_F(Wddm20Tests, makeResidentNonResident) {
|
||||
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenGraphicsAllocationWithSharedPropertiesIsCreated) {
|
||||
void *pSysMem = (void *)0x1000;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096u, false));
|
||||
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
EXPECT_EQ(0u, status);
|
||||
|
||||
@ -484,7 +483,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationF
|
||||
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenMapGpuVaWithCpuPtrDepensOnBitness) {
|
||||
void *pSysMem = (void *)0x1000;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096u, false));
|
||||
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
EXPECT_EQ(0u, status);
|
||||
|
||||
@ -806,7 +805,7 @@ TEST_F(Wddm20Tests, givenReadOnlyMemoryWhenCreateAllocationFailsWithNoVideoMemor
|
||||
handleStorage.fragmentStorageData[0].freeTheFragment = false;
|
||||
handleStorage.fragmentStorageData[0].osHandleStorage = &handle;
|
||||
handleStorage.fragmentStorageData[0].residency = &residency;
|
||||
handleStorage.fragmentStorageData[0].osHandleStorage->gmm = GmmHelperFunctions::getGmm(nullptr, 0);
|
||||
handleStorage.fragmentStorageData[0].osHandleStorage->gmm = GmmHelperFunctions::getGmm(nullptr, 0, getGmmClientContext());
|
||||
|
||||
NTSTATUS result = wddm->createAllocationsAndMapGpuVa(handleStorage);
|
||||
|
||||
@ -889,7 +888,7 @@ TEST_F(WddmLockWithMakeResidentTests, givenAllocationWhenApplyBlockingMakeReside
|
||||
TEST_F(WddmLockWithMakeResidentTests, givenAllocationWhenApplyBlockingMakeResidentAndMakeResidentCallFailsThenEvictTemporaryResourcesAndRetry) {
|
||||
MockWddmAllocation allocation;
|
||||
allocation.handle = 0x3;
|
||||
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
||||
EXPECT_CALL(gmockWddm, makeResident(&allocation.handle, ::testing::_, ::testing::_, ::testing::_, ::testing::_)).Times(2).WillRepeatedly(::testing::Return(false));
|
||||
gmockWddm.temporaryResources->makeResidentResource(allocation.handle, 0x1000);
|
||||
@ -898,7 +897,7 @@ TEST_F(WddmLockWithMakeResidentTests, givenAllocationWhenApplyBlockingMakeReside
|
||||
TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndTemporaryResourcesAreEvictedSuccessfullyThenCallMakeResidentOneMoreTime) {
|
||||
MockWddmAllocation allocation;
|
||||
allocation.handle = 0x3;
|
||||
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
||||
mockTemporaryResources->resourceHandles.push_back(allocation.handle);
|
||||
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillRepeatedly(::testing::Return(true));
|
||||
@ -909,7 +908,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndTemporaryR
|
||||
TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeResidentStillFailsThenDontStoreTemporaryResource) {
|
||||
MockWddmAllocation allocation;
|
||||
allocation.handle = 0x2;
|
||||
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
||||
mockTemporaryResources->resourceHandles.push_back(0x1);
|
||||
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillRepeatedly(::testing::Return(true));
|
||||
@ -921,7 +920,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeReside
|
||||
TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeResidentPassesAfterEvictThenStoreTemporaryResource) {
|
||||
MockWddmAllocation allocation;
|
||||
allocation.handle = 0x2;
|
||||
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
||||
mockTemporaryResources->resourceHandles.push_back(0x1);
|
||||
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillRepeatedly(::testing::Return(true));
|
||||
@ -934,7 +933,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeReside
|
||||
TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeResidentPassesThenStoreTemporaryResource) {
|
||||
MockWddmAllocation allocation;
|
||||
allocation.handle = 0x2;
|
||||
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
||||
mockTemporaryResources->resourceHandles.push_back(0x1);
|
||||
EXPECT_CALL(gmockWddm, makeResident(&allocation.handle, ::testing::_, ::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
|
||||
@ -953,7 +952,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenEvictingAllTemporaryResourcesThenAcqui
|
||||
}
|
||||
TEST_F(WddmLockWithMakeResidentTests, whenEvictingAllTemporaryResourcesAndAllEvictionsSucceedThenReturnSuccess) {
|
||||
MockWddmAllocation allocation;
|
||||
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
||||
mockTemporaryResources->resourceHandles.push_back(allocation.handle);
|
||||
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
|
||||
@ -962,7 +961,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenEvictingAllTemporaryResourcesAndAllEvi
|
||||
EXPECT_EQ(MemoryOperationsStatus::SUCCESS, mockTemporaryResources->evictAllResourcesResult.operationSuccess);
|
||||
}
|
||||
TEST_F(WddmLockWithMakeResidentTests, givenThreeAllocationsWhenEvictingAllTemporaryResourcesThenCallEvictForEachAllocationAndCleanList) {
|
||||
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
||||
constexpr uint32_t numAllocations = 3u;
|
||||
for (auto i = 0u; i < numAllocations; i++) {
|
||||
@ -1000,7 +999,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenEvictingNonExistingTemporaryResourceTh
|
||||
EXPECT_EQ(MemoryOperationsStatus::MEMORY_NOT_FOUND, mockTemporaryResources->evictResourceResult.operationSuccess);
|
||||
}
|
||||
TEST_F(WddmLockWithMakeResidentTests, whenEvictingTemporaryResourceAndEvictFailsThenReturnFail) {
|
||||
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
||||
mockTemporaryResources->resourceHandles.push_back(ALLOCATION_HANDLE);
|
||||
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(false));
|
||||
@ -1009,7 +1008,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenEvictingTemporaryResourceAndEvictFails
|
||||
EXPECT_EQ(MemoryOperationsStatus::FAILED, mockTemporaryResources->evictResourceResult.operationSuccess);
|
||||
}
|
||||
TEST_F(WddmLockWithMakeResidentTests, whenEvictingTemporaryResourceAndEvictSucceedThenReturnSuccess) {
|
||||
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
GmockWddm gmockWddm(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(gmockWddm.temporaryResources.get());
|
||||
mockTemporaryResources->resourceHandles.push_back(ALLOCATION_HANDLE);
|
||||
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
|
||||
@ -1071,7 +1070,7 @@ TEST(WddmGfxPartitionTests, initGfxPartitionHeapStandard64KBSplit) {
|
||||
MockWddm(RootDeviceEnvironment &rootDeviceEnvironment) : Wddm(std::move(OSInterface::discoverDevices(rootDeviceEnvironment.executionEnvironment)[0]), rootDeviceEnvironment) {}
|
||||
};
|
||||
|
||||
MockWddm wddm(*platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0].get());
|
||||
MockWddm wddm(*platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]);
|
||||
|
||||
uint32_t rootDeviceIndex = 3;
|
||||
size_t numRootDevices = 5;
|
||||
@ -1186,7 +1185,7 @@ TEST_F(Wddm20WithMockGdiDllTests, whenSetDeviceInfoSucceedsThenDeviceCallbacksAr
|
||||
|
||||
TEST_F(Wddm20WithMockGdiDllTests, whenSetDeviceInfoFailsThenDeviceIsNotConfigured) {
|
||||
|
||||
auto gmockGmmMemory = new ::testing::NiceMock<GmockGmmMemory>(rootDeviceEnvironment->getGmmClientContext());
|
||||
auto gmockGmmMemory = new ::testing::NiceMock<GmockGmmMemory>(getGmmClientContext());
|
||||
ON_CALL(*gmockGmmMemory, setDeviceInfo(::testing::_))
|
||||
.WillByDefault(::testing::Return(false));
|
||||
EXPECT_CALL(*gmockGmmMemory, configureDeviceAddressSpace(::testing::_,
|
||||
@ -1205,7 +1204,7 @@ HWTEST_F(Wddm20WithMockGdiDllTests, givenNonGen12LPPlatformWhenConfigureDeviceAd
|
||||
if (defaultHwInfo->platform.eRenderCoreFamily == IGFX_GEN12LP_CORE) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
auto gmmMemory = new ::testing::NiceMock<GmockGmmMemory>(rootDeviceEnvironment->getGmmClientContext());
|
||||
auto gmmMemory = new ::testing::NiceMock<GmockGmmMemory>(getGmmClientContext());
|
||||
wddm->gmmMemory.reset(gmmMemory);
|
||||
ON_CALL(*gmmMemory, configureDeviceAddressSpace(::testing::_,
|
||||
::testing::_,
|
||||
|
@ -19,8 +19,8 @@
|
||||
#include "shared/test/unit_test/helpers/default_hw_info.h"
|
||||
#include "shared/test/unit_test/os_interface/windows/mock_gdi_interface.h"
|
||||
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "opencl/test/unit_test/fixtures/mock_execution_environment_gmm_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm_interface20.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm_residency_allocations_container.h"
|
||||
@ -30,9 +30,9 @@
|
||||
#include "mock_gmm_memory.h"
|
||||
|
||||
namespace NEO {
|
||||
struct WddmFixture : ::testing::Test {
|
||||
struct WddmFixture : public Test<MockExecutionEnvironmentGmmFixture> {
|
||||
void SetUp() override {
|
||||
executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
MockExecutionEnvironmentGmmFixture::SetUp();
|
||||
rootDeviceEnvironemnt = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
auto osEnvironment = new OsEnvironmentWin();
|
||||
gdi = new MockGdi();
|
||||
@ -54,7 +54,6 @@ struct WddmFixture : ::testing::Test {
|
||||
|
||||
WddmMock *wddm = nullptr;
|
||||
OSInterface *osInterface;
|
||||
ExecutionEnvironment *executionEnvironment;
|
||||
RootDeviceEnvironment *rootDeviceEnvironemnt = nullptr;
|
||||
std::unique_ptr<OsContextWin> osContext;
|
||||
|
||||
@ -62,11 +61,11 @@ struct WddmFixture : ::testing::Test {
|
||||
MockWddmResidentAllocationsContainer *mockTemporaryResources;
|
||||
};
|
||||
|
||||
struct WddmFixtureWithMockGdiDll : public GdiDllFixture {
|
||||
struct WddmFixtureWithMockGdiDll : public GdiDllFixture, public MockExecutionEnvironmentGmmFixture {
|
||||
void SetUp() override {
|
||||
executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
MockExecutionEnvironmentGmmFixture::SetUp();
|
||||
GdiDllFixture::SetUp();
|
||||
rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
wddm = static_cast<WddmMock *>(Wddm::createWddm(nullptr, *rootDeviceEnvironment));
|
||||
wddmMockInterface = new WddmMockInterface20(*wddm);
|
||||
wddm->wddmInterface.reset(wddmMockInterface);
|
||||
@ -95,7 +94,6 @@ struct WddmFixtureWithMockGdiDll : public GdiDllFixture {
|
||||
WddmMock *wddm = nullptr;
|
||||
OSInterface *osInterface;
|
||||
std::unique_ptr<OsContextWin> osContext;
|
||||
ExecutionEnvironment *executionEnvironment;
|
||||
WddmMockInterface20 *wddmMockInterface = nullptr;
|
||||
RootDeviceEnvironment *rootDeviceEnvironment = nullptr;
|
||||
};
|
||||
|
Reference in New Issue
Block a user