Files
compute-runtime/unit_tests/fixtures/kernel_data_fixture.h
Filip Hazubski 82bc594af0 Add clEnqueueNDRangeKernelINTEL API
Related-To: NEO-2712

Change-Id: If1d16d9d626871a9dc4b19282f9edc5786ffa398
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
2019-12-04 17:11:28 +01:00

94 lines
2.3 KiB
C++

/*
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "runtime/device/device.h"
#include "runtime/memory_manager/memory_manager.h"
#include "runtime/program/kernel_info.h"
#include "unit_tests/mocks/mock_context.h"
#include "unit_tests/mocks/mock_program.h"
#include "gtest/gtest.h"
using namespace NEO;
using namespace iOpenCL;
class KernelDataTest : public testing::Test {
public:
KernelDataTest() {
memset(&kernelBinaryHeader, 0x00, sizeof(SKernelBinaryHeaderCommon));
pCurPtr = nullptr;
pKernelData = nullptr;
kernelName = "test";
pDsh = nullptr;
pGsh = nullptr;
pKernelHeap = nullptr;
pSsh = nullptr;
pPatchList = nullptr;
kernelDataSize = 0;
kernelNameSize = (uint32_t)alignUp(strlen(kernelName.c_str()) + 1, sizeof(uint32_t));
dshSize = 0;
gshSize = 0;
kernelHeapSize = 0;
sshSize = 0;
patchListSize = 0;
checkSum = 0;
shaderHashCode = 0;
kernelUnpaddedSize = 0;
pKernelInfo = nullptr;
}
void buildAndDecode();
protected:
void SetUp() override {
kernelBinaryHeader.KernelNameSize = kernelNameSize;
pContext = new MockContext;
program = std::make_unique<MockProgram>(*pContext->getDevice(0)->getExecutionEnvironment(), pContext, false);
}
void TearDown() override {
if (pKernelInfo->kernelAllocation) {
pContext->getDevice(0)->getMemoryManager()->freeGraphicsMemory(pKernelInfo->kernelAllocation);
const_cast<KernelInfo *>(pKernelInfo)->kernelAllocation = nullptr;
}
program.reset();
delete pContext;
alignedFree(pKernelData);
}
char *pCurPtr;
char *pKernelData;
SKernelBinaryHeaderCommon kernelBinaryHeader;
std::string kernelName;
void *pDsh;
void *pGsh;
void *pKernelHeap;
void *pSsh;
void *pPatchList;
uint32_t kernelDataSize;
uint32_t kernelNameSize;
uint32_t dshSize;
uint32_t gshSize;
uint32_t kernelHeapSize;
uint32_t sshSize;
uint32_t patchListSize;
uint32_t checkSum;
uint64_t shaderHashCode;
uint32_t kernelUnpaddedSize;
std::unique_ptr<MockProgram> program;
MockContext *pContext;
const KernelInfo *pKernelInfo;
};