Disable generation of kernel with kernel-debug-enable flag

- generation temporarily disabled for gen8 platforms only
- unit tests using the pregenerated kernel modified accordingly

Change-Id: I304a796836c823d222e60c44a78fc7f4b03b8a73
This commit is contained in:
Hoppe, Mateusz 2018-03-20 14:54:13 +01:00 committed by sys_ocldev
parent 37443c19a2
commit 1e81426599
2 changed files with 39 additions and 25 deletions

View File

@ -381,11 +381,19 @@ foreach(GEN_NUM RANGE ${MAX_GEN})
if(MSVC OR CMAKE_SIZEOF_VOID_P EQUAL 8) if(MSVC OR CMAKE_SIZEOF_VOID_P EQUAL 8)
neo_gen_kernels(test_kernels_${PLATFORM_IT_LOWER} ${PLATFORM_IT_LOWER} ${TEST_KERNELS}) neo_gen_kernels(test_kernels_${PLATFORM_IT_LOWER} ${PLATFORM_IT_LOWER} ${TEST_KERNELS})
neo_gen_kernel_with_options(test_kernel_${PLATFORM_IT_LOWER} ${PLATFORM_IT_LOWER} ${TEST_KERNEL} ${TEST_KERNEL_options}) neo_gen_kernel_with_options(test_kernel_${PLATFORM_IT_LOWER} ${PLATFORM_IT_LOWER} ${TEST_KERNEL} ${TEST_KERNEL_options})
neo_gen_kernel_with_internal_options(test_kernel_internal_options_${PLATFORM_IT_LOWER} ${PLATFORM_IT_LOWER} ${TEST_KERNEL} ${TEST_KERNEL_internal_options})
# Temporarily disabled debug kernel generation on gen8
if(NOT ("gen${GEN_NUM}" STREQUAL "gen8"))
neo_gen_kernel_with_internal_options(test_kernel_internal_options_${PLATFORM_IT_LOWER} ${PLATFORM_IT_LOWER} ${TEST_KERNEL} ${TEST_KERNEL_internal_options})
endif()
add_dependencies(unit_tests test_kernels_${PLATFORM_IT_LOWER}) add_dependencies(unit_tests test_kernels_${PLATFORM_IT_LOWER})
add_dependencies(unit_tests test_kernel_${PLATFORM_IT_LOWER}) add_dependencies(unit_tests test_kernel_${PLATFORM_IT_LOWER})
add_dependencies(unit_tests test_kernel_internal_options_${PLATFORM_IT_LOWER})
# Temporarily disabled debug kernel generation on gen8
if(NOT ("gen${GEN_NUM}" STREQUAL "gen8"))
add_dependencies(unit_tests test_kernel_internal_options_${PLATFORM_IT_LOWER})
endif()
set(sip_kernel_file_name) set(sip_kernel_file_name)
set(sip_kernel_output_file) set(sip_kernel_output_file)

View File

@ -77,40 +77,46 @@ class ProgramWithKernelDebuggingTest : public ProgramSimpleFixture,
}; };
TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompiledThenInternalOptionsIncludeDebugFlag) { TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompiledThenInternalOptionsIncludeDebugFlag) {
std::string receivedInternalOptions; if (pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) {
std::string receivedInternalOptions;
auto debugVars = OCLRT::getFclDebugVars(); auto debugVars = OCLRT::getFclDebugVars();
debugVars.receivedInternalOptionsOutput = &receivedInternalOptions; debugVars.receivedInternalOptionsOutput = &receivedInternalOptions;
gEnvironment->fclPushDebugVars(debugVars); gEnvironment->fclPushDebugVars(debugVars);
cl_int retVal = pProgram->compile(1, &device, nullptr, cl_int retVal = pProgram->compile(1, &device, nullptr,
0, nullptr, nullptr, 0, nullptr, nullptr,
nullptr, nullptr,
nullptr); nullptr);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_THAT(receivedInternalOptions, ::testing::HasSubstr(CompilerOptions::debugKernelEnable)); EXPECT_THAT(receivedInternalOptions, ::testing::HasSubstr(CompilerOptions::debugKernelEnable));
gEnvironment->fclPopDebugVars(); gEnvironment->fclPopDebugVars();
}
} }
TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuiltThenInternalOptionsIncludeDebugFlag) { TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuiltThenInternalOptionsIncludeDebugFlag) {
std::string receivedInternalOptions; if (pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) {
std::string receivedInternalOptions;
auto debugVars = OCLRT::getFclDebugVars(); auto debugVars = OCLRT::getFclDebugVars();
debugVars.receivedInternalOptionsOutput = &receivedInternalOptions; debugVars.receivedInternalOptionsOutput = &receivedInternalOptions;
gEnvironment->fclPushDebugVars(debugVars); gEnvironment->fclPushDebugVars(debugVars);
cl_int retVal = pProgram->build(1, &device, nullptr, nullptr, nullptr, false); cl_int retVal = pProgram->build(1, &device, nullptr, nullptr, nullptr, false);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_THAT(receivedInternalOptions, ::testing::HasSubstr(CompilerOptions::debugKernelEnable)); EXPECT_THAT(receivedInternalOptions, ::testing::HasSubstr(CompilerOptions::debugKernelEnable));
gEnvironment->fclPopDebugVars(); gEnvironment->fclPopDebugVars();
}
} }
TEST_F(ProgramWithKernelDebuggingTest, givenProgramWithKernelDebugEnabledWhenBuiltThenPatchTokenAllocateSipSurfaceHasSizeGreaterThanZero) { TEST_F(ProgramWithKernelDebuggingTest, givenProgramWithKernelDebugEnabledWhenBuiltThenPatchTokenAllocateSipSurfaceHasSizeGreaterThanZero) {
retVal = pProgram->build(1, &device, CompilerOptions::debugKernelEnable, nullptr, nullptr, false); if (pDevice->getHardwareInfo().pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) {
EXPECT_EQ(CL_SUCCESS, retVal); retVal = pProgram->build(1, &device, CompilerOptions::debugKernelEnable, nullptr, nullptr, false);
EXPECT_EQ(CL_SUCCESS, retVal);
auto kernelInfo = pProgram->getKernelInfo("CopyBuffer"); auto kernelInfo = pProgram->getKernelInfo("CopyBuffer");
EXPECT_NE(0u, kernelInfo->patchInfo.pAllocateSystemThreadSurface->PerThreadSystemThreadSurfaceSize); EXPECT_NE(0u, kernelInfo->patchInfo.pAllocateSystemThreadSurface->PerThreadSystemThreadSurfaceSize);
}
} }