mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-11 16:45:25 +08:00
performance: Memory handling improvements
By default prefer allocating memory first by KMD, instead of malloc first. By default prefer not caching allocations on MTL devices. This results in allocations being handled with non-coherent pat index. For integrated devices when caching is not preferred do not allow direct memory access in CPU domain. For map/unmap operations create a dedicated memory allocation for CPU access, instead of accessing it directly, reusing the same logic as when mapping/unmapping local memory. Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
1d07d999c8
commit
5b80bd4d7c
@@ -54,6 +54,8 @@ TEST_F(ClEnqueueMapBufferTests, GivenNullCommandQueueWhenMappingBufferThenInvali
|
||||
}
|
||||
|
||||
TEST_F(ClEnqueueMapBufferTests, GivenValidParametersWhenMappingBufferThenSuccessIsReturned) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pContext->getDevice(0)->getRootDeviceEnvironment());
|
||||
|
||||
unsigned int bufferSize = 16;
|
||||
auto pHostMem = new unsigned char[bufferSize];
|
||||
memset(pHostMem, 0xaa, bufferSize);
|
||||
@@ -111,6 +113,8 @@ TEST_F(ClEnqueueMapBufferTests, GivenQueueIncapableWhenMappingBufferThenInvalidO
|
||||
}
|
||||
|
||||
TEST_F(ClEnqueueMapBufferTests, GivenMappedPointerWhenCreatingBufferFromThisPointerThenInvalidHostPtrErrorIsReturned) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pContext->getDevice(0)->getRootDeviceEnvironment());
|
||||
|
||||
unsigned int bufferSize = 16;
|
||||
|
||||
cl_mem buffer = clCreateBuffer(pContext, CL_MEM_READ_WRITE, bufferSize, nullptr, &retVal);
|
||||
|
||||
@@ -53,6 +53,8 @@ TEST_F(ClEnqueueUnmapMemObjTests, GivenQueueIncapableWhenUnmappingBufferThenInva
|
||||
}
|
||||
|
||||
TEST_F(ClEnqueueUnmapMemObjTests, givenInvalidAddressWhenUnmappingOnCpuThenReturnError) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pContext->getDevice(0)->getRootDeviceEnvironment());
|
||||
|
||||
auto buffer = std::unique_ptr<Buffer>(BufferHelper<BufferUseHostPtr<>>::create(pContext));
|
||||
EXPECT_TRUE(buffer->mappingOnCpuAllowed());
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "shared/test/common/mocks/mock_os_library.h"
|
||||
#include "shared/test/common/mocks/mock_source_level_debugger.h"
|
||||
#include "shared/test/common/mocks/mock_timestamp_container.h"
|
||||
#include "shared/test/common/test_macros/test_checks_shared.h"
|
||||
#include "shared/test/common/utilities/base_object_utils.h"
|
||||
|
||||
#include "opencl/test/unit_test/command_queue/command_queue_fixture.h"
|
||||
@@ -430,6 +431,8 @@ HWTEST_F(CommandQueueHwTest, GivenNonEmptyQueueOnBlockingWhenMappingBufferThenWi
|
||||
bool finishWasCalled;
|
||||
};
|
||||
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(context->getDevice(0)->getRootDeviceEnvironment());
|
||||
|
||||
MockCmdQ cmdQ(context, pCmdQ->getDevice().getSpecializedDevice<ClDevice>());
|
||||
|
||||
auto b1 = clCreateBuffer(context, CL_MEM_READ_WRITE, 20, nullptr, nullptr);
|
||||
@@ -476,6 +479,8 @@ HWTEST_F(CommandQueueHwTest, GivenEventsWaitlistOnBlockingWhenMappingBufferThenW
|
||||
uint32_t updateCountBeforeCompleted;
|
||||
};
|
||||
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(context->getDevice(0)->getRootDeviceEnvironment());
|
||||
|
||||
MockEvent *me = new MockEvent(context, 1024);
|
||||
auto b1 = clCreateBuffer(context, CL_MEM_READ_WRITE, 20, nullptr, nullptr);
|
||||
cl_event meAsClEv = me;
|
||||
|
||||
@@ -265,6 +265,8 @@ TEST_F(EnqueueMapBufferTest, GivenValidArgsWhenMappingBufferThenSuccessIsReturne
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueMapBufferTest, givenNonBlockingReadOnlyMapBufferOnZeroCopyBufferWhenItIsCalledThenSynchronizationIsNotMadeUntilWaitForEvents) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.EnableAsyncEventsHandler.set(false);
|
||||
cl_event mapEventReturned = nullptr;
|
||||
@@ -463,6 +465,8 @@ TEST_F(EnqueueMapBufferTest, givenReadOnlyBufferWhenMappedOnGpuThenSetValidEvent
|
||||
}
|
||||
|
||||
TEST_F(EnqueueMapBufferTest, givenNonBlockingMapBufferAfterL3IsAlreadyFlushedThenEventIsSignaledAsCompleted) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
|
||||
cl_event eventReturned = nullptr;
|
||||
uint32_t tagHW = 0;
|
||||
*pTagMemory = tagHW;
|
||||
@@ -530,6 +534,8 @@ TEST_F(EnqueueMapBufferTest, givenNonBlockingMapBufferAfterL3IsAlreadyFlushedThe
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueMapBufferTest, GivenBufferThatIsNotZeroCopyWhenNonBlockingMapIsCalledThenFinishIsCalledAndDataTransferred) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
|
||||
const auto bufferSize = 100;
|
||||
auto localSize = bufferSize;
|
||||
char misaligned[bufferSize] = {1};
|
||||
@@ -611,6 +617,8 @@ TEST_F(EnqueueMapBufferTest, GivenWrongMemObjectWhenMapIsCalledThenInvalidMemObj
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueMapBufferTest, GivenPtrToReturnEventWhenMappingBufferThenEventIsNotNull) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
|
||||
cl_event eventReturned = NULL;
|
||||
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
@@ -658,6 +666,8 @@ HWTEST_F(EnqueueMapBufferTest, GivenPtrToReturnEventWhenMappingBufferThenEventIs
|
||||
}
|
||||
|
||||
TEST_F(EnqueueMapBufferTest, GivenZeroCopyBufferWhenMapBufferWithoutEventsThenCommandStreamReceiverUpdatesRequiredDCFlushCount) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
|
||||
auto &commandStreamReceiver = pCmdQ->getGpgpuCommandStreamReceiver();
|
||||
|
||||
auto buffer = clCreateBuffer(
|
||||
@@ -691,6 +701,8 @@ TEST_F(EnqueueMapBufferTest, GivenZeroCopyBufferWhenMapBufferWithoutEventsThenCo
|
||||
}
|
||||
|
||||
TEST_F(EnqueueMapBufferTest, givenBufferWithoutUseHostPtrFlagWhenMappedOnCpuThenSetAllMapParams) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
|
||||
std::unique_ptr<Buffer> buffer(Buffer::create(BufferDefaults::context, CL_MEM_READ_WRITE, 10, nullptr, retVal));
|
||||
EXPECT_NE(nullptr, buffer);
|
||||
EXPECT_TRUE(buffer->mappingOnCpuAllowed());
|
||||
@@ -720,6 +732,8 @@ TEST_F(EnqueueMapBufferTest, givenBufferWithoutUseHostPtrFlagWhenMappedOnCpuThen
|
||||
}
|
||||
|
||||
TEST_F(EnqueueMapBufferTest, givenBufferWithUseHostPtrFlagWhenMappedOnCpuThenSetAllMapParams) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
|
||||
uint8_t hostPtr[10] = {};
|
||||
std::unique_ptr<Buffer> buffer(Buffer::create(BufferDefaults::context, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR, 10, hostPtr, retVal));
|
||||
EXPECT_NE(nullptr, buffer);
|
||||
@@ -750,6 +764,8 @@ TEST_F(EnqueueMapBufferTest, givenBufferWithUseHostPtrFlagWhenMappedOnCpuThenSet
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueMapBufferTest, givenMapBufferOnGpuWhenMappingBufferThenStoreGraphicsAllocationInMapInfo) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
|
||||
uint8_t hostPtr[10] = {};
|
||||
std::unique_ptr<Buffer> bufferForCpuMap(Buffer::create(context, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR, 10, hostPtr, retVal));
|
||||
ASSERT_NE(nullptr, bufferForCpuMap);
|
||||
|
||||
@@ -496,6 +496,7 @@ HWTEST_F(EnqueueMapImageTest, GivenPtrToReturnEventWhenMappingImageThenEventIsNo
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueMapImageTest, givenZeroCopyImageWhenItIsMappedAndReturnsEventThenEventHasCorrectProperties) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pDevice->getRootDeviceEnvironment());
|
||||
cl_event eventReturned = nullptr;
|
||||
auto mapFlags = CL_MAP_READ;
|
||||
const size_t origin[3] = {0, 0, 0};
|
||||
@@ -647,6 +648,7 @@ HWTEST_F(EnqueueMapImageTest, givenSharingHandlerWhenReadOnlyMapAndUnmapOnNonTil
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueMapImageTest, givenImageWithouUsetHostPtrFlagWhenMappedOnCpuThenSetAllMapProperties) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pDevice->getRootDeviceEnvironment());
|
||||
std::unique_ptr<Image> image(ImageHelper<Image1dDefaults>::create(context));
|
||||
ASSERT_NE(nullptr, image);
|
||||
EXPECT_TRUE(image->mappingOnCpuAllowed());
|
||||
@@ -675,6 +677,7 @@ HWTEST_F(EnqueueMapImageTest, givenImageWithouUsetHostPtrFlagWhenMappedOnCpuThen
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueMapImageTest, givenImageWithUseHostPtrFlagWhenMappedOnCpuThenSetAllMapProperties) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pDevice->getRootDeviceEnvironment());
|
||||
std::unique_ptr<Image> image(ImageHelper<ImageUseHostPtr<Image1dDefaults>>::create(context));
|
||||
ASSERT_NE(nullptr, image);
|
||||
EXPECT_TRUE(image->mappingOnCpuAllowed());
|
||||
@@ -786,6 +789,7 @@ TEST_F(EnqueueMapImageTest, givenBlockedCommandQueueWhenBlockingMapWith1DImageIs
|
||||
}
|
||||
|
||||
TEST_F(EnqueueMapImageTest, givenBlockedCommandQueueWhenBlockingCpuMapIsCalledThenReturnRowPitchAndSlicePitch) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pDevice->getRootDeviceEnvironment());
|
||||
const size_t origin[3] = {0, 0, 0};
|
||||
const size_t region[3] = {1, 1, 1};
|
||||
size_t retImageRowPitch = 0;
|
||||
@@ -823,6 +827,7 @@ TEST_F(EnqueueMapImageTest, givenBlockedCommandQueueWhenBlockingCpuMapIsCalledTh
|
||||
}
|
||||
|
||||
TEST_F(EnqueueMapImageTest, givenZeroCopyImageWhenMappedOnCpuThenReturnImageRowAndSlicePitch) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pDevice->getRootDeviceEnvironment());
|
||||
const size_t origin[3] = {0, 0, 0};
|
||||
const size_t region[3] = {1, 1, 1};
|
||||
size_t retImageRowPitch = 0;
|
||||
@@ -842,6 +847,7 @@ TEST_F(EnqueueMapImageTest, givenZeroCopyImageWhenMappedOnCpuThenReturnImageRowA
|
||||
}
|
||||
|
||||
TEST_F(EnqueueMapImageTest, givenNonZeroCopyImageWhenMappedOnCpuThenReturnHostRowAndSlicePitch) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pDevice->getRootDeviceEnvironment());
|
||||
const size_t origin[3] = {0, 0, 0};
|
||||
const size_t region[3] = {1, 1, 1};
|
||||
size_t retImageRowPitch = 0;
|
||||
@@ -948,6 +954,8 @@ TEST_F(EnqueueMapImageTest, givenImage1DArrayWhenEnqueueMapImageIsCalledThenRetu
|
||||
void transformImage3dTo2dArray(void *memory) override {}
|
||||
};
|
||||
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pDevice->getRootDeviceEnvironment());
|
||||
|
||||
const size_t origin[3] = {0, 0, 0};
|
||||
const size_t region[3] = {1, 1, 1};
|
||||
size_t retImageRowPitch = 0;
|
||||
|
||||
@@ -102,6 +102,7 @@ TEST_F(EnqueueReadBuffer, WhenReadingBufferThenEventReturnedShouldBeMaxOfInputEv
|
||||
delete pEvent;
|
||||
}
|
||||
TEST_F(EnqueueReadBuffer, givenInOrderQueueAndForcedCpuCopyOnReadBufferAndDstPtrEqualSrcPtrWithEventsNotBlockedWhenReadBufferIsExecutedThenTaskLevelShouldNotBeIncreased) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.DoCpuCopyOnReadBuffer.set(1);
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::Default));
|
||||
@@ -179,6 +180,7 @@ TEST_F(EnqueueReadBuffer, givenInOrderQueueAndForcedCpuCopyOnReadBufferAndDstPtr
|
||||
}
|
||||
|
||||
TEST_F(EnqueueReadBuffer, givenOutOfOrderQueueAndForcedCpuCopyOnReadBufferAndDstPtrEqualSrcPtrWithEventsNotBlockedWhenReadBufferIsExecutedThenTaskLevelShouldNotBeIncreased) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.DoCpuCopyOnReadBuffer.set(1);
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::Default));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -599,6 +599,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenEnqueueReadBufferCalledWhenLockedPtrInT
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueReadBufferTypeTest, givenForcedCpuCopyWhenEnqueueReadCompressedBufferThenDontCopyOnCpu) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.DoCpuCopyOnReadBuffer.set(1);
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::Default));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -119,6 +119,7 @@ TEST_F(EnqueueUnmapMemObjTest, WhenUnmappingMemoryObjectThenReturnedEventHasGrea
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueUnmapMemObjTest, WhenUnmappingMemoryObjectThenEventIsUpdated) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pDevice->getRootDeviceEnvironment());
|
||||
cl_event eventReturned = NULL;
|
||||
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
@@ -142,6 +143,7 @@ HWTEST_F(EnqueueUnmapMemObjTest, WhenUnmappingMemoryObjectThenEventIsUpdated) {
|
||||
}
|
||||
|
||||
TEST_F(EnqueueUnmapMemObjTest, WhenUnmappingMemoryObjectThenWaitEventIsUpdated) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pDevice->getRootDeviceEnvironment());
|
||||
cl_event waitEvent = nullptr;
|
||||
cl_event retEvent = nullptr;
|
||||
|
||||
@@ -196,6 +198,7 @@ TEST_F(EnqueueUnmapMemObjTest, WhenUnmappingMemoryObjectThenWaitEventIsUpdated)
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueUnmapMemObjTest, givenEnqueueUnmapMemObjectWhenNonAubWritableBufferObjectMappedToHostPtrForWritingThenItShouldBeResetToAubAndTbxWritable) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pDevice->getRootDeviceEnvironment());
|
||||
auto buffer = std::unique_ptr<Buffer>(BufferHelper<>::create());
|
||||
ASSERT_NE(nullptr, buffer);
|
||||
auto graphicsAllocation = buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex());
|
||||
@@ -218,6 +221,7 @@ HWTEST_F(EnqueueUnmapMemObjTest, givenEnqueueUnmapMemObjectWhenNonAubWritableBuf
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueUnmapMemObjTest, givenWriteBufferIsServicedOnCPUWhenBufferIsNonAubTbxWriteableThenFlagsChange) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pDevice->getRootDeviceEnvironment());
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.DoCpuCopyOnWriteBuffer.set(1);
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::Default));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -102,6 +102,7 @@ TEST_F(EnqueueWriteBufferTypeTest, WhenWritingBufferThenReturnedEventShouldBeMax
|
||||
}
|
||||
|
||||
TEST_F(EnqueueWriteBufferTypeTest, givenInOrderQueueAndForcedCpuCopyOnWriteBufferAndDstPtrEqualSrcPtrWithEventsNotBlockedWhenWriteBufferIsExecutedThenTaskLevelShouldNotBeIncreased) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.DoCpuCopyOnWriteBuffer.set(1);
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::Default));
|
||||
@@ -217,6 +218,7 @@ TEST_F(EnqueueWriteBufferTypeTest, givenInOrderQueueAndForcedCpuCopyOnWriteBuffe
|
||||
}
|
||||
|
||||
TEST_F(EnqueueWriteBufferTypeTest, givenOutOfOrderQueueAndForcedCpuCopyOnWriteBufferAndDstPtrEqualSrcPtrWithEventsWhenWriteBufferIsExecutedThenTaskLevelShouldNotBeIncreased) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.DoCpuCopyOnWriteBuffer.set(1);
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::Default));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -428,6 +428,7 @@ HWTEST_F(EnqueueWriteBufferTypeTest, givenEnqueueWriteBufferCalledWhenLockedPtrI
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueWriteBufferTypeTest, givenForcedCpuCopyWhenEnqueueWriteCompressedBufferThenDontCopyOnCpu) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.DoCpuCopyOnWriteBuffer.set(1);
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::Default));
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "shared/test/common/mocks/mock_allocation_properties.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
#include "shared/test/common/test_macros/test_checks_shared.h"
|
||||
|
||||
#include "opencl/source/command_queue/command_queue_hw.h"
|
||||
#include "opencl/source/event/user_event.h"
|
||||
@@ -229,6 +230,7 @@ HWTEST_F(MultipleMapBufferTest, givenErrorFromWriteBufferWhenUnmappedOnGpuThenDo
|
||||
}
|
||||
|
||||
HWTEST_F(MultipleMapBufferTest, givenUnblockedQueueWhenMappedOnCpuThenAddMappedPtrAndRemoveOnUnmap) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
auto buffer = createMockBuffer<FamilyType>(false);
|
||||
auto cmdQ = createMockCmdQ<FamilyType>();
|
||||
EXPECT_TRUE(buffer->mappingOnCpuAllowed());
|
||||
@@ -250,6 +252,7 @@ HWTEST_F(MultipleMapBufferTest, givenUnblockedQueueWhenMappedOnCpuThenAddMappedP
|
||||
}
|
||||
|
||||
HWTEST_F(MultipleMapBufferTest, givenUnblockedQueueWhenReadOnlyMappedOnCpuThenDontMakeCpuCopy) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
auto buffer = createMockBuffer<FamilyType>(false);
|
||||
auto cmdQ = createMockCmdQ<FamilyType>();
|
||||
EXPECT_TRUE(buffer->mappingOnCpuAllowed());
|
||||
@@ -267,6 +270,7 @@ HWTEST_F(MultipleMapBufferTest, givenUnblockedQueueWhenReadOnlyMappedOnCpuThenDo
|
||||
}
|
||||
|
||||
HWTEST_F(MultipleMapBufferTest, givenUnblockedQueueWhenWriteInvalidateMappedOnCpuThenDontMakeCpuCopy) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
auto buffer = createMockBuffer<FamilyType>(false);
|
||||
auto cmdQ = createMockCmdQ<FamilyType>();
|
||||
EXPECT_TRUE(buffer->mappingOnCpuAllowed());
|
||||
@@ -284,6 +288,7 @@ HWTEST_F(MultipleMapBufferTest, givenUnblockedQueueWhenWriteInvalidateMappedOnCp
|
||||
}
|
||||
|
||||
HWTEST_F(MultipleMapBufferTest, givenBlockedQueueWhenMappedOnCpuThenAddMappedPtrAndRemoveOnUnmap) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
auto buffer = createMockBuffer<FamilyType>(false);
|
||||
auto cmdQ = createMockCmdQ<FamilyType>();
|
||||
EXPECT_TRUE(buffer->mappingOnCpuAllowed());
|
||||
@@ -311,6 +316,7 @@ HWTEST_F(MultipleMapBufferTest, givenBlockedQueueWhenMappedOnCpuThenAddMappedPtr
|
||||
}
|
||||
|
||||
HWTEST_F(MultipleMapBufferTest, givenBlockedQueueWhenMappedReadOnlyOnCpuThenDontMakeCpuCopy) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
auto buffer = createMockBuffer<FamilyType>(false);
|
||||
auto cmdQ = createMockCmdQ<FamilyType>();
|
||||
EXPECT_TRUE(buffer->mappingOnCpuAllowed());
|
||||
@@ -334,6 +340,7 @@ HWTEST_F(MultipleMapBufferTest, givenBlockedQueueWhenMappedReadOnlyOnCpuThenDont
|
||||
}
|
||||
|
||||
HWTEST_F(MultipleMapBufferTest, givenInvalidPtrWhenUnmappedOnCpuThenReturnError) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
auto buffer = createMockBuffer<FamilyType>(false);
|
||||
auto cmdQ = createMockCmdQ<FamilyType>();
|
||||
EXPECT_TRUE(buffer->mappingOnCpuAllowed());
|
||||
@@ -401,6 +408,7 @@ HWTEST_F(MultipleMapBufferTest, givenOverlapingPtrWhenMappingOnGpuForWriteThenRe
|
||||
}
|
||||
|
||||
HWTEST_F(MultipleMapBufferTest, givenOverlapingPtrWhenMappingOnCpuForWriteThenReturnError) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
auto buffer = createMockBuffer<FamilyType>(false);
|
||||
auto cmdQ = createMockCmdQ<FamilyType>();
|
||||
EXPECT_TRUE(buffer->mappingOnCpuAllowed());
|
||||
@@ -418,3 +426,9 @@ HWTEST_F(MultipleMapBufferTest, givenOverlapingPtrWhenMappingOnCpuForWriteThenRe
|
||||
EXPECT_EQ(CL_INVALID_OPERATION, retVal);
|
||||
EXPECT_EQ(1u, buffer->getMapOperationsHandler().size());
|
||||
}
|
||||
|
||||
HWTEST_F(MultipleMapBufferTest, givenCachingOnCpuUnavailableWhenMappingOnCpuAllowedIsCalledThenReturnFalse) {
|
||||
auto buffer = createMockBuffer<FamilyType>(false);
|
||||
auto &productHelper = pClDevice->getRootDeviceEnvironment().getHelper<ProductHelper>();
|
||||
EXPECT_EQ(productHelper.isCachingOnCpuAvailable(), buffer->mappingOnCpuAllowed());
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
#include "shared/test/common/test_macros/test_checks_shared.h"
|
||||
|
||||
#include "opencl/source/command_queue/command_queue_hw.h"
|
||||
#include "opencl/source/event/user_event.h"
|
||||
@@ -265,6 +266,7 @@ HWTEST_F(MultipleMapImageTest, givenErrorFromWriteImageWhenUnmappedOnGpuThenDont
|
||||
}
|
||||
|
||||
HWTEST_F(MultipleMapImageTest, givenUnblockedQueueWhenMappedOnCpuThenAddMappedPtrAndRemoveOnUnmap) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
auto image = createMockImage<Image1dDefaults, FamilyType>();
|
||||
auto cmdQ = createMockCmdQ<FamilyType>();
|
||||
image->isZeroCopy = false;
|
||||
@@ -287,6 +289,7 @@ HWTEST_F(MultipleMapImageTest, givenUnblockedQueueWhenMappedOnCpuThenAddMappedPt
|
||||
}
|
||||
|
||||
HWTEST_F(MultipleMapImageTest, givenUnblockedQueueWhenReadOnlyUnmappedOnCpuThenDontMakeCpuCopy) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
auto image = createMockImage<Image1dDefaults, FamilyType>();
|
||||
auto cmdQ = createMockCmdQ<FamilyType>();
|
||||
image->isZeroCopy = false;
|
||||
@@ -308,6 +311,7 @@ HWTEST_F(MultipleMapImageTest, givenUnblockedQueueWhenReadOnlyUnmappedOnCpuThenD
|
||||
}
|
||||
|
||||
HWTEST_F(MultipleMapImageTest, givenUnblockedQueueWhenWriteInvalidateMappedOnCpuThenDontMakeCpuCopy) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
auto image = createMockImage<Image1dDefaults, FamilyType>();
|
||||
auto cmdQ = createMockCmdQ<FamilyType>();
|
||||
image->isZeroCopy = false;
|
||||
@@ -329,6 +333,7 @@ HWTEST_F(MultipleMapImageTest, givenUnblockedQueueWhenWriteInvalidateMappedOnCpu
|
||||
}
|
||||
|
||||
HWTEST_F(MultipleMapImageTest, givenBlockedQueueWhenMappedOnCpuThenAddMappedPtrAndRemoveOnUnmap) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
auto image = createMockImage<Image1dDefaults, FamilyType>();
|
||||
auto cmdQ = createMockCmdQ<FamilyType>();
|
||||
image->isZeroCopy = false;
|
||||
@@ -358,6 +363,7 @@ HWTEST_F(MultipleMapImageTest, givenBlockedQueueWhenMappedOnCpuThenAddMappedPtrA
|
||||
}
|
||||
|
||||
HWTEST_F(MultipleMapImageTest, givenBlockedQueueWhenMappedReadOnlyOnCpuThenDontMakeCpuCopy) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
auto image = createMockImage<Image1dDefaults, FamilyType>();
|
||||
auto cmdQ = createMockCmdQ<FamilyType>();
|
||||
image->isZeroCopy = false;
|
||||
@@ -385,6 +391,7 @@ HWTEST_F(MultipleMapImageTest, givenBlockedQueueWhenMappedReadOnlyOnCpuThenDontM
|
||||
}
|
||||
|
||||
HWTEST_F(MultipleMapImageTest, givenInvalidPtrWhenUnmappedOnCpuThenReturnError) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
auto image = createMockImage<Image1dDefaults, FamilyType>();
|
||||
auto cmdQ = createMockCmdQ<FamilyType>();
|
||||
EXPECT_TRUE(image->mappingOnCpuAllowed());
|
||||
@@ -453,6 +460,7 @@ HWTEST_F(MultipleMapImageTest, givenOverlapingPtrWhenMappingForWriteThenReturnEr
|
||||
}
|
||||
|
||||
HWTEST_F(MultipleMapImageTest, givenOverlapingPtrWhenMappingOnCpuForWriteThenReturnError) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
auto image = createMockImage<Image1dDefaults, FamilyType>();
|
||||
auto cmdQ = createMockCmdQ<FamilyType>();
|
||||
EXPECT_TRUE(image->mappingOnCpuAllowed());
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "shared/source/memory_manager/memory_allocation.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
#include "shared/test/common/test_macros/test_checks_shared.h"
|
||||
|
||||
#include "opencl/test/unit_test/command_queue/enqueue_read_buffer_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
|
||||
@@ -20,6 +21,7 @@ using namespace NEO;
|
||||
typedef EnqueueReadBufferTypeTest ReadWriteBufferCpuCopyTest;
|
||||
|
||||
HWTEST_F(ReadWriteBufferCpuCopyTest, givenCompressedGmmWhenAskingForCpuOperationThenDisallow) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(context->getDevice(0)->getRootDeviceEnvironment());
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::Default));
|
||||
cl_int retVal;
|
||||
@@ -44,6 +46,7 @@ HWTEST_F(ReadWriteBufferCpuCopyTest, givenCompressedGmmWhenAskingForCpuOperation
|
||||
}
|
||||
|
||||
HWTEST_F(ReadWriteBufferCpuCopyTest, GivenUnalignedReadPtrWhenReadingBufferThenMemoryIsReadCorrectly) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(context->getDevice(0)->getRootDeviceEnvironment());
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::Default));
|
||||
cl_int retVal;
|
||||
@@ -85,6 +88,7 @@ HWTEST_F(ReadWriteBufferCpuCopyTest, GivenUnalignedReadPtrWhenReadingBufferThenM
|
||||
}
|
||||
|
||||
HWTEST_F(ReadWriteBufferCpuCopyTest, GivenUnalignedSrcPtrWhenWritingBufferThenMemoryIsWrittenCorrectly) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(context->getDevice(0)->getRootDeviceEnvironment());
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::Default));
|
||||
cl_int retVal;
|
||||
@@ -226,6 +230,7 @@ HWTEST_F(ReadWriteBufferCpuCopyTest, GivenSpecificMemoryStructuresWhenReadingWri
|
||||
}
|
||||
|
||||
HWTEST_F(ReadWriteBufferCpuCopyTest, givenDebugVariableToDisableCpuCopiesWhenBufferCpuCopyAllowedIsCalledThenItReturnsFalse) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(context->getDevice(0)->getRootDeviceEnvironment());
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.EnableLocalMemory.set(false);
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::Default));
|
||||
@@ -252,6 +257,13 @@ HWTEST_F(ReadWriteBufferCpuCopyTest, givenDebugVariableToDisableCpuCopiesWhenBuf
|
||||
EXPECT_FALSE(mockCommandQueue->bufferCpuCopyAllowed(buffer.get(), CL_COMMAND_WRITE_BUFFER, true, MemoryConstants::pageSize, reinterpret_cast<void *>(0x1000), 0u, nullptr));
|
||||
}
|
||||
|
||||
HWTEST_F(ReadWriteBufferCpuCopyTest, givenCachingOnCpuUnavailableWhenIsReadWriteOnCpuAllowedThenReturnFalse) {
|
||||
cl_int retVal;
|
||||
std::unique_ptr<Buffer> buffer(Buffer::create(context, CL_MEM_ALLOC_HOST_PTR, MemoryConstants::pageSize, nullptr, retVal));
|
||||
auto &productHelper = context->getDevice(0)->getRootDeviceEnvironment().getHelper<ProductHelper>();
|
||||
EXPECT_EQ(productHelper.isCachingOnCpuAvailable(), buffer->isReadWriteOnCpuAllowed(context->getDevice(0)->getDevice()));
|
||||
}
|
||||
|
||||
TEST(ReadWriteBufferOnCpu, givenNoHostPtrAndAlignedSizeWhenMemoryAllocationIsInNonSystemMemoryPoolThenIsReadWriteOnCpuAllowedReturnsFalse) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::Default));
|
||||
@@ -259,6 +271,7 @@ TEST(ReadWriteBufferOnCpu, givenNoHostPtrAndAlignedSizeWhenMemoryAllocationIsInN
|
||||
MockMemoryManager *memoryManager = new MockMemoryManager(*executionEnvironment);
|
||||
executionEnvironment->memoryManager.reset(memoryManager);
|
||||
auto device = std::make_unique<MockClDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(nullptr, executionEnvironment, 0u));
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(device->getRootDeviceEnvironment());
|
||||
|
||||
MockContext ctx(device.get());
|
||||
|
||||
@@ -283,6 +296,7 @@ TEST(ReadWriteBufferOnCpu, givenPointerThatRequiresCpuCopyWhenCpuCopyIsEvaluated
|
||||
MockMemoryManager *memoryManager = new MockMemoryManager(*executionEnvironment);
|
||||
executionEnvironment->memoryManager.reset(memoryManager);
|
||||
auto device = std::make_unique<MockClDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(nullptr, executionEnvironment, 0u));
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(device->getRootDeviceEnvironment());
|
||||
|
||||
MockContext context(device.get());
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "shared/test/common/mocks/mock_gmm_page_table_mngr.h"
|
||||
#include "shared/test/common/mocks/mock_submissions_aggregator.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
#include "shared/test/common/test_macros/test_checks_shared.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/ult_command_stream_receiver_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_buffer.h"
|
||||
@@ -227,6 +228,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenNonDcFlushWithInitialTaskCoun
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenDcFlushWhenFinishingThenTaskCountIncremented) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(pClDevice->getRootDeviceEnvironment());
|
||||
MockContext ctx(pClDevice);
|
||||
MockKernelWithInternals kernel(*pClDevice);
|
||||
MockCommandQueueHw<FamilyType> mockCmdQueue(&ctx, pClDevice, nullptr);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "shared/source/helpers/local_work_size.h"
|
||||
#include "shared/source/memory_manager/unified_memory_manager.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/test_macros/test_checks_shared.h"
|
||||
|
||||
#include "opencl/source/command_queue/cl_local_work_size.h"
|
||||
#include "opencl/source/command_queue/command_queue.h"
|
||||
@@ -451,6 +452,7 @@ TEST_F(PerformanceHintEnqueueImageTest, GivenNonBlockingReadImageSharesStorageWi
|
||||
}
|
||||
|
||||
TEST_P(PerformanceHintEnqueueMapTest, GivenZeroCopyFlagWhenEnqueueMapBufferIsCallingThenContextProvidesProperHint) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(context->getDevice(0)->getRootDeviceEnvironment());
|
||||
|
||||
Buffer *buffer;
|
||||
void *address;
|
||||
@@ -475,6 +477,7 @@ TEST_P(PerformanceHintEnqueueMapTest, GivenZeroCopyFlagWhenEnqueueMapBufferIsCal
|
||||
delete buffer;
|
||||
}
|
||||
TEST_P(PerformanceHintEnqueueMapTest, GivenZeroCopyFlagAndBlockingEventWhenEnqueueMapBufferIsCallingThenContextProvidesProperHint) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(context->getDevice(0)->getRootDeviceEnvironment());
|
||||
|
||||
void *address;
|
||||
bool zeroCopyBuffer = GetParam();
|
||||
@@ -505,6 +508,7 @@ TEST_P(PerformanceHintEnqueueMapTest, GivenZeroCopyFlagAndBlockingEventWhenEnque
|
||||
}
|
||||
|
||||
TEST_P(PerformanceHintEnqueueMapTest, GivenZeroCopyFlagWhenEnqueueMapImageIsCallingThenContextProvidesProperHint) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(context->getDevice(0)->getRootDeviceEnvironment());
|
||||
|
||||
Image *image;
|
||||
bool isZeroCopyImage;
|
||||
@@ -543,6 +547,7 @@ TEST_P(PerformanceHintEnqueueMapTest, GivenZeroCopyFlagWhenEnqueueMapImageIsCall
|
||||
}
|
||||
|
||||
TEST_P(PerformanceHintEnqueueMapTest, GivenZeroCopyFlagAndBlockingEventWhenEnqueueMapImageIsCallingThenContextProvidesProperHint) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(context->getDevice(0)->getRootDeviceEnvironment());
|
||||
|
||||
auto image = std::unique_ptr<Image>(ImageHelper<ImageReadOnly<Image1dDefaults>>::create(context));
|
||||
bool isZeroCopyImage = GetParam();
|
||||
@@ -581,6 +586,7 @@ TEST_P(PerformanceHintEnqueueMapTest, GivenZeroCopyFlagAndBlockingEventWhenEnque
|
||||
}
|
||||
|
||||
TEST_P(PerformanceHintEnqueueMapTest, GivenZeroCopyFlagWhenEnqueueUnmapIsCallingWithBufferThenContextProvidesProperHint) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(context->getDevice(0)->getRootDeviceEnvironment());
|
||||
|
||||
Buffer *buffer;
|
||||
void *address;
|
||||
@@ -607,6 +613,7 @@ TEST_P(PerformanceHintEnqueueMapTest, GivenZeroCopyFlagWhenEnqueueUnmapIsCalling
|
||||
}
|
||||
|
||||
TEST_P(PerformanceHintEnqueueMapTest, GivenZeroCopyAndBlockedEventFlagWhenEnqueueUnmapIsCallingWithBufferThenContextProvidesProperHint) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(context->getDevice(0)->getRootDeviceEnvironment());
|
||||
|
||||
void *address;
|
||||
bool zeroCopyBuffer = GetParam();
|
||||
@@ -638,6 +645,7 @@ TEST_P(PerformanceHintEnqueueMapTest, GivenZeroCopyAndBlockedEventFlagWhenEnqueu
|
||||
}
|
||||
|
||||
TEST_P(PerformanceHintEnqueueMapTest, GivenZeroCopyFlagWhenEnqueueUnmapIsCallingWithImageThenContextProvidesProperHint) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(context->getDevice(0)->getRootDeviceEnvironment());
|
||||
|
||||
Image *image;
|
||||
bool isZeroCopyImage;
|
||||
|
||||
@@ -1488,6 +1488,7 @@ TEST_F(EventTest, givenCmdQueueWithoutProfilingWhenIsCpuProfilingIsCalledThenFal
|
||||
}
|
||||
|
||||
TEST_F(EventTest, givenOutEventWhenBlockingEnqueueHandledOnCpuThenUpdateTaskCountAndFlushStampFromCmdQ) {
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(mockContext.getDevice(0)->getRootDeviceEnvironment());
|
||||
std::unique_ptr<Image> image(ImageHelper<Image1dDefaults>::create(&mockContext));
|
||||
EXPECT_TRUE(image->mappingOnCpuAllowed());
|
||||
|
||||
|
||||
@@ -276,6 +276,8 @@ int main(int argc, char **argv) {
|
||||
revId = platform.usRevId;
|
||||
}
|
||||
|
||||
NEO::DebugManager.flags.ForcePreferredAllocationMethod.set(0); // Force allocation in system for ULTs
|
||||
|
||||
adjustHwInfoForTests(hwInfoForTests, euPerSubSlice, sliceCount, subSlicePerSliceCount, dieRecovery);
|
||||
|
||||
binaryNameSuffix.append(hardwarePrefix[hwInfoForTests.platform.eProductFamily]);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "shared/test/common/mocks/mock_host_ptr_manager.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
#include "shared/test/common/test_macros/test_checks_shared.h"
|
||||
|
||||
#include "opencl/extensions/public/cl_ext_private.h"
|
||||
#include "opencl/source/command_queue/command_queue_hw.h"
|
||||
@@ -77,6 +78,7 @@ TEST(Buffer, whenBufferAllocatedInLocalMemoryThenCpuCopyIsDisallowed) {
|
||||
MockBuffer buffer(allocation);
|
||||
UltDeviceFactory factory{1, 0};
|
||||
auto &device = *factory.rootDevices[0];
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(factory.rootDevices[0]->getRootDeviceEnvironment());
|
||||
|
||||
allocation.memoryPool = MemoryPool::LocalMemory;
|
||||
EXPECT_FALSE(buffer.isReadWriteOnCpuAllowed(device));
|
||||
|
||||
@@ -1298,6 +1298,7 @@ TEST(ImageTest, givenImageWhenAskedForPtrOffsetForCpuMappingThenReturnCorrectVal
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.ForceLinearImages.set(true);
|
||||
MockContext ctx;
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(ctx.getDevice(0)->getRootDeviceEnvironment());
|
||||
std::unique_ptr<Image> image(ImageHelper<Image3dDefaults>::create(&ctx));
|
||||
EXPECT_TRUE(image->mappingOnCpuAllowed());
|
||||
|
||||
@@ -1313,6 +1314,7 @@ TEST(ImageTest, givenImageWhenAskedForPtrOffsetForCpuMappingThenReturnCorrectVal
|
||||
|
||||
TEST(ImageTest, given1DArrayImageWhenAskedForPtrOffsetForMappingThenReturnCorrectValue) {
|
||||
MockContext ctx;
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(ctx.getDevice(0)->getRootDeviceEnvironment());
|
||||
std::unique_ptr<Image> image(ImageHelper<Image1dArrayDefaults>::create(&ctx));
|
||||
|
||||
MemObjOffsetArray origin = {{4, 5, 0}};
|
||||
@@ -1345,6 +1347,7 @@ TEST(ImageTest, givenImageWhenAskedForPtrLengthForCpuMappingThenReturnCorrectVal
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.ForceLinearImages.set(true);
|
||||
MockContext ctx;
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(ctx.getDevice(0)->getRootDeviceEnvironment());
|
||||
std::unique_ptr<Image> image(ImageHelper<Image3dDefaults>::create(&ctx));
|
||||
EXPECT_TRUE(image->mappingOnCpuAllowed());
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
#include "shared/test/common/test_macros/test_checks_shared.h"
|
||||
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
#include "opencl/source/helpers/properties_helper.h"
|
||||
@@ -301,15 +302,23 @@ TEST(MemObj, givenTiledObjectWhenAskedForCpuMappingThenReturnFalse) {
|
||||
bool isTiledAllocation() const override { return true; }
|
||||
};
|
||||
MockContext context;
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(context.getDevice(0)->getRootDeviceEnvironment());
|
||||
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
|
||||
|
||||
context.memoryManager = &memoryManager;
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, MemoryConstants::pageSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
|
||||
auto memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_COPY_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice());
|
||||
MyMemObj memObj(nullptr, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryConstants::pageSize, nullptr, nullptr, 0, true, false, false);
|
||||
MyMemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_COPY_HOST_PTR, 0,
|
||||
MemoryConstants::pageSize, allocation->getUnderlyingBuffer(), nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(allocation), true, false, false);
|
||||
|
||||
EXPECT_FALSE(memObj.mappingOnCpuAllowed());
|
||||
}
|
||||
|
||||
TEST(MemObj, givenCompressedGmmWhenAskingForMappingOnCpuThenDisallow) {
|
||||
MockContext context;
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(context.getDevice(0)->getRootDeviceEnvironment());
|
||||
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
|
||||
|
||||
context.memoryManager = &memoryManager;
|
||||
@@ -328,6 +337,7 @@ TEST(MemObj, givenCompressedGmmWhenAskingForMappingOnCpuThenDisallow) {
|
||||
|
||||
TEST(MemObj, givenDefaultWhenAskedForCpuMappingThenReturnTrue) {
|
||||
MockContext context;
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(context.getDevice(0)->getRootDeviceEnvironment());
|
||||
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
|
||||
|
||||
context.memoryManager = &memoryManager;
|
||||
@@ -344,6 +354,7 @@ TEST(MemObj, givenDefaultWhenAskedForCpuMappingThenReturnTrue) {
|
||||
|
||||
TEST(MemObj, givenNonCpuAccessibleMemoryWhenAskingForMappingOnCpuThenDisallow) {
|
||||
MockContext context;
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(context.getDevice(0)->getRootDeviceEnvironment());
|
||||
MockMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
|
||||
|
||||
context.memoryManager = &memoryManager;
|
||||
|
||||
@@ -1130,6 +1130,7 @@ TEST(UnifiedSharedMemoryTransferCalls, givenHostUsmAllocationWhenPtrIsUsedForTra
|
||||
DebugManager.flags.EnableLocalMemory.set(false);
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(static_cast<int32_t>(LocalMemoryAccessMode::Default));
|
||||
MockContext mockContext;
|
||||
REQUIRE_CPU_MEM_ACCESS_OR_SKIP(mockContext.getDevice(0)->getRootDeviceEnvironment());
|
||||
cl_context clContext = &mockContext;
|
||||
|
||||
if (mockContext.getDevice(0u)->getHardwareInfo().capabilityTable.supportsOcl21Features == false) {
|
||||
|
||||
@@ -149,6 +149,8 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
NEO::DebugManager.flags.ForcePreferredAllocationMethod.set(0); // Force allocation in system for ULTs
|
||||
|
||||
auto productConfigHelper = new ProductConfigHelper();
|
||||
auto allEnabledDeviceConfigs = productConfigHelper->getDeviceAotInfo();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user