mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 22:12:59 +08:00
fix: change gmm resource for externalHostPtr
Resolves: NEO-10157 Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
4116dd5c9e
commit
63843862df
@@ -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
|
||||
*/
|
||||
uint16_t IoctlHelperXe::getCpuCachingMode(bool allocationInSystemMemory) const {
|
||||
uint16_t IoctlHelperXe::getCpuCachingMode(std::optional<bool> isCoherent, bool allocationInSystemMemory) const {
|
||||
uint16_t cpuCachingMode = DRM_XE_GEM_CPU_CACHING_WC;
|
||||
if (allocationInSystemMemory) {
|
||||
if ((isCoherent.value_or(false) == true) || (isCoherent == std::nullopt && allocationInSystemMemory)) {
|
||||
cpuCachingMode = DRM_XE_GEM_CPU_CACHING_WB;
|
||||
}
|
||||
|
||||
@@ -550,7 +550,7 @@ uint16_t IoctlHelperXe::getCpuCachingMode(bool allocationInSystemMemory) const {
|
||||
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) {
|
||||
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) {
|
||||
struct drm_xe_gem_create create = {};
|
||||
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);
|
||||
}
|
||||
create.placement = static_cast<uint32_t>(memoryInstances.to_ulong());
|
||||
create.cpu_caching = this->getCpuCachingMode(mem.memoryClass == drm_xe_memory_class::DRM_XE_MEM_REGION_CLASS_SYSMEM);
|
||||
create.cpu_caching = this->getCpuCachingMode(isCoherent, mem.memoryClass == drm_xe_memory_class::DRM_XE_MEM_REGION_CLASS_SYSMEM);
|
||||
auto ret = IoctlHelper::ioctl(DrmIoctl::gemCreate, &create);
|
||||
handle = create.handle;
|
||||
|
||||
@@ -581,7 +581,7 @@ int IoctlHelperXe::createGemExt(const MemRegionsVec &memClassInstances, size_t a
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint32_t IoctlHelperXe::createGem(uint64_t size, uint32_t memoryBanks) {
|
||||
uint32_t IoctlHelperXe::createGem(uint64_t size, uint32_t memoryBanks, std::optional<bool> isCoherent) {
|
||||
struct drm_xe_gem_create create = {};
|
||||
create.size = size;
|
||||
auto pHwInfo = drm.getRootDeviceEnvironment().getHardwareInfo();
|
||||
@@ -603,7 +603,7 @@ uint32_t IoctlHelperXe::createGem(uint64_t size, uint32_t memoryBanks) {
|
||||
memoryInstances.set(regionClassAndInstance.memoryInstance);
|
||||
}
|
||||
create.placement = static_cast<uint32_t>(memoryInstances.to_ulong());
|
||||
create.cpu_caching = this->getCpuCachingMode(create.placement == drm_xe_memory_class::DRM_XE_MEM_REGION_CLASS_SYSMEM);
|
||||
create.cpu_caching = this->getCpuCachingMode(isCoherent, create.placement == drm_xe_memory_class::DRM_XE_MEM_REGION_CLASS_SYSMEM);
|
||||
[[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__,
|
||||
|
||||
@@ -41,8 +41,8 @@ class IoctlHelperXe : public IoctlHelper {
|
||||
bool isSetPairAvailable() override;
|
||||
bool isChunkingAvailable() 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) override;
|
||||
uint32_t createGem(uint64_t size, uint32_t memoryBanks) 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;
|
||||
uint32_t createGem(uint64_t size, uint32_t memoryBanks, std::optional<bool> isCoherent) override;
|
||||
CacheRegion closAlloc() override;
|
||||
uint16_t closAllocWays(CacheRegion closIndex, uint16_t cacheLevel, uint16_t numWays) 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 logExecBuffer(const ExecBuffer &execBuffer, std::stringstream &logger) override;
|
||||
bool setDomainCpu(uint32_t handle, bool writeEnable) override;
|
||||
uint16_t getCpuCachingMode(bool allocationInSystemMemory) const;
|
||||
uint16_t getCpuCachingMode(std::optional<bool> isCoherent, bool allocationInSystemMemory) const;
|
||||
void addDebugMetadata(DrmResourceClass type, uint64_t *offset, uint64_t size);
|
||||
void addDebugMetadataCookie(uint64_t cookie);
|
||||
uint32_t registerResource(DrmResourceClass classType, const void *data, size_t size) override;
|
||||
|
||||
Reference in New Issue
Block a user