Pass Device when creating MemoryProperties

Related-To: NEO-4651

Change-Id: Ie1f7f55d4817612de83bfb2a372fd7ac35c11930
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2020-06-05 00:16:55 +02:00
committed by sys_ocldev
parent 7f5aa241b2
commit 78d07b9b37
53 changed files with 567 additions and 365 deletions

View File

@ -5,6 +5,7 @@
*
*/
#include "opencl/source/cl_device/cl_device.h"
#include "opencl/source/helpers/memory_properties_helpers.h"
#include "opencl/source/mem_obj/mem_obj.h"
#include "opencl/source/sharings/sharing.h"
@ -38,8 +39,10 @@ TEST(sharingHandler, givenMemObjWhenAcquireIncrementCounterThenReleaseShouldDecr
char buffer[64];
MockContext context;
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(buffer, sizeof(buffer));
std::unique_ptr<MemObj> memObj(new MemObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0,
sizeof(buffer), buffer, buffer, mockAllocation, true, false, false));
std::unique_ptr<MemObj> memObj(
new MemObj(&context, CL_MEM_OBJECT_BUFFER,
MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice()),
CL_MEM_USE_HOST_PTR, 0, sizeof(buffer), buffer, buffer, mockAllocation, true, false, false));
struct MockSharingHandler : SharingHandler {
using SharingHandler::acquireCount;
@ -60,8 +63,10 @@ TEST(sharingHandler, givenMemObjWhenAcquireTwoTimesThenReleaseShouldBeCalledTwoT
char buffer[64];
MockContext context;
MockGraphicsAllocation *mockAllocation = new MockGraphicsAllocation(buffer, sizeof(buffer));
std::unique_ptr<MemObj> memObj(new MemObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0,
sizeof(buffer), buffer, buffer, mockAllocation, true, false, false));
std::unique_ptr<MemObj> memObj(
new MemObj(&context, CL_MEM_OBJECT_BUFFER,
MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice()),
CL_MEM_USE_HOST_PTR, 0, sizeof(buffer), buffer, buffer, mockAllocation, true, false, false));
struct MockSharingHandler : SharingHandler {
using SharingHandler::acquireCount;
@ -102,8 +107,9 @@ TEST(sharingHandler, givenSharingHandlerWhenAcquiringThenReturnErrorCode) {
SharingHandler sharingHandler;
MockContext context;
MockGraphicsAllocation *graphicsAllocation = new MockGraphicsAllocation(nullptr, 0);
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0), CL_MEM_USE_HOST_PTR, 0,
1, nullptr, nullptr, graphicsAllocation, true, false, false);
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER,
MemoryPropertiesHelper::createMemoryProperties(CL_MEM_USE_HOST_PTR, 0, 0, &context.getDevice(0)->getDevice()),
CL_MEM_USE_HOST_PTR, 0, 1, nullptr, nullptr, graphicsAllocation, true, false, false);
auto result = sharingHandler.acquire(&memObj, graphicsAllocation->getRootDeviceIndex());
EXPECT_NE(CL_SUCCESS, result);