Handle debug data when using native binaries

- fix for debugger when programs are created from
binaries

Change-Id: I31bbb941c4f4aff577aa5393b3e09e9a97b868ae
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2020-04-15 12:43:23 +02:00
committed by sys_ocldev
parent 7db5e6997b
commit a13c1e642d
8 changed files with 75 additions and 6 deletions

View File

@@ -131,7 +131,7 @@ macro(macro_for_each_gen)
get_family_name_with_type(${GEN_TYPE} ${PLATFORM_TYPE})
string(TOLOWER ${PLATFORM_TYPE} PLATFORM_TYPE_LOWER)
set(PLATFORM_LOWER ${DEFAULT_SUPPORTED_${GEN_TYPE}_${PLATFORM_TYPE}_PLATFORM})
level_zero_gen_kernels(level_zero_test_kernels_${family_name_with_type} ${PLATFORM_LOWER} ${family_name_with_type} ${TEST_MODULES})
level_zero_gen_kernels(level_zero_test_kernels_${family_name_with_type} ${PLATFORM_LOWER} ${family_name_with_type} "-g" ${TEST_MODULES})
add_dependencies(${TARGET_NAME} level_zero_test_kernels_${family_name_with_type})
endif()
endforeach()

View File

@@ -4,7 +4,7 @@
# SPDX-License-Identifier: MIT
#
function(level_zero_gen_kernels target platform_name suffix)
function(level_zero_gen_kernels target platform_name suffix options)
if(NOT DEFINED cloc_cmd_prefix)
if(WIN32)
@@ -33,9 +33,9 @@ function(level_zero_gen_kernels target platform_name suffix)
)
add_custom_command(
COMMAND echo generate ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -out_dir ${outputdir}
COMMAND echo generate ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -out_dir ${outputdir} -options "${options}"
OUTPUT ${output_files}
COMMAND ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -out_dir ${outputdir}
COMMAND ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -out_dir ${outputdir} -options "${options}"
WORKING_DIRECTORY ${workdir}
DEPENDS ${filepath} ocloc
)

View File

@@ -0,0 +1,10 @@
#
# Copyright (C) 2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
target_sources(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test_module.cpp
)

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "test.h"
#include "level_zero/core/test/unit_tests/fixtures/module_fixture.h"
namespace L0 {
namespace ult {
using ModuleTest = Test<ModuleFixture>;
HWTEST_F(ModuleTest, givenBinaryWithDebugDataWhenModuleCreatedFromNativeBinaryThenDebugDataIsStored) {
size_t size = 0;
std::unique_ptr<uint8_t[]> data;
auto result = module->getDebugInfo(&size, nullptr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
data = std::make_unique<uint8_t[]>(size);
result = module->getDebugInfo(&size, data.get());
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_NE(nullptr, data.get());
EXPECT_NE(0u, size);
}
} // namespace ult
} // namespace L0

View File

@@ -30,8 +30,6 @@ kernel void test(const global float *a, const global float *b,
c[global_id] = sum;
int2 coord = {get_global_id(0), get_global_id(1)};
uint4 pixel = read_imageui(input, sampler, coord);
write_imageui(output, coord, pixel);
printf("local_id = %d, global_id = %d \n", local_id, global_id);
}