fix: set correct default value of cacheable flag

Related-To: NEO-9421

Signed-off-by: Tomasz Biernacik <tomasz.biernacik@intel.com>
This commit is contained in:
Tomasz Biernacik
2025-03-07 15:52:31 +00:00
committed by Compute-Runtime-Automation
parent 4885879f3e
commit a8d9e7ed35
3 changed files with 23 additions and 3 deletions

View File

@@ -1404,17 +1404,18 @@ uint64_t Drm::getPatIndex(Gmm *gmm, AllocationType allocationType, CacheRegion c
}
GMM_RESOURCE_INFO *resourceInfo = nullptr;
bool cachable = !CacheSettingsHelper::isUncachedType(usageType);
auto preferNoCpuAccess = CacheSettingsHelper::preferNoCpuAccess(usageType, rootDeviceEnvironment);
bool cacheable = !preferNoCpuAccess && !isUncachedType;
bool compressed = false;
if (gmm) {
resourceInfo = gmm->gmmResourceInfo->peekGmmResourceInfo();
usageType = gmm->resourceParams.Usage;
compressed = gmm->isCompressionEnabled();
cachable = gmm->gmmResourceInfo->getResourceFlags()->Info.Cacheable;
cacheable = gmm->gmmResourceInfo->getResourceFlags()->Info.Cacheable;
}
uint64_t patIndex = rootDeviceEnvironment.getGmmClientContext()->cachePolicyGetPATIndex(resourceInfo, usageType, compressed, cachable);
uint64_t patIndex = rootDeviceEnvironment.getGmmClientContext()->cachePolicyGetPATIndex(resourceInfo, usageType, compressed, cacheable);
patIndex = productHelper.overridePatIndex(isUncachedType, patIndex, allocationType);
UNRECOVERABLE_IF(patIndex == static_cast<uint64_t>(GMM_PAT_ERROR));

View File

@@ -119,6 +119,7 @@ struct DrmMockCustom : public Drm {
using Drm::pageFaultSupported;
using Drm::queryTopology;
using Drm::setupIoctlHelper;
using Drm::vmBindPatIndexProgrammingSupported;
struct IoctlResExt {
std::vector<int32_t> no;

View File

@@ -7599,6 +7599,24 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenCompress
memoryManager->freeGraphicsMemory(allocation);
}
TEST_F(DrmMemoryManagerTest, givenNoGmmWhenQueryingPatIndexThenPassCorrectParams) {
mock->vmBindPatIndexProgrammingSupported = true;
auto &productHelper = this->device->getProductHelper();
auto mockClientContext = static_cast<MockGmmClientContextBase *>(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext());
for (auto allocationType = static_cast<uint32_t>(AllocationType::buffer); allocationType < static_cast<uint32_t>(AllocationType::count); ++allocationType) {
auto usageType = CacheSettingsHelper::getGmmUsageType(static_cast<AllocationType>(allocationType), false, productHelper);
auto isUncachedType = CacheSettingsHelper::isUncachedType(usageType);
auto preferNoCpuAccess = CacheSettingsHelper::preferNoCpuAccess(usageType, *executionEnvironment->rootDeviceEnvironments[0]);
bool cacheable = !preferNoCpuAccess && !isUncachedType;
mock->getPatIndex(nullptr, static_cast<AllocationType>(allocationType), CacheRegion::defaultRegion, CachePolicy::writeBack, false, false);
EXPECT_EQ(cacheable, mockClientContext->passedCachableSettingForGetPatIndexQuery);
EXPECT_EQ(false, mockClientContext->passedCompressedSettingForGetPatIndexQuery);
}
}
TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenNotSetUseSystemMemoryWhenGraphicsAllocationInDevicePoolIsAllocatedForImageThenLocalMemoryAllocationIsReturnedFromStandard64KbHeap) {
ImageDescriptor imgDesc = {};
imgDesc.imageType = ImageType::image2D;