2018-03-19 17:11:30 +08:00
|
|
|
/*
|
2019-02-27 18:39:32 +08:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2018-03-19 17:11:30 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-03-19 17:11:30 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "test.h"
|
2018-03-19 17:11:30 +08: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>
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
using namespace NEO;
|
2018-03-19 17:11:30 +08:00
|
|
|
|
|
|
|
TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetDebugSurfaceBtiIsCalledThenCorrectValueIsReturned) {
|
2019-05-06 18:33:44 +08:00
|
|
|
auto device = std::make_unique<MockDevice>();
|
2018-08-06 15:46:57 +08:00
|
|
|
MockProgram program(*device->getExecutionEnvironment());
|
2018-03-19 17:11:30 +08:00
|
|
|
program.enableKernelDebug();
|
|
|
|
std::unique_ptr<MockKernel> kernel(MockKernel::create<MockDebugKernel>(*device.get(), &program));
|
|
|
|
|
|
|
|
EXPECT_EQ(0, kernel->getDebugSurfaceBti());
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetPerThreadSystemThreadSurfaceSizeIsCalledThenCorrectValueIsReturned) {
|
2019-05-06 18:33:44 +08:00
|
|
|
auto device = std::make_unique<MockDevice>();
|
2018-08-06 15:46:57 +08:00
|
|
|
MockProgram program(*device->getExecutionEnvironment());
|
2018-03-19 17:11:30 +08:00
|
|
|
program.enableKernelDebug();
|
|
|
|
std::unique_ptr<MockDebugKernel> kernel(MockKernel::create<MockDebugKernel>(*device.get(), &program));
|
|
|
|
|
|
|
|
EXPECT_EQ(MockDebugKernel::perThreadSystemThreadSurfaceSize, kernel->getPerThreadSystemThreadSurfaceSize());
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(DebugKernelTest, givenKernelWithoutDebugFlagWhenGetDebugSurfaceBtiIsCalledThenInvalidIndexValueIsReturned) {
|
2019-05-06 18:33:44 +08:00
|
|
|
auto device = std::make_unique<MockDevice>();
|
2018-08-06 15:46:57 +08:00
|
|
|
MockProgram program(*device->getExecutionEnvironment());
|
2018-03-19 17:11:30 +08:00
|
|
|
program.enableKernelDebug();
|
|
|
|
std::unique_ptr<MockKernel> kernel(MockKernel::create<MockKernel>(*device.get(), &program));
|
|
|
|
|
|
|
|
EXPECT_EQ(-1, kernel->getDebugSurfaceBti());
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(DebugKernelTest, givenKernelWithoutDebugFlagWhenGetPerThreadSystemThreadSurfaceSizeIsCalledThenZeroIsReturned) {
|
2019-05-06 18:33:44 +08:00
|
|
|
auto device = std::make_unique<MockDevice>();
|
2018-08-06 15:46:57 +08:00
|
|
|
MockProgram program(*device->getExecutionEnvironment());
|
2018-03-19 17:11:30 +08:00
|
|
|
program.enableKernelDebug();
|
|
|
|
std::unique_ptr<MockKernel> kernel(MockKernel::create<MockKernel>(*device.get(), &program));
|
|
|
|
|
|
|
|
EXPECT_EQ(0u, kernel->getPerThreadSystemThreadSurfaceSize());
|
|
|
|
}
|