Revert "fix: change gmm resource for externalHostPtr"

This reverts commit 63843862df.

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

View File

@@ -69,11 +69,11 @@ GMM_RESOURCE_USAGE_TYPE_ENUM CacheSettingsHelper::getDefaultUsageTypeWithCaching
case AllocationType::sharedBuffer: case AllocationType::sharedBuffer:
case AllocationType::svmGpu: case AllocationType::svmGpu:
case AllocationType::unifiedSharedMemory: case AllocationType::unifiedSharedMemory:
case AllocationType::externalHostPtr:
if (debugManager.flags.DisableCachingForStatefulBufferAccess.get()) { if (debugManager.flags.DisableCachingForStatefulBufferAccess.get()) {
return getDefaultUsageTypeWithCachingDisabled(allocationType, productHelper); return getDefaultUsageTypeWithCachingDisabled(allocationType, productHelper);
} }
return GMM_RESOURCE_USAGE_OCL_BUFFER; return GMM_RESOURCE_USAGE_OCL_BUFFER;
case AllocationType::externalHostPtr:
case AllocationType::bufferHostMemory: case AllocationType::bufferHostMemory:
case AllocationType::internalHostMemory: case AllocationType::internalHostMemory:
case AllocationType::mapAllocation: case AllocationType::mapAllocation:

View File

@@ -43,7 +43,6 @@
#include "shared/source/os_interface/linux/os_context_linux.h" #include "shared/source/os_interface/linux/os_context_linux.h"
#include "shared/source/os_interface/linux/sys_calls.h" #include "shared/source/os_interface/linux/sys_calls.h"
#include "shared/source/os_interface/os_interface.h" #include "shared/source/os_interface/os_interface.h"
#include "shared/source/os_interface/product_helper.h"
#include <cstring> #include <cstring>
#include <iostream> #include <iostream>
@@ -654,9 +653,10 @@ GraphicsAllocation *DrmMemoryManager::allocatePhysicalDeviceMemory(const Allocat
auto &drm = getDrm(allocationData.rootDeviceIndex); auto &drm = getDrm(allocationData.rootDeviceIndex);
auto ioctlHelper = drm.getIoctlHelper(); auto ioctlHelper = drm.getIoctlHelper();
uint32_t handle = ioctlHelper->createGem(bufferSize, static_cast<uint32_t>(allocationData.storageInfo.memoryBanks.to_ulong()));
auto patIndex = drm.getPatIndex(gmm.get(), allocationData.type, CacheRegion::defaultRegion, CachePolicy::writeBack, false, MemoryPoolHelper::isSystemMemoryPool(memoryPool)); auto patIndex = drm.getPatIndex(gmm.get(), allocationData.type, CacheRegion::defaultRegion, CachePolicy::writeBack, false, MemoryPoolHelper::isSystemMemoryPool(memoryPool));
auto isCoherent = productHelper.isCoherentAllocation(patIndex);
uint32_t handle = ioctlHelper->createGem(bufferSize, static_cast<uint32_t>(allocationData.storageInfo.memoryBanks.to_ulong()), isCoherent);
std::unique_ptr<BufferObject, BufferObject::Deleter> bo(new BufferObject(allocationData.rootDeviceIndex, &drm, patIndex, handle, bufferSize, maxOsContextCount)); std::unique_ptr<BufferObject, BufferObject::Deleter> bo(new BufferObject(allocationData.rootDeviceIndex, &drm, patIndex, handle, bufferSize, maxOsContextCount));
@@ -702,8 +702,7 @@ GraphicsAllocation *DrmMemoryManager::allocateMemoryByKMD(const AllocationData &
if (0 != ret) { if (0 != ret) {
auto ioctlHelper = drm.getIoctlHelper(); auto ioctlHelper = drm.getIoctlHelper();
auto isCoherent = productHelper.isCoherentAllocation(patIndex); handle = ioctlHelper->createGem(bufferSize, static_cast<uint32_t>(allocationData.storageInfo.memoryBanks.to_ulong()));
handle = ioctlHelper->createGem(bufferSize, static_cast<uint32_t>(allocationData.storageInfo.memoryBanks.to_ulong()), isCoherent);
boType = BufferObject::BOType::legacy; boType = BufferObject::BOType::legacy;
} }
@@ -739,10 +738,9 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryForImageImpl(const A
auto &drm = this->getDrm(allocationData.rootDeviceIndex); auto &drm = this->getDrm(allocationData.rootDeviceIndex);
auto ioctlHelper = drm.getIoctlHelper(); auto ioctlHelper = drm.getIoctlHelper();
uint32_t handle = ioctlHelper->createGem(allocationData.imgInfo->size, static_cast<uint32_t>(allocationData.storageInfo.memoryBanks.to_ulong()));
auto patIndex = drm.getPatIndex(gmm.get(), allocationData.type, CacheRegion::defaultRegion, CachePolicy::writeBack, false, MemoryPoolHelper::isSystemMemoryPool(memoryPool)); auto patIndex = drm.getPatIndex(gmm.get(), allocationData.type, CacheRegion::defaultRegion, CachePolicy::writeBack, false, MemoryPoolHelper::isSystemMemoryPool(memoryPool));
auto &productHelper = drm.getRootDeviceEnvironment().getProductHelper();
auto isCoherent = productHelper.isCoherentAllocation(patIndex);
uint32_t handle = ioctlHelper->createGem(allocationData.imgInfo->size, static_cast<uint32_t>(allocationData.storageInfo.memoryBanks.to_ulong()), isCoherent);
std::unique_ptr<BufferObject, BufferObject::Deleter> bo(new (std::nothrow) BufferObject(allocationData.rootDeviceIndex, &drm, patIndex, handle, allocationData.imgInfo->size, maxOsContextCount)); std::unique_ptr<BufferObject, BufferObject::Deleter> bo(new (std::nothrow) BufferObject(allocationData.rootDeviceIndex, &drm, patIndex, handle, allocationData.imgInfo->size, maxOsContextCount));
if (!bo) { if (!bo) {

View File

@@ -99,8 +99,8 @@ class IoctlHelper {
virtual bool isSetPairAvailable() = 0; virtual bool isSetPairAvailable() = 0;
virtual bool isChunkingAvailable() = 0; virtual bool isChunkingAvailable() = 0;
virtual bool isVmBindAvailable() = 0; virtual bool isVmBindAvailable() = 0;
virtual int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, std::optional<uint32_t> memPolicyMode, std::optional<std::vector<unsigned long>> memPolicyNodemask, std::optional<bool> isCoherent) = 0; virtual int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, std::optional<uint32_t> memPolicyMode, std::optional<std::vector<unsigned long>> memPolicyNodemask) = 0;
virtual uint32_t createGem(uint64_t size, uint32_t memoryBanks, std::optional<bool> isCoherent) = 0; virtual uint32_t createGem(uint64_t size, uint32_t memoryBanks) = 0;
virtual CacheRegion closAlloc() = 0; virtual CacheRegion closAlloc() = 0;
virtual uint16_t closAllocWays(CacheRegion closIndex, uint16_t cacheLevel, uint16_t numWays) = 0; virtual uint16_t closAllocWays(CacheRegion closIndex, uint16_t cacheLevel, uint16_t numWays) = 0;
virtual CacheRegion closFree(CacheRegion closIndex) = 0; virtual CacheRegion closFree(CacheRegion closIndex) = 0;
@@ -228,7 +228,7 @@ class IoctlHelperI915 : public IoctlHelper {
bool getTopologyDataAndMap(const HardwareInfo &hwInfo, DrmQueryTopologyData &topologyData, TopologyMap &topologyMap) override; bool getTopologyDataAndMap(const HardwareInfo &hwInfo, DrmQueryTopologyData &topologyData, TopologyMap &topologyMap) override;
void fillBindInfoForIpcHandle(uint32_t handle, size_t size) override; void fillBindInfoForIpcHandle(uint32_t handle, size_t size) override;
bool getFdFromVmExport(uint32_t vmId, uint32_t flags, int32_t *fd) override; bool getFdFromVmExport(uint32_t vmId, uint32_t flags, int32_t *fd) override;
uint32_t createGem(uint64_t size, uint32_t memoryBanks, std::optional<bool> isCoherent) override; uint32_t createGem(uint64_t size, uint32_t memoryBanks) override;
bool setGemTiling(void *setTiling) override; bool setGemTiling(void *setTiling) override;
bool getGemTiling(void *setTiling) override; bool getGemTiling(void *setTiling) override;
bool setGpuCpuTimes(TimeStampData *pGpuCpuTime, OSTime *osTime) override; bool setGpuCpuTimes(TimeStampData *pGpuCpuTime, OSTime *osTime) override;
@@ -250,7 +250,7 @@ class IoctlHelperUpstream : public IoctlHelperI915 {
bool isSetPairAvailable() override; bool isSetPairAvailable() override;
bool isChunkingAvailable() override; bool isChunkingAvailable() override;
bool isVmBindAvailable() override; bool isVmBindAvailable() override;
int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, std::optional<uint32_t> memPolicyMode, std::optional<std::vector<unsigned long>> memPolicyNodemask, std::optional<bool> isCoherent) override; int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, std::optional<uint32_t> memPolicyMode, std::optional<std::vector<unsigned long>> memPolicyNodemask) override;
CacheRegion closAlloc() override; CacheRegion closAlloc() override;
uint16_t closAllocWays(CacheRegion closIndex, uint16_t cacheLevel, uint16_t numWays) override; uint16_t closAllocWays(CacheRegion closIndex, uint16_t cacheLevel, uint16_t numWays) override;
CacheRegion closFree(CacheRegion closIndex) override; CacheRegion closFree(CacheRegion closIndex) override;
@@ -315,7 +315,7 @@ class IoctlHelperImpl : public IoctlHelperUpstream {
return std::make_unique<IoctlHelperImpl<gfxProduct>>(drm); return std::make_unique<IoctlHelperImpl<gfxProduct>>(drm);
} }
int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, std::optional<uint32_t> memPolicyMode, std::optional<std::vector<unsigned long>> memPolicyNodemask, std::optional<bool> isCoherent) override; int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, std::optional<uint32_t> memPolicyMode, std::optional<std::vector<unsigned long>> memPolicyNodemask) override;
std::vector<MemoryRegion> translateToMemoryRegions(const std::vector<uint64_t> &regionInfo) override; std::vector<MemoryRegion> translateToMemoryRegions(const std::vector<uint64_t> &regionInfo) override;
unsigned int getIoctlRequestValue(DrmIoctl ioctlRequest) const override; unsigned int getIoctlRequestValue(DrmIoctl ioctlRequest) const override;
std::string getIoctlString(DrmIoctl ioctlRequest) const override; std::string getIoctlString(DrmIoctl ioctlRequest) const override;
@@ -328,7 +328,7 @@ class IoctlHelperPrelim20 : public IoctlHelperI915 {
bool isSetPairAvailable() override; bool isSetPairAvailable() override;
bool isChunkingAvailable() override; bool isChunkingAvailable() override;
bool isVmBindAvailable() override; bool isVmBindAvailable() override;
int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, std::optional<uint32_t> memPolicyMode, std::optional<std::vector<unsigned long>> memPolicyNodemask, std::optional<bool> isCoherent) override; int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, std::optional<uint32_t> memPolicyMode, std::optional<std::vector<unsigned long>> memPolicyNodemask) override;
CacheRegion closAlloc() override; CacheRegion closAlloc() override;
uint16_t closAllocWays(CacheRegion closIndex, uint16_t cacheLevel, uint16_t numWays) override; uint16_t closAllocWays(CacheRegion closIndex, uint16_t cacheLevel, uint16_t numWays) override;
CacheRegion closFree(CacheRegion closIndex) override; CacheRegion closFree(CacheRegion closIndex) override;

View File

@@ -544,7 +544,7 @@ bool IoctlHelperI915::getFdFromVmExport(uint32_t vmId, uint32_t flags, int32_t *
return false; return false;
} }
uint32_t IoctlHelperI915::createGem(uint64_t size, uint32_t memoryBanks, std::optional<bool> isCoherent) { uint32_t IoctlHelperI915::createGem(uint64_t size, uint32_t memoryBanks) {
GemCreate gemCreate = {}; GemCreate gemCreate = {};
gemCreate.size = size; gemCreate.size = size;
[[maybe_unused]] auto ret = ioctl(DrmIoctl::gemCreate, &gemCreate); [[maybe_unused]] auto ret = ioctl(DrmIoctl::gemCreate, &gemCreate);

View File

@@ -157,7 +157,7 @@ bool IoctlHelperPrelim20::isVmBindAvailable() {
return vmBindSupported; return vmBindSupported;
} }
int IoctlHelperPrelim20::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, std::optional<uint32_t> memPolicyMode, std::optional<std::vector<unsigned long>> memPolicyNodemask, std::optional<bool> isCoherent) { int IoctlHelperPrelim20::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, std::optional<uint32_t> memPolicyMode, std::optional<std::vector<unsigned long>> memPolicyNodemask) {
uint32_t regionsSize = static_cast<uint32_t>(memClassInstances.size()); uint32_t regionsSize = static_cast<uint32_t>(memClassInstances.size());
std::vector<prelim_drm_i915_gem_memory_class_instance> regions(regionsSize); std::vector<prelim_drm_i915_gem_memory_class_instance> regions(regionsSize);
for (uint32_t i = 0; i < regionsSize; i++) { for (uint32_t i = 0; i < regionsSize; i++) {

View File

@@ -33,7 +33,7 @@ bool IoctlHelperUpstream::isVmBindAvailable() {
return false; return false;
} }
int IoctlHelperUpstream::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, std::optional<uint32_t> memPolicyMode, std::optional<std::vector<unsigned long>> memPolicyNodemask, std::optional<bool> isCoherent) { int IoctlHelperUpstream::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, std::optional<uint32_t> memPolicyMode, std::optional<std::vector<unsigned long>> memPolicyNodemask) {
bool isPatIndexValid = (patIndex != CommonConstants::unsupportedPatIndex) && (patIndex <= std::numeric_limits<uint32_t>::max()); bool isPatIndexValid = (patIndex != CommonConstants::unsupportedPatIndex) && (patIndex <= std::numeric_limits<uint32_t>::max());
bool useSetPat = this->isSetPatSupported && isPatIndexValid; bool useSetPat = this->isSetPatSupported && isPatIndexValid;

View File

@@ -21,8 +21,8 @@ constexpr static auto gfxProduct = IGFX_DG1;
extern bool isQueryDrmTip(const std::vector<uint64_t> &queryInfo); extern bool isQueryDrmTip(const std::vector<uint64_t> &queryInfo);
template <> template <>
int IoctlHelperImpl<gfxProduct>::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, std::optional<uint32_t> memPolicyMode, std::optional<std::vector<unsigned long>> memPolicyNodemask, std::optional<bool> isCoherent) { int IoctlHelperImpl<gfxProduct>::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, std::optional<uint32_t> memPolicyMode, std::optional<std::vector<unsigned long>> memPolicyNodemask) {
auto ret = IoctlHelperUpstream::createGemExt(memClassInstances, allocSize, handle, patIndex, vmId, pairHandle, isChunked, numOfChunks, memPolicyMode, memPolicyNodemask, isCoherent); auto ret = IoctlHelperUpstream::createGemExt(memClassInstances, allocSize, handle, patIndex, vmId, pairHandle, isChunked, numOfChunks, memPolicyMode, memPolicyNodemask);
if (ret == 0) { if (ret == 0) {
return ret; return ret;
} }

View File

@@ -15,7 +15,6 @@
#include "shared/source/helpers/hw_info.h" #include "shared/source/helpers/hw_info.h"
#include "shared/source/os_interface/linux/drm_neo.h" #include "shared/source/os_interface/linux/drm_neo.h"
#include "shared/source/os_interface/linux/numa_library.h" #include "shared/source/os_interface/linux/numa_library.h"
#include "shared/source/os_interface/product_helper.h"
#include <iostream> #include <iostream>
@@ -69,17 +68,15 @@ void MemoryInfo::assignRegionsFromDistances(const std::vector<DistanceInfo> &dis
int MemoryInfo::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, bool isUSMHostAllocation) { int MemoryInfo::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, bool isUSMHostAllocation) {
std::vector<unsigned long> memPolicyNodeMask; std::vector<unsigned long> memPolicyNodeMask;
int mode = -1; int mode = -1;
auto &productHelper = this->drm.getRootDeviceEnvironment().getHelper<ProductHelper>();
auto isCoherent = productHelper.isCoherentAllocation(patIndex);
if (memPolicySupported && if (memPolicySupported &&
isUSMHostAllocation && isUSMHostAllocation &&
Linux::NumaLibrary::getMemPolicy(&mode, memPolicyNodeMask)) { Linux::NumaLibrary::getMemPolicy(&mode, memPolicyNodeMask)) {
if (memPolicyMode != -1) { if (memPolicyMode != -1) {
mode = memPolicyMode; mode = memPolicyMode;
} }
return this->drm.getIoctlHelper()->createGemExt(memClassInstances, allocSize, handle, patIndex, vmId, pairHandle, isChunked, numOfChunks, mode, memPolicyNodeMask, isCoherent); return this->drm.getIoctlHelper()->createGemExt(memClassInstances, allocSize, handle, patIndex, vmId, pairHandle, isChunked, numOfChunks, mode, memPolicyNodeMask);
} else { } else {
return this->drm.getIoctlHelper()->createGemExt(memClassInstances, allocSize, handle, patIndex, vmId, pairHandle, isChunked, numOfChunks, std::nullopt, std::nullopt, isCoherent); return this->drm.getIoctlHelper()->createGemExt(memClassInstances, allocSize, handle, patIndex, vmId, pairHandle, isChunked, numOfChunks, std::nullopt, std::nullopt);
} }
} }

View File

@@ -537,9 +537,9 @@ uint16_t IoctlHelperXe::getDefaultEngineClass(const aub_stream::EngineType &defa
* *
* @return returns caching policy defined as DRM_XE_GEM_CPU_CACHING_WC or DRM_XE_GEM_CPU_CACHING_WB * @return returns caching policy defined as DRM_XE_GEM_CPU_CACHING_WC or DRM_XE_GEM_CPU_CACHING_WB
*/ */
uint16_t IoctlHelperXe::getCpuCachingMode(std::optional<bool> isCoherent, bool allocationInSystemMemory) const { uint16_t IoctlHelperXe::getCpuCachingMode(bool allocationInSystemMemory) const {
uint16_t cpuCachingMode = DRM_XE_GEM_CPU_CACHING_WC; uint16_t cpuCachingMode = DRM_XE_GEM_CPU_CACHING_WC;
if ((isCoherent.value_or(false) == true) || (isCoherent == std::nullopt && allocationInSystemMemory)) { if (allocationInSystemMemory) {
cpuCachingMode = DRM_XE_GEM_CPU_CACHING_WB; cpuCachingMode = DRM_XE_GEM_CPU_CACHING_WB;
} }
@@ -550,7 +550,7 @@ uint16_t IoctlHelperXe::getCpuCachingMode(std::optional<bool> isCoherent, bool a
return cpuCachingMode; return cpuCachingMode;
} }
int IoctlHelperXe::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, std::optional<uint32_t> memPolicyMode, std::optional<std::vector<unsigned long>> memPolicyNodemask, std::optional<bool> isCoherent) { int IoctlHelperXe::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, std::optional<uint32_t> memPolicyMode, std::optional<std::vector<unsigned long>> memPolicyNodemask) {
struct drm_xe_gem_create create = {}; struct drm_xe_gem_create create = {};
uint32_t regionsSize = static_cast<uint32_t>(memClassInstances.size()); uint32_t regionsSize = static_cast<uint32_t>(memClassInstances.size());
@@ -570,7 +570,7 @@ int IoctlHelperXe::createGemExt(const MemRegionsVec &memClassInstances, size_t a
memoryInstances.set(memoryClassInstance.memoryInstance); memoryInstances.set(memoryClassInstance.memoryInstance);
} }
create.placement = static_cast<uint32_t>(memoryInstances.to_ulong()); create.placement = static_cast<uint32_t>(memoryInstances.to_ulong());
create.cpu_caching = this->getCpuCachingMode(isCoherent, mem.memoryClass == drm_xe_memory_class::DRM_XE_MEM_REGION_CLASS_SYSMEM); create.cpu_caching = this->getCpuCachingMode(mem.memoryClass == drm_xe_memory_class::DRM_XE_MEM_REGION_CLASS_SYSMEM);
auto ret = IoctlHelper::ioctl(DrmIoctl::gemCreate, &create); auto ret = IoctlHelper::ioctl(DrmIoctl::gemCreate, &create);
handle = create.handle; handle = create.handle;
@@ -581,7 +581,7 @@ int IoctlHelperXe::createGemExt(const MemRegionsVec &memClassInstances, size_t a
return ret; return ret;
} }
uint32_t IoctlHelperXe::createGem(uint64_t size, uint32_t memoryBanks, std::optional<bool> isCoherent) { uint32_t IoctlHelperXe::createGem(uint64_t size, uint32_t memoryBanks) {
struct drm_xe_gem_create create = {}; struct drm_xe_gem_create create = {};
create.size = size; create.size = size;
auto pHwInfo = drm.getRootDeviceEnvironment().getHardwareInfo(); auto pHwInfo = drm.getRootDeviceEnvironment().getHardwareInfo();
@@ -603,7 +603,7 @@ uint32_t IoctlHelperXe::createGem(uint64_t size, uint32_t memoryBanks, std::opti
memoryInstances.set(regionClassAndInstance.memoryInstance); memoryInstances.set(regionClassAndInstance.memoryInstance);
} }
create.placement = static_cast<uint32_t>(memoryInstances.to_ulong()); create.placement = static_cast<uint32_t>(memoryInstances.to_ulong());
create.cpu_caching = this->getCpuCachingMode(isCoherent, create.placement == drm_xe_memory_class::DRM_XE_MEM_REGION_CLASS_SYSMEM); create.cpu_caching = this->getCpuCachingMode(create.placement == drm_xe_memory_class::DRM_XE_MEM_REGION_CLASS_SYSMEM);
[[maybe_unused]] auto ret = ioctl(DrmIoctl::gemCreate, &create); [[maybe_unused]] auto ret = ioctl(DrmIoctl::gemCreate, &create);
xeLog(" -> IoctlHelperXe::%s vmid=0x%x s=0x%lx f=0x%x p=0x%x h=0x%x c=%hu r=%d\n", __FUNCTION__, xeLog(" -> IoctlHelperXe::%s vmid=0x%x s=0x%lx f=0x%x p=0x%x h=0x%x c=%hu r=%d\n", __FUNCTION__,

View File

@@ -41,8 +41,8 @@ class IoctlHelperXe : public IoctlHelper {
bool isSetPairAvailable() override; bool isSetPairAvailable() override;
bool isChunkingAvailable() override; bool isChunkingAvailable() override;
bool isVmBindAvailable() override; bool isVmBindAvailable() override;
int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, std::optional<uint32_t> memPolicyMode, std::optional<std::vector<unsigned long>> memPolicyNodemask, std::optional<bool> isCoherent) override; int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks, std::optional<uint32_t> memPolicyMode, std::optional<std::vector<unsigned long>> memPolicyNodemask) override;
uint32_t createGem(uint64_t size, uint32_t memoryBanks, std::optional<bool> isCoherent) override; uint32_t createGem(uint64_t size, uint32_t memoryBanks) override;
CacheRegion closAlloc() override; CacheRegion closAlloc() override;
uint16_t closAllocWays(CacheRegion closIndex, uint16_t cacheLevel, uint16_t numWays) override; uint16_t closAllocWays(CacheRegion closIndex, uint16_t cacheLevel, uint16_t numWays) override;
CacheRegion closFree(CacheRegion closIndex) override; CacheRegion closFree(CacheRegion closIndex) override;
@@ -120,7 +120,7 @@ class IoctlHelperXe : public IoctlHelper {
void fillExecBuffer(ExecBuffer &execBuffer, uintptr_t buffersPtr, uint32_t bufferCount, uint32_t startOffset, uint32_t size, uint64_t flags, uint32_t drmContextId) override; void fillExecBuffer(ExecBuffer &execBuffer, uintptr_t buffersPtr, uint32_t bufferCount, uint32_t startOffset, uint32_t size, uint64_t flags, uint32_t drmContextId) override;
void logExecBuffer(const ExecBuffer &execBuffer, std::stringstream &logger) override; void logExecBuffer(const ExecBuffer &execBuffer, std::stringstream &logger) override;
bool setDomainCpu(uint32_t handle, bool writeEnable) override; bool setDomainCpu(uint32_t handle, bool writeEnable) override;
uint16_t getCpuCachingMode(std::optional<bool> isCoherent, bool allocationInSystemMemory) const; uint16_t getCpuCachingMode(bool allocationInSystemMemory) const;
void addDebugMetadata(DrmResourceClass type, uint64_t *offset, uint64_t size); void addDebugMetadata(DrmResourceClass type, uint64_t *offset, uint64_t size);
void addDebugMetadataCookie(uint64_t cookie); void addDebugMetadataCookie(uint64_t cookie);
uint32_t registerResource(DrmResourceClass classType, const void *data, size_t size) override; uint32_t registerResource(DrmResourceClass classType, const void *data, size_t size) override;

View File

@@ -233,7 +233,6 @@ class ProductHelper {
virtual bool isDeviceToHostCopySignalingFenceRequired() const = 0; virtual bool isDeviceToHostCopySignalingFenceRequired() const = 0;
virtual size_t getMaxFillPaternSizeForCopyEngine() const = 0; virtual size_t getMaxFillPaternSizeForCopyEngine() const = 0;
virtual bool isAvailableExtendedScratch() const = 0; virtual bool isAvailableExtendedScratch() const = 0;
virtual std::optional<bool> isCoherentAllocation(uint64_t patIndex) const = 0;
virtual ~ProductHelper() = default; virtual ~ProductHelper() = default;

View File

@@ -113,9 +113,4 @@ bool ProductHelperHw<gfxProduct>::useLocalPreferredForCacheableBuffers() const {
return false; return false;
} }
template <PRODUCT_FAMILY gfxProduct>
std::optional<bool> ProductHelperHw<gfxProduct>::isCoherentAllocation(uint64_t patIndex) const {
return std::nullopt;
}
} // namespace NEO } // namespace NEO

View File

@@ -178,7 +178,6 @@ class ProductHelperHw : public ProductHelper {
bool isDeviceToHostCopySignalingFenceRequired() const override; bool isDeviceToHostCopySignalingFenceRequired() const override;
size_t getMaxFillPaternSizeForCopyEngine() const override; size_t getMaxFillPaternSizeForCopyEngine() const override;
bool isAvailableExtendedScratch() const override; bool isAvailableExtendedScratch() const override;
std::optional<bool> isCoherentAllocation(uint64_t patIndex) const override;
~ProductHelperHw() override = default; ~ProductHelperHw() override = default;

View File

@@ -242,9 +242,4 @@ bool ProductHelperHw<gfxProduct>::supportReadOnlyAllocations() const {
return true; return true;
} }
template <>
std::optional<bool> ProductHelperHw<gfxProduct>::isCoherentAllocation(uint64_t patIndex) const {
return std::nullopt;
}
} // namespace NEO } // namespace NEO

View File

@@ -256,11 +256,6 @@ void ProductHelperHw<gfxProduct>::adjustNumberOfCcs(HardwareInfo &hwInfo) const
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1; hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1;
} }
template <>
std::optional<bool> ProductHelperHw<gfxProduct>::isCoherentAllocation(uint64_t patIndex) const {
return std::nullopt;
}
template <> template <>
bool ProductHelperHw<gfxProduct>::isDeviceUsmAllocationReuseSupported() const { bool ProductHelperHw<gfxProduct>::isDeviceUsmAllocationReuseSupported() const {
return false; return false;

View File

@@ -108,15 +108,6 @@ bool ProductHelperHw<gfxProduct>::isNewCoherencyModelSupported() const {
return true; return true;
} }
template <>
std::optional<bool> ProductHelperHw<gfxProduct>::isCoherentAllocation(uint64_t patIndex) const {
std::array<uint64_t, 2> listOfCoherentPatIndexes = {3, 4};
if (std::find(listOfCoherentPatIndexes.begin(), listOfCoherentPatIndexes.end(), patIndex) != listOfCoherentPatIndexes.end()) {
return true;
}
return false;
}
template <> template <>
bool ProductHelperHw<gfxProduct>::isDeviceUsmAllocationReuseSupported() const { bool ProductHelperHw<gfxProduct>::isDeviceUsmAllocationReuseSupported() const {
return true; return true;

View File

@@ -422,11 +422,6 @@ bool ProductHelperHw<gfxProduct>::useLocalPreferredForCacheableBuffers() const {
return false; return false;
} }
template <>
std::optional<bool> ProductHelperHw<IGFX_UNKNOWN>::isCoherentAllocation(uint64_t patIndex) const {
return std::nullopt;
}
struct UnknownProduct { struct UnknownProduct {
struct FrontEndStateSupport { struct FrontEndStateSupport {
static constexpr bool scratchSize = false; static constexpr bool scratchSize = false;

View File

@@ -79,7 +79,6 @@ using IsAtLeastSkl = IsAtLeastProduct<IGFX_SKYLAKE>;
using IsAtLeastMtl = IsAtLeastProduct<IGFX_METEORLAKE>; using IsAtLeastMtl = IsAtLeastProduct<IGFX_METEORLAKE>;
using IsAtMostDg2 = IsAtMostProduct<IGFX_DG2>; using IsAtMostDg2 = IsAtMostProduct<IGFX_DG2>;
using IsAtMostPVC = IsAtMostProduct<IGFX_PVC>;
using IsNotPVC = IsNotWithinProducts<IGFX_PVC, IGFX_PVC>; using IsNotPVC = IsNotWithinProducts<IGFX_PVC, IGFX_PVC>;
using IsNotPvcOrDg2 = IsNotWithinProducts<IGFX_DG2, IGFX_PVC>; using IsNotPvcOrDg2 = IsNotWithinProducts<IGFX_DG2, IGFX_PVC>;

View File

@@ -708,7 +708,6 @@ TEST(GmmTest, givenAllocationTypeWhenGettingUsageTypeThenReturnCorrectValue) {
expectedUsage = (forceUncached || productHelper.isDcFlushAllowed()) ? uncachedGmmUsageType expectedUsage = (forceUncached || productHelper.isDcFlushAllowed()) ? uncachedGmmUsageType
: GMM_RESOURCE_USAGE_OCL_BUFFER; : GMM_RESOURCE_USAGE_OCL_BUFFER;
break; break;
case AllocationType::externalHostPtr:
case AllocationType::bufferHostMemory: case AllocationType::bufferHostMemory:
case AllocationType::internalHostMemory: case AllocationType::internalHostMemory:
case AllocationType::mapAllocation: case AllocationType::mapAllocation:
@@ -780,7 +779,6 @@ TEST(GmmTest, givenAllocationTypeAndMitigatedDcFlushWhenGettingUsageTypeThenRetu
case AllocationType::linearStream: case AllocationType::linearStream:
expectedUsage = GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER; expectedUsage = GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER;
break; break;
case AllocationType::externalHostPtr:
case AllocationType::bufferHostMemory: case AllocationType::bufferHostMemory:
case AllocationType::internalHostMemory: case AllocationType::internalHostMemory:
case AllocationType::mapAllocation: case AllocationType::mapAllocation:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -332,7 +332,6 @@ PVCTEST_F(PvcProductHelper, whenQueryingMaxNumSamplersThenReturnZero) {
PVCTEST_F(PvcProductHelper, whenCheckingIfDummyBlitWaIsRequiredThenTrueIsReturned) { PVCTEST_F(PvcProductHelper, whenCheckingIfDummyBlitWaIsRequiredThenTrueIsReturned) {
EXPECT_TRUE(productHelper->isDummyBlitWaRequired()); EXPECT_TRUE(productHelper->isDummyBlitWaRequired());
} }
PVCTEST_F(PvcProductHelper, givenProductHelperWhenAskingForReadOnlyResourceSupportThenTrueReturned) { PVCTEST_F(PvcProductHelper, givenProductHelperWhenAskingForReadOnlyResourceSupportThenTrueReturned) {
EXPECT_TRUE(productHelper->supportReadOnlyAllocations()); EXPECT_TRUE(productHelper->supportReadOnlyAllocations());
} }

View File

@@ -358,14 +358,3 @@ HWTEST2_F(XeLpgProductHelperTests, givenProductHelperWhenCallIsNewCoherencyModel
HWTEST2_F(XeLpgProductHelperTests, givenProductHelperWhenCheckDummyBlitWaRequiredThenReturnTrue, IsXeLpg) { HWTEST2_F(XeLpgProductHelperTests, givenProductHelperWhenCheckDummyBlitWaRequiredThenReturnTrue, IsXeLpg) {
EXPECT_TRUE(productHelper->isDummyBlitWaRequired()); EXPECT_TRUE(productHelper->isDummyBlitWaRequired());
} }
HWTEST2_F(XeLpgProductHelperTests, givenPatIndexWhenCheckIsCoherentAllocationThenReturnProperValue, IsXeLpg) {
std::array<uint64_t, 2> listOfCoherentPatIndexes = {3, 4};
for (auto patIndex : listOfCoherentPatIndexes) {
EXPECT_TRUE(productHelper->isCoherentAllocation(patIndex).value());
}
std::array<uint64_t, 3> listOfNonCoherentPatIndexes = {0, 1, 2};
for (auto patIndex : listOfNonCoherentPatIndexes) {
EXPECT_FALSE(productHelper->isCoherentAllocation(patIndex).value());
}
}