Kernel source debugging support 1/n

- new patch token
- program debug compilation flag
- sip kernel new methods for querying bti and debug
surface size

Change-Id: Icaddd15f269c4b76efdf926f2e346aa61cbaae02
This commit is contained in:
Hoppe, Mateusz
2018-03-09 14:40:31 +01:00
committed by sys_ocldev
parent 0ef0d6fc52
commit cc6fa3d1e1
22 changed files with 356 additions and 5 deletions

View File

@@ -28,6 +28,7 @@ set(IGDRCL_SRCS_tests_gen9
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/image_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sampler_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sip_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_device_queue_hw.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_platform_caps.cpp

View File

@@ -0,0 +1,61 @@
/*
* Copyright (c) 2017, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "gtest/gtest.h"
#include "test.h"
#include "runtime/built_ins/built_ins.h"
#include "runtime/built_ins/sip.h"
#include "unit_tests/global_environment.h"
#include "unit_tests/helpers/test_files.h"
#include "unit_tests/mocks/mock_device.h"
using namespace OCLRT;
namespace SipKernelTests {
extern std::string getDebugSipKernelNameWithBitnessAndProductSuffix(std::string &base, const char *product);
typedef ::testing::Test gen9SipTests;
GEN9TEST_F(gen9SipTests, givenDebugCsrSipKernelWithLocalMemoryWhenAskedForDebugSurfaceBtiAndSizeThenBtiIsZeroAndSizeGreaterThanZero) {
auto mockDevice = std::unique_ptr<MockDevice>(Device::create<MockDevice>(nullptr));
EXPECT_NE(nullptr, mockDevice);
MockCompilerDebugVars igcDebugVars;
auto product = mockDevice->getProductAbbrev();
std::string name = "sip_dummy_kernel_debug";
std::string builtInFileRoot = testFiles + getDebugSipKernelNameWithBitnessAndProductSuffix(name, product);
std::string builtInGenFile = builtInFileRoot;
builtInGenFile.append(".gen");
igcDebugVars.fileName = builtInGenFile;
gEnvironment->igcPushDebugVars(igcDebugVars);
auto &builtins = BuiltIns::getInstance();
auto &sipKernel = builtins.getSipKernel(SipKernelType::DbgCsrLocal, *mockDevice);
EXPECT_EQ((int32_t)0, sipKernel.getDebugSurfaceBti());
EXPECT_EQ(SipKernel::maxDbgSurfaceSize, sipKernel.getDebugSurfaceSize());
gEnvironment->igcPopDebugVars();
}
} // namespace SipKernelTests