Initial implementation of CacheSettingsHelper

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski 2022-02-04 13:50:19 +00:00 committed by Compute-Runtime-Automation
parent c88fce0def
commit a95198521e
41 changed files with 250 additions and 163 deletions

View File

@ -160,7 +160,7 @@ class MemoryManagerNTHandleMock : public NEO::OsAgnosticMemoryManager {
rootDeviceIndex, false, false, false); rootDeviceIndex, false, false, false);
graphicsAllocation->setSharedHandle(static_cast<osHandle>(reinterpret_cast<uint64_t>(handle))); graphicsAllocation->setSharedHandle(static_cast<osHandle>(reinterpret_cast<uint64_t>(handle)));
graphicsAllocation->set32BitAllocation(false); graphicsAllocation->set32BitAllocation(false);
graphicsAllocation->setDefaultGmm(new Gmm(executionEnvironment.rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); graphicsAllocation->setDefaultGmm(new Gmm(executionEnvironment.rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
return graphicsAllocation; return graphicsAllocation;
} }
}; };

View File

@ -363,7 +363,7 @@ class MemoryManagerNTHandleMock : public NEO::OsAgnosticMemoryManager {
rootDeviceIndex, false, false, false); rootDeviceIndex, false, false, false);
graphicsAllocation->setSharedHandle(static_cast<osHandle>(reinterpret_cast<uint64_t>(handle))); graphicsAllocation->setSharedHandle(static_cast<osHandle>(reinterpret_cast<uint64_t>(handle)));
graphicsAllocation->set32BitAllocation(false); graphicsAllocation->set32BitAllocation(false);
graphicsAllocation->setDefaultGmm(new Gmm(executionEnvironment.rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); graphicsAllocation->setDefaultGmm(new Gmm(executionEnvironment.rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
return graphicsAllocation; return graphicsAllocation;
} }
}; };

View File

@ -633,7 +633,7 @@ HWTEST2_P(AuxBuiltInTests, givenAuxToNonAuxTranslationWhenSettingSurfaceStateThe
std::unique_ptr<Buffer> buffer = nullptr; std::unique_ptr<Buffer> buffer = nullptr;
std::unique_ptr<GraphicsAllocation> gfxAllocation = nullptr; std::unique_ptr<GraphicsAllocation> gfxAllocation = nullptr;
auto gmm = std::unique_ptr<Gmm>(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); auto gmm = std::unique_ptr<Gmm>(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
gmm->isCompressionEnabled = true; gmm->isCompressionEnabled = true;
if (kernelObjType == MockKernelObjForAuxTranslation::Type::MEM_OBJ) { if (kernelObjType == MockKernelObjForAuxTranslation::Type::MEM_OBJ) {
@ -688,7 +688,7 @@ HWTEST2_P(AuxBuiltInTests, givenNonAuxToAuxTranslationWhenSettingSurfaceStateThe
builtinOpParams.auxTranslationDirection = AuxTranslationDirection::NonAuxToAux; builtinOpParams.auxTranslationDirection = AuxTranslationDirection::NonAuxToAux;
MockKernelObjForAuxTranslation mockKernelObjForAuxTranslation(kernelObjType); MockKernelObjForAuxTranslation mockKernelObjForAuxTranslation(kernelObjType);
auto gmm = std::make_unique<Gmm>(pDevice->getGmmClientContext(), nullptr, 1, 0, false, false, StorageInfo{}, true); auto gmm = std::make_unique<Gmm>(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
gmm->isCompressionEnabled = true; gmm->isCompressionEnabled = true;
if (kernelObjType == MockKernelObjForAuxTranslation::Type::MEM_OBJ) { if (kernelObjType == MockKernelObjForAuxTranslation::Type::MEM_OBJ) {
mockKernelObjForAuxTranslation.mockBuffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->setDefaultGmm(gmm.release()); mockKernelObjForAuxTranslation.mockBuffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->setDefaultGmm(gmm.release());

View File

@ -165,7 +165,7 @@ struct BlitEnqueueTests : public ::testing::Test {
if (compressed && !graphicsAllocation->getDefaultGmm()) { if (compressed && !graphicsAllocation->getDefaultGmm()) {
auto clientContext = device->getRootDeviceEnvironment().getGmmClientContext(); auto clientContext = device->getRootDeviceEnvironment().getGmmClientContext();
graphicsAllocation->setDefaultGmm(new Gmm(clientContext, nullptr, 0, 0, false, false, {}, true)); graphicsAllocation->setDefaultGmm(new Gmm(clientContext, nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
} }
if (graphicsAllocation->getDefaultGmm()) { if (graphicsAllocation->getDefaultGmm()) {

View File

@ -24,7 +24,7 @@ HWTEST_F(ReadWriteBufferCpuCopyTest, givenCompressedGmmWhenAskingForCpuOperation
cl_int retVal; cl_int retVal;
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex(); auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
std::unique_ptr<Buffer> buffer(Buffer::create(context, CL_MEM_READ_WRITE, 1, nullptr, retVal)); std::unique_ptr<Buffer> buffer(Buffer::create(context, CL_MEM_READ_WRITE, 1, nullptr, retVal));
auto gmm = new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true); auto gmm = new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm->isCompressionEnabled = false; gmm->isCompressionEnabled = false;
auto allocation = buffer->getGraphicsAllocation(rootDeviceIndex); auto allocation = buffer->getGraphicsAllocation(rootDeviceIndex);
allocation->setDefaultGmm(gmm); allocation->setDefaultGmm(gmm);

View File

@ -745,7 +745,7 @@ HWTEST_F(PerformanceHintTest, givenCompressedImageWhenItsCreatedThenProperPerfor
auto mockBuffer = std::unique_ptr<MockBuffer>(new MockBuffer()); auto mockBuffer = std::unique_ptr<MockBuffer>(new MockBuffer());
StorageInfo info; StorageInfo info;
size_t t = 4; size_t t = 4;
auto gmm = new Gmm(device->getGmmClientContext(), static_cast<const void *>(nullptr), t, 0, false, true, info, true); auto gmm = new Gmm(device->getGmmClientContext(), static_cast<const void *>(nullptr), t, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, info, true);
gmm->isCompressionEnabled = true; gmm->isCompressionEnabled = true;
auto graphicsAllocation = mockBuffer->getGraphicsAllocation(device->getRootDeviceIndex()); auto graphicsAllocation = mockBuffer->getGraphicsAllocation(device->getRootDeviceIndex());
@ -815,7 +815,7 @@ TEST_F(PerformanceHintTest, givenUncompressedImageWhenItsCreatedThenProperPerfor
auto mockBuffer = std::unique_ptr<MockBuffer>(new MockBuffer()); auto mockBuffer = std::unique_ptr<MockBuffer>(new MockBuffer());
StorageInfo info; StorageInfo info;
size_t t = 4; size_t t = 4;
auto gmm = new Gmm(device->getGmmClientContext(), (const void *)nullptr, t, 0, false, true, info, true); auto gmm = new Gmm(device->getGmmClientContext(), (const void *)nullptr, t, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, info, true);
gmm->isCompressionEnabled = false; gmm->isCompressionEnabled = false;
mockBuffer->getGraphicsAllocation(device->getRootDeviceIndex())->setDefaultGmm(gmm); mockBuffer->getGraphicsAllocation(device->getRootDeviceIndex())->setDefaultGmm(gmm);

View File

@ -94,7 +94,7 @@ GEN12LPTEST_F(ImageClearColorFixture, givenMcsAllocationWhenSetArgIsCalledWithUn
auto surfaceState = FamilyType::cmdInitRenderSurfaceState; auto surfaceState = FamilyType::cmdInitRenderSurfaceState;
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get()); auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
mcsAlloc->setDefaultGmm(new Gmm(context->getDevice(0)->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); mcsAlloc->setDefaultGmm(new Gmm(context->getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
surfaceState.setSurfaceBaseAddress(0xABCDEF1000); surfaceState.setSurfaceBaseAddress(0xABCDEF1000);
imageHw->setMcsSurfaceInfo(msi); imageHw->setMcsSurfaceInfo(msi);
imageHw->setMcsAllocation(mcsAlloc); imageHw->setMcsAllocation(mcsAlloc);

View File

@ -7,6 +7,7 @@
#include "shared/source/execution_environment/execution_environment.h" #include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/gmm_helper/cache_settings_helper.h"
#include "shared/source/gmm_helper/client_context/gmm_client_context.h" #include "shared/source/gmm_helper/client_context/gmm_client_context.h"
#include "shared/source/gmm_helper/gmm.h" #include "shared/source/gmm_helper/gmm.h"
#include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/gmm_helper/gmm_helper.h"
@ -75,7 +76,7 @@ TEST(GmmGlTests, givenGmmWhenAskedforCubeFaceIndexThenProperValueIsReturned) {
TEST_F(GmmTests, WhenGmmIsCreatedThenAllResourceAreCreated) { TEST_F(GmmTests, WhenGmmIsCreatedThenAllResourceAreCreated) {
std::unique_ptr<MemoryManager> mm(new MemoryManagerCreate<OsAgnosticMemoryManager>(false, false, *executionEnvironment)); std::unique_ptr<MemoryManager> mm(new MemoryManagerCreate<OsAgnosticMemoryManager>(false, false, *executionEnvironment));
void *pSysMem = mm->allocateSystemMemory(4096, 4096); void *pSysMem = mm->allocateSystemMemory(4096, 4096);
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
ASSERT_TRUE(gmm->gmmResourceInfo.get() != nullptr); ASSERT_TRUE(gmm->gmmResourceInfo.get() != nullptr);
@ -90,7 +91,7 @@ TEST_F(GmmTests, GivenUncacheableWhenGmmIsCreatedThenAllResourceAreCreated) {
std::unique_ptr<MemoryManager> mm(new MemoryManagerCreate<OsAgnosticMemoryManager>(false, false, *executionEnvironment)); std::unique_ptr<MemoryManager> mm(new MemoryManagerCreate<OsAgnosticMemoryManager>(false, false, *executionEnvironment));
void *pSysMem = mm->allocateSystemMemory(4096, 4096); void *pSysMem = mm->allocateSystemMemory(4096, 4096);
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, true, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC, false, {}, true));
ASSERT_TRUE(gmm->gmmResourceInfo.get() != nullptr); ASSERT_TRUE(gmm->gmmResourceInfo.get() != nullptr);
@ -107,7 +108,7 @@ TEST_F(GmmTests, givenHostPointerWithHighestBitSetWhenGmmIsCreatedThenItHasTheSa
auto address = reinterpret_cast<void *>(addressWithHighestBitSet); auto address = reinterpret_cast<void *>(addressWithHighestBitSet);
auto expectedAddress = castToUint64(address); auto expectedAddress = castToUint64(address);
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), address, 4096, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), address, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
EXPECT_EQ(gmm->resourceParams.pExistingSysMem, expectedAddress); EXPECT_EQ(gmm->resourceParams.pExistingSysMem, expectedAddress);
} }
@ -117,7 +118,7 @@ TEST_F(GmmTests, GivenBufferSizeLargerThenMaxPitchWhenAskedForGmmCreationThenGmm
MemoryManager *mm = new MemoryManagerCreate<OsAgnosticMemoryManager>(false, false, *executionEnvironment); MemoryManager *mm = new MemoryManagerCreate<OsAgnosticMemoryManager>(false, false, *executionEnvironment);
void *pSysMem = mm->allocateSystemMemory(4096, 4096); void *pSysMem = mm->allocateSystemMemory(4096, 4096);
auto gmmRes = new Gmm(getGmmClientContext(), pSysMem, maxSize, 0, false, false, {}, true); auto gmmRes = new Gmm(getGmmClientContext(), pSysMem, maxSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
ASSERT_TRUE(gmmRes->gmmResourceInfo.get() != nullptr); ASSERT_TRUE(gmmRes->gmmResourceInfo.get() != nullptr);
@ -131,7 +132,7 @@ TEST_F(GmmTests, GivenBufferSizeLargerThenMaxPitchWhenAskedForGmmCreationThenGmm
TEST_F(GmmTests, givenGmmCreatedFromExistingGmmThenHelperDoesNotReleaseParentGmm) { TEST_F(GmmTests, givenGmmCreatedFromExistingGmmThenHelperDoesNotReleaseParentGmm) {
auto size = 4096u; auto size = 4096u;
void *incomingPtr = (void *)0x1000; void *incomingPtr = (void *)0x1000;
auto gmmRes = new Gmm(getGmmClientContext(), incomingPtr, size, 0, false, false, {}, true); auto gmmRes = new Gmm(getGmmClientContext(), incomingPtr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmmRes2 = new Gmm(getGmmClientContext(), gmmRes->gmmResourceInfo->peekGmmResourceInfo()); auto gmmRes2 = new Gmm(getGmmClientContext(), gmmRes->gmmResourceInfo->peekGmmResourceInfo());
// copy is being made // copy is being made
@ -209,27 +210,27 @@ TEST_F(GmmTests, WhenQueryingImgParamsThenCorrectValuesAreReturned) {
TEST_F(GmmTests, givenWidthWhenCreatingResourceThenSetWidth64Field) { TEST_F(GmmTests, givenWidthWhenCreatingResourceThenSetWidth64Field) {
const void *dummyPtr = reinterpret_cast<void *>(0x123); const void *dummyPtr = reinterpret_cast<void *>(0x123);
size_t allocationSize = std::numeric_limits<size_t>::max(); size_t allocationSize = std::numeric_limits<size_t>::max();
Gmm gmm(getGmmClientContext(), dummyPtr, allocationSize, 0, false, false, {}, true); Gmm gmm(getGmmClientContext(), dummyPtr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
EXPECT_EQ(static_cast<uint64_t>(allocationSize), gmm.resourceParams.BaseWidth64); EXPECT_EQ(static_cast<uint64_t>(allocationSize), gmm.resourceParams.BaseWidth64);
} }
TEST_F(GmmTests, givenNullptrWhenGmmConstructorIsCalledThenNoGfxMemoryIsProperlySet) { TEST_F(GmmTests, givenNullptrWhenGmmConstructorIsCalledThenNoGfxMemoryIsProperlySet) {
void *pSysMem = nullptr; void *pSysMem = nullptr;
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
EXPECT_EQ(gmm->resourceParams.NoGfxMemory, 1u); EXPECT_EQ(gmm->resourceParams.NoGfxMemory, 1u);
} }
HWTEST_F(GmmTests, givenGmmWithForceLocalMemThenNonLocalIsSetToFalse) { HWTEST_F(GmmTests, givenGmmWithForceLocalMemThenNonLocalIsSetToFalse) {
void *pSysMem = nullptr; void *pSysMem = nullptr;
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
EXPECT_EQ(gmm->resourceParams.Flags.Info.NonLocalOnly, 0u); EXPECT_EQ(gmm->resourceParams.Flags.Info.NonLocalOnly, 0u);
} }
TEST_F(GmmTests, givenPtrWhenGmmConstructorIsCalledThenNoGfxMemoryIsProperlySet) { TEST_F(GmmTests, givenPtrWhenGmmConstructorIsCalledThenNoGfxMemoryIsProperlySet) {
void *pSysMem = reinterpret_cast<void *>(0x1111); void *pSysMem = reinterpret_cast<void *>(0x1111);
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
EXPECT_EQ(gmm->resourceParams.NoGfxMemory, 0u); EXPECT_EQ(gmm->resourceParams.NoGfxMemory, 0u);
} }
@ -490,7 +491,7 @@ struct GmmMediaCompressedTests : public GmmTests {
void SetUp() override { void SetUp() override {
GmmTests::SetUp(); GmmTests::SetUp();
StorageInfo info; StorageInfo info;
gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 4, 0, false, true, info, true); gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 4, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, info, true);
flags = gmm->gmmResourceInfo->getResourceFlags(); flags = gmm->gmmResourceInfo->getResourceFlags();
flags->Gpu.CCS = true; flags->Gpu.CCS = true;
flags->Gpu.UnifiedAuxSurface = true; flags->Gpu.UnifiedAuxSurface = true;
@ -750,7 +751,7 @@ TEST_F(GmmTests, GivenPlaneWhenCopyingResourceBltThenResourceIsCopiedCorrectly)
} }
TEST_F(GmmTests, givenAllValidFlagsWhenAskedForUnifiedAuxTranslationCapabilityThenReturnTrue) { TEST_F(GmmTests, givenAllValidFlagsWhenAskedForUnifiedAuxTranslationCapabilityThenReturnTrue) {
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get()); auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
mockResource->setUnifiedAuxTranslationCapable(); mockResource->setUnifiedAuxTranslationCapable();
@ -763,12 +764,12 @@ TEST_F(GmmTests, givenAllValidFlagsWhenAskedForUnifiedAuxTranslationCapabilityTh
TEST_F(GmmTests, givenAlignmentValueWhenConstructingGmmThenSetAlignmentInResourceCreateObject) { TEST_F(GmmTests, givenAlignmentValueWhenConstructingGmmThenSetAlignmentInResourceCreateObject) {
const uint32_t alignment = 8096; const uint32_t alignment = 8096;
Gmm gmm{getGmmClientContext(), nullptr, 1, alignment, false, false, {}, true}; Gmm gmm{getGmmClientContext(), nullptr, 1, alignment, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true};
EXPECT_EQ(alignment, gmm.resourceParams.BaseAlignment); EXPECT_EQ(alignment, gmm.resourceParams.BaseAlignment);
} }
TEST_F(GmmTests, givenInvalidFlagsSetWhenAskedForUnifiedAuxTranslationCapabilityThenReturnFalse) { TEST_F(GmmTests, givenInvalidFlagsSetWhenAskedForUnifiedAuxTranslationCapabilityThenReturnFalse) {
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get()); auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
mockResource->mockResourceCreateParams.Flags.Gpu.CCS = 0; mockResource->mockResourceCreateParams.Flags.Gpu.CCS = 0;
@ -787,14 +788,14 @@ TEST_F(GmmTests, givenInvalidFlagsSetWhenAskedForUnifiedAuxTranslationCapability
TEST_F(GmmTests, whenLargePagesAreImplicitlyAllowedThenEnableOptimizationPadding) { TEST_F(GmmTests, whenLargePagesAreImplicitlyAllowedThenEnableOptimizationPadding) {
size_t allocationSize = 128; size_t allocationSize = 128;
Gmm gmm(getGmmClientContext(), nullptr, allocationSize, 0, false, false, {}, true); Gmm gmm(getGmmClientContext(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
EXPECT_FALSE(gmm.resourceParams.Flags.Info.NoOptimizationPadding); EXPECT_FALSE(gmm.resourceParams.Flags.Info.NoOptimizationPadding);
} }
TEST_F(GmmTests, whenLargePagesAreExplicitlyAllowedAndUserPtrIsNullThenAllowOptimizationPadding) { TEST_F(GmmTests, whenLargePagesAreExplicitlyAllowedAndUserPtrIsNullThenAllowOptimizationPadding) {
size_t allocationSize = 128; size_t allocationSize = 128;
bool allowLargePages = true; bool allowLargePages = true;
Gmm gmm(getGmmClientContext(), nullptr, allocationSize, 0, false, false, {}, allowLargePages); Gmm gmm(getGmmClientContext(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages);
EXPECT_FALSE(gmm.resourceParams.Flags.Info.NoOptimizationPadding); EXPECT_FALSE(gmm.resourceParams.Flags.Info.NoOptimizationPadding);
} }
@ -802,14 +803,14 @@ TEST_F(GmmTests, whenLargePagesAreExplicitlyDisallowedButUserPtrIsNotNullThenAll
const void *dummyPtr = reinterpret_cast<void *>(0x123); const void *dummyPtr = reinterpret_cast<void *>(0x123);
size_t allocationSize = 128; size_t allocationSize = 128;
bool allowLargePages = false; bool allowLargePages = false;
Gmm gmm(getGmmClientContext(), dummyPtr, allocationSize, 0, false, false, {}, allowLargePages); Gmm gmm(getGmmClientContext(), dummyPtr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages);
EXPECT_FALSE(gmm.resourceParams.Flags.Info.NoOptimizationPadding); EXPECT_FALSE(gmm.resourceParams.Flags.Info.NoOptimizationPadding);
} }
TEST_F(GmmTests, whenLargePagesAreExplicitlyDisallowedAndUserPtrIsNullThenDisableOptimizationPadding) { TEST_F(GmmTests, whenLargePagesAreExplicitlyDisallowedAndUserPtrIsNullThenDisableOptimizationPadding) {
size_t allocationSize = 128; size_t allocationSize = 128;
bool allowLargePages = false; bool allowLargePages = false;
Gmm gmm(getGmmClientContext(), nullptr, allocationSize, 0, false, false, {}, allowLargePages); Gmm gmm(getGmmClientContext(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages);
EXPECT_TRUE(gmm.resourceParams.Flags.Info.NoOptimizationPadding); EXPECT_TRUE(gmm.resourceParams.Flags.Info.NoOptimizationPadding);
} }
@ -817,14 +818,14 @@ TEST_F(GmmTests, givenSizeIsMisallignedTo64kbWhenForceDisablingLargePagesThenSiz
const void *dummyPtr = reinterpret_cast<void *>(0x123); const void *dummyPtr = reinterpret_cast<void *>(0x123);
size_t allocationSize = 256U; size_t allocationSize = 256U;
bool allowLargePages = false; bool allowLargePages = false;
Gmm gmm(getGmmClientContext(), dummyPtr, allocationSize, 0, false, false, {}, allowLargePages); Gmm gmm(getGmmClientContext(), dummyPtr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages);
EXPECT_EQ(allocationSize, gmm.resourceParams.BaseWidth64); EXPECT_EQ(allocationSize, gmm.resourceParams.BaseWidth64);
} }
TEST_F(GmmTests, givenSizeIsAllignedTo64kbWhenForceDisablingLargePagesThenSizeIsAlteredToBreak64kbAlignment) { TEST_F(GmmTests, givenSizeIsAllignedTo64kbWhenForceDisablingLargePagesThenSizeIsAlteredToBreak64kbAlignment) {
size_t allocationSize = MemoryConstants::pageSize64k; size_t allocationSize = MemoryConstants::pageSize64k;
bool allowLargePages = false; bool allowLargePages = false;
Gmm gmm(getGmmClientContext(), nullptr, allocationSize, 0, false, false, {}, allowLargePages); Gmm gmm(getGmmClientContext(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages);
EXPECT_EQ(allocationSize + MemoryConstants::pageSize, gmm.resourceParams.BaseWidth64); EXPECT_EQ(allocationSize + MemoryConstants::pageSize, gmm.resourceParams.BaseWidth64);
} }
@ -833,6 +834,36 @@ TEST(GmmTest, givenHwInfoWhenDeviceIsCreatedThenSetThisHwInfoToGmmHelper) {
EXPECT_EQ(&device->getHardwareInfo(), device->getGmmHelper()->getHardwareInfo()); EXPECT_EQ(&device->getHardwareInfo(), device->getGmmHelper()->getHardwareInfo());
} }
TEST(GmmTest, givenAllocationTypeWhenGettingUsageTypeThenReturnCorrectValue) {
for (uint32_t i = 0; i < static_cast<uint32_t>(AllocationType::COUNT); i++) {
auto allocationType = static_cast<AllocationType>(i);
for (auto forceUncached : {true, false}) {
auto usage = CacheSettingsHelper::getGmmUsageType(allocationType, forceUncached);
if (allocationType == AllocationType::IMAGE) {
if (forceUncached) {
EXPECT_EQ(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED, usage);
} else {
EXPECT_EQ(GMM_RESOURCE_USAGE_OCL_IMAGE, usage);
}
} else if (allocationType == AllocationType::PREEMPTION) {
if (forceUncached) {
EXPECT_EQ(GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC, usage);
} else {
EXPECT_EQ(GMM_RESOURCE_USAGE_OCL_BUFFER, usage);
}
} else {
if (forceUncached) {
EXPECT_EQ(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED, usage);
} else {
EXPECT_EQ(GMM_RESOURCE_USAGE_OCL_BUFFER, usage);
}
}
}
}
}
TEST_F(GmmTests, whenResourceIsCreatedThenHandleItsOwnership) { TEST_F(GmmTests, whenResourceIsCreatedThenHandleItsOwnership) {
struct MyMockResourecInfo : public GmmResourceInfo { struct MyMockResourecInfo : public GmmResourceInfo {
using GmmResourceInfo::resourceInfo; using GmmResourceInfo::resourceInfo;
@ -864,12 +895,12 @@ TEST_F(GmmTests, whenResourceIsCreatedThenHandleItsOwnership) {
using GmmEnvironmentTest = MockExecutionEnvironmentGmmFixtureTest; using GmmEnvironmentTest = MockExecutionEnvironmentGmmFixtureTest;
TEST_F(GmmEnvironmentTest, givenGmmWithNotSetMCSInResourceInfoGpuFlagsWhenCallHasMultisampleControlSurfaceThenReturnFalse) { TEST_F(GmmEnvironmentTest, givenGmmWithNotSetMCSInResourceInfoGpuFlagsWhenCallHasMultisampleControlSurfaceThenReturnFalse) {
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
EXPECT_FALSE(gmm->hasMultisampleControlSurface()); EXPECT_FALSE(gmm->hasMultisampleControlSurface());
} }
TEST_F(GmmEnvironmentTest, givenGmmWithSetMCSInResourceInfoGpuFlagsWhenCallhasMultisampleControlSurfaceThenReturnTrue) { TEST_F(GmmEnvironmentTest, givenGmmWithSetMCSInResourceInfoGpuFlagsWhenCallhasMultisampleControlSurfaceThenReturnTrue) {
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get()); auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
mockResource->setMultisampleControlSurface(); mockResource->setMultisampleControlSurface();
EXPECT_TRUE(gmm->hasMultisampleControlSurface()); EXPECT_TRUE(gmm->hasMultisampleControlSurface());
@ -985,7 +1016,7 @@ struct GmmCompressionTests : public MockExecutionEnvironmentGmmFixtureTest {
}; };
TEST_F(GmmCompressionTests, givenEnabledAndNotPreferredE2ECWhenApplyingForBuffersThenDontSetValidFlags) { TEST_F(GmmCompressionTests, givenEnabledAndNotPreferredE2ECWhenApplyingForBuffersThenDontSetValidFlags) {
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
gmm->resourceParams = {}; gmm->resourceParams = {};
localPlatformDevice->capabilityTable.ftrRenderCompressedBuffers = true; localPlatformDevice->capabilityTable.ftrRenderCompressedBuffers = true;
@ -998,7 +1029,7 @@ TEST_F(GmmCompressionTests, givenEnabledAndNotPreferredE2ECWhenApplyingForBuffer
} }
TEST_F(GmmCompressionTests, givenDisabledAndPreferredE2ECWhenApplyingForBuffersThenDontSetValidFlags) { TEST_F(GmmCompressionTests, givenDisabledAndPreferredE2ECWhenApplyingForBuffersThenDontSetValidFlags) {
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
gmm->resourceParams = {}; gmm->resourceParams = {};
localPlatformDevice->capabilityTable.ftrRenderCompressedBuffers = false; localPlatformDevice->capabilityTable.ftrRenderCompressedBuffers = false;
@ -1164,18 +1195,18 @@ TEST_F(GmmCompressionTests, givenPackedYuvFormatWhenQueryingThenDisallow) {
} }
} }
HWTEST_F(GmmCompressionTests, whenConstructedWithPreferCompressionFlagThenApplyAuxFlags) { HWTEST_F(GmmCompressionTests, whenConstructedWithPreferCompressionFlagThenApplyAuxFlags) {
Gmm gmm1(getGmmClientContext(), nullptr, 1, 0, false, false, {}, true); Gmm gmm1(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
EXPECT_EQ(0u, gmm1.resourceParams.Flags.Info.RenderCompressed); EXPECT_EQ(0u, gmm1.resourceParams.Flags.Info.RenderCompressed);
Gmm gmm2(getGmmClientContext(), nullptr, 1, 0, false, false, {}, true); Gmm gmm2(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
EXPECT_EQ(0u, gmm2.resourceParams.Flags.Info.RenderCompressed); EXPECT_EQ(0u, gmm2.resourceParams.Flags.Info.RenderCompressed);
Gmm gmm3(getGmmClientContext(), nullptr, 1, 0, false, true, {}, true); Gmm gmm3(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, {}, true);
EXPECT_EQ(1u, gmm3.resourceParams.Flags.Info.RenderCompressed); EXPECT_EQ(1u, gmm3.resourceParams.Flags.Info.RenderCompressed);
} }
TEST_F(GmmCompressionTests, givenMediaCompressedImageApplyAuxFlagsForImageThenSetFlagsToCompressed) { TEST_F(GmmCompressionTests, givenMediaCompressedImageApplyAuxFlagsForImageThenSetFlagsToCompressed) {
MockGmm gmm(getGmmClientContext(), nullptr, 1, 0, false, false, {}, true); MockGmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm.resourceParams.Flags.Info.MediaCompressed = true; gmm.resourceParams.Flags.Info.MediaCompressed = true;
gmm.resourceParams.Flags.Info.RenderCompressed = false; gmm.resourceParams.Flags.Info.RenderCompressed = false;
gmm.setupImageResourceParams(imgInfo, true); gmm.setupImageResourceParams(imgInfo, true);
@ -1184,7 +1215,7 @@ TEST_F(GmmCompressionTests, givenMediaCompressedImageApplyAuxFlagsForImageThenSe
} }
TEST_F(GmmCompressionTests, givenRenderCompressedImageApplyAuxFlagsForImageThenSetFlagsToCompressed) { TEST_F(GmmCompressionTests, givenRenderCompressedImageApplyAuxFlagsForImageThenSetFlagsToCompressed) {
MockGmm gmm(getGmmClientContext(), nullptr, 1, 0, false, false, {}, true); MockGmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm.resourceParams.Flags.Info.MediaCompressed = false; gmm.resourceParams.Flags.Info.MediaCompressed = false;
gmm.resourceParams.Flags.Info.RenderCompressed = true; gmm.resourceParams.Flags.Info.RenderCompressed = true;
gmm.setupImageResourceParams(imgInfo, true); gmm.setupImageResourceParams(imgInfo, true);
@ -1193,7 +1224,7 @@ TEST_F(GmmCompressionTests, givenRenderCompressedImageApplyAuxFlagsForImageThenS
} }
HWTEST_F(GmmCompressionTests, givenEnabledAndPreferredE2ECWhenApplyingForBuffersThenSetValidFlags) { HWTEST_F(GmmCompressionTests, givenEnabledAndPreferredE2ECWhenApplyingForBuffersThenSetValidFlags) {
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
gmm->resourceParams = {}; gmm->resourceParams = {};
localPlatformDevice->capabilityTable.ftrRenderCompressedBuffers = true; localPlatformDevice->capabilityTable.ftrRenderCompressedBuffers = true;
@ -1207,7 +1238,7 @@ HWTEST_F(GmmCompressionTests, givenEnabledAndPreferredE2ECWhenApplyingForBuffers
HWTEST_F(GmmCompressionTests, givenDisabledE2ECAndEnabledDebugFlagWhenApplyingForBuffersThenSetValidFlags) { HWTEST_F(GmmCompressionTests, givenDisabledE2ECAndEnabledDebugFlagWhenApplyingForBuffersThenSetValidFlags) {
DebugManagerStateRestore restore; DebugManagerStateRestore restore;
Gmm gmm(getGmmClientContext(), nullptr, 1, 0, false, false, {}, true); Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm.resourceParams = {}; gmm.resourceParams = {};
DebugManager.flags.RenderCompressedBuffersEnabled.set(1); DebugManager.flags.RenderCompressedBuffersEnabled.set(1);
@ -1253,7 +1284,7 @@ struct MultiTileGmmTests : GmmLocalMemoryTests {
}; };
TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryWhenUseSystemMemoryIsTrueThenNonLocalOnlyFlagIsSetAndLocalOnlyCleared) { TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryWhenUseSystemMemoryIsTrueThenNonLocalOnlyFlagIsSetAndLocalOnlyCleared) {
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, false, false, StorageInfo{}, true); auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NonLocalOnly); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly);
} }
@ -1262,7 +1293,7 @@ TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryWhenUsingLocalMemoryAndAllocation
StorageInfo storageInfo{}; StorageInfo storageInfo{};
storageInfo.isLockable = true; storageInfo.isLockable = true;
storageInfo.memoryBanks.set(1); storageInfo.memoryBanks.set(1);
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, false, false, storageInfo, true); auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NotLockable); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NotLockable);
@ -1272,7 +1303,7 @@ TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryWhenUsingLocalMemoryFalseAndAlloc
StorageInfo storageInfo{}; StorageInfo storageInfo{};
storageInfo.isLockable = false; storageInfo.isLockable = false;
storageInfo.memoryBanks.set(1); storageInfo.memoryBanks.set(1);
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, false, false, storageInfo, true); auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NotLockable); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NotLockable);
@ -1284,7 +1315,7 @@ TEST_F(GmmLocalMemoryTests, givenLocalMemoryAndNotLockableAllocationAndStorageIn
storageInfo.isLockable = false; storageInfo.isLockable = false;
storageInfo.memoryBanks.set(1); storageInfo.memoryBanks.set(1);
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, false, false, storageInfo, true); auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.LocalOnly); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.LocalOnly);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NotLockable); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NotLockable);
@ -1300,7 +1331,7 @@ TEST_F(GmmLocalMemoryTests, givenLocalMemoryAndStorageInfoWithLocalOnlyRequiredW
for (auto csrMode = static_cast<int32_t>(CommandStreamReceiverType::CSR_HW); csrMode < static_cast<int32_t>(CommandStreamReceiverType::CSR_TYPES_NUM); csrMode++) { for (auto csrMode = static_cast<int32_t>(CommandStreamReceiverType::CSR_HW); csrMode < static_cast<int32_t>(CommandStreamReceiverType::CSR_TYPES_NUM); csrMode++) {
DebugManager.flags.SetCommandStreamReceiver.set(csrMode); DebugManager.flags.SetCommandStreamReceiver.set(csrMode);
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, false, false, storageInfo, true); auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.LocalOnly); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.LocalOnly);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NotLockable); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NotLockable);
} }
@ -1309,7 +1340,7 @@ TEST_F(GmmLocalMemoryTests, givenLocalMemoryAndStorageInfoWithLocalOnlyRequiredW
TEST_F(GmmLocalMemoryTests, givenSystemMemoryAndStorageInfoWithLocalOnlyRequiredWhenPreparingFlagsForGmmThenLocalOnlyIsNotSet) { TEST_F(GmmLocalMemoryTests, givenSystemMemoryAndStorageInfoWithLocalOnlyRequiredWhenPreparingFlagsForGmmThenLocalOnlyIsNotSet) {
StorageInfo storageInfo{}; StorageInfo storageInfo{};
storageInfo.localOnlyRequired = true; storageInfo.localOnlyRequired = true;
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, false, false, storageInfo, true); auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NonLocalOnly); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly);
} }
@ -1317,7 +1348,7 @@ TEST_F(GmmLocalMemoryTests, givenSystemMemoryAndStorageInfoWithLocalOnlyRequired
TEST_F(GmmLocalMemoryTests, givenLocalMemoryAndStorageInfoWithoutLocalOnlyRequiredWhenPreparingFlagsForGmmThenLocalOnlyIsNotSet) { TEST_F(GmmLocalMemoryTests, givenLocalMemoryAndStorageInfoWithoutLocalOnlyRequiredWhenPreparingFlagsForGmmThenLocalOnlyIsNotSet) {
StorageInfo storageInfo{}; StorageInfo storageInfo{};
storageInfo.localOnlyRequired = false; storageInfo.localOnlyRequired = false;
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, false, false, storageInfo, true); auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NonLocalOnly); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly);
} }
@ -1329,7 +1360,7 @@ TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryAndCompressionEnabledWhenUsingLoc
storageInfo.isLockable = false; storageInfo.isLockable = false;
storageInfo.memoryBanks.set(1); storageInfo.memoryBanks.set(1);
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, false, true, storageInfo, true); auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, storageInfo, true);
EXPECT_TRUE(gmm->isCompressionEnabled); EXPECT_TRUE(gmm->isCompressionEnabled);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.LocalOnly); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.LocalOnly);
@ -1343,7 +1374,7 @@ TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryWhenUseSystemMemoryIsFalseAndAllo
StorageInfo storageInfo{}; StorageInfo storageInfo{};
storageInfo.memoryBanks.set(1); storageInfo.memoryBanks.set(1);
storageInfo.isLockable = false; storageInfo.isLockable = false;
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, false, false, storageInfo, true); auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly); EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NotLockable); EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NotLockable);
@ -1447,7 +1478,7 @@ TEST_F(MultiTileGmmTests, givenMultiTileAllocationWhenGmmIsCreatedWithEmptyMempo
StorageInfo storageInfo; StorageInfo storageInfo;
storageInfo.memoryBanks = 0; storageInfo.memoryBanks = 0;
Gmm gmm(getGmmClientContext(), nullptr, 1, 0, false, false, storageInfo, true); Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable); EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable);
EXPECT_EQ(0u, gmm.resourceParams.MultiTileArch.TileInstanced); EXPECT_EQ(0u, gmm.resourceParams.MultiTileArch.TileInstanced);
@ -1458,7 +1489,7 @@ TEST_F(MultiTileGmmTests, givenMultiTileAllocationWithoutCloningWhenGmmIsCreated
storageInfo.memoryBanks = 1; storageInfo.memoryBanks = 1;
storageInfo.cloningOfPageTables = false; storageInfo.cloningOfPageTables = false;
Gmm gmm(getGmmClientContext(), nullptr, 1, 0, false, false, storageInfo, true); Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable); EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable);
EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.GpuVaMappingSet); EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.GpuVaMappingSet);
@ -1470,7 +1501,7 @@ TEST_F(MultiTileGmmTests, givenMultiTileAllocationWithoutCloningWhenGmmIsCreated
TEST_F(MultiTileGmmTests, givenMultiTileWhenGmmIsCreatedWithNonLocalMemoryThenMultitileArchIsPropertlyFilled) { TEST_F(MultiTileGmmTests, givenMultiTileWhenGmmIsCreatedWithNonLocalMemoryThenMultitileArchIsPropertlyFilled) {
StorageInfo storageInfo; StorageInfo storageInfo;
Gmm gmm(getGmmClientContext(), nullptr, 1, 0, false, false, storageInfo, true); Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable); EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable);
EXPECT_EQ(customTileMask, gmm.resourceParams.MultiTileArch.GpuVaMappingSet); EXPECT_EQ(customTileMask, gmm.resourceParams.MultiTileArch.GpuVaMappingSet);
@ -1484,7 +1515,7 @@ TEST_F(MultiTileGmmTests, givenMultiTileWhenGmmIsCreatedWithSpecificMemoryBanksT
storageInfo.memoryBanks = 1u; storageInfo.memoryBanks = 1u;
storageInfo.cloningOfPageTables = false; storageInfo.cloningOfPageTables = false;
Gmm gmm(getGmmClientContext(), nullptr, 1, 0, false, false, storageInfo, true); Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable); EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable);
EXPECT_EQ(storageInfo.memoryBanks, gmm.resourceParams.MultiTileArch.LocalMemPreferredSet); EXPECT_EQ(storageInfo.memoryBanks, gmm.resourceParams.MultiTileArch.LocalMemPreferredSet);
@ -1499,7 +1530,7 @@ TEST_F(MultiTileGmmTests, givenMultiTileWhenGmmIsCreatedWithCloningEnabledThenGp
storageInfo.cloningOfPageTables = true; storageInfo.cloningOfPageTables = true;
storageInfo.pageTablesVisibility = 3u; storageInfo.pageTablesVisibility = 3u;
Gmm gmm(getGmmClientContext(), nullptr, 1, 0, false, false, storageInfo, true); Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable); EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable);
EXPECT_EQ(storageInfo.memoryBanks, gmm.resourceParams.MultiTileArch.LocalMemPreferredSet); EXPECT_EQ(storageInfo.memoryBanks, gmm.resourceParams.MultiTileArch.LocalMemPreferredSet);
@ -1514,7 +1545,7 @@ TEST_F(MultiTileGmmTests, whenAllocationIsTileInstancedWithoutClonningPageTables
storageInfo.tileInstanced = true; storageInfo.tileInstanced = true;
storageInfo.memoryBanks = 2u; storageInfo.memoryBanks = 2u;
Gmm gmm(getGmmClientContext(), nullptr, 1, 0, false, false, storageInfo, true); Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable); EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable);
EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.TileInstanced); EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.TileInstanced);
@ -1525,7 +1556,7 @@ TEST_F(MultiTileGmmTests, whenAllocationIsTileInstancedWithClonningPageTablesThe
storageInfo.cloningOfPageTables = true; storageInfo.cloningOfPageTables = true;
storageInfo.tileInstanced = true; storageInfo.tileInstanced = true;
Gmm gmm(getGmmClientContext(), nullptr, 1, 0, false, false, storageInfo, true); Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable); EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable);
EXPECT_EQ(0u, gmm.resourceParams.MultiTileArch.TileInstanced); EXPECT_EQ(0u, gmm.resourceParams.MultiTileArch.TileInstanced);

View File

@ -480,7 +480,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenAllocationProvidedThenU
size_t allocSize = size; size_t allocSize = size;
length.Length = static_cast<uint32_t>(allocSize - 1); length.Length = static_cast<uint32_t>(allocSize - 1);
GraphicsAllocation allocation(0, AllocationType::UNKNOWN, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 0u); GraphicsAllocation allocation(0, AllocationType::UNKNOWN, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 0u);
allocation.setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, false, false, {}, true)); allocation.setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER; SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER;
helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, true, false); helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, true, false);
EXPECT_EQ(length.SurfaceState.Depth + 1u, state->getDepth()); EXPECT_EQ(length.SurfaceState.Depth + 1u, state->getDepth());
@ -517,7 +517,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmAndAllocationCompres
uint64_t gpuAddr = 0x4000u; uint64_t gpuAddr = 0x4000u;
size_t allocSize = size; size_t allocSize = size;
GraphicsAllocation allocation(0, AllocationType::BUFFER, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 0u); GraphicsAllocation allocation(0, AllocationType::BUFFER, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 0u);
allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, false, false, {}, true)); allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
allocation.getDefaultGmm()->isCompressionEnabled = true; allocation.getDefaultGmm()->isCompressionEnabled = true;
SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER; SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER;
helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, false, false); helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, false, false);
@ -549,7 +549,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmCompressionDisabledA
uint64_t gpuAddr = 0x4000u; uint64_t gpuAddr = 0x4000u;
size_t allocSize = size; size_t allocSize = size;
GraphicsAllocation allocation(0, AllocationType::BUFFER, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 1); GraphicsAllocation allocation(0, AllocationType::BUFFER, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 1);
allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, false, false, {}, true)); allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER; SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER;
helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, false, false); helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, false, false);
EXPECT_EQ(UnitTestHelper<FamilyType>::getCoherencyTypeSupported(RENDER_SURFACE_STATE::COHERENCY_TYPE_IA_COHERENT), state->getCoherencyType()); EXPECT_EQ(UnitTestHelper<FamilyType>::getCoherencyTypeSupported(RENDER_SURFACE_STATE::COHERENCY_TYPE_IA_COHERENT), state->getCoherencyType());
@ -582,7 +582,7 @@ HWTEST_F(HwHelperTest, givenOverrideMocsIndexForScratchSpaceWhenSurfaceStateIsPr
uint64_t gpuAddr = 0x4000u; uint64_t gpuAddr = 0x4000u;
size_t allocSize = size; size_t allocSize = size;
GraphicsAllocation allocation(0, AllocationType::BUFFER, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 1); GraphicsAllocation allocation(0, AllocationType::BUFFER, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 1);
allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, false, false, {}, true)); allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER; SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER;
helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, false, false); helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, false, false);
@ -614,7 +614,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmAndAllocationCompres
uint64_t gpuAddr = 0x4000u; uint64_t gpuAddr = 0x4000u;
size_t allocSize = size; size_t allocSize = size;
GraphicsAllocation allocation(0, AllocationType::BUFFER, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 1u); GraphicsAllocation allocation(0, AllocationType::BUFFER, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 1u);
allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, false, false, {}, true)); allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
allocation.getDefaultGmm()->isCompressionEnabled = true; allocation.getDefaultGmm()->isCompressionEnabled = true;
SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER; SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER;
helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, true, false); helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, true, false);
@ -1025,7 +1025,7 @@ HWTEST_F(HwHelperTest, givenNotLockableAllocationWhenGettingIsBlitCopyRequiredFo
EXPECT_FALSE(GraphicsAllocation::isLockable(graphicsAllocation.getAllocationType())); EXPECT_FALSE(GraphicsAllocation::isLockable(graphicsAllocation.getAllocationType()));
graphicsAllocation.overrideMemoryPool(MemoryPool::LocalMemory); graphicsAllocation.overrideMemoryPool(MemoryPool::LocalMemory);
MockGmm mockGmm(pDevice->getGmmClientContext(), nullptr, 100, 100, false, false, {}, true); MockGmm mockGmm(pDevice->getGmmClientContext(), nullptr, 100, 100, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
mockGmm.resourceParams.Flags.Info.NotLockable = true; mockGmm.resourceParams.Flags.Info.NotLockable = true;
graphicsAllocation.setDefaultGmm(&mockGmm); graphicsAllocation.setDefaultGmm(&mockGmm);

View File

@ -657,7 +657,7 @@ TEST_F(KernelArgBufferTest, givenSetUnifiedMemoryExecInfoOnKernelWithIndirectSta
{AllocationType::BUFFER_HOST_MEMORY, false}, {AllocationType::BUFFER_HOST_MEMORY, false},
{AllocationType::SVM_GPU, true}}}; {AllocationType::SVM_GPU, true}}};
auto gmm = std::make_unique<Gmm>(pDevice->getRootDeviceEnvironment().getGmmClientContext(), nullptr, 0, 0, false, false, StorageInfo{}, true); auto gmm = std::make_unique<Gmm>(pDevice->getRootDeviceEnvironment().getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
MockGraphicsAllocation gfxAllocation; MockGraphicsAllocation gfxAllocation;
gfxAllocation.setDefaultGmm(gmm.get()); gfxAllocation.setDefaultGmm(gmm.get());
@ -698,7 +698,7 @@ TEST_F(KernelArgBufferTest, givenSVMAllocsManagerWithCompressedSVMAllocationsWhe
{AllocationType::BUFFER_HOST_MEMORY, false}, {AllocationType::BUFFER_HOST_MEMORY, false},
{AllocationType::SVM_GPU, true}}}; {AllocationType::SVM_GPU, true}}};
auto gmm = std::make_unique<Gmm>(pDevice->getRootDeviceEnvironment().getGmmClientContext(), nullptr, 0, 0, false, false, StorageInfo{}, true); auto gmm = std::make_unique<Gmm>(pDevice->getRootDeviceEnvironment().getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
MockGraphicsAllocation gfxAllocation; MockGraphicsAllocation gfxAllocation;
gfxAllocation.setDefaultGmm(gmm.get()); gfxAllocation.setDefaultGmm(gmm.get());

View File

@ -165,7 +165,7 @@ HWTEST_F(BufferSetArgTest, givenNonPureStatefulArgWhenCompressedBufferIsSetThenS
pKernelInfo->argAsPtr(0).bindful = 0; pKernelInfo->argAsPtr(0).bindful = 0;
auto graphicsAllocation = buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex()); auto graphicsAllocation = buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex());
graphicsAllocation->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), graphicsAllocation->getUnderlyingBuffer(), buffer->getSize(), 0, false, false, {}, true)); graphicsAllocation->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), graphicsAllocation->getUnderlyingBuffer(), buffer->getSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
graphicsAllocation->getDefaultGmm()->isCompressionEnabled = true; graphicsAllocation->getDefaultGmm()->isCompressionEnabled = true;
cl_mem clMem = buffer; cl_mem clMem = buffer;

View File

@ -1712,7 +1712,7 @@ HWTEST_F(BufferSetSurfaceTests, givenCompressedGmmResourceWhenSurfaceStateIsProg
std::unique_ptr<Buffer> buffer(Buffer::create(&context, CL_MEM_READ_WRITE, 1, nullptr, retVal)); std::unique_ptr<Buffer> buffer(Buffer::create(&context, CL_MEM_READ_WRITE, 1, nullptr, retVal));
auto graphicsAllocation = buffer->getGraphicsAllocation(rootDeviceIndex); auto graphicsAllocation = buffer->getGraphicsAllocation(rootDeviceIndex);
auto gmm = new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true); auto gmm = new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
graphicsAllocation->setDefaultGmm(gmm); graphicsAllocation->setDefaultGmm(gmm);
gmm->isCompressionEnabled = true; gmm->isCompressionEnabled = true;
@ -1733,7 +1733,7 @@ HWTEST_F(BufferSetSurfaceTests, givenNonCompressedGmmResourceWhenSurfaceStateIsP
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
std::unique_ptr<Buffer> buffer(Buffer::create(&context, CL_MEM_READ_WRITE, 1, nullptr, retVal)); std::unique_ptr<Buffer> buffer(Buffer::create(&context, CL_MEM_READ_WRITE, 1, nullptr, retVal));
auto gmm = new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true); auto gmm = new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
buffer->getGraphicsAllocation(rootDeviceIndex)->setDefaultGmm(gmm); buffer->getGraphicsAllocation(rootDeviceIndex)->setDefaultGmm(gmm);
gmm->isCompressionEnabled = false; gmm->isCompressionEnabled = false;

View File

@ -33,7 +33,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterBufferTests, givenDebugFlagSetWhenProgr
uint32_t defaultCompressionFormat = gmmContext->getSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT::GMM_FORMAT_GENERIC_8BIT); uint32_t defaultCompressionFormat = gmmContext->getSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT::GMM_FORMAT_GENERIC_8BIT);
auto retVal = CL_SUCCESS; auto retVal = CL_SUCCESS;
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, false, false, {}, true); auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm->isCompressionEnabled = true; gmm->isCompressionEnabled = true;
auto buffer = std::unique_ptr<Buffer>(Buffer::create(&context, CL_MEM_READ_WRITE, 1, nullptr, retVal)); auto buffer = std::unique_ptr<Buffer>(Buffer::create(&context, CL_MEM_READ_WRITE, 1, nullptr, retVal));

View File

@ -514,7 +514,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithoutUnifiedAuxC
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE; typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
McsSurfaceInfo msi = {10, 20, 3}; McsSurfaceInfo msi = {10, 20, 3};
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize}); auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
cl_image_desc imgDesc = Image2dDefaults::imageDesc; cl_image_desc imgDesc = Image2dDefaults::imageDesc;
imgDesc.num_samples = 8; imgDesc.num_samples = 8;
@ -613,7 +613,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationAndCompressionWhenSetArgOnMultisampl
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE; typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
McsSurfaceInfo msi = {10, 20, 3}; McsSurfaceInfo msi = {10, 20, 3};
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize}); auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
cl_image_desc imgDesc = Image2dDefaults::imageDesc; cl_image_desc imgDesc = Image2dDefaults::imageDesc;
imgDesc.num_samples = 8; imgDesc.num_samples = 8;
@ -676,7 +676,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithUnifiedAuxCapa
McsSurfaceInfo msi = {10, 20, 3}; McsSurfaceInfo msi = {10, 20, 3};
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize}); auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
cl_image_desc imgDesc = Image2dDefaults::imageDesc; cl_image_desc imgDesc = Image2dDefaults::imageDesc;
imgDesc.num_samples = 8; imgDesc.num_samples = 8;
@ -708,7 +708,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithUnifiedAuxCapa
McsSurfaceInfo msi = {10, 20, 3}; McsSurfaceInfo msi = {10, 20, 3};
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize}); auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
cl_image_desc imgDesc = Image2dDefaults::imageDesc; cl_image_desc imgDesc = Image2dDefaults::imageDesc;
imgDesc.num_samples = 8; imgDesc.num_samples = 8;
@ -737,7 +737,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithUnifiedAuxCapa
McsSurfaceInfo msi = {10, 20, 3}; McsSurfaceInfo msi = {10, 20, 3};
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize}); auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
cl_image_desc imgDesc = Image2dDefaults::imageDesc; cl_image_desc imgDesc = Image2dDefaults::imageDesc;
imgDesc.num_samples = 8; imgDesc.num_samples = 8;

View File

@ -1699,7 +1699,7 @@ HWTEST_F(ImageTransformTest, givenSurfaceBaseAddressAndUnifiedSurfaceWhenSetUnif
MockContext context; MockContext context;
auto image = std::unique_ptr<Image>(ImageHelper<Image3dDefaults>::create(&context)); auto image = std::unique_ptr<Image>(ImageHelper<Image3dDefaults>::create(&context));
auto surfaceState = FamilyType::cmdInitRenderSurfaceState; auto surfaceState = FamilyType::cmdInitRenderSurfaceState;
auto gmm = std::unique_ptr<Gmm>(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); auto gmm = std::unique_ptr<Gmm>(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
uint64_t surfBsaseAddress = 0xABCDEF1000; uint64_t surfBsaseAddress = 0xABCDEF1000;
surfaceState.setSurfaceBaseAddress(surfBsaseAddress); surfaceState.setSurfaceBaseAddress(surfBsaseAddress);
auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get()); auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());

View File

@ -89,7 +89,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterImageTests, givenCompressionWhenAppendi
imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, 128 * 256 * 4, nullptr, &retVal); imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, 128 * 256 * 4, nullptr, &retVal);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, false, false, {}, true); auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm->isCompressionEnabled = true; gmm->isCompressionEnabled = true;
auto buffer = castToObject<Buffer>(imageDesc.mem_object); auto buffer = castToObject<Buffer>(imageDesc.mem_object);
@ -130,7 +130,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterImageTests, givenImageFromBufferWhenSet
imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, 128 * 256 * 4, nullptr, &retVal); imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, 128 * 256 * 4, nullptr, &retVal);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, false, false, {}, true); auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm->isCompressionEnabled = true; gmm->isCompressionEnabled = true;
auto buffer = castToObject<Buffer>(imageDesc.mem_object); auto buffer = castToObject<Buffer>(imageDesc.mem_object);
@ -173,7 +173,7 @@ HWTEST2_F(XeHPAndLaterImageTests, givenMcsAllocationWhenSetArgIsCalledWithUnifie
auto surfaceState = FamilyType::cmdInitRenderSurfaceState; auto surfaceState = FamilyType::cmdInitRenderSurfaceState;
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get()); auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
mcsAlloc->setDefaultGmm(new Gmm(context.getDevice(0)->getRootDeviceEnvironment().getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); mcsAlloc->setDefaultGmm(new Gmm(context.getDevice(0)->getRootDeviceEnvironment().getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
surfaceState.setSurfaceBaseAddress(0xABCDEF1000); surfaceState.setSurfaceBaseAddress(0xABCDEF1000);
imageHw->setMcsSurfaceInfo(msi); imageHw->setMcsSurfaceInfo(msi);
imageHw->setMcsAllocation(mcsAlloc); imageHw->setMcsAllocation(mcsAlloc);

View File

@ -313,7 +313,7 @@ TEST(MemObj, givenCompressedGmmWhenAskingForMappingOnCpuThenDisallow) {
context.memoryManager = &memoryManager; context.memoryManager = &memoryManager;
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize}); auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice()); auto memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice());
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
1, allocation->getUnderlyingBuffer(), nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(allocation), false, false, false); 1, allocation->getUnderlyingBuffer(), nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(allocation), false, false, false);
@ -347,7 +347,7 @@ TEST(MemObj, givenNonCpuAccessibleMemoryWhenAskingForMappingOnCpuThenDisallow) {
context.memoryManager = &memoryManager; context.memoryManager = &memoryManager;
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize}); auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice()); auto memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice());
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0, MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
1, allocation->getUnderlyingBuffer(), nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(allocation), false, false, false); 1, allocation->getUnderlyingBuffer(), nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(allocation), false, false, false);

View File

@ -975,7 +975,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerAndUnifiedAuxCapableAlloc
executionEnvironment.initGmm(); executionEnvironment.initGmm();
OsAgnosticMemoryManager memoryManager(executionEnvironment); OsAgnosticMemoryManager memoryManager(executionEnvironment);
auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 123, 0, false, false, {}, true); auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 123, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{0, MemoryConstants::pageSize}); auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{0, MemoryConstants::pageSize});
allocation->setDefaultGmm(gmm); allocation->setDefaultGmm(gmm);
@ -1849,7 +1849,7 @@ TEST(MemoryManager, givenShareableWhenAllocatingGraphicsMemoryThenAllocateSharea
} }
TEST_F(MemoryAllocatorTest, GivenSizeWhenGmmIsCreatedThenNonNullPointerIsReturned) { TEST_F(MemoryAllocatorTest, GivenSizeWhenGmmIsCreatedThenNonNullPointerIsReturned) {
Gmm *gmm = new Gmm(device->getGmmClientContext(), nullptr, 65536, 0, false, false, {}, true); Gmm *gmm = new Gmm(device->getGmmClientContext(), nullptr, 65536, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
EXPECT_NE(nullptr, gmm); EXPECT_NE(nullptr, gmm);
delete gmm; delete gmm;
} }
@ -2608,7 +2608,7 @@ TEST_F(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAlloca
TEST_F(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocationWithoutPtrAndResourceIs64KSuitableThenStandard64kHeapIsUsed) { TEST_F(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocationWithoutPtrAndResourceIs64KSuitableThenStandard64kHeapIsUsed) {
GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull}; GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull};
auto rootDeviceEnvironment = platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0].get(); auto rootDeviceEnvironment = platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0].get();
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false, false, StorageInfo{}, true); auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto resourceInfo = static_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get()); auto resourceInfo = static_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
resourceInfo->is64KBPageSuitableValue = true; resourceInfo->is64KBPageSuitableValue = true;
allocation.setDefaultGmm(gmm.get()); allocation.setDefaultGmm(gmm.get());
@ -2618,7 +2618,7 @@ TEST_F(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAlloca
TEST_F(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocationWithoutPtrAndResourceIsNot64KSuitableThenStandardHeapIsUsed) { TEST_F(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocationWithoutPtrAndResourceIsNot64KSuitableThenStandardHeapIsUsed) {
GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull}; GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull};
auto rootDeviceEnvironment = platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0].get(); auto rootDeviceEnvironment = platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0].get();
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false, false, StorageInfo{}, true); auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto resourceInfo = static_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get()); auto resourceInfo = static_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
resourceInfo->is64KBPageSuitableValue = false; resourceInfo->is64KBPageSuitableValue = false;
allocation.setDefaultGmm(gmm.get()); allocation.setDefaultGmm(gmm.get());

View File

@ -98,8 +98,8 @@ TEST_F(MigrationControllerTests, givenNotLockableBufferAllocationWithDefinedLoca
auto srcAllocation = pBuffer->getMultiGraphicsAllocation().getGraphicsAllocation(0); auto srcAllocation = pBuffer->getMultiGraphicsAllocation().getGraphicsAllocation(0);
auto dstAllocation = pBuffer->getMultiGraphicsAllocation().getGraphicsAllocation(1); auto dstAllocation = pBuffer->getMultiGraphicsAllocation().getGraphicsAllocation(1);
auto gmm0 = new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true); auto gmm0 = new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmm1 = new Gmm(context.getDevice(1)->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true); auto gmm1 = new Gmm(context.getDevice(1)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
srcAllocation->setDefaultGmm(gmm0); srcAllocation->setDefaultGmm(gmm0);
dstAllocation->setDefaultGmm(gmm1); dstAllocation->setDefaultGmm(gmm1);

View File

@ -52,7 +52,7 @@ class MockBuffer : public MockBufferStorage, public Buffer {
static void setAllocationType(GraphicsAllocation *graphicsAllocation, GmmClientContext *gmmClientContext, bool compressed) { static void setAllocationType(GraphicsAllocation *graphicsAllocation, GmmClientContext *gmmClientContext, bool compressed) {
if (compressed && !graphicsAllocation->getDefaultGmm()) { if (compressed && !graphicsAllocation->getDefaultGmm()) {
graphicsAllocation->setDefaultGmm(new Gmm(gmmClientContext, nullptr, 0, 0, false, compressed, {}, true)); graphicsAllocation->setDefaultGmm(new Gmm(gmmClientContext, nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, compressed, {}, true));
} }
if (graphicsAllocation->getDefaultGmm()) { if (graphicsAllocation->getDefaultGmm()) {

View File

@ -2774,7 +2774,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndUnifiedAuxCapableAllocation
mock->ioctl_expected.gemWait = 1; mock->ioctl_expected.gemWait = 1;
mock->ioctl_expected.gemClose = 1; mock->ioctl_expected.gemClose = 1;
auto gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 123, 0, false, false, {}, true); auto gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 123, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, MemoryConstants::pageSize}); auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, MemoryConstants::pageSize});
allocation->setDefaultGmm(gmm); allocation->setDefaultGmm(gmm);

View File

@ -56,7 +56,7 @@ Gmm *getGmm(void *ptr, size_t size, GmmClientContext *clientContext) {
size_t alignedSize = alignSizeWholePage(ptr, size); size_t alignedSize = alignSizeWholePage(ptr, size);
void *alignedPtr = alignUp(ptr, 4096); void *alignedPtr = alignUp(ptr, 4096);
Gmm *gmm = new Gmm(clientContext, alignedPtr, alignedSize, 0, false, false, {}, true); Gmm *gmm = new Gmm(clientContext, alignedPtr, alignedSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
EXPECT_NE(gmm->gmmResourceInfo.get(), nullptr); EXPECT_NE(gmm->gmmResourceInfo.get(), nullptr);
return gmm; return gmm;
} }
@ -87,7 +87,7 @@ TEST_F(Wddm20Tests, GivenExisitingContextWhenInitializingWddmThenCreateContextRe
} }
TEST_F(Wddm20Tests, givenNullPageTableManagerAndCompressedResourceWhenMappingGpuVaThenDontUpdateAuxTable) { TEST_F(Wddm20Tests, givenNullPageTableManagerAndCompressedResourceWhenMappingGpuVaThenDontUpdateAuxTable) {
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto mockGmmRes = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get()); auto mockGmmRes = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
mockGmmRes->setUnifiedAuxTranslationCapable(); mockGmmRes->setUnifiedAuxTranslationCapable();
@ -497,7 +497,7 @@ TEST_F(Wddm20Tests, WhenMakingResidentAndEvictingThenReturnIsCorrect) {
TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenGraphicsAllocationWithSharedPropertiesIsCreated) { TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenGraphicsAllocationWithSharedPropertiesIsCreated) {
void *pSysMem = (void *)0x1000; void *pSysMem = (void *)0x1000;
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u); auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
EXPECT_EQ(0u, status); EXPECT_EQ(0u, status);
@ -534,7 +534,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationF
TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenMapGpuVaWithCpuPtrDepensOnBitness) { TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenMapGpuVaWithCpuPtrDepensOnBitness) {
void *pSysMem = (void *)0x1000; void *pSysMem = (void *)0x1000;
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u); auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
EXPECT_EQ(0u, status); EXPECT_EQ(0u, status);
@ -830,7 +830,7 @@ TEST_F(Wddm20Tests, whenCreateAllocation64kFailsThenReturnFalse) {
gdi->createAllocation2 = FailingCreateAllocation::mockCreateAllocation2; gdi->createAllocation2 = FailingCreateAllocation::mockCreateAllocation2;
void *fakePtr = reinterpret_cast<void *>(0x123); void *fakePtr = reinterpret_cast<void *>(0x123);
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), fakePtr, 100, 0, false, false, StorageInfo{}, true); auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), fakePtr, 100, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
WddmAllocation allocation(0, AllocationType::UNKNOWN, fakePtr, 100, nullptr, MemoryPool::MemoryNull, 0u, 1u); WddmAllocation allocation(0, AllocationType::UNKNOWN, fakePtr, 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
allocation.setDefaultGmm(gmm.get()); allocation.setDefaultGmm(gmm.get());

View File

@ -84,7 +84,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenUnlockResourceIsCalledThenKmDafListen
TEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDafListenerNotifyMapGpuVAIsFedWithCorrectParams) { TEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDafListenerNotifyMapGpuVAIsFedWithCorrectParams) {
uint64_t gpuPtr = 0u; uint64_t gpuPtr = 0u;
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false, false, StorageInfo{}, true); auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
wddmWithKmDafMock->mapGpuVirtualAddress(gmm.get(), ALLOCATION_HANDLE, wddmWithKmDafMock->getGfxPartition().Standard.Base, wddmWithKmDafMock->mapGpuVirtualAddress(gmm.get(), ALLOCATION_HANDLE, wddmWithKmDafMock->getGfxPartition().Standard.Base,
wddmWithKmDafMock->getGfxPartition().Standard.Limit, 0u, gpuPtr); wddmWithKmDafMock->getGfxPartition().Standard.Limit, 0u, gpuPtr);
@ -137,7 +137,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenEvictIsCalledThenKmDafListenerNotifyE
} }
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) { TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false, false, StorageInfo{}, true); auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto handle = 0u; auto handle = 0u;
auto resourceHandle = 0u; auto resourceHandle = 0u;
auto ptr = reinterpret_cast<void *>(0x10000); auto ptr = reinterpret_cast<void *>(0x10000);
@ -152,7 +152,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafList
} }
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) { TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false, false, StorageInfo{}, true); auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto handle = 0u; auto handle = 0u;
wddmWithKmDafMock->createAllocation(gmm.get(), handle); wddmWithKmDafMock->createAllocation(gmm.get(), handle);
@ -167,7 +167,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafLi
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationsAndMapGpuVaIsCalledThenKmDafListenerNotifyWriteTargetAndMapGpuVAIsFedWithCorrectParams) { TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationsAndMapGpuVaIsCalledThenKmDafListenerNotifyWriteTargetAndMapGpuVAIsFedWithCorrectParams) {
OsHandleStorage storage; OsHandleStorage storage;
OsHandleWin osHandle; OsHandleWin osHandle;
auto gmm = std::unique_ptr<Gmm>(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true)); auto gmm = std::unique_ptr<Gmm>(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
storage.fragmentStorageData[0].osHandleStorage = &osHandle; storage.fragmentStorageData[0].osHandleStorage = &osHandle;
storage.fragmentStorageData[0].fragmentSize = 100; storage.fragmentStorageData[0].fragmentSize = 100;
static_cast<OsHandleWin *>(storage.fragmentStorageData[0].osHandleStorage)->gmm = gmm.get(); static_cast<OsHandleWin *>(storage.fragmentStorageData[0].osHandleStorage)->gmm = gmm.get();

View File

@ -302,7 +302,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenCreateAllocationFromHa
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment)); memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
auto osHandle = 1u; auto osHandle = 1u;
gdi->getQueryResourceInfoArgOut().NumAllocations = 1; gdi->getQueryResourceInfoArgOut().NumAllocations = 1;
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
D3DDDI_OPENALLOCATIONINFO allocationInfo; D3DDDI_OPENALLOCATIONINFO allocationInfo;
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle(); allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
@ -322,7 +322,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenAllocationPropertiesWhenCreateAllocatio
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment)); memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
auto osHandle = 1u; auto osHandle = 1u;
gdi->getQueryResourceInfoArgOut().NumAllocations = 1; gdi->getQueryResourceInfoArgOut().NumAllocations = 1;
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
D3DDDI_OPENALLOCATIONINFO allocationInfo; D3DDDI_OPENALLOCATIONINFO allocationInfo;
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle(); allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
@ -348,7 +348,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenCreateAllocationFromHandleAndMapCallFail
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment)); memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
auto osHandle = 1u; auto osHandle = 1u;
gdi->getQueryResourceInfoArgOut().NumAllocations = 1; gdi->getQueryResourceInfoArgOut().NumAllocations = 1;
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false, false, StorageInfo{}, true); auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
D3DDDI_OPENALLOCATIONINFO allocationInfo; D3DDDI_OPENALLOCATIONINFO allocationInfo;
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle(); allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
@ -607,7 +607,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIs
auto osHandle = 1u; auto osHandle = 1u;
void *pSysMem = reinterpret_cast<void *>(0x1000); void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u); setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
AllocationProperties properties(0, false, 4096u, AllocationType::SHARED_BUFFER, false, false, mockDeviceBitfield); AllocationProperties properties(0, false, 4096u, AllocationType::SHARED_BUFFER, false, false, mockDeviceBitfield);
@ -623,7 +623,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIs
TEST_F(WddmMemoryManagerSimpleTest, whenAllocationCreatedFromSharedHandleIsDestroyedThenDestroyAllocationFromGdiIsNotInvoked) { TEST_F(WddmMemoryManagerSimpleTest, whenAllocationCreatedFromSharedHandleIsDestroyedThenDestroyAllocationFromGdiIsNotInvoked) {
gdi->getQueryResourceInfoArgOut().NumAllocations = 1; gdi->getQueryResourceInfoArgOut().NumAllocations = 1;
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
D3DDDI_OPENALLOCATIONINFO allocationInfo; D3DDDI_OPENALLOCATIONINFO allocationInfo;
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle(); allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
@ -650,7 +650,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenAllocationCreatedFromSharedHandleIsDestr
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCalledThenNonNullGraphicsAllocationIsReturned) { TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCalledThenNonNullGraphicsAllocationIsReturned) {
void *pSysMem = reinterpret_cast<void *>(0x1000); void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u); setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromNTHandle(reinterpret_cast<void *>(1), 0, AllocationType::SHARED_IMAGE); auto *gpuAllocation = memoryManager->createGraphicsAllocationFromNTHandle(reinterpret_cast<void *>(1), 0, AllocationType::SHARED_IMAGE);
@ -682,7 +682,7 @@ TEST_F(WddmMemoryManagerTest, GivenForce32bitAddressingAndRequireSpecificBitness
auto osHandle = 1u; auto osHandle = 1u;
void *pSysMem = reinterpret_cast<void *>(0x1000); void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u); setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
memoryManager->setForce32BitAllocations(true); memoryManager->setForce32BitAllocations(true);
@ -705,7 +705,7 @@ TEST_F(WddmMemoryManagerTest, GivenForce32bitAddressingAndNotRequiredSpecificBit
auto osHandle = 1u; auto osHandle = 1u;
void *pSysMem = reinterpret_cast<void *>(0x1000); void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u); setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
memoryManager->setForce32BitAllocations(true); memoryManager->setForce32BitAllocations(true);
@ -727,7 +727,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenFreeAllocFromSharedHandl
auto osHandle = 1u; auto osHandle = 1u;
void *pSysMem = reinterpret_cast<void *>(0x1000); void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u); setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
AllocationProperties properties(0, false, 4096u, AllocationType::SHARED_BUFFER, false, false, 0); AllocationProperties properties(0, false, 4096u, AllocationType::SHARED_BUFFER, false, false, 0);
@ -749,7 +749,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerSizeZeroWhenCreateFromShared
auto size = 4096u; auto size = 4096u;
void *pSysMem = reinterpret_cast<void *>(0x1000); void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, size, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u); setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
AllocationProperties properties(0, false, size, AllocationType::SHARED_BUFFER, false, false, 0); AllocationProperties properties(0, false, size, AllocationType::SHARED_BUFFER, false, false, 0);
@ -825,7 +825,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleFa
auto size = 4096u; auto size = 4096u;
void *pSysMem = reinterpret_cast<void *>(0x1000); void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, size, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u); setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
wddm->failOpenSharedHandle = true; wddm->failOpenSharedHandle = true;
@ -1154,7 +1154,7 @@ TEST_F(WddmMemoryManagerTest, GivenThreeOsHandlesWhenAskedForDestroyAllocationsT
osHandle0->handle = ALLOCATION_HANDLE; osHandle0->handle = ALLOCATION_HANDLE;
storage.fragmentStorageData[0].freeTheFragment = true; storage.fragmentStorageData[0].freeTheFragment = true;
osHandle0->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true); osHandle0->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
storage.fragmentStorageData[1].osHandleStorage = osHandle1; storage.fragmentStorageData[1].osHandleStorage = osHandle1;
osHandle1->handle = ALLOCATION_HANDLE; osHandle1->handle = ALLOCATION_HANDLE;
@ -1165,7 +1165,7 @@ TEST_F(WddmMemoryManagerTest, GivenThreeOsHandlesWhenAskedForDestroyAllocationsT
storage.fragmentStorageData[2].osHandleStorage = osHandle2; storage.fragmentStorageData[2].osHandleStorage = osHandle2;
osHandle2->handle = ALLOCATION_HANDLE; osHandle2->handle = ALLOCATION_HANDLE;
storage.fragmentStorageData[2].freeTheFragment = true; storage.fragmentStorageData[2].freeTheFragment = true;
osHandle2->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true); osHandle2->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
storage.fragmentStorageData[2].residency = new ResidencyData(maxOsContextCount); storage.fragmentStorageData[2].residency = new ResidencyData(maxOsContextCount);
memoryManager->cleanOsHandles(storage, 0); memoryManager->cleanOsHandles(storage, 0);
@ -1213,7 +1213,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCpuMemNotMeetRestriction
TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuVaFailThenFailToCreateAllocation) { TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuVaFailThenFailToCreateAllocation) {
void *ptr = reinterpret_cast<void *>(0x1000); void *ptr = reinterpret_cast<void *>(0x1000);
size_t size = 0x1000; size_t size = 0x1000;
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
memoryManager->setDeferredDeleter(nullptr); memoryManager->setDeferredDeleter(nullptr);
setMapGpuVaFailConfigFcn(0, 1); setMapGpuVaFailConfigFcn(0, 1);
@ -1227,7 +1227,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuV
TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMapGpuVaFailSecondAfterDrainSuccessThenCreateAllocation) { TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMapGpuVaFailSecondAfterDrainSuccessThenCreateAllocation) {
void *ptr = reinterpret_cast<void *>(0x10000); void *ptr = reinterpret_cast<void *>(0x10000);
size_t size = 0x1000; size_t size = 0x1000;
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
MockDeferredDeleter *deleter = new MockDeferredDeleter; MockDeferredDeleter *deleter = new MockDeferredDeleter;
memoryManager->setDeferredDeleter(deleter); memoryManager->setDeferredDeleter(deleter);
@ -1243,7 +1243,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMap
TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstAndMapGpuVaFailSecondAfterDrainFailThenFailToCreateAllocation) { TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstAndMapGpuVaFailSecondAfterDrainFailThenFailToCreateAllocation) {
void *ptr = reinterpret_cast<void *>(0x1000); void *ptr = reinterpret_cast<void *>(0x1000);
size_t size = 0x1000; size_t size = 0x1000;
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
MockDeferredDeleter *deleter = new MockDeferredDeleter; MockDeferredDeleter *deleter = new MockDeferredDeleter;
memoryManager->setDeferredDeleter(deleter); memoryManager->setDeferredDeleter(deleter);
@ -1413,7 +1413,7 @@ TEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAllocati
handleStorage.fragmentStorageData[0].residency = new ResidencyData(maxOsContextCount); handleStorage.fragmentStorageData[0].residency = new ResidencyData(maxOsContextCount);
handleStorage.fragmentStorageData[0].freeTheFragment = true; handleStorage.fragmentStorageData[0].freeTheFragment = true;
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get(); auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false, false, {}, true); osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
handleStorage.fragmentCount = 1; handleStorage.fragmentCount = 1;
FragmentStorage fragment = {}; FragmentStorage fragment = {};
@ -1451,7 +1451,7 @@ TEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAllocati
handleStorage.fragmentStorageData[0].residency = new ResidencyData(maxOsContextCount); handleStorage.fragmentStorageData[0].residency = new ResidencyData(maxOsContextCount);
handleStorage.fragmentStorageData[0].freeTheFragment = true; handleStorage.fragmentStorageData[0].freeTheFragment = true;
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get(); auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false, false, {}, true); osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
handleStorage.fragmentCount = 1; handleStorage.fragmentCount = 1;
FragmentStorage fragment = {}; FragmentStorage fragment = {};
@ -1883,7 +1883,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedAllocationWhenMappedGpuVaAndPag
GTEST_SKIP(); GTEST_SKIP();
} }
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get(); auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
gmm->isCompressionEnabled = true; gmm->isCompressionEnabled = true;
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0; D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
WddmMock wddm(*executionEnvironment->rootDeviceEnvironments[1].get()); WddmMock wddm(*executionEnvironment->rootDeviceEnvironments[1].get());
@ -1915,7 +1915,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedAllocationWhenMappedGpuVaAndPag
GTEST_SKIP(); GTEST_SKIP();
} }
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get(); auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
gmm->isCompressionEnabled = true; gmm->isCompressionEnabled = true;
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0; D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
WddmMock wddm(*executionEnvironment->rootDeviceEnvironments[1].get()); WddmMock wddm(*executionEnvironment->rootDeviceEnvironments[1].get());
@ -2016,7 +2016,7 @@ TEST_F(MockWddmMemoryManagerTest, givenNonCompressedAllocationWhenReleaseingThen
TEST_F(MockWddmMemoryManagerTest, givenNonCompressedAllocationWhenMappedGpuVaThenDontMapAuxVa) { TEST_F(MockWddmMemoryManagerTest, givenNonCompressedAllocationWhenMappedGpuVaThenDontMapAuxVa) {
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get(); auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
gmm->isCompressionEnabled = false; gmm->isCompressionEnabled = false;
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0; D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
WddmMock wddm(*rootDeviceEnvironment); WddmMock wddm(*rootDeviceEnvironment);
@ -2042,7 +2042,7 @@ TEST_F(MockWddmMemoryManagerTest, givenNonCompressedAllocationWhenMappedGpuVaThe
TEST_F(MockWddmMemoryManagerTest, givenFailingAllocationWhenMappedGpuVaThenReturnFalse) { TEST_F(MockWddmMemoryManagerTest, givenFailingAllocationWhenMappedGpuVaThenReturnFalse) {
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get(); auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false, false, {}, true)); std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
gmm->isCompressionEnabled = false; gmm->isCompressionEnabled = false;
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0; D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
WddmMock wddm(*rootDeviceEnvironment); WddmMock wddm(*rootDeviceEnvironment);
@ -2071,7 +2071,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedFlagSetWhenInternalIsUnsetThenD
engine.commandStreamReceiver->pageTableManager.reset(mockMngr); engine.commandStreamReceiver->pageTableManager.reset(mockMngr);
} }
auto myGmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false, false, {}, true); auto myGmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
myGmm->isCompressionEnabled = false; myGmm->isCompressionEnabled = false;
myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1; myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1;
@ -2108,7 +2108,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedFlagSetWhenInternalIsSetThenUpd
engine.commandStreamReceiver->pageTableManager.reset(mockMngr); engine.commandStreamReceiver->pageTableManager.reset(mockMngr);
} }
auto myGmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false, false, {}, true); auto myGmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
myGmm->isCompressionEnabled = true; myGmm->isCompressionEnabled = true;
myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1; myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1;

View File

@ -87,7 +87,7 @@ TEST_F(GlReusedBufferTests, givenMultipleBuffersWithReusedAllocationWhenReleasin
TEST_F(GlReusedBufferTests, givenMultipleBuffersWithReusedAllocationWhenCreatingThenReuseGmmResourceToo) { TEST_F(GlReusedBufferTests, givenMultipleBuffersWithReusedAllocationWhenCreatingThenReuseGmmResourceToo) {
std::unique_ptr<Buffer> glBuffer1(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId1, &retVal)); std::unique_ptr<Buffer> glBuffer1(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId1, &retVal));
glBuffer1->getGraphicsAllocation(rootDeviceIndex)->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), (void *)0x100, 1, 0, false, false, {}, true)); glBuffer1->getGraphicsAllocation(rootDeviceIndex)->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), (void *)0x100, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Buffer> glBuffer2(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId1, &retVal)); std::unique_ptr<Buffer> glBuffer2(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId1, &retVal));

View File

@ -256,7 +256,7 @@ TEST_F(glSharingTests, givenClGLBufferWhenItIsAcquiredTwiceThenAcuqireIsNotCalle
TEST_F(glSharingTests, givenClGLBufferWhenItIsCreatedAndGmmIsAvailableThenItIsUsedInGraphicsAllocation) { TEST_F(glSharingTests, givenClGLBufferWhenItIsCreatedAndGmmIsAvailableThenItIsUsedInGraphicsAllocation) {
void *ptr = (void *)0x1000; void *ptr = (void *)0x1000;
auto rootDeviceIndex = context.getDevice(0)->getRootDeviceIndex(); auto rootDeviceIndex = context.getDevice(0)->getRootDeviceIndex();
auto gmm = new Gmm(context.getDevice(0)->getGmmClientContext(), ptr, 4096u, 0, false, false, {}, true); auto gmm = new Gmm(context.getDevice(0)->getGmmClientContext(), ptr, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
mockGlSharing->m_bufferInfoOutput.pGmmResInfo = gmm->gmmResourceInfo->peekGmmResourceInfo(); mockGlSharing->m_bufferInfoOutput.pGmmResInfo = gmm->gmmResourceInfo->peekGmmResourceInfo();
mockGlSharing->uploadDataToBufferInfo(); mockGlSharing->uploadDataToBufferInfo();

View File

@ -167,7 +167,7 @@ XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, givenDecompressInL3ForImage2dFr
imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, imageDesc.image_height * imageDesc.image_width, nullptr, &retVal); imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, imageDesc.image_height * imageDesc.image_width, nullptr, &retVal);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, false, false, {}, true); auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm->isCompressionEnabled = true; gmm->isCompressionEnabled = true;
auto buffer = castToObject<Buffer>(imageDesc.mem_object); auto buffer = castToObject<Buffer>(imageDesc.mem_object);
@ -241,7 +241,7 @@ XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, givenDecompressInL3ForImage2dFr
imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, imageDesc.image_height * imageDesc.image_width, nullptr, &retVal); imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, imageDesc.image_height * imageDesc.image_width, nullptr, &retVal);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, false, false, {}, true); auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm->isCompressionEnabled = true; gmm->isCompressionEnabled = true;
auto buffer = castToObject<Buffer>(imageDesc.mem_object); auto buffer = castToObject<Buffer>(imageDesc.mem_object);
@ -284,7 +284,7 @@ XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, givenDecompressInL3ForImage2dFr
imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, imageDesc.image_height * imageDesc.image_width, nullptr, &retVal); imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, imageDesc.image_height * imageDesc.image_width, nullptr, &retVal);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, false, false, {}, true); auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm->isCompressionEnabled = false; gmm->isCompressionEnabled = false;
auto buffer = castToObject<Buffer>(imageDesc.mem_object); auto buffer = castToObject<Buffer>(imageDesc.mem_object);
@ -327,7 +327,7 @@ XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, givenDecompressInL3ForImage2dFr
imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, imageDesc.image_height * imageDesc.image_width, nullptr, &retVal); imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, imageDesc.image_height * imageDesc.image_width, nullptr, &retVal);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, false, false, {}, true); auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm->isCompressionEnabled = true; gmm->isCompressionEnabled = true;
gmm->gmmResourceInfo->getResourceFlags()->Info.MediaCompressed = true; gmm->gmmResourceInfo->getResourceFlags()->Info.MediaCompressed = true;

View File

@ -1,5 +1,5 @@
# #
# Copyright (C) 2019-2021 Intel Corporation # Copyright (C) 2019-2022 Intel Corporation
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
# #
@ -9,6 +9,8 @@ set(NEO_CORE_GMM_HELPER
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}resource_info_${DRIVER_MODEL}.cpp ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}resource_info_${DRIVER_MODEL}.cpp
${CMAKE_CURRENT_SOURCE_DIR}/client_context/gmm_client_context.cpp ${CMAKE_CURRENT_SOURCE_DIR}/client_context/gmm_client_context.cpp
${CMAKE_CURRENT_SOURCE_DIR}/client_context/gmm_client_context.h ${CMAKE_CURRENT_SOURCE_DIR}/client_context/gmm_client_context.h
${CMAKE_CURRENT_SOURCE_DIR}/cache_settings_helper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cache_settings_helper.h
${CMAKE_CURRENT_SOURCE_DIR}/gmm.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gmm.cpp
${CMAKE_CURRENT_SOURCE_DIR}/gmm.h ${CMAKE_CURRENT_SOURCE_DIR}/gmm.h
${CMAKE_CURRENT_SOURCE_DIR}/gmm_helper.cpp ${CMAKE_CURRENT_SOURCE_DIR}/gmm_helper.cpp

View File

@ -0,0 +1,28 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/gmm_helper/cache_settings_helper.h"
#include "shared/source/memory_manager/allocation_type.h"
namespace NEO {
namespace CacheSettingsHelper {
GMM_RESOURCE_USAGE_TYPE_ENUM getGmmUsageType(AllocationType allocationType, bool forceUncached) {
if (forceUncached) {
return (allocationType == AllocationType::PREEMPTION) ? GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC
: GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED;
}
if (allocationType == AllocationType::IMAGE) {
return GMM_RESOURCE_USAGE_OCL_IMAGE;
}
return GMM_RESOURCE_USAGE_OCL_BUFFER;
}
} // namespace CacheSettingsHelper
} // namespace NEO

View File

@ -0,0 +1,17 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/gmm_helper/gmm_lib.h"
namespace NEO {
enum class AllocationType;
namespace CacheSettingsHelper {
GMM_RESOURCE_USAGE_TYPE_ENUM getGmmUsageType(AllocationType allocationType, bool forceUncached);
}
} // namespace NEO

View File

@ -7,6 +7,7 @@
#include "shared/source/gmm_helper/gmm.h" #include "shared/source/gmm_helper/gmm.h"
#include "shared/source/gmm_helper/cache_settings_helper.h"
#include "shared/source/gmm_helper/client_context/gmm_client_context.h" #include "shared/source/gmm_helper/client_context/gmm_client_context.h"
#include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/resource_info.h" #include "shared/source/gmm_helper/resource_info.h"
@ -16,9 +17,11 @@
#include "shared/source/helpers/hw_info.h" #include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/ptr_math.h" #include "shared/source/helpers/ptr_math.h"
#include "shared/source/helpers/surface_format_info.h" #include "shared/source/helpers/surface_format_info.h"
#include "shared/source/memory_manager/allocation_type.h"
namespace NEO { namespace NEO {
Gmm::Gmm(GmmClientContext *clientContext, const void *alignedPtr, size_t alignedSize, size_t alignment, bool uncacheable, bool preferCompressed, StorageInfo storageInfo, bool allowLargePages) : clientContext(clientContext) { Gmm::Gmm(GmmClientContext *clientContext, const void *alignedPtr, size_t alignedSize, size_t alignment, GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsage,
bool preferCompressed, StorageInfo storageInfo, bool allowLargePages) : clientContext(clientContext) {
resourceParams.Type = RESOURCE_BUFFER; resourceParams.Type = RESOURCE_BUFFER;
resourceParams.Format = GMM_FORMAT_GENERIC_8BIT; resourceParams.Format = GMM_FORMAT_GENERIC_8BIT;
resourceParams.BaseWidth64 = static_cast<uint64_t>(alignedSize); resourceParams.BaseWidth64 = static_cast<uint64_t>(alignedSize);
@ -32,11 +35,7 @@ Gmm::Gmm(GmmClientContext *clientContext, const void *alignedPtr, size_t aligned
} }
} }
if (!uncacheable) { resourceParams.Usage = gmmResourceUsage;
resourceParams.Usage = GMM_RESOURCE_USAGE_OCL_BUFFER;
} else {
resourceParams.Usage = GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC;
}
resourceParams.Flags.Info.Linear = 1; resourceParams.Flags.Info.Linear = 1;
resourceParams.Flags.Info.Cacheable = 1; resourceParams.Flags.Info.Cacheable = 1;
resourceParams.Flags.Gpu.Texture = 1; resourceParams.Flags.Gpu.Texture = 1;
@ -118,7 +117,7 @@ void Gmm::setupImageResourceParams(ImageInfo &imgInfo, bool preferCompressed) {
resourceParams.NoGfxMemory = 1; // dont allocate, only query for params resourceParams.NoGfxMemory = 1; // dont allocate, only query for params
resourceParams.Usage = GMM_RESOURCE_USAGE_TYPE::GMM_RESOURCE_USAGE_OCL_IMAGE; resourceParams.Usage = CacheSettingsHelper::getGmmUsageType(AllocationType::IMAGE, false);
resourceParams.Format = imgInfo.surfaceFormat->GMMSurfaceFormat; resourceParams.Format = imgInfo.surfaceFormat->GMMSurfaceFormat;
resourceParams.Flags.Gpu.Texture = 1; resourceParams.Flags.Gpu.Texture = 1;

View File

@ -25,7 +25,8 @@ class Gmm {
virtual ~Gmm(); virtual ~Gmm();
Gmm() = delete; Gmm() = delete;
Gmm(GmmClientContext *clientContext, ImageInfo &inputOutputImgInfo, StorageInfo storageInfo, bool preferCompressed); Gmm(GmmClientContext *clientContext, ImageInfo &inputOutputImgInfo, StorageInfo storageInfo, bool preferCompressed);
Gmm(GmmClientContext *clientContext, const void *alignedPtr, size_t alignedSize, size_t alignment, bool uncacheable, bool preferCompressed, StorageInfo storageInfo, bool allowLargePages); Gmm(GmmClientContext *clientContext, const void *alignedPtr, size_t alignedSize, size_t alignment,
GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsage, bool preferCompressed, StorageInfo storageInfo, bool allowLargePages);
Gmm(GmmClientContext *clientContext, GMM_RESOURCE_INFO *inputGmm); Gmm(GmmClientContext *clientContext, GMM_RESOURCE_INFO *inputGmm);
void queryImageParams(ImageInfo &inputOutputImgInfo); void queryImageParams(ImageInfo &inputOutputImgInfo);

View File

@ -11,6 +11,7 @@
#include "shared/source/aub/aub_helper.h" #include "shared/source/aub/aub_helper.h"
#include "shared/source/execution_environment/execution_environment.h" #include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/gmm_helper/cache_settings_helper.h"
#include "shared/source/gmm_helper/gmm.h" #include "shared/source/gmm_helper/gmm.h"
#include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/resource_info.h" #include "shared/source/gmm_helper/resource_info.h"
@ -110,7 +111,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryWithAlignment
allocationData.hostPtr, allocationData.hostPtr,
sizeAligned, sizeAligned,
alignment, alignment,
allocationData.flags.uncacheable, CacheSettingsHelper::getGmmUsageType(memoryAllocation->getAllocationType(), !!allocationData.flags.uncacheable),
true, true,
allocationData.storageInfo, allocationData.storageInfo,
true); true);
@ -161,7 +162,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemory64kb(const Al
allocationData.hostPtr, allocationData.hostPtr,
allocationDataAlign.size, allocationDataAlign.size,
allocationDataAlign.alignment, allocationDataAlign.alignment,
allocationData.flags.uncacheable, CacheSettingsHelper::getGmmUsageType(memoryAllocation->getAllocationType(), !!allocationData.flags.uncacheable),
allocationData.flags.preferCompressed, allocationData.flags.preferCompressed,
allocationData.storageInfo, true); allocationData.storageInfo, true);
memoryAllocation->setDefaultGmm(gmm.release()); memoryAllocation->setDefaultGmm(gmm.release());
@ -348,7 +349,8 @@ void OsAgnosticMemoryManager::cleanOsHandles(OsHandleStorage &handleStorage, uin
GraphicsAllocation *OsAgnosticMemoryManager::allocateMemoryByKMD(const AllocationData &allocationData) { GraphicsAllocation *OsAgnosticMemoryManager::allocateMemoryByKMD(const AllocationData &allocationData) {
auto gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), allocationData.hostPtr, auto gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), allocationData.hostPtr,
allocationData.size, 0u, false, allocationData.flags.preferCompressed, allocationData.storageInfo, true); allocationData.size, 0u, CacheSettingsHelper::getGmmUsageType(allocationData.type, allocationData.flags.uncacheable),
allocationData.flags.preferCompressed, allocationData.storageInfo, true);
GraphicsAllocation *alloc = nullptr; GraphicsAllocation *alloc = nullptr;
@ -480,7 +482,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryInDevicePool(
allocationData.hostPtr, allocationData.hostPtr,
sizeAligned64k, sizeAligned64k,
MemoryConstants::pageSize64k, MemoryConstants::pageSize64k,
allocationData.flags.uncacheable, CacheSettingsHelper::getGmmUsageType(allocationData.type, allocationData.flags.uncacheable),
true, true,
allocationData.storageInfo, allocationData.storageInfo,
true); true);

View File

@ -10,6 +10,7 @@
#include "shared/source/command_stream/command_stream_receiver.h" #include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/execution_environment/execution_environment.h" #include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/gmm_helper/cache_settings_helper.h"
#include "shared/source/gmm_helper/gmm.h" #include "shared/source/gmm_helper/gmm.h"
#include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/resource_info.h" #include "shared/source/gmm_helper/resource_info.h"
@ -483,7 +484,7 @@ DrmAllocation *DrmMemoryManager::allocateGraphicsMemory64kb(const AllocationData
GraphicsAllocation *DrmMemoryManager::allocateMemoryByKMD(const AllocationData &allocationData) { GraphicsAllocation *DrmMemoryManager::allocateMemoryByKMD(const AllocationData &allocationData) {
StorageInfo systemMemoryStorageInfo = {}; StorageInfo systemMemoryStorageInfo = {};
auto gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), allocationData.hostPtr, auto gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), allocationData.hostPtr,
allocationData.size, 0u, false, false, systemMemoryStorageInfo, true); allocationData.size, 0u, CacheSettingsHelper::getGmmUsageType(allocationData.type, allocationData.flags.uncacheable), false, systemMemoryStorageInfo, true);
size_t bufferSize = allocationData.size; size_t bufferSize = allocationData.size;
uint64_t gpuRange = acquireGpuRange(bufferSize, allocationData.rootDeviceIndex, HeapIndex::HEAP_STANDARD64KB); uint64_t gpuRange = acquireGpuRange(bufferSize, allocationData.rootDeviceIndex, HeapIndex::HEAP_STANDARD64KB);
@ -1196,7 +1197,7 @@ void createColouredGmms(GmmClientContext *clientContext, DrmAllocation &allocati
nullptr, nullptr,
currentSize, currentSize,
0u, 0u,
false, CacheSettingsHelper::getGmmUsageType(allocation.getAllocationType(), false),
compression, compression,
limitedStorageInfo, limitedStorageInfo,
true); true);
@ -1210,7 +1211,7 @@ void fillGmmsInAllocation(GmmClientContext *clientContext, DrmAllocation *alloca
StorageInfo limitedStorageInfo = storageInfo; StorageInfo limitedStorageInfo = storageInfo;
limitedStorageInfo.memoryBanks &= 1u << handleId; limitedStorageInfo.memoryBanks &= 1u << handleId;
limitedStorageInfo.pageTablesVisibility &= 1u << handleId; limitedStorageInfo.pageTablesVisibility &= 1u << handleId;
auto gmm = new Gmm(clientContext, nullptr, alignedSize, 0u, false, false, limitedStorageInfo, true); auto gmm = new Gmm(clientContext, nullptr, alignedSize, 0u, CacheSettingsHelper::getGmmUsageType(allocation->getAllocationType(), false), false, limitedStorageInfo, true);
allocation->setGmm(gmm, handleId); allocation->setGmm(gmm, handleId);
} }
} }
@ -1279,7 +1280,7 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryInDevicePool(const A
nullptr, nullptr,
sizeAligned, sizeAligned,
0u, 0u,
allocationData.flags.uncacheable, CacheSettingsHelper::getGmmUsageType(allocationData.type, !!allocationData.flags.uncacheable),
allocationData.flags.preferCompressed, allocationData.flags.preferCompressed,
allocationData.storageInfo, allocationData.storageInfo,
true); true);

View File

@ -9,6 +9,7 @@
#include "shared/source/command_stream/command_stream_receiver_hw.h" #include "shared/source/command_stream/command_stream_receiver_hw.h"
#include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/gmm_helper/cache_settings_helper.h"
#include "shared/source/gmm_helper/gmm.h" #include "shared/source/gmm_helper/gmm.h"
#include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/page_table_mngr.h" #include "shared/source/gmm_helper/page_table_mngr.h"
@ -71,7 +72,7 @@ GraphicsAllocation *WddmMemoryManager::allocateMemoryByKMD(const AllocationData
} }
StorageInfo systemMemoryStorageInfo = {}; StorageInfo systemMemoryStorageInfo = {};
auto gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), allocationData.hostPtr, allocationData.size, 0u, auto gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), allocationData.hostPtr, allocationData.size, 0u,
false, false, systemMemoryStorageInfo, true); CacheSettingsHelper::getGmmUsageType(allocationData.type, !!allocationData.flags.uncacheable), false, systemMemoryStorageInfo, true);
auto allocation = std::make_unique<WddmAllocation>(allocationData.rootDeviceIndex, auto allocation = std::make_unique<WddmAllocation>(allocationData.rootDeviceIndex,
1u, // numGmms 1u, // numGmms
allocationData.type, nullptr, allocationData.size, nullptr, allocationData.type, nullptr, allocationData.size, nullptr,
@ -122,7 +123,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryUsingKmdAndMapItToC
auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), nullptr, auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), nullptr,
sizeAligned, 0u, sizeAligned, 0u,
allocationData.flags.uncacheable, CacheSettingsHelper::getGmmUsageType(wddmAllocation->getAllocationType(), !!allocationData.flags.uncacheable),
allocationData.flags.preferCompressed, allocationData.flags.preferCompressed,
allocationData.storageInfo, allocationData.storageInfo,
allowLargePages); allowLargePages);
@ -188,7 +189,8 @@ GraphicsAllocation *WddmMemoryManager::allocateHugeGraphicsMemory(const Allocati
for (auto gmmId = 0u; gmmId < numGmms; ++gmmId) { for (auto gmmId = 0u; gmmId < numGmms; ++gmmId) {
auto size = sizeRemaining > chunkSize ? chunkSize : sizeRemaining; auto size = sizeRemaining > chunkSize ? chunkSize : sizeRemaining;
auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(),
static_cast<char *>(alignedPtr) + gmmId * chunkSize, size, 0u, uncacheable, false, {}, true); static_cast<char *>(alignedPtr) + gmmId * chunkSize, size, 0u,
CacheSettingsHelper::getGmmUsageType(wddmAllocation->getAllocationType(), !!uncacheable), false, {}, true);
wddmAllocation->setGmm(gmm, gmmId); wddmAllocation->setGmm(gmm, gmmId);
sizeRemaining -= size; sizeRemaining -= size;
} }
@ -242,7 +244,7 @@ GraphicsAllocation *WddmMemoryManager::allocateSystemMemoryAndCreateGraphicsAllo
wddmAllocation->setDriverAllocatedCpuPtr(pSysMem); wddmAllocation->setDriverAllocatedCpuPtr(pSysMem);
gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), pSysMem, sizeAligned, 0u, gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), pSysMem, sizeAligned, 0u,
allocationData.flags.uncacheable, allocationData.flags.preferCompressed, allocationData.storageInfo, true); CacheSettingsHelper::getGmmUsageType(wddmAllocation->getAllocationType(), !!allocationData.flags.uncacheable), allocationData.flags.preferCompressed, allocationData.storageInfo, true);
wddmAllocation->setDefaultGmm(gmm); wddmAllocation->setDefaultGmm(gmm);
void *mapPtr = wddmAllocation->getAlignedCpuPtr(); void *mapPtr = wddmAllocation->getAlignedCpuPtr();
@ -286,7 +288,8 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForNonSvmHostPtr(co
auto offsetInPage = ptrDiff(allocationData.hostPtr, alignedPtr); auto offsetInPage = ptrDiff(allocationData.hostPtr, alignedPtr);
wddmAllocation->setAllocationOffset(offsetInPage); wddmAllocation->setAllocationOffset(offsetInPage);
auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), alignedPtr, alignedSize, 0u, false, false, {}, true); auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), alignedPtr, alignedSize, 0u,
CacheSettingsHelper::getGmmUsageType(wddmAllocation->getAllocationType(), !!allocationData.flags.uncacheable), false, {}, true);
wddmAllocation->setDefaultGmm(gmm); wddmAllocation->setDefaultGmm(gmm);
@ -322,7 +325,8 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryWithHostPtr(const A
maxOsContextCount); maxOsContextCount);
allocation->setAllocationOffset(offset); allocation->setAllocationOffset(offset);
Gmm *gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), ptrAligned, sizeAligned, 0u, false, false, {}, true); Gmm *gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), ptrAligned, sizeAligned, 0u,
CacheSettingsHelper::getGmmUsageType(allocation->getAllocationType(), !!allocationData.flags.uncacheable), false, {}, true);
allocation->setDefaultGmm(gmm); allocation->setDefaultGmm(gmm);
if (createWddmAllocation(allocation, reserve)) { if (createWddmAllocation(allocation, reserve)) {
return allocation; return allocation;
@ -366,7 +370,8 @@ GraphicsAllocation *WddmMemoryManager::allocate32BitGraphicsMemoryImpl(const All
wddmAllocation->setAllocationOffset(offset); wddmAllocation->setAllocationOffset(offset);
wddmAllocation->allocInFrontWindowPool = allocationData.flags.use32BitFrontWindow; wddmAllocation->allocInFrontWindowPool = allocationData.flags.use32BitFrontWindow;
gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), ptrAligned, sizeAligned, 0u, false, false, {}, true); gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), ptrAligned, sizeAligned, 0u,
CacheSettingsHelper::getGmmUsageType(wddmAllocation->getAllocationType(), !!allocationData.flags.uncacheable), false, {}, true);
wddmAllocation->setDefaultGmm(gmm); wddmAllocation->setDefaultGmm(gmm);
if (!createWddmAllocation(wddmAllocation.get(), nullptr)) { if (!createWddmAllocation(wddmAllocation.get(), nullptr)) {
@ -596,7 +601,8 @@ MemoryManager::AllocationStatus WddmMemoryManager::populateOsHandles(OsHandleSto
handleStorage.fragmentStorageData[i].residency = new ResidencyData(maxOsContextCount); handleStorage.fragmentStorageData[i].residency = new ResidencyData(maxOsContextCount);
osHandle->gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getGmmClientContext(), handleStorage.fragmentStorageData[i].cpuPtr, osHandle->gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getGmmClientContext(), handleStorage.fragmentStorageData[i].cpuPtr,
handleStorage.fragmentStorageData[i].fragmentSize, 0u, false, false, {}, true); handleStorage.fragmentStorageData[i].fragmentSize, 0u,
CacheSettingsHelper::getGmmUsageType(AllocationType::EXTERNAL_HOST_PTR, false), false, {}, true);
allocatedFragmentIndexes[allocatedFragmentsCounter] = i; allocatedFragmentIndexes[allocatedFragmentsCounter] = i;
allocatedFragmentsCounter++; allocatedFragmentsCounter++;
} }
@ -919,7 +925,7 @@ void createColouredGmms(GmmClientContext *clientContext, WddmAllocation &allocat
nullptr, nullptr,
currentSize, currentSize,
0u, 0u,
false, CacheSettingsHelper::getGmmUsageType(allocation.getAllocationType(), false),
compression, compression,
limitedStorageInfo, true); limitedStorageInfo, true);
allocation.setGmm(gmm, handleId); allocation.setGmm(gmm, handleId);
@ -931,7 +937,7 @@ void fillGmmsInAllocation(GmmClientContext *clientContext, WddmAllocation *alloc
StorageInfo limitedStorageInfo = storageInfo; StorageInfo limitedStorageInfo = storageInfo;
limitedStorageInfo.memoryBanks &= static_cast<uint32_t>(1u << handleId); limitedStorageInfo.memoryBanks &= static_cast<uint32_t>(1u << handleId);
limitedStorageInfo.pageTablesVisibility &= static_cast<uint32_t>(1u << handleId); limitedStorageInfo.pageTablesVisibility &= static_cast<uint32_t>(1u << handleId);
auto gmm = new Gmm(clientContext, nullptr, allocation->getAlignedSize(), 0u, false, false, limitedStorageInfo, true); auto gmm = new Gmm(clientContext, nullptr, allocation->getAlignedSize(), 0u, CacheSettingsHelper::getGmmUsageType(allocation->getAllocationType(), false), false, limitedStorageInfo, true);
allocation->setGmm(gmm, handleId); allocation->setGmm(gmm, handleId);
} }
} }
@ -940,7 +946,7 @@ void splitGmmsInAllocation(GmmClientContext *clientContext, WddmAllocation *wddm
auto sizeRemaining = wddmAllocation->getAlignedSize(); auto sizeRemaining = wddmAllocation->getAlignedSize();
for (auto gmmId = 0u; gmmId < wddmAllocation->getNumGmms(); ++gmmId) { for (auto gmmId = 0u; gmmId < wddmAllocation->getNumGmms(); ++gmmId) {
auto size = sizeRemaining > chunkSize ? chunkSize : sizeRemaining; auto size = sizeRemaining > chunkSize ? chunkSize : sizeRemaining;
auto gmm = new Gmm(clientContext, nullptr, size, alignment, false, false, storageInfo, true); auto gmm = new Gmm(clientContext, nullptr, size, alignment, CacheSettingsHelper::getGmmUsageType(wddmAllocation->getAllocationType(), false), false, storageInfo, true);
wddmAllocation->setGmm(gmm, gmmId); wddmAllocation->setGmm(gmm, gmmId);
sizeRemaining -= size; sizeRemaining -= size;
} }
@ -988,7 +994,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryInDevicePool(const
nullptr, nullptr,
sizeAligned, sizeAligned,
alignment, alignment,
allocationData.flags.uncacheable, CacheSettingsHelper::getGmmUsageType(allocationData.type, !!allocationData.flags.uncacheable),
allocationData.flags.preferCompressed, allocationData.flags.preferCompressed,
allocationData.storageInfo, allocationData.storageInfo,
true); true);

View File

@ -24,7 +24,7 @@ void MemoryAllocatorMultiDeviceSystemSpecificFixture::SetUp(ExecutionEnvironment
auto osEnvironment = new OsEnvironmentWin(); auto osEnvironment = new OsEnvironmentWin();
osEnvironment->gdi.reset(gdi); osEnvironment->gdi.reset(gdi);
for (auto i = 0u; i < executionEnvironment.rootDeviceEnvironments.size(); i++) { for (auto i = 0u; i < executionEnvironment.rootDeviceEnvironments.size(); i++) {
gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[i]->getGmmClientContext(), nullptr, 0, 0, false, false, StorageInfo{}, true); gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[i]->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto wddm = static_cast<WddmMock *>(executionEnvironment.rootDeviceEnvironments[i]->osInterface->getDriverModel()->as<Wddm>()); auto wddm = static_cast<WddmMock *>(executionEnvironment.rootDeviceEnvironments[i]->osInterface->getDriverModel()->as<Wddm>());
wddm->hwDeviceId = std::make_unique<HwDeviceIdWddm>(ADAPTER_HANDLE, LUID{}, osEnvironment, std::make_unique<UmKmDataTranslator>()); wddm->hwDeviceId = std::make_unique<HwDeviceIdWddm>(ADAPTER_HANDLE, LUID{}, osEnvironment, std::make_unique<UmKmDataTranslator>());
wddm->callBaseMapGpuVa = false; wddm->callBaseMapGpuVa = false;

View File

@ -23,7 +23,7 @@ class MockGmm : public Gmm {
using Gmm::Gmm; using Gmm::Gmm;
using Gmm::setupImageResourceParams; using Gmm::setupImageResourceParams;
MockGmm(GmmClientContext *clientContext) : Gmm(clientContext, nullptr, 1, 0, false, false, {}, true){}; MockGmm(GmmClientContext *clientContext) : Gmm(clientContext, nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true){};
static std::unique_ptr<Gmm> queryImgParams(GmmClientContext *clientContext, ImageInfo &imgInfo, bool preferCompression) { static std::unique_ptr<Gmm> queryImgParams(GmmClientContext *clientContext, ImageInfo &imgInfo, bool preferCompression) {
return std::unique_ptr<Gmm>(new Gmm(clientContext, imgInfo, {}, preferCompression)); return std::unique_ptr<Gmm>(new Gmm(clientContext, imgInfo, {}, preferCompression));

View File

@ -278,7 +278,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenNoCpuPtrAndNotLockableAllocationWhe
allocation.overrideMemoryPool(MemoryPool::LocalMemory); allocation.overrideMemoryPool(MemoryPool::LocalMemory);
aubExecutionEnvironment->executionEnvironment->rootDeviceEnvironments[0]->initGmm(); aubExecutionEnvironment->executionEnvironment->rootDeviceEnvironments[0]->initGmm();
MockGmm mockGmm(aubExecutionEnvironment->executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, initSize, initSize, false, false, {}, true); MockGmm mockGmm(aubExecutionEnvironment->executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, initSize, initSize, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
mockGmm.resourceParams.Flags.Info.NotLockable = true; mockGmm.resourceParams.Flags.Info.NotLockable = true;
allocation.setDefaultGmm(&mockGmm); allocation.setDefaultGmm(&mockGmm);
@ -313,7 +313,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenNoCpuPtrAndLockableAllocationWhenGe
allocation.overrideMemoryPool(MemoryPool::LocalMemory); allocation.overrideMemoryPool(MemoryPool::LocalMemory);
aubExecutionEnvironment->executionEnvironment->rootDeviceEnvironments[0]->initGmm(); aubExecutionEnvironment->executionEnvironment->rootDeviceEnvironments[0]->initGmm();
MockGmm mockGmm(aubExecutionEnvironment->executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, initSize, initSize, false, false, {}, true); MockGmm mockGmm(aubExecutionEnvironment->executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, initSize, initSize, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
mockGmm.resourceParams.Flags.Info.NotLockable = false; mockGmm.resourceParams.Flags.Info.NotLockable = false;
allocation.setDefaultGmm(&mockGmm); allocation.setDefaultGmm(&mockGmm);
@ -798,7 +798,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMe
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize}); auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
aubCsr->setAubWritable(true, *gfxAllocation); aubCsr->setAubWritable(true, *gfxAllocation);
auto gmm = new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true); auto gmm = new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gfxAllocation->setDefaultGmm(gmm); gfxAllocation->setDefaultGmm(gmm);
for (bool compressed : {false, true}) { for (bool compressed : {false, true}) {

View File

@ -327,7 +327,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenCompressedAllocationWhenCloningPageTa
csr->setupContext(osContext); csr->setupContext(osContext);
auto mockHardwareContext = static_cast<MockHardwareContext *>(csr->hardwareContextController->hardwareContexts[0].get()); auto mockHardwareContext = static_cast<MockHardwareContext *>(csr->hardwareContextController->hardwareContexts[0].get());
MockGmm gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true); MockGmm gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm.isCompressionEnabled = true; gmm.isCompressionEnabled = true;
int dummy = 1; int dummy = 1;
@ -386,7 +386,7 @@ HWTEST_F(CommandStreamSimulatedTests, givenCompressedTileInstancedAllocationWhen
csr->multiOsContextCapable = true; csr->multiOsContextCapable = true;
MockGmm gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true); MockGmm gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm.isCompressionEnabled = true; gmm.isCompressionEnabled = true;
int dummy = 1; int dummy = 1;

View File

@ -68,7 +68,7 @@ TEST_F(WdmmSharedTests, WhenCreatingSharedAllocationAndGetNTHandleFailedThenAllo
D3DKMT_HANDLE handle = 32u; D3DKMT_HANDLE handle = 32u;
D3DKMT_HANDLE resourceHandle = 32u; D3DKMT_HANDLE resourceHandle = 32u;
uint64_t ntHandle = 0u; uint64_t ntHandle = 0u;
Gmm gmm(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 20, 0, false, true, {}, true); Gmm gmm(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 20, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, {}, true);
EXPECT_NE(STATUS_SUCCESS, wddm->createAllocation(nullptr, &gmm, handle, resourceHandle, &ntHandle)); EXPECT_NE(STATUS_SUCCESS, wddm->createAllocation(nullptr, &gmm, handle, resourceHandle, &ntHandle));
EXPECT_EQ(wddm->destroyAllocationResult.called++, 1u); EXPECT_EQ(wddm->destroyAllocationResult.called++, 1u);

View File

@ -17,7 +17,7 @@ TEST_F(WddmTests, whenCreatingAllocation64kThenDoNotCreateResource) {
init(); init();
D3DKMT_HANDLE handle; D3DKMT_HANDLE handle;
Gmm gmm(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 20, 0, false, true, {}, true); Gmm gmm(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 20, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, {}, true);
EXPECT_TRUE(wddm->createAllocation(&gmm, handle)); EXPECT_TRUE(wddm->createAllocation(&gmm, handle));
auto gdiParam = getMockAllocationFcn(); auto gdiParam = getMockAllocationFcn();