2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2022-08-16 14:51:17 +00:00
|
|
|
* Copyright (C) 2018-2022 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "cl_api_tests.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2021-01-21 13:10:13 +01:00
|
|
|
#include "shared/test/common/mocks/mock_device.h"
|
2020-04-02 09:35:50 +02:00
|
|
|
|
2020-03-18 13:08:45 +01:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
2020-03-04 15:28:58 +01:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
|
2020-02-23 15:20:22 +01:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_context.h"
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2020-10-27 12:43:48 +01:00
|
|
|
void CL_CALLBACK notifyFuncProgram(
|
|
|
|
cl_program program,
|
|
|
|
void *userData) {
|
|
|
|
*((char *)userData) = 'a';
|
|
|
|
}
|
2022-08-16 14:51:17 +00:00
|
|
|
void ApiFixtureUsingAlignedMemoryManager::setUp() {
|
2018-01-26 16:53:18 +01:00
|
|
|
retVal = CL_SUCCESS;
|
|
|
|
retSize = 0;
|
|
|
|
|
2020-03-23 10:23:43 +01:00
|
|
|
device = new MockClDevice{MockDevice::createWithNewExecutionEnvironment<MockAlignedMallocManagerDevice>(defaultHwInfo.get())};
|
2020-01-14 14:32:11 +01:00
|
|
|
cl_device_id deviceId = device;
|
2018-01-26 16:53:18 +01:00
|
|
|
|
2020-01-14 14:32:11 +01:00
|
|
|
context = Context::create<MockContext>(nullptr, ClDeviceVector(&deviceId, 1), nullptr, nullptr, retVal);
|
2018-01-26 16:53:18 +01:00
|
|
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
|
|
|
Context *ctxPtr = reinterpret_cast<Context *>(context);
|
|
|
|
|
2021-07-23 10:36:36 +00:00
|
|
|
commandQueue = new MockCommandQueue(context, device, 0, false);
|
2018-01-26 16:53:18 +01:00
|
|
|
|
2020-10-16 15:00:28 +02:00
|
|
|
program = new MockProgram(ctxPtr, false, toClDeviceVector(*device));
|
2018-01-26 16:53:18 +01:00
|
|
|
Program *prgPtr = reinterpret_cast<Program *>(program);
|
|
|
|
|
2021-03-22 15:26:03 +00:00
|
|
|
kernel = new MockKernel(prgPtr, program->mockKernelInfo, *device);
|
2018-01-26 16:53:18 +01:00
|
|
|
ASSERT_NE(nullptr, kernel);
|
|
|
|
}
|
|
|
|
|
2022-08-16 14:51:17 +00:00
|
|
|
void ApiFixtureUsingAlignedMemoryManager::tearDown() {
|
2018-01-26 16:53:18 +01:00
|
|
|
delete kernel;
|
|
|
|
delete commandQueue;
|
|
|
|
context->release();
|
|
|
|
program->release();
|
|
|
|
delete device;
|
|
|
|
}
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|