mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
Delete unneeded memory transfer for USM
Change-Id: I7b11a132b621069febd5b851f9e29e7177d8d395 Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com> Related-To: NEO-5059
This commit is contained in:
committed by
sys_ocldev
parent
b54a5a795a
commit
7c7cfb1099
@@ -19,6 +19,7 @@ void PageFaultManager::transferToCpu(void *ptr, size_t size, void *cmdQ) {
|
||||
}
|
||||
void PageFaultManager::transferToGpu(void *ptr, void *cmdQ) {
|
||||
auto commandQueue = static_cast<CommandQueue *>(cmdQ);
|
||||
memoryData[ptr].unifiedMemoryManager->insertSvmMapOperation(ptr, memoryData[ptr].size, ptr, 0, false);
|
||||
auto retVal = commandQueue->enqueueSVMUnmap(ptr, 0, nullptr, nullptr, false);
|
||||
UNRECOVERABLE_IF(retVal);
|
||||
retVal = commandQueue->finish();
|
||||
|
||||
@@ -36,6 +36,8 @@ HWTEST_F(UnifiedMemoryAubTest, givenDeviceMemoryAllocWhenWriteIntoItThenValuesMa
|
||||
HWTEST_F(UnifiedMemoryAubTest, givenSharedMemoryAllocWhenWriteIntoCPUPartThenValuesMatchAfterUsingAllocAsKernelParam) {
|
||||
auto unifiedMemoryType = InternalMemoryType::SHARED_UNIFIED_MEMORY;
|
||||
auto unifiedMemoryPtr = allocateUSM(unifiedMemoryType);
|
||||
retVal = clEnqueueMemsetINTEL(this->pCmdQ, unifiedMemoryPtr, 0, dataSize, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(retVal, CL_SUCCESS);
|
||||
|
||||
writeToUsmMemory(values, unifiedMemoryPtr, unifiedMemoryType);
|
||||
|
||||
|
||||
@@ -1860,13 +1860,14 @@ TEST_F(EnqueueSvmTest, givenPageFaultManagerWhenEnqueueMemcpyThenAllocIsDecommit
|
||||
auto srcSvm = context->getSVMAllocsManager()->createSVMAlloc(pDevice->getRootDeviceIndex(), 256, {}, pDevice->getDeviceBitfield());
|
||||
mockMemoryManager->getPageFaultManager()->insertAllocation(srcSvm, 256, context->getSVMAllocsManager(), context->getSpecialQueue());
|
||||
mockMemoryManager->getPageFaultManager()->insertAllocation(ptrSVM, 256, context->getSVMAllocsManager(), context->getSpecialQueue());
|
||||
EXPECT_EQ(static_cast<MockPageFaultManager *>(mockMemoryManager->getPageFaultManager())->transferToCpuCalled, 2);
|
||||
EXPECT_EQ(static_cast<MockPageFaultManager *>(mockMemoryManager->getPageFaultManager())->transferToCpuCalled, 0);
|
||||
EXPECT_EQ(static_cast<MockPageFaultManager *>(mockMemoryManager->getPageFaultManager())->protectMemoryCalled, 0);
|
||||
|
||||
this->pCmdQ->enqueueSVMMemcpy(false, ptrSVM, srcSvm, 256, 0, nullptr, nullptr);
|
||||
|
||||
EXPECT_EQ(static_cast<MockPageFaultManager *>(mockMemoryManager->getPageFaultManager())->allowMemoryAccessCalled, 0);
|
||||
EXPECT_EQ(static_cast<MockPageFaultManager *>(mockMemoryManager->getPageFaultManager())->protectMemoryCalled, 2);
|
||||
EXPECT_EQ(static_cast<MockPageFaultManager *>(mockMemoryManager->getPageFaultManager())->transferToCpuCalled, 2);
|
||||
EXPECT_EQ(static_cast<MockPageFaultManager *>(mockMemoryManager->getPageFaultManager())->transferToCpuCalled, 0);
|
||||
EXPECT_EQ(static_cast<MockPageFaultManager *>(mockMemoryManager->getPageFaultManager())->transferToGpuCalled, 2);
|
||||
|
||||
context->getSVMAllocsManager()->freeSVMAlloc(srcSvm);
|
||||
@@ -1880,13 +1881,14 @@ TEST_F(EnqueueSvmTest, givenPageFaultManagerWhenEnqueueMemFillThenAllocIsDecommi
|
||||
auto memoryManager = context->getMemoryManager();
|
||||
context->memoryManager = mockMemoryManager.get();
|
||||
mockMemoryManager->getPageFaultManager()->insertAllocation(ptrSVM, 256, context->getSVMAllocsManager(), context->getSpecialQueue());
|
||||
EXPECT_EQ(static_cast<MockPageFaultManager *>(mockMemoryManager->getPageFaultManager())->transferToCpuCalled, 1);
|
||||
EXPECT_EQ(static_cast<MockPageFaultManager *>(mockMemoryManager->getPageFaultManager())->transferToCpuCalled, 0);
|
||||
EXPECT_EQ(static_cast<MockPageFaultManager *>(mockMemoryManager->getPageFaultManager())->protectMemoryCalled, 0);
|
||||
|
||||
pCmdQ->enqueueSVMMemFill(ptrSVM, &pattern, 256, 256, 0, nullptr, nullptr);
|
||||
|
||||
EXPECT_EQ(static_cast<MockPageFaultManager *>(mockMemoryManager->getPageFaultManager())->allowMemoryAccessCalled, 0);
|
||||
EXPECT_EQ(static_cast<MockPageFaultManager *>(mockMemoryManager->getPageFaultManager())->protectMemoryCalled, 1);
|
||||
EXPECT_EQ(static_cast<MockPageFaultManager *>(mockMemoryManager->getPageFaultManager())->transferToCpuCalled, 1);
|
||||
EXPECT_EQ(static_cast<MockPageFaultManager *>(mockMemoryManager->getPageFaultManager())->transferToCpuCalled, 0);
|
||||
EXPECT_EQ(static_cast<MockPageFaultManager *>(mockMemoryManager->getPageFaultManager())->transferToGpuCalled, 1);
|
||||
|
||||
context->memoryManager = memoryManager;
|
||||
|
||||
@@ -1860,7 +1860,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAndPageFaultManagerWhenMak
|
||||
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
|
||||
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue());
|
||||
|
||||
EXPECT_EQ(mockPageFaultManager->transferToCpuCalled, 1);
|
||||
EXPECT_EQ(mockPageFaultManager->transferToCpuCalled, 0);
|
||||
|
||||
EXPECT_EQ(0u, mockKernel.mockKernel->kernelUnifiedMemoryGfxAllocations.size());
|
||||
mockKernel.mockKernel->setUnifiedMemoryExecInfo(unifiedMemoryGraphicsAllocation->gpuAllocations.getGraphicsAllocation(pDevice->getRootDeviceIndex()));
|
||||
@@ -1870,7 +1870,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAndPageFaultManagerWhenMak
|
||||
|
||||
EXPECT_EQ(mockPageFaultManager->allowMemoryAccessCalled, 0);
|
||||
EXPECT_EQ(mockPageFaultManager->protectMemoryCalled, 1);
|
||||
EXPECT_EQ(mockPageFaultManager->transferToCpuCalled, 1);
|
||||
EXPECT_EQ(mockPageFaultManager->transferToCpuCalled, 0);
|
||||
EXPECT_EQ(mockPageFaultManager->transferToGpuCalled, 1);
|
||||
|
||||
EXPECT_EQ(mockPageFaultManager->protectedMemoryAccessAddress, unifiedMemoryAllocation);
|
||||
@@ -1895,7 +1895,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAndNotRequiredMemSyncWhenM
|
||||
auto unifiedMemoryGraphicsAllocation = svmAllocationsManager->getSVMAlloc(unifiedMemoryAllocation);
|
||||
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue());
|
||||
|
||||
EXPECT_EQ(mockPageFaultManager->transferToCpuCalled, 1);
|
||||
EXPECT_EQ(mockPageFaultManager->transferToCpuCalled, 0);
|
||||
auto gpuAllocation = unifiedMemoryGraphicsAllocation->gpuAllocations.getGraphicsAllocation(pDevice->getRootDeviceIndex());
|
||||
mockKernel.mockKernel->kernelArguments[0] = {Kernel::kernelArgType::SVM_ALLOC_OBJ, gpuAllocation, unifiedMemoryAllocation, 4096u, gpuAllocation, sizeof(uintptr_t)};
|
||||
mockKernel.mockKernel->setUnifiedMemorySyncRequirement(false);
|
||||
@@ -1904,7 +1904,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAndNotRequiredMemSyncWhenM
|
||||
|
||||
EXPECT_EQ(mockPageFaultManager->allowMemoryAccessCalled, 0);
|
||||
EXPECT_EQ(mockPageFaultManager->protectMemoryCalled, 0);
|
||||
EXPECT_EQ(mockPageFaultManager->transferToCpuCalled, 1);
|
||||
EXPECT_EQ(mockPageFaultManager->transferToCpuCalled, 0);
|
||||
EXPECT_EQ(mockPageFaultManager->transferToGpuCalled, 0);
|
||||
|
||||
EXPECT_EQ(0u, mockKernel.mockKernel->kernelUnifiedMemoryGfxAllocations.size());
|
||||
@@ -1925,7 +1925,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryRequiredMemSyncWhenMakeRes
|
||||
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue());
|
||||
|
||||
auto gpuAllocation = unifiedMemoryGraphicsAllocation->gpuAllocations.getGraphicsAllocation(pDevice->getRootDeviceIndex());
|
||||
EXPECT_EQ(mockPageFaultManager->transferToCpuCalled, 1);
|
||||
EXPECT_EQ(mockPageFaultManager->transferToCpuCalled, 0);
|
||||
mockKernel.mockKernel->kernelArguments[0] = {Kernel::kernelArgType::SVM_ALLOC_OBJ, gpuAllocation, unifiedMemoryAllocation, 4096u, gpuAllocation, sizeof(uintptr_t)};
|
||||
mockKernel.mockKernel->setUnifiedMemorySyncRequirement(true);
|
||||
|
||||
@@ -1933,7 +1933,7 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryRequiredMemSyncWhenMakeRes
|
||||
|
||||
EXPECT_EQ(mockPageFaultManager->allowMemoryAccessCalled, 0);
|
||||
EXPECT_EQ(mockPageFaultManager->protectMemoryCalled, 1);
|
||||
EXPECT_EQ(mockPageFaultManager->transferToCpuCalled, 1);
|
||||
EXPECT_EQ(mockPageFaultManager->transferToCpuCalled, 0);
|
||||
EXPECT_EQ(mockPageFaultManager->transferToGpuCalled, 1);
|
||||
|
||||
EXPECT_EQ(0u, mockKernel.mockKernel->kernelUnifiedMemoryGfxAllocations.size());
|
||||
@@ -1952,14 +1952,14 @@ HWTEST_F(KernelResidencyTest, givenSharedUnifiedMemoryAllocPageFaultManagerAndIn
|
||||
auto unifiedMemoryAllocation = svmAllocationsManager->createSharedUnifiedMemoryAllocation(pDevice->getRootDeviceIndex(), 4096u, sharedProperties, mockKernel.mockContext->getSpecialQueue());
|
||||
mockPageFaultManager->insertAllocation(unifiedMemoryAllocation, 4096u, svmAllocationsManager, mockKernel.mockContext->getSpecialQueue());
|
||||
|
||||
EXPECT_EQ(mockPageFaultManager->transferToCpuCalled, 1);
|
||||
EXPECT_EQ(mockPageFaultManager->transferToCpuCalled, 0);
|
||||
mockKernel.mockKernel->unifiedMemoryControls.indirectSharedAllocationsAllowed = true;
|
||||
|
||||
mockKernel.mockKernel->makeResident(commandStreamReceiver);
|
||||
|
||||
EXPECT_EQ(mockPageFaultManager->allowMemoryAccessCalled, 0);
|
||||
EXPECT_EQ(mockPageFaultManager->protectMemoryCalled, 1);
|
||||
EXPECT_EQ(mockPageFaultManager->transferToCpuCalled, 1);
|
||||
EXPECT_EQ(mockPageFaultManager->transferToCpuCalled, 0);
|
||||
EXPECT_EQ(mockPageFaultManager->transferToGpuCalled, 1);
|
||||
|
||||
EXPECT_EQ(mockPageFaultManager->protectedMemoryAccessAddress, unifiedMemoryAllocation);
|
||||
|
||||
@@ -5,10 +5,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/memory_manager/unified_memory_manager.h"
|
||||
#include "shared/test/unit_test/page_fault_manager/cpu_page_fault_manager_tests_fixture.h"
|
||||
#include "shared/test/unit_test/test_macros/test_checks_shared.h"
|
||||
|
||||
#include "opencl/source/command_queue/command_queue.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_graphics_allocation.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_memory_manager.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
@@ -41,8 +45,15 @@ struct CommandQueueMock : public MockCommandQueue {
|
||||
};
|
||||
|
||||
TEST_F(PageFaultManagerTest, givenUnifiedMemoryAllocWhenSynchronizeMemoryThenEnqueueProperCalls) {
|
||||
void *alloc = reinterpret_cast<void *>(0x1);
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
REQUIRE_SVM_OR_SKIP(executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo());
|
||||
|
||||
auto memoryManager = std::make_unique<MockMemoryManager>(executionEnvironment);
|
||||
auto svmAllocsManager = std::make_unique<SVMAllocsManager>(memoryManager.get());
|
||||
void *alloc = svmAllocsManager->createSVMAlloc(mockRootDeviceIndex, 256, {}, mockDeviceBitfield);
|
||||
|
||||
auto cmdQ = std::make_unique<CommandQueueMock>();
|
||||
pageFaultManager->insertAllocation(alloc, 256, svmAllocsManager.get(), cmdQ.get());
|
||||
|
||||
pageFaultManager->baseCpuTransfer(alloc, 10, cmdQ.get());
|
||||
EXPECT_EQ(cmdQ->transferToCpuCalled, 1);
|
||||
@@ -53,4 +64,31 @@ TEST_F(PageFaultManagerTest, givenUnifiedMemoryAllocWhenSynchronizeMemoryThenEnq
|
||||
EXPECT_EQ(cmdQ->transferToCpuCalled, 1);
|
||||
EXPECT_EQ(cmdQ->transferToGpuCalled, 1);
|
||||
EXPECT_EQ(cmdQ->finishCalled, 1);
|
||||
|
||||
svmAllocsManager->freeSVMAlloc(alloc);
|
||||
}
|
||||
|
||||
TEST_F(PageFaultManagerTest, givenUnifiedMemoryAllocWhenGpuTransferIsInvokedThenInsertMapOperation) {
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
REQUIRE_SVM_OR_SKIP(executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo());
|
||||
|
||||
struct MockSVMAllocsManager : SVMAllocsManager {
|
||||
using SVMAllocsManager::SVMAllocsManager;
|
||||
void insertSvmMapOperation(void *regionSvmPtr, size_t regionSize, void *baseSvmPtr, size_t offset, bool readOnlyMap) override {
|
||||
SVMAllocsManager::insertSvmMapOperation(regionSvmPtr, regionSize, baseSvmPtr, offset, readOnlyMap);
|
||||
insertSvmMapOperationCalled++;
|
||||
}
|
||||
int insertSvmMapOperationCalled = 0;
|
||||
};
|
||||
auto memoryManager = std::make_unique<MockMemoryManager>(executionEnvironment);
|
||||
auto svmAllocsManager = std::make_unique<MockSVMAllocsManager>(memoryManager.get());
|
||||
void *alloc = svmAllocsManager->createSVMAlloc(mockRootDeviceIndex, 256, {}, mockDeviceBitfield);
|
||||
auto cmdQ = std::make_unique<CommandQueueMock>();
|
||||
pageFaultManager->insertAllocation(alloc, 256, svmAllocsManager.get(), cmdQ.get());
|
||||
|
||||
EXPECT_EQ(svmAllocsManager->insertSvmMapOperationCalled, 0);
|
||||
pageFaultManager->baseGpuTransfer(alloc, cmdQ.get());
|
||||
EXPECT_EQ(svmAllocsManager->insertSvmMapOperationCalled, 1);
|
||||
|
||||
svmAllocsManager->freeSVMAlloc(alloc);
|
||||
}
|
||||
|
||||
@@ -912,7 +912,7 @@ TEST(UnfiedSharedMemoryTransferCalls, givenSharedUsmAllocationWithLocalMemoryWhe
|
||||
auto neoQueue = castToObject<CommandQueue>(commandQueue);
|
||||
auto osContextId = neoQueue->getGpgpuCommandStreamReceiver().getOsContext().getContextId();
|
||||
|
||||
EXPECT_EQ(1u, svmAllocation->cpuAllocation->getTaskCount(osContextId));
|
||||
EXPECT_EQ(GraphicsAllocation::objectNotUsed, svmAllocation->cpuAllocation->getTaskCount(osContextId));
|
||||
|
||||
status = clEnqueueWriteBuffer(commandQueue, buffer, false, 0u, 4096u, sharedMemory, 0u, nullptr, nullptr);
|
||||
ASSERT_EQ(CL_SUCCESS, status);
|
||||
@@ -920,12 +920,12 @@ TEST(UnfiedSharedMemoryTransferCalls, givenSharedUsmAllocationWithLocalMemoryWhe
|
||||
auto &temporaryAllocations = neoQueue->getGpgpuCommandStreamReceiver().getTemporaryAllocations();
|
||||
EXPECT_TRUE(temporaryAllocations.peekIsEmpty());
|
||||
|
||||
EXPECT_EQ(2u, svmAllocation->cpuAllocation->getTaskCount(osContextId));
|
||||
EXPECT_EQ(1u, svmAllocation->cpuAllocation->getTaskCount(osContextId));
|
||||
|
||||
status = clEnqueueReadBuffer(commandQueue, buffer, false, 0u, 4096u, sharedMemory, 0u, nullptr, nullptr);
|
||||
ASSERT_EQ(CL_SUCCESS, status);
|
||||
EXPECT_TRUE(temporaryAllocations.peekIsEmpty());
|
||||
EXPECT_EQ(3u, svmAllocation->cpuAllocation->getTaskCount(osContextId));
|
||||
EXPECT_EQ(2u, svmAllocation->cpuAllocation->getTaskCount(osContextId));
|
||||
|
||||
status = clReleaseMemObject(buffer);
|
||||
ASSERT_EQ(CL_SUCCESS, status);
|
||||
|
||||
@@ -100,6 +100,7 @@ class SVMAllocsManager {
|
||||
};
|
||||
|
||||
SVMAllocsManager(MemoryManager *memoryManager);
|
||||
MOCKABLE_VIRTUAL ~SVMAllocsManager() = default;
|
||||
void *createSVMAlloc(uint32_t rootDeviceIndex,
|
||||
size_t size,
|
||||
const SvmAllocationProperties svmProperties,
|
||||
@@ -122,7 +123,7 @@ class SVMAllocsManager {
|
||||
size_t getNumAllocs() const { return SVMAllocs.getNumAllocs(); }
|
||||
MapBasedAllocationTracker *getSVMAllocs() { return &SVMAllocs; }
|
||||
|
||||
void insertSvmMapOperation(void *regionSvmPtr, size_t regionSize, void *baseSvmPtr, size_t offset, bool readOnlyMap);
|
||||
MOCKABLE_VIRTUAL void insertSvmMapOperation(void *regionSvmPtr, size_t regionSize, void *baseSvmPtr, size_t offset, bool readOnlyMap);
|
||||
void removeSvmMapOperation(const void *regionSvmPtr);
|
||||
SvmMapOperation *getSvmMapOperation(const void *regionPtr);
|
||||
void addInternalAllocationsToResidencyContainer(uint32_t rootDeviceIndex,
|
||||
|
||||
@@ -17,7 +17,6 @@ namespace NEO {
|
||||
void PageFaultManager::insertAllocation(void *ptr, size_t size, SVMAllocsManager *unifiedMemoryManager, void *cmdQ) {
|
||||
std::unique_lock<SpinLock> lock{mtx};
|
||||
this->memoryData.insert(std::make_pair(ptr, PageFaultData{size, unifiedMemoryManager, cmdQ, false}));
|
||||
this->transferToCpu(ptr, size, cmdQ);
|
||||
}
|
||||
|
||||
void PageFaultManager::removeAllocation(void *ptr) {
|
||||
|
||||
@@ -31,7 +31,7 @@ TEST_F(PageFaultManagerTest, givenUnifiedMemoryAllocsWhenInsertingAllocsThenAllo
|
||||
EXPECT_EQ(pageFaultManager->memoryData[alloc1].unifiedMemoryManager, reinterpret_cast<SVMAllocsManager *>(unifiedMemoryManager));
|
||||
EXPECT_EQ(pageFaultManager->allowMemoryAccessCalled, 0);
|
||||
EXPECT_EQ(pageFaultManager->protectMemoryCalled, 0);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 1);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 0);
|
||||
EXPECT_EQ(pageFaultManager->transferToGpuCalled, 0);
|
||||
EXPECT_TRUE(pageFaultManager->isAubWritable);
|
||||
|
||||
@@ -47,7 +47,7 @@ TEST_F(PageFaultManagerTest, givenUnifiedMemoryAllocsWhenInsertingAllocsThenAllo
|
||||
EXPECT_EQ(pageFaultManager->memoryData[alloc2].unifiedMemoryManager, reinterpret_cast<SVMAllocsManager *>(unifiedMemoryManager));
|
||||
EXPECT_EQ(pageFaultManager->allowMemoryAccessCalled, 0);
|
||||
EXPECT_EQ(pageFaultManager->protectMemoryCalled, 0);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 2);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 0);
|
||||
EXPECT_EQ(pageFaultManager->transferToGpuCalled, 0);
|
||||
EXPECT_TRUE(pageFaultManager->isAubWritable);
|
||||
|
||||
@@ -95,7 +95,7 @@ TEST_F(PageFaultManagerTest, givenUnifiedMemoryAllocsWhenMovingToGpuDomainAllocs
|
||||
pageFaultManager->insertAllocation(alloc1, 10, reinterpret_cast<SVMAllocsManager *>(unifiedMemoryManager), cmdQ);
|
||||
pageFaultManager->insertAllocation(alloc2, 20, reinterpret_cast<SVMAllocsManager *>(unifiedMemoryManager2), cmdQ);
|
||||
pageFaultManager->insertAllocation(alloc3, 30, reinterpret_cast<SVMAllocsManager *>(unifiedMemoryManager), cmdQ);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 3);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 0);
|
||||
EXPECT_EQ(pageFaultManager->memoryData.size(), 3u);
|
||||
pageFaultManager->memoryData.at(alloc3).isInGpuDomain = true;
|
||||
|
||||
@@ -103,7 +103,7 @@ TEST_F(PageFaultManagerTest, givenUnifiedMemoryAllocsWhenMovingToGpuDomainAllocs
|
||||
|
||||
EXPECT_EQ(pageFaultManager->allowMemoryAccessCalled, 0);
|
||||
EXPECT_EQ(pageFaultManager->protectMemoryCalled, 1);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 3);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 0);
|
||||
EXPECT_EQ(pageFaultManager->transferToGpuCalled, 1);
|
||||
|
||||
EXPECT_EQ(pageFaultManager->protectedMemoryAccessAddress, alloc1);
|
||||
@@ -119,13 +119,13 @@ TEST_F(PageFaultManagerTest, givenUnifiedMemoryAllocWhenMoveToGpuDomainThenTrans
|
||||
|
||||
pageFaultManager->insertAllocation(alloc, 10, reinterpret_cast<SVMAllocsManager *>(unifiedMemoryManager), cmdQ);
|
||||
EXPECT_EQ(pageFaultManager->memoryData.size(), 1u);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 1);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 0);
|
||||
|
||||
pageFaultManager->moveAllocationToGpuDomain(alloc);
|
||||
|
||||
EXPECT_EQ(pageFaultManager->allowMemoryAccessCalled, 0);
|
||||
EXPECT_EQ(pageFaultManager->protectMemoryCalled, 1);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 1);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 0);
|
||||
EXPECT_EQ(pageFaultManager->transferToGpuCalled, 1);
|
||||
|
||||
EXPECT_EQ(pageFaultManager->protectedMemoryAccessAddress, alloc);
|
||||
@@ -140,7 +140,7 @@ TEST_F(PageFaultManagerTest, givenUnifiedMemoryAllocInGpuDomainWhenMovingToGpuDo
|
||||
void *alloc = reinterpret_cast<void *>(0x1);
|
||||
|
||||
pageFaultManager->insertAllocation(alloc, 10, reinterpret_cast<SVMAllocsManager *>(unifiedMemoryManager), cmdQ);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 1);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 0);
|
||||
EXPECT_EQ(pageFaultManager->memoryData.size(), 1u);
|
||||
pageFaultManager->memoryData.at(alloc).isInGpuDomain = true;
|
||||
|
||||
@@ -148,7 +148,7 @@ TEST_F(PageFaultManagerTest, givenUnifiedMemoryAllocInGpuDomainWhenMovingToGpuDo
|
||||
|
||||
EXPECT_EQ(pageFaultManager->allowMemoryAccessCalled, 0);
|
||||
EXPECT_EQ(pageFaultManager->protectMemoryCalled, 0);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 1);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 0);
|
||||
EXPECT_EQ(pageFaultManager->transferToGpuCalled, 0);
|
||||
EXPECT_TRUE(pageFaultManager->isAubWritable);
|
||||
}
|
||||
@@ -186,14 +186,14 @@ TEST_F(PageFaultManagerTest, givenTrackedPageFaultAddressWhenVerifyingThenProper
|
||||
|
||||
pageFaultManager->insertAllocation(alloc1, 10, reinterpret_cast<SVMAllocsManager *>(unifiedMemoryManager), nullptr);
|
||||
pageFaultManager->insertAllocation(alloc2, 20, reinterpret_cast<SVMAllocsManager *>(unifiedMemoryManager), nullptr);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 2);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 0);
|
||||
EXPECT_EQ(pageFaultManager->memoryData.size(), 2u);
|
||||
|
||||
pageFaultManager->verifyPageFault(alloc1);
|
||||
|
||||
EXPECT_EQ(pageFaultManager->allowMemoryAccessCalled, 1);
|
||||
EXPECT_EQ(pageFaultManager->protectMemoryCalled, 0);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 3);
|
||||
EXPECT_EQ(pageFaultManager->transferToCpuCalled, 1);
|
||||
EXPECT_EQ(pageFaultManager->transferToGpuCalled, 0);
|
||||
|
||||
EXPECT_EQ(pageFaultManager->allowedMemoryAccessAddress, alloc1);
|
||||
|
||||
Reference in New Issue
Block a user