2018-03-19 10:11:30 +01:00
|
|
|
/*
|
2019-02-27 11:39:32 +01:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2018-03-19 10:11:30 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-03-19 10:11:30 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2019-02-27 11:39:32 +01:00
|
|
|
#include "test.h"
|
2018-03-19 10:11:30 +01:00
|
|
|
#include "unit_tests/fixtures/execution_model_kernel_fixture.h"
|
|
|
|
|
#include "unit_tests/mocks/mock_device.h"
|
|
|
|
|
#include "unit_tests/mocks/mock_kernel.h"
|
|
|
|
|
#include "unit_tests/mocks/mock_program.h"
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
using namespace OCLRT;
|
|
|
|
|
|
|
|
|
|
TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetDebugSurfaceBtiIsCalledThenCorrectValueIsReturned) {
|
2018-07-31 11:38:09 +02:00
|
|
|
auto device = std::make_unique<MockDevice>(*platformDevices[0]);
|
2018-08-06 09:46:57 +02:00
|
|
|
MockProgram program(*device->getExecutionEnvironment());
|
2018-03-19 10:11:30 +01:00
|
|
|
program.enableKernelDebug();
|
|
|
|
|
std::unique_ptr<MockKernel> kernel(MockKernel::create<MockDebugKernel>(*device.get(), &program));
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(0, kernel->getDebugSurfaceBti());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetPerThreadSystemThreadSurfaceSizeIsCalledThenCorrectValueIsReturned) {
|
2018-07-31 11:38:09 +02:00
|
|
|
auto device = std::make_unique<MockDevice>(*platformDevices[0]);
|
2018-08-06 09:46:57 +02:00
|
|
|
MockProgram program(*device->getExecutionEnvironment());
|
2018-03-19 10:11:30 +01:00
|
|
|
program.enableKernelDebug();
|
|
|
|
|
std::unique_ptr<MockDebugKernel> kernel(MockKernel::create<MockDebugKernel>(*device.get(), &program));
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(MockDebugKernel::perThreadSystemThreadSurfaceSize, kernel->getPerThreadSystemThreadSurfaceSize());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(DebugKernelTest, givenKernelWithoutDebugFlagWhenGetDebugSurfaceBtiIsCalledThenInvalidIndexValueIsReturned) {
|
2018-07-31 11:38:09 +02:00
|
|
|
auto device = std::make_unique<MockDevice>(*platformDevices[0]);
|
2018-08-06 09:46:57 +02:00
|
|
|
MockProgram program(*device->getExecutionEnvironment());
|
2018-03-19 10:11:30 +01:00
|
|
|
program.enableKernelDebug();
|
|
|
|
|
std::unique_ptr<MockKernel> kernel(MockKernel::create<MockKernel>(*device.get(), &program));
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(-1, kernel->getDebugSurfaceBti());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(DebugKernelTest, givenKernelWithoutDebugFlagWhenGetPerThreadSystemThreadSurfaceSizeIsCalledThenZeroIsReturned) {
|
2018-07-31 11:38:09 +02:00
|
|
|
auto device = std::make_unique<MockDevice>(*platformDevices[0]);
|
2018-08-06 09:46:57 +02:00
|
|
|
MockProgram program(*device->getExecutionEnvironment());
|
2018-03-19 10:11:30 +01:00
|
|
|
program.enableKernelDebug();
|
|
|
|
|
std::unique_ptr<MockKernel> kernel(MockKernel::create<MockKernel>(*device.get(), &program));
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(0u, kernel->getPerThreadSystemThreadSurfaceSize());
|
|
|
|
|
}
|