2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2021-05-16 20:51:16 +02:00
|
|
|
* Copyright (C) 2018-2021 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
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-02-27 11:39:32 +01:00
|
|
|
#include "kernel_arg_buffer_fixture.h"
|
|
|
|
|
2020-11-17 11:55:37 +00:00
|
|
|
#include "shared/source/helpers/api_specific_config.h"
|
2021-12-14 17:40:08 +00:00
|
|
|
#include "shared/test/common/test_macros/test.h"
|
2020-11-17 11:55:37 +00:00
|
|
|
|
2020-02-22 22:50:57 +01:00
|
|
|
#include "opencl/source/kernel/kernel.h"
|
|
|
|
#include "opencl/source/mem_obj/buffer.h"
|
2020-05-28 14:05:12 +02:00
|
|
|
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
2020-02-23 15:20:22 +01:00
|
|
|
#include "opencl/test/unit_test/fixtures/context_fixture.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_buffer.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_context.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_kernel.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_program.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
|
|
|
#include "CL/cl.h"
|
2017-12-21 00:45:38 +01:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
using namespace NEO;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
void KernelArgBufferFixture::SetUp() {
|
2020-05-28 14:05:12 +02:00
|
|
|
ClDeviceFixture::SetUp();
|
2020-01-14 14:32:11 +01:00
|
|
|
cl_device_id device = pClDevice;
|
2017-12-21 00:45:38 +01:00
|
|
|
ContextFixture::SetUp(1, &device);
|
|
|
|
|
|
|
|
// define kernel info
|
2021-04-08 11:05:45 +02:00
|
|
|
pKernelInfo = std::make_unique<MockKernelInfo>();
|
2020-11-19 12:30:44 +01:00
|
|
|
pKernelInfo->kernelDescriptor.kernelAttributes.simdSize = 1;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
pKernelInfo->heapInfo.pSsh = pSshLocal;
|
2020-05-26 09:36:04 +02:00
|
|
|
pKernelInfo->heapInfo.SurfaceStateHeapSize = sizeof(pSshLocal);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2021-04-08 11:05:45 +02:00
|
|
|
pKernelInfo->addArgBuffer(0, 0x30, sizeof(void *), 0x0);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2020-11-17 11:55:37 +00:00
|
|
|
pKernelInfo->kernelDescriptor.kernelAttributes.bufferAddressingMode = ApiSpecificConfig::getBindlessConfiguration() ? KernelDescriptor::AddressingMode::BindlessAndStateless : KernelDescriptor::AddressingMode::BindfulAndStateless;
|
|
|
|
|
2020-10-16 15:00:28 +02:00
|
|
|
pProgram = new MockProgram(pContext, false, toClDeviceVector(*pClDevice));
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2021-03-22 15:26:03 +00:00
|
|
|
pKernel = new MockKernel(pProgram, *pKernelInfo, *pClDevice);
|
2017-12-21 00:45:38 +01:00
|
|
|
ASSERT_EQ(CL_SUCCESS, pKernel->initialize());
|
|
|
|
pKernel->setCrossThreadData(pCrossThreadData, sizeof(pCrossThreadData));
|
|
|
|
|
|
|
|
pKernel->setKernelArgHandler(0, &Kernel::setArgBuffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KernelArgBufferFixture::TearDown() {
|
|
|
|
delete pKernel;
|
2018-08-16 14:28:58 +02:00
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
delete pProgram;
|
|
|
|
ContextFixture::TearDown();
|
2020-05-28 14:05:12 +02:00
|
|
|
ClDeviceFixture::TearDown();
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|