Make CPU copy for read buffer when host ptr is write combined on DG2

With this commit on DG2 32bit driver will check if passed host ptr for
clEnqueueReadBuffer is write combined memory. If check will be true copy
will be make on CPU.

Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka
2022-06-13 14:13:34 +00:00
committed by Compute-Runtime-Automation
parent cdfe2ce8ad
commit 213dc2fe24
13 changed files with 92 additions and 2 deletions

View File

@@ -93,6 +93,7 @@ set(NEO_CORE_OS_INTERFACE_WDDM
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm.h
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm_defs.h
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm_residency_logger.h
${CMAKE_CURRENT_SOURCE_DIR}/wddm_memory_manager_${DRIVER_MODEL}.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm_memory_manager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm_memory_manager.h
${CMAKE_CURRENT_SOURCE_DIR}/wddm/um_km_data_translator.cpp

View File

@@ -886,7 +886,7 @@ bool WddmMemoryManager::isCpuCopyRequired(const void *ptr) {
}
// dummy read
//cacheable = *localVariablePointer;
// cacheable = *localVariablePointer;
_mm_lfence();
timestamp0 = __rdtsc();
@@ -904,7 +904,7 @@ bool WddmMemoryManager::isCpuCopyRequired(const void *ptr) {
fastestLocalRead = localVariableReadDelta;
}
// dummy read
//cacheable = *volatileInputPtr;
// cacheable = *volatileInputPtr;
_mm_lfence();
timestamp0 = __rdtsc();

View File

@@ -71,6 +71,7 @@ class WddmMemoryManager : public MemoryManager {
void *reserveCpuAddressRange(size_t size, uint32_t rootDeviceIndex) override;
void releaseReservedCpuAddressRange(void *reserved, size_t size, uint32_t rootDeviceIndex) override;
bool isCpuCopyRequired(const void *ptr) override;
bool isWCMemory(const void *ptr) override;
AddressRange reserveGpuAddress(size_t size, uint32_t rootDeviceIndex) override { return AddressRange{0, 0}; };
void freeGpuAddress(AddressRange addressRange, uint32_t rootDeviceIndex) override{};

View File

@@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/windows/wddm_memory_manager.h"
namespace NEO {
bool WddmMemoryManager::isWCMemory(const void *ptr) {
return false;
}
} // namespace NEO

View File

@@ -0,0 +1,20 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/windows/wddm_memory_manager.h"
#include <winnt.h>
namespace NEO {
constexpr uint32_t pageWriteCombine = 0x400;
bool WddmMemoryManager::isWCMemory(const void *ptr) {
MEMORY_BASIC_INFORMATION info;
VirtualQuery(ptr, &info, sizeof(info));
return info.AllocationProtect & pageWriteCombine;
}
} // namespace NEO