Allow to set shared system memory pointers in constant buffers.

Change-Id: Ie2a811c0f50abf667df82517abf2291e00a18460
Signed-off-by: Mrozek, Michal <michal.mrozek@intel.com>
This commit is contained in:
Mrozek, Michal
2019-09-04 17:26:57 +02:00
committed by sys_ocldev
parent b25422deb1
commit 29613a2b1a
5 changed files with 54 additions and 4 deletions

View File

@@ -5,6 +5,7 @@
*
*/
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
#include "runtime/api/api.h"
#include "runtime/memory_manager/unified_memory_manager.h"
#include "unit_tests/mocks/mock_context.h"
@@ -292,6 +293,25 @@ TEST(clUnifiedSharedMemoryTests, whenClSetKernelArgMemPointerINTELisCalledWithIn
EXPECT_EQ(CL_INVALID_KERNEL, retVal);
}
TEST(clUnifiedSharedMemoryTests, whenDeviceSupportSharedMemoryAllocationsAndSystemPointerIsPassedItIsProperlySetInKernel) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableSharedSystemUsmSupport.set(1u);
auto mockContext = std::make_unique<MockContext>();
MockKernelWithInternals mockKernel(*mockContext->getDevice(0u), mockContext.get(), true);
auto systemPointer = reinterpret_cast<void *>(0xfeedbac);
auto retVal = clSetKernelArgMemPointerINTEL(mockKernel.mockKernel, 0, systemPointer);
EXPECT_EQ(retVal, CL_SUCCESS);
//check if cross thread is updated
auto crossThreadLocation = reinterpret_cast<uintptr_t *>(ptrOffset(mockKernel.mockKernel->getCrossThreadData(), mockKernel.kernelInfo.kernelArgInfo[0].kernelArgPatchInfoVector[0].crossthreadOffset));
auto systemAddress = reinterpret_cast<uintptr_t>(systemPointer);
EXPECT_EQ(*crossThreadLocation, systemAddress);
}
TEST(clUnifiedSharedMemoryTests, whenClSetKernelArgMemPointerINTELisCalledWithValidUnifiedMemoryAllocationThenProperFieldsAreSet) {
auto mockContext = std::make_unique<MockContext>();
cl_int retVal = CL_SUCCESS;