From bd247d725b7a899331a46eb61abf2cdbded516bf Mon Sep 17 00:00:00 2001 From: Mateusz Hoppe Date: Fri, 3 Apr 2020 23:05:30 +0200 Subject: [PATCH] AppendLaunchKernel tests RelatedTo: NEO-4515 Change-Id: I1f719ea1f60f313fba44d49f84fe2caf6ea4e5c4 Signed-off-by: Mateusz Hoppe --- level_zero/cmake/l0_tests.cmake | 2 +- .../core/test/unit_tests/CMakeLists.txt | 20 +++++ .../test/unit_tests/fixtures/CMakeLists.txt | 1 + .../test/unit_tests/fixtures/device_fixture.h | 11 ++- .../test/unit_tests/fixtures/module_fixture.h | 68 +++++++++++++++ .../core/test/unit_tests/gen_kernel.cmake | 47 ++++++++++ level_zero/core/test/unit_tests/main.cpp | 11 +++ .../core/test/unit_tests/mocks/mock_kernel.h | 23 +++++ .../unit_tests/sources/cmdlist/CMakeLists.txt | 1 + .../sources/cmdlist/test_cmdlist.cpp | 48 ++--------- .../test_cmdlist_append_launch_kernel.cpp | 86 +++++++++++++++++++ .../sources/cmdqueue/test_cmdqueue.cpp | 4 +- .../unit_tests/sources/image/test_image.cpp | 29 +------ .../unit_tests/test_modules/test_kernel.cl | 37 ++++++++ .../unit_test/api/cl_build_program_tests.inl | 2 +- .../unit_test/api/cl_clone_kernel_tests.inl | 2 +- .../api/cl_compile_program_tests.inl | 2 +- .../unit_test/api/cl_create_kernel_tests.inl | 2 +- .../cl_create_kernels_in_program_tests.inl | 2 +- .../cl_create_program_with_binary_tests.inl | 2 +- .../api/cl_get_kernel_arg_info_tests.inl | 2 +- .../api/cl_get_kernel_info_tests.inl | 2 +- .../cl_get_kernel_work_group_info_tests.inl | 2 +- .../api/cl_get_mem_object_info_tests.inl | 2 +- .../api/cl_get_program_build_info_tests.inl | 2 +- .../api/cl_get_program_info_tests.inl | 2 +- .../unit_test/api/cl_link_program_tests.inl | 2 +- .../unit_test/api/cl_release_kernel_tests.inl | 2 +- .../aub_tests/fixtures/run_kernel_fixture.h | 2 +- opencl/test/unit_test/built_ins/sip_tests.cpp | 2 +- .../unit_test/fixtures/built_in_fixture.cpp | 2 +- .../fixtures/hello_world_kernel_fixture.h | 2 +- .../test/unit_test/fixtures/program_fixture.h | 2 +- .../unit_test/fixtures/run_kernel_fixture.h | 3 +- opencl/test/unit_test/gen9/sip_tests_gen9.cpp | 2 +- opencl/test/unit_test/gtpin/gtpin_tests.cpp | 2 +- .../helpers/kernel_binary_helper.cpp | 3 +- opencl/test/unit_test/libult/CMakeLists.txt | 4 +- opencl/test/unit_test/main.cpp | 2 +- .../test/unit_test/mocks/mock_compilers.cpp | 2 +- opencl/test/unit_test/mocks/mock_sip.cpp | 2 +- .../unit_test/offline_compiler/CMakeLists.txt | 2 +- .../decoder/encoder_tests.cpp | 3 +- .../unit_test/offline_compiler/environment.h | 2 +- .../test/unit_test/offline_compiler/main.cpp | 2 +- .../program/process_elf_binary_tests.cpp | 2 +- .../program/program_spec_constants_tests.cpp | 2 +- .../compiler_interface_tests.cpp | 2 +- .../test/unit_test/helpers/test_files.cpp | 0 .../test/unit_test/helpers/test_files.h | 0 50 files changed, 353 insertions(+), 108 deletions(-) create mode 100644 level_zero/core/test/unit_tests/fixtures/module_fixture.h create mode 100644 level_zero/core/test/unit_tests/gen_kernel.cmake create mode 100644 level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel.cpp create mode 100644 level_zero/core/test/unit_tests/test_modules/test_kernel.cl rename {opencl => shared}/test/unit_test/helpers/test_files.cpp (100%) rename {opencl => shared}/test/unit_test/helpers/test_files.h (100%) diff --git a/level_zero/cmake/l0_tests.cmake b/level_zero/cmake/l0_tests.cmake index cfa3862147..73ed9ec1a6 100644 --- a/level_zero/cmake/l0_tests.cmake +++ b/level_zero/cmake/l0_tests.cmake @@ -79,11 +79,11 @@ add_library(compute_runtime_mockable_extra EXCLUDE_FROM_ALL ${CMAKE_CURRENT_LIST_DIR}/l0_tests.cmake ${NEO_SHARED_TEST_DIRECTORY}/unit_test/utilities/cpuintrinsics.cpp + ${NEO_SHARED_TEST_DIRECTORY}/unit_test/helpers/test_files.cpp ${COMPUTE_RUNTIME_DIR}/opencl/source/aub/aub_stream_interface.cpp ${COMPUTE_RUNTIME_DIR}/opencl/test/unit_test/abort.cpp ${COMPUTE_RUNTIME_DIR}/opencl/test/unit_test/helpers/built_ins_helper.cpp ${COMPUTE_RUNTIME_DIR}/opencl/test/unit_test/helpers/debug_helpers.cpp - ${COMPUTE_RUNTIME_DIR}/opencl/test/unit_test/helpers/test_files.cpp ${COMPUTE_RUNTIME_DIR}/opencl/test/unit_test/libult/os_interface.cpp ${COMPUTE_RUNTIME_DIR}/opencl/test/unit_test/libult/source_level_debugger_ult.cpp ${COMPUTE_RUNTIME_DIR}/opencl/test/unit_test/libult/source_level_debugger_library.cpp diff --git a/level_zero/core/test/unit_tests/CMakeLists.txt b/level_zero/core/test/unit_tests/CMakeLists.txt index 7a22547f5a..5e14f15f90 100644 --- a/level_zero/core/test/unit_tests/CMakeLists.txt +++ b/level_zero/core/test/unit_tests/CMakeLists.txt @@ -8,6 +8,8 @@ link_libraries(${ASAN_LIBS} ${TSAN_LIBS}) set(TARGET_NAME ${TARGET_NAME_L0}_core_tests) +include(gen_kernel.cmake) + append_sources_from_properties(L0_CORE_ENABLERS NEO_CORE_SRCS_LINK) function(ADD_SUPPORTED_TEST_PRODUCT_FAMILIES_DEFINITION) @@ -28,6 +30,7 @@ add_executable(${TARGET_NAME} ) target_sources(${TARGET_NAME} PRIVATE + ${CMAKE_CURRENT_LIST_DIR}/gen_kernel.cmake ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/mock.h @@ -118,6 +121,23 @@ target_sources(${TARGET_NAME} PRIVATE $ ) +set(TEST_MODULES + ${CMAKE_CURRENT_SOURCE_DIR}/test_modules/test_kernel.cl +) + +macro(macro_for_each_gen) + foreach(PLATFORM_TYPE ${PLATFORM_TYPES}) + if(${GEN_TYPE}_HAS_${PLATFORM_TYPE}) + 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}) + add_dependencies(${TARGET_NAME} level_zero_test_kernels_${family_name_with_type}) + endif() + endforeach() +endmacro() +apply_macro_for_each_gen("TESTED") + option(L0_ULT_VERBOSE "Use the default/verbose test output" OFF) if(NOT L0_ULT_VERBOSE) set(L0_TESTS_LISTENER_OPTION "--disable_default_listener") diff --git a/level_zero/core/test/unit_tests/fixtures/CMakeLists.txt b/level_zero/core/test/unit_tests/fixtures/CMakeLists.txt index 1e65e1660c..63f0c7484b 100644 --- a/level_zero/core/test/unit_tests/fixtures/CMakeLists.txt +++ b/level_zero/core/test/unit_tests/fixtures/CMakeLists.txt @@ -10,6 +10,7 @@ set(L0_FIXTURES_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/device_fixture.h ${CMAKE_CURRENT_SOURCE_DIR}/device_fixture.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/module_fixture.h ) add_library(${TARGET_NAME} OBJECT ${L0_FIXTURES_SOURCES}) diff --git a/level_zero/core/test/unit_tests/fixtures/device_fixture.h b/level_zero/core/test/unit_tests/fixtures/device_fixture.h index 804f2cc847..84721e12aa 100644 --- a/level_zero/core/test/unit_tests/fixtures/device_fixture.h +++ b/level_zero/core/test/unit_tests/fixtures/device_fixture.h @@ -11,6 +11,7 @@ #include "shared/test/unit_test/mocks/mock_device.h" #include "level_zero/core/test/unit_tests/mocks/mock_device.h" +#include "level_zero/core/test/unit_tests/mocks/mock_driver_handle.h" namespace L0 { namespace ult { @@ -18,14 +19,18 @@ namespace ult { struct DeviceFixture { void SetUp() { neoDevice = NEO::MockDevice::createWithNewExecutionEnvironment(NEO::defaultHwInfo.get()); - device = std::make_unique>(neoDevice, neoDevice->getExecutionEnvironment()); + NEO::DeviceVector devices; + devices.push_back(std::unique_ptr(neoDevice)); + driverHandle = std::make_unique>(); + driverHandle->initialize(std::move(devices)); + device = driverHandle->devices[0]; } void TearDown() { } - + std::unique_ptr> driverHandle; NEO::MockDevice *neoDevice = nullptr; - std::unique_ptr> device = nullptr; + L0::Device *device = nullptr; }; } // namespace ult diff --git a/level_zero/core/test/unit_tests/fixtures/module_fixture.h b/level_zero/core/test/unit_tests/fixtures/module_fixture.h new file mode 100644 index 0000000000..1c5a8173be --- /dev/null +++ b/level_zero/core/test/unit_tests/fixtures/module_fixture.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2020 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once + +#include "shared/source/helpers/file_io.h" +#include "shared/test/unit_test/helpers/test_files.h" + +#include "level_zero/core/source/module/module.h" +#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h" +#include "level_zero/core/test/unit_tests/mocks/mock_kernel.h" + +namespace L0 { +namespace ult { + +struct ModuleFixture : public DeviceFixture { + void SetUp() { + DeviceFixture::SetUp(); + createModuleFromBinary(); + } + + void createModuleFromBinary() { + std::string testFile; + retrieveBinaryKernelFilename(testFile, binaryFilename + "_", ".bin"); + + size_t size = 0; + auto src = loadDataFromFile( + testFile.c_str(), + size); + + ASSERT_NE(0u, size); + ASSERT_NE(nullptr, src); + + ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT}; + moduleDesc.format = ZE_MODULE_FORMAT_NATIVE; + moduleDesc.pInputModule = reinterpret_cast(src.get()); + moduleDesc.inputSize = size; + + ModuleBuildLog *moduleBuildLog = nullptr; + + module.reset(Module::create(device, &moduleDesc, neoDevice, moduleBuildLog)); + } + + void createKernel() { + ze_kernel_desc_t desc = {ZE_KERNEL_DESC_VERSION_CURRENT}; + desc.pKernelName = kernelName.c_str(); + + kernel = std::make_unique>(); + kernel->module = module.get(); + kernel->initialize(&desc); + } + + void TearDown() { + DeviceFixture::TearDown(); + } + + const std::string binaryFilename = "test_kernel"; + const std::string kernelName = "test"; + std::unique_ptr module; + std::unique_ptr> kernel; +}; + +} // namespace ult +} // namespace L0 diff --git a/level_zero/core/test/unit_tests/gen_kernel.cmake b/level_zero/core/test/unit_tests/gen_kernel.cmake new file mode 100644 index 0000000000..1c7cfe746b --- /dev/null +++ b/level_zero/core/test/unit_tests/gen_kernel.cmake @@ -0,0 +1,47 @@ +# +# Copyright (C) 2020 Intel Corporation +# +# SPDX-License-Identifier: MIT +# + +function(level_zero_gen_kernels target platform_name suffix) + + if(NOT DEFINED cloc_cmd_prefix) + if(WIN32) + set(cloc_cmd_prefix ocloc) + else() + if(DEFINED NEO__IGC_LIBRARY_PATH) + set(cloc_cmd_prefix LD_LIBRARY_PATH=${NEO__IGC_LIBRARY_PATH}:$ $) + else() + set(cloc_cmd_prefix LD_LIBRARY_PATH=$ $) + endif() + endif() + endif() + + set(outputdir "${TargetDir}/level_zero/${suffix}/test_files/${NEO_ARCH}/") + + set(results) + foreach(filepath ${ARGN}) + get_filename_component(filename ${filepath} NAME) + get_filename_component(basename ${filepath} NAME_WE) + get_filename_component(workdir ${filepath} DIRECTORY) + + set(outputpath_base "${outputdir}${basename}_${suffix}") + set(output_files + ${outputpath_base}.bin + ${outputpath_base}.gen + ) + + add_custom_command( + COMMAND echo generate ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -out_dir ${outputdir} + OUTPUT ${output_files} + COMMAND ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -out_dir ${outputdir} + WORKING_DIRECTORY ${workdir} + DEPENDS ${filepath} ocloc + ) + + list(APPEND results ${output_files}) + endforeach() + add_custom_target(${target} DEPENDS ${results} copy_compiler_files) + set_target_properties(${target} PROPERTIES FOLDER ${TARGET_NAME_L0}) +endfunction() diff --git a/level_zero/core/test/unit_tests/main.cpp b/level_zero/core/test/unit_tests/main.cpp index 66b85d1673..a16c51da55 100644 --- a/level_zero/core/test/unit_tests/main.cpp +++ b/level_zero/core/test/unit_tests/main.cpp @@ -10,6 +10,7 @@ #include "shared/source/os_interface/hw_info_config.h" #include "shared/test/unit_test/helpers/default_hw_info.inl" #include "shared/test/unit_test/helpers/memory_leak_listener.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "shared/test/unit_test/helpers/ult_hw_config.inl" #include "opencl/source/program/kernel_info.h" @@ -192,6 +193,16 @@ int main(int argc, char **argv) { listeners.Append(customEventListener); } + binaryNameSuffix.append(NEO::familyName[hwInfoForTests.platform.eRenderCoreFamily]); + binaryNameSuffix.append(hwInfoForTests.capabilityTable.platformType); + + std::string testBinaryFiles = getRunPath(argv[0]); + testBinaryFiles.append("/level_zero/"); + testBinaryFiles.append(binaryNameSuffix); + testBinaryFiles.append("/"); + testBinaryFiles.append(testFiles); + testFiles = testBinaryFiles; + listeners.Append(new NEO::MemoryLeakListener); NEO::GmmHelper::createGmmContextWrapperFunc = diff --git a/level_zero/core/test/unit_tests/mocks/mock_kernel.h b/level_zero/core/test/unit_tests/mocks/mock_kernel.h index 8603e66d6c..37ad217de2 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_kernel.h +++ b/level_zero/core/test/unit_tests/mocks/mock_kernel.h @@ -31,6 +31,29 @@ struct WhiteBox<::L0::KernelImmutableData> : public ::L0::KernelImmutableData { WhiteBox() : ::L0::KernelImmutableData() {} }; +template <> +struct WhiteBox<::L0::Kernel> : public ::L0::KernelImp { + using BaseClass = ::L0::KernelImp; + using ::L0::KernelImp::createPrintfBuffer; + using ::L0::KernelImp::crossThreadData; + using ::L0::KernelImp::crossThreadDataSize; + using ::L0::KernelImp::groupSize; + using ::L0::KernelImp::kernelImmData; + using ::L0::KernelImp::module; + using ::L0::KernelImp::perThreadDataForWholeThreadGroup; + using ::L0::KernelImp::perThreadDataSize; + using ::L0::KernelImp::printfBuffer; + using ::L0::KernelImp::residencyContainer; + using ::L0::KernelImp::unifiedMemoryControls; + + void setBufferSurfaceState(uint32_t argIndex, void *address, + NEO::GraphicsAllocation *alloc) override {} + + std::unique_ptr clone() const override { return nullptr; } + + WhiteBox() : ::L0::KernelImp(nullptr) {} +}; + template <> struct Mock<::L0::Kernel> : public ::L0::KernelImp { using BaseClass = ::L0::KernelImp; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/CMakeLists.txt b/level_zero/core/test/unit_tests/sources/cmdlist/CMakeLists.txt index a87c7964b7..7320562c52 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/CMakeLists.txt +++ b/level_zero/core/test/unit_tests/sources/cmdlist/CMakeLists.txt @@ -8,4 +8,5 @@ target_sources(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/test_cmdlist.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_cmdlist_api.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_cmdlist_append_launch_kernel.cpp ) \ No newline at end of file diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist.cpp index d7d89c547c..cff9f4aa89 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist.cpp @@ -32,10 +32,10 @@ TEST(zeCommandListCreateImmediate, redirectsToObject) { } TEST_F(CommandListCreate, whenCommandListIsCreatedThenItIsInitialized) { - std::unique_ptr commandList(CommandList::create(productFamily, device.get())); + std::unique_ptr commandList(CommandList::create(productFamily, device)); ASSERT_NE(nullptr, commandList); - EXPECT_EQ(device.get(), commandList->device); + EXPECT_EQ(device, commandList->device); ASSERT_GT(commandList->commandContainer.getCmdBufferAllocations().size(), 0u); auto numAllocations = 0u; @@ -57,7 +57,7 @@ TEST_F(CommandListCreate, whenCommandListIsCreatedThenItIsInitialized) { } TEST_F(CommandListCreate, givenRegularCommandListThenDefaultNumIddPerBlockIsUsed) { - std::unique_ptr commandList(CommandList::create(productFamily, device.get())); + std::unique_ptr commandList(CommandList::create(productFamily, device)); ASSERT_NE(nullptr, commandList); const uint32_t defaultNumIdds = CommandList::defaultNumIddsPerBlock; @@ -71,7 +71,7 @@ TEST_F(CommandListCreate, givenImmediateCommandListThenCustomNumIddPerBlockUsed) ZE_COMMAND_QUEUE_MODE_DEFAULT, ZE_COMMAND_QUEUE_PRIORITY_NORMAL, 0}; - std::unique_ptr commandList(CommandList::createImmediate(productFamily, device.get(), &desc, false)); + std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false)); ASSERT_NE(nullptr, commandList); const uint32_t cmdListImmediateIdds = CommandList::commandListimmediateIddsPerBlock; @@ -85,23 +85,23 @@ TEST_F(CommandListCreate, whenCreatingImmediateCommandListThenItHasImmediateComm ZE_COMMAND_QUEUE_MODE_DEFAULT, ZE_COMMAND_QUEUE_PRIORITY_NORMAL, 0}; - std::unique_ptr commandList(CommandList::createImmediate(productFamily, device.get(), &desc, false)); + std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false)); ASSERT_NE(nullptr, commandList); - EXPECT_EQ(device.get(), commandList->device); + EXPECT_EQ(device, commandList->device); EXPECT_EQ(1u, commandList->cmdListType); EXPECT_NE(nullptr, commandList->cmdQImmediate); } TEST_F(CommandListCreate, givenInvalidProductFamilyThenReturnsNullPointer) { - std::unique_ptr commandList(CommandList::create(IGFX_UNKNOWN, device.get())); + std::unique_ptr commandList(CommandList::create(IGFX_UNKNOWN, device)); EXPECT_EQ(nullptr, commandList); } HWTEST_F(CommandListCreate, whenCommandListIsCreatedThenStateBaseAddressCmdIsAddedAndCorrectlyProgrammed) { using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS; - std::unique_ptr commandList(CommandList::create(productFamily, device.get())); + std::unique_ptr commandList(CommandList::create(productFamily, device)); auto &commandContainer = commandList->commandContainer; auto gmmHelper = commandContainer.getDevice()->getGmmHelper(); @@ -141,37 +141,5 @@ HWTEST_F(CommandListCreate, whenCommandListIsCreatedThenStateBaseAddressCmdIsAdd EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER), cmdSba->getStatelessDataPortAccessMemoryObjectControlState()); } -HWTEST_F(CommandListCreate, givenNotEnoughSpaceInCommandStreamWhenAppendingFunctionThenBbEndIsAddedAndNewCmdBufferAllocated) { - using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END; - Mock kernel; - std::unique_ptr commandList(CommandList::create(productFamily, device.get())); - - auto &commandContainer = commandList->commandContainer; - const auto stream = commandContainer.getCommandStream(); - const auto streamCpu = stream->getCpuBase(); - - auto available = stream->getAvailableSpace(); - stream->getSpace(available - sizeof(MI_BATCH_BUFFER_END) - 16); - auto bbEndPosition = stream->getSpace(0); - - ze_group_count_t dispatchFunctionArguments{1, 1, 1}; - commandList->appendLaunchKernel(kernel.toHandle(), &dispatchFunctionArguments, nullptr, 0, nullptr); - - auto usedSpaceAfter = commandContainer.getCommandStream()->getUsed(); - ASSERT_GT(usedSpaceAfter, 0u); - - const auto streamCpu2 = stream->getCpuBase(); - - EXPECT_NE(nullptr, streamCpu2); - EXPECT_NE(streamCpu, streamCpu2); - - EXPECT_EQ(2u, commandContainer.getCmdBufferAllocations().size()); - - GenCmdList cmdList; - FamilyType::PARSE::parseCommandBuffer(cmdList, bbEndPosition, 2 * sizeof(MI_BATCH_BUFFER_END)); - auto itor = find(cmdList.begin(), cmdList.end()); - EXPECT_NE(cmdList.end(), itor); -} - } // namespace ult } // namespace L0 \ No newline at end of file diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel.cpp new file mode 100644 index 0000000000..4eaaac366e --- /dev/null +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel.cpp @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2020 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/test/unit_test/cmd_parse/gen_cmd_parse.h" + +#include "opencl/source/helpers/hardware_commands_helper.h" +#include "test.h" + +#include "level_zero/core/test/unit_tests/fixtures/module_fixture.h" + +namespace L0 { +namespace ult { + +using CommandListAppendLaunchKernel = Test; + +HWTEST_F(CommandListAppendLaunchKernel, givenNotEnoughSpaceInCommandStreamWhenAppendingKernelThenBbEndIsAddedAndNewCmdBufferAllocated) { + using MI_BATCH_BUFFER_END = typename FamilyType::MI_BATCH_BUFFER_END; + createKernel(); + + std::unique_ptr commandList(CommandList::create(productFamily, device)); + + auto &commandContainer = commandList->commandContainer; + const auto stream = commandContainer.getCommandStream(); + const auto streamCpu = stream->getCpuBase(); + + auto available = stream->getAvailableSpace(); + stream->getSpace(available - sizeof(MI_BATCH_BUFFER_END) - 16); + auto bbEndPosition = stream->getSpace(0); + + ze_group_count_t groupCount{1, 1, 1}; + commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr); + + auto usedSpaceAfter = commandContainer.getCommandStream()->getUsed(); + ASSERT_GT(usedSpaceAfter, 0u); + + const auto streamCpu2 = stream->getCpuBase(); + + EXPECT_NE(nullptr, streamCpu2); + EXPECT_NE(streamCpu, streamCpu2); + + EXPECT_EQ(2u, commandContainer.getCmdBufferAllocations().size()); + + GenCmdList cmdList; + FamilyType::PARSE::parseCommandBuffer(cmdList, bbEndPosition, 2 * sizeof(MI_BATCH_BUFFER_END)); + auto itor = find(cmdList.begin(), cmdList.end()); + EXPECT_NE(cmdList.end(), itor); +} + +HWCMDTEST_F(IGFX_GEN8_CORE, CommandListAppendLaunchKernel, givenFunctionWhenBindingTablePrefetchAllowedThenProgramBindingTableEntryCount) { + using MEDIA_INTERFACE_DESCRIPTOR_LOAD = typename FamilyType::MEDIA_INTERFACE_DESCRIPTOR_LOAD; + using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA; + + createKernel(); + + ze_group_count_t groupCount{1, 1, 1}; + std::unique_ptr commandList(CommandList::create(productFamily, device)); + commandList->appendLaunchKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr); + + auto commandStream = commandList->commandContainer.getCommandStream(); + + GenCmdList cmdList; + ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, commandStream->getCpuBase(), commandStream->getUsed())); + + auto itorMIDL = find(cmdList.begin(), cmdList.end()); + ASSERT_NE(itorMIDL, cmdList.end()); + + auto cmd = genCmdCast(*itorMIDL); + ASSERT_NE(cmd, nullptr); + + auto dsh = commandList->commandContainer.getIndirectHeap(NEO::HeapType::DYNAMIC_STATE); + auto idd = static_cast(ptrOffset(dsh->getCpuBase(), cmd->getInterfaceDescriptorDataStartAddress())); + + if (NEO::HardwareCommandsHelper::doBindingTablePrefetch()) { + uint32_t numArgs = kernel->kernelImmData->getDescriptor().payloadMappings.bindingTable.numEntries; + EXPECT_EQ(numArgs, idd->getBindingTableEntryCount()); + } else { + EXPECT_EQ(0u, idd->getBindingTableEntryCount()); + } +} + +} // namespace ult +} // namespace L0 \ No newline at end of file diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue.cpp index b892be3d8c..b91370fec6 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue.cpp @@ -26,7 +26,7 @@ TEST_F(CommandQueueCreate, whenCreatingCommandQueueThenItIsInitialized) { auto csr = std::unique_ptr(neoDevice->createCommandStreamReceiver()); L0::CommandQueue *commandQueue = CommandQueue::create(productFamily, - device.get(), + device, csr.get(), &desc); ASSERT_NE(nullptr, commandQueue); @@ -34,7 +34,7 @@ TEST_F(CommandQueueCreate, whenCreatingCommandQueueThenItIsInitialized) { L0::CommandQueueImp *commandQueueImp = reinterpret_cast(commandQueue); EXPECT_EQ(csr.get(), commandQueueImp->getCsr()); - EXPECT_EQ(device.get(), commandQueueImp->getDevice()); + EXPECT_EQ(device, commandQueueImp->getDevice()); EXPECT_EQ(0u, commandQueueImp->getTaskCount()); commandQueue->destroy(); diff --git a/level_zero/core/test/unit_tests/sources/image/test_image.cpp b/level_zero/core/test/unit_tests/sources/image/test_image.cpp index 38d5fcd017..e18d4ad050 100644 --- a/level_zero/core/test/unit_tests/sources/image/test_image.cpp +++ b/level_zero/core/test/unit_tests/sources/image/test_image.cpp @@ -11,7 +11,7 @@ #include "test.h" #include "level_zero/core/source/image/image_hw.h" -#include "level_zero/core/test/unit_tests/mocks/mock_device.h" +#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h" namespace L0 { namespace ult { @@ -42,17 +42,7 @@ INSTANTIATE_TEST_CASE_P( ImageStaticFunctionConvertTypeTest, testing::ValuesIn(validTypes)); -struct ImageStaticFunctionDescriptorFixture { - void SetUp() { - } - - void TearDown() { - } -}; - -using ImageStaticFunctionDescriptorTest = Test; - -TEST_F(ImageStaticFunctionDescriptorTest, givenZeImageDescWhenConvertDescriptorThenCorrectImageDescriptorReturned) { +TEST(ImageStaticFunctionDescriptorTest, givenZeImageDescWhenConvertDescriptorThenCorrectImageDescriptorReturned) { ze_image_desc_t zeDesc = {}; zeDesc.arraylevels = 1u; zeDesc.depth = 1u; @@ -74,19 +64,6 @@ TEST_F(ImageStaticFunctionDescriptorTest, givenZeImageDescWhenConvertDescriptorT EXPECT_EQ(desc.numSamples, 0u); } -struct DeviceFixture { - void SetUp() { - neoDevice = NEO::MockDevice::createWithNewExecutionEnvironment(NEO::defaultHwInfo.get()); - device = std::make_unique>(neoDevice, neoDevice->getExecutionEnvironment()); - } - - void TearDown() { - } - - NEO::MockDevice *neoDevice = nullptr; - std::unique_ptr> device = nullptr; -}; - using ImageSupport = IsAtMostProduct; using ImageCreate = Test; @@ -108,7 +85,7 @@ HWTEST2_F(ImageCreate, givenValidImageDescriptionWhenImageCreateThenImageIsCreat ZE_IMAGE_FORMAT_SWIZZLE_B, ZE_IMAGE_FORMAT_SWIZZLE_A}; - std::unique_ptr image(Image::create(productFamily, device.get(), &zeDesc)); + std::unique_ptr image(Image::create(productFamily, device, &zeDesc)); ASSERT_NE(image, nullptr); diff --git a/level_zero/core/test/unit_tests/test_modules/test_kernel.cl b/level_zero/core/test/unit_tests/test_modules/test_kernel.cl new file mode 100644 index 0000000000..61dafe7ebe --- /dev/null +++ b/level_zero/core/test/unit_tests/test_modules/test_kernel.cl @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2020 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +const sampler_t sampler = + CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST; + +kernel void test(const global float *a, const global float *b, + global float *c, + read_only image2d_t input, + write_only image2d_t output) { + const int global_id = get_global_id(0); + const int local_id = get_local_id(0); + + local float a_local[16]; + float sum = 0.0f; + + a_local[local_id] = a[local_id] + b[local_id]; + + barrier(CLK_LOCAL_MEM_FENCE); + + for (int i = 0; i < get_local_size(0); ++i) { + sum += a_local[i]; + } + barrier(CLK_LOCAL_MEM_FENCE); + + 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); +} \ No newline at end of file diff --git a/opencl/test/unit_test/api/cl_build_program_tests.inl b/opencl/test/unit_test/api/cl_build_program_tests.inl index d5bdfa3909..f366c589e0 100644 --- a/opencl/test/unit_test/api/cl_build_program_tests.inl +++ b/opencl/test/unit_test/api/cl_build_program_tests.inl @@ -8,12 +8,12 @@ #include "shared/source/compiler_interface/compiler_interface.h" #include "shared/source/device/device.h" #include "shared/source/helpers/file_io.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/source/context/context.h" #include "opencl/source/program/kernel_info.h" #include "opencl/source/program/program.h" #include "opencl/test/unit_test/helpers/kernel_binary_helper.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "opencl/test/unit_test/mocks/mock_compilers.h" #include "cl_api_tests.h" diff --git a/opencl/test/unit_test/api/cl_clone_kernel_tests.inl b/opencl/test/unit_test/api/cl_clone_kernel_tests.inl index f081aad2d5..7ee28e6d7a 100644 --- a/opencl/test/unit_test/api/cl_clone_kernel_tests.inl +++ b/opencl/test/unit_test/api/cl_clone_kernel_tests.inl @@ -6,9 +6,9 @@ */ #include "shared/source/helpers/file_io.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/source/context/context.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "cl_api_tests.h" diff --git a/opencl/test/unit_test/api/cl_compile_program_tests.inl b/opencl/test/unit_test/api/cl_compile_program_tests.inl index 1e56d8f1dc..7a7bf5bd4f 100644 --- a/opencl/test/unit_test/api/cl_compile_program_tests.inl +++ b/opencl/test/unit_test/api/cl_compile_program_tests.inl @@ -7,10 +7,10 @@ #include "shared/source/compiler_interface/compiler_interface.h" #include "shared/source/helpers/file_io.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/source/context/context.h" #include "opencl/test/unit_test/helpers/kernel_binary_helper.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "cl_api_tests.h" diff --git a/opencl/test/unit_test/api/cl_create_kernel_tests.inl b/opencl/test/unit_test/api/cl_create_kernel_tests.inl index 2b4bebf285..3e1861e24a 100644 --- a/opencl/test/unit_test/api/cl_create_kernel_tests.inl +++ b/opencl/test/unit_test/api/cl_create_kernel_tests.inl @@ -6,10 +6,10 @@ */ #include "shared/source/helpers/file_io.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/source/context/context.h" #include "opencl/source/program/kernel_info.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "opencl/test/unit_test/mocks/mock_program.h" #include "cl_api_tests.h" diff --git a/opencl/test/unit_test/api/cl_create_kernels_in_program_tests.inl b/opencl/test/unit_test/api/cl_create_kernels_in_program_tests.inl index 42d00cd785..83c2e58b0d 100644 --- a/opencl/test/unit_test/api/cl_create_kernels_in_program_tests.inl +++ b/opencl/test/unit_test/api/cl_create_kernels_in_program_tests.inl @@ -6,9 +6,9 @@ */ #include "shared/source/helpers/file_io.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/source/context/context.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "cl_api_tests.h" diff --git a/opencl/test/unit_test/api/cl_create_program_with_binary_tests.inl b/opencl/test/unit_test/api/cl_create_program_with_binary_tests.inl index dcb830e03b..c5aa8fc574 100644 --- a/opencl/test/unit_test/api/cl_create_program_with_binary_tests.inl +++ b/opencl/test/unit_test/api/cl_create_program_with_binary_tests.inl @@ -6,9 +6,9 @@ */ #include "shared/source/helpers/file_io.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/source/context/context.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "cl_api_tests.h" diff --git a/opencl/test/unit_test/api/cl_get_kernel_arg_info_tests.inl b/opencl/test/unit_test/api/cl_get_kernel_arg_info_tests.inl index 9006fde894..805e86c670 100644 --- a/opencl/test/unit_test/api/cl_get_kernel_arg_info_tests.inl +++ b/opencl/test/unit_test/api/cl_get_kernel_arg_info_tests.inl @@ -8,10 +8,10 @@ #include "shared/source/compiler_interface/compiler_interface.h" #include "shared/source/device/device.h" #include "shared/source/helpers/file_io.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/source/context/context.h" #include "opencl/test/unit_test/helpers/kernel_binary_helper.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "cl_api_tests.h" #include "compiler_options.h" diff --git a/opencl/test/unit_test/api/cl_get_kernel_info_tests.inl b/opencl/test/unit_test/api/cl_get_kernel_info_tests.inl index 5216fe83d6..78b75c51fb 100644 --- a/opencl/test/unit_test/api/cl_get_kernel_info_tests.inl +++ b/opencl/test/unit_test/api/cl_get_kernel_info_tests.inl @@ -8,10 +8,10 @@ #include "shared/source/compiler_interface/compiler_interface.h" #include "shared/source/device/device.h" #include "shared/source/helpers/file_io.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/source/context/context.h" #include "opencl/test/unit_test/helpers/kernel_binary_helper.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "cl_api_tests.h" diff --git a/opencl/test/unit_test/api/cl_get_kernel_work_group_info_tests.inl b/opencl/test/unit_test/api/cl_get_kernel_work_group_info_tests.inl index f71dd2e936..7486f7f60d 100644 --- a/opencl/test/unit_test/api/cl_get_kernel_work_group_info_tests.inl +++ b/opencl/test/unit_test/api/cl_get_kernel_work_group_info_tests.inl @@ -8,9 +8,9 @@ #include "shared/source/compiler_interface/compiler_interface.h" #include "shared/source/device/device.h" #include "shared/source/helpers/file_io.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/test/unit_test/helpers/kernel_binary_helper.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "opencl/test/unit_test/mocks/mock_kernel.h" #include "cl_api_tests.h" diff --git a/opencl/test/unit_test/api/cl_get_mem_object_info_tests.inl b/opencl/test/unit_test/api/cl_get_mem_object_info_tests.inl index 57be8aef99..ed899039ab 100644 --- a/opencl/test/unit_test/api/cl_get_mem_object_info_tests.inl +++ b/opencl/test/unit_test/api/cl_get_mem_object_info_tests.inl @@ -8,9 +8,9 @@ #include "shared/source/compiler_interface/compiler_interface.h" #include "shared/source/device/device.h" #include "shared/source/helpers/file_io.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/source/context/context.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "cl_api_tests.h" diff --git a/opencl/test/unit_test/api/cl_get_program_build_info_tests.inl b/opencl/test/unit_test/api/cl_get_program_build_info_tests.inl index e531f2dd7c..603ae7bd48 100644 --- a/opencl/test/unit_test/api/cl_get_program_build_info_tests.inl +++ b/opencl/test/unit_test/api/cl_get_program_build_info_tests.inl @@ -12,10 +12,10 @@ #include "shared/source/device_binary_format/elf/elf_encoder.h" #include "shared/source/device_binary_format/elf/ocl_elf.h" #include "shared/source/helpers/file_io.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/source/context/context.h" #include "opencl/test/unit_test/helpers/kernel_binary_helper.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "cl_api_tests.h" diff --git a/opencl/test/unit_test/api/cl_get_program_info_tests.inl b/opencl/test/unit_test/api/cl_get_program_info_tests.inl index d60122a340..6cb1203764 100644 --- a/opencl/test/unit_test/api/cl_get_program_info_tests.inl +++ b/opencl/test/unit_test/api/cl_get_program_info_tests.inl @@ -8,10 +8,10 @@ #include "shared/source/compiler_interface/compiler_interface.h" #include "shared/source/device/device.h" #include "shared/source/helpers/file_io.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/source/context/context.h" #include "opencl/test/unit_test/helpers/kernel_binary_helper.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "cl_api_tests.h" diff --git a/opencl/test/unit_test/api/cl_link_program_tests.inl b/opencl/test/unit_test/api/cl_link_program_tests.inl index c6c1665c4e..ad5da7d27d 100644 --- a/opencl/test/unit_test/api/cl_link_program_tests.inl +++ b/opencl/test/unit_test/api/cl_link_program_tests.inl @@ -8,10 +8,10 @@ #include "shared/source/compiler_interface/compiler_interface.h" #include "shared/source/device_binary_format/elf/elf_decoder.h" #include "shared/source/helpers/file_io.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/source/context/context.h" #include "opencl/test/unit_test/global_environment.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "cl_api_tests.h" #include "compiler_options.h" diff --git a/opencl/test/unit_test/api/cl_release_kernel_tests.inl b/opencl/test/unit_test/api/cl_release_kernel_tests.inl index 15d9d789e6..95465d49d3 100644 --- a/opencl/test/unit_test/api/cl_release_kernel_tests.inl +++ b/opencl/test/unit_test/api/cl_release_kernel_tests.inl @@ -6,9 +6,9 @@ */ #include "shared/source/helpers/file_io.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/source/context/context.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "cl_api_tests.h" diff --git a/opencl/test/unit_test/aub_tests/fixtures/run_kernel_fixture.h b/opencl/test/unit_test/aub_tests/fixtures/run_kernel_fixture.h index 5115f03af9..12d6abdd03 100644 --- a/opencl/test/unit_test/aub_tests/fixtures/run_kernel_fixture.h +++ b/opencl/test/unit_test/aub_tests/fixtures/run_kernel_fixture.h @@ -9,6 +9,7 @@ #include "shared/source/command_stream/command_stream_receiver.h" #include "shared/source/helpers/file_io.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/source/program/program.h" #include "opencl/test/unit_test/aub_tests/command_queue/command_enqueue_fixture.h" @@ -18,7 +19,6 @@ #include "opencl/test/unit_test/command_stream/command_stream_fixture.h" #include "opencl/test/unit_test/fixtures/run_kernel_fixture.h" #include "opencl/test/unit_test/global_environment.h" -#include "opencl/test/unit_test/helpers/test_files.h" namespace NEO { diff --git a/opencl/test/unit_test/built_ins/sip_tests.cpp b/opencl/test/unit_test/built_ins/sip_tests.cpp index a637f69e67..df3ed56521 100644 --- a/opencl/test/unit_test/built_ins/sip_tests.cpp +++ b/opencl/test/unit_test/built_ins/sip_tests.cpp @@ -7,10 +7,10 @@ #include "shared/source/built_ins/built_ins.h" #include "shared/source/built_ins/sip.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "shared/test/unit_test/mocks/mock_device.h" #include "opencl/test/unit_test/global_environment.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "opencl/test/unit_test/mocks/mock_program.h" #include "test.h" diff --git a/opencl/test/unit_test/fixtures/built_in_fixture.cpp b/opencl/test/unit_test/fixtures/built_in_fixture.cpp index 0e3bb24a95..5410b7402b 100644 --- a/opencl/test/unit_test/fixtures/built_in_fixture.cpp +++ b/opencl/test/unit_test/fixtures/built_in_fixture.cpp @@ -9,10 +9,10 @@ #include "shared/source/built_ins/built_ins.h" #include "shared/source/device/device.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/test/unit_test/global_environment.h" #include "opencl/test/unit_test/helpers/kernel_binary_helper.h" -#include "opencl/test/unit_test/helpers/test_files.h" using namespace NEO; diff --git a/opencl/test/unit_test/fixtures/hello_world_kernel_fixture.h b/opencl/test/unit_test/fixtures/hello_world_kernel_fixture.h index 07027d4e20..270c953f74 100644 --- a/opencl/test/unit_test/fixtures/hello_world_kernel_fixture.h +++ b/opencl/test/unit_test/fixtures/hello_world_kernel_fixture.h @@ -8,13 +8,13 @@ #pragma once #include "shared/source/device/device.h" #include "shared/source/helpers/file_io.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/source/kernel/kernel.h" #include "opencl/source/platform/platform.h" #include "opencl/source/program/program.h" #include "opencl/test/unit_test/fixtures/device_fixture.h" #include "opencl/test/unit_test/fixtures/program_fixture.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "opencl/test/unit_test/mocks/mock_context.h" #include "opencl/test/unit_test/mocks/mock_kernel.h" #include "opencl/test/unit_test/mocks/mock_program.h" diff --git a/opencl/test/unit_test/fixtures/program_fixture.h b/opencl/test/unit_test/fixtures/program_fixture.h index 9270ee8d89..f74c8e3235 100644 --- a/opencl/test/unit_test/fixtures/program_fixture.h +++ b/opencl/test/unit_test/fixtures/program_fixture.h @@ -7,9 +7,9 @@ #pragma once #include "shared/source/helpers/file_io.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/source/program/program.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "opencl/test/unit_test/mocks/mock_program.h" #include "gtest/gtest.h" diff --git a/opencl/test/unit_test/fixtures/run_kernel_fixture.h b/opencl/test/unit_test/fixtures/run_kernel_fixture.h index 8648abce3b..de8715af54 100644 --- a/opencl/test/unit_test/fixtures/run_kernel_fixture.h +++ b/opencl/test/unit_test/fixtures/run_kernel_fixture.h @@ -7,8 +7,9 @@ #pragma once +#include "shared/test/unit_test/helpers/test_files.h" + #include "opencl/test/unit_test/global_environment.h" -#include "opencl/test/unit_test/helpers/test_files.h" namespace NEO { struct CommandQueueHwFixture; diff --git a/opencl/test/unit_test/gen9/sip_tests_gen9.cpp b/opencl/test/unit_test/gen9/sip_tests_gen9.cpp index 0442336779..a8f4b1f858 100644 --- a/opencl/test/unit_test/gen9/sip_tests_gen9.cpp +++ b/opencl/test/unit_test/gen9/sip_tests_gen9.cpp @@ -7,10 +7,10 @@ #include "shared/source/built_ins/built_ins.h" #include "shared/source/built_ins/sip.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "shared/test/unit_test/mocks/mock_device.h" #include "opencl/test/unit_test/global_environment.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "test.h" #include "gtest/gtest.h" diff --git a/opencl/test/unit_test/gtpin/gtpin_tests.cpp b/opencl/test/unit_test/gtpin/gtpin_tests.cpp index 635cd6e1c4..b2c649c782 100644 --- a/opencl/test/unit_test/gtpin/gtpin_tests.cpp +++ b/opencl/test/unit_test/gtpin/gtpin_tests.cpp @@ -13,6 +13,7 @@ #include "shared/source/memory_manager/surface.h" #include "shared/source/os_interface/os_context.h" #include "shared/test/unit_test/device_binary_format/patchtokens_tests.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "shared/test/unit_test/helpers/variable_backup.h" #include "shared/test/unit_test/mocks/mock_device.h" @@ -30,7 +31,6 @@ #include "opencl/test/unit_test/fixtures/memory_management_fixture.h" #include "opencl/test/unit_test/fixtures/platform_fixture.h" #include "opencl/test/unit_test/helpers/kernel_binary_helper.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "opencl/test/unit_test/mocks/mock_buffer.h" #include "opencl/test/unit_test/mocks/mock_command_queue.h" #include "opencl/test/unit_test/mocks/mock_context.h" diff --git a/opencl/test/unit_test/helpers/kernel_binary_helper.cpp b/opencl/test/unit_test/helpers/kernel_binary_helper.cpp index 3dbff21687..e92decb525 100644 --- a/opencl/test/unit_test/helpers/kernel_binary_helper.cpp +++ b/opencl/test/unit_test/helpers/kernel_binary_helper.cpp @@ -7,8 +7,9 @@ #include "opencl/test/unit_test/helpers/kernel_binary_helper.h" +#include "shared/test/unit_test/helpers/test_files.h" + #include "opencl/test/unit_test/global_environment.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include diff --git a/opencl/test/unit_test/libult/CMakeLists.txt b/opencl/test/unit_test/libult/CMakeLists.txt index e15d6212d1..0b17f18d92 100644 --- a/opencl/test/unit_test/libult/CMakeLists.txt +++ b/opencl/test/unit_test/libult/CMakeLists.txt @@ -32,8 +32,6 @@ set(IGDRCL_SRCS_LIB_ULT ${NEO_SOURCE_DIR}/opencl/test/unit_test/helpers/debug_helpers.cpp ${NEO_SOURCE_DIR}/opencl/test/unit_test/helpers/execution_environment_helper.cpp ${NEO_SOURCE_DIR}/opencl/test/unit_test/helpers/execution_environment_helper.h - ${NEO_SOURCE_DIR}/opencl/test/unit_test/helpers/test_files.cpp - ${NEO_SOURCE_DIR}/opencl/test/unit_test/helpers/test_files.h ${NEO_SOURCE_DIR}/opencl/test/unit_test/libult/create_tbx_sockets.cpp ${NEO_SOURCE_DIR}/opencl/test/unit_test/libult/debug_manager.cpp ${NEO_SOURCE_DIR}/opencl/test/unit_test/libult/io_functions.cpp @@ -47,6 +45,8 @@ set(IGDRCL_SRCS_LIB_ULT ${NEO_SHARED_TEST_DIRECTORY}/unit_test/helpers/memory_leak_listener.h ${NEO_SHARED_TEST_DIRECTORY}/unit_test/helpers/memory_management.cpp ${NEO_SHARED_TEST_DIRECTORY}/unit_test/helpers/memory_management.h + ${NEO_SHARED_TEST_DIRECTORY}/unit_test/helpers/test_files.cpp + ${NEO_SHARED_TEST_DIRECTORY}/unit_test/helpers/test_files.h ) get_property(NEO_SHARED_TESTS_CMD_PARSE GLOBAL PROPERTY NEO_SHARED_TESTS_CMD_PARSE) diff --git a/opencl/test/unit_test/main.cpp b/opencl/test/unit_test/main.cpp index 575965c83e..835a9c8454 100644 --- a/opencl/test/unit_test/main.cpp +++ b/opencl/test/unit_test/main.cpp @@ -13,6 +13,7 @@ #include "shared/source/utilities/debug_settings_reader.h" #include "shared/test/unit_test/helpers/default_hw_info.inl" #include "shared/test/unit_test/helpers/memory_leak_listener.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "shared/test/unit_test/helpers/ult_hw_config.inl" #include "shared/test/unit_test/tests_configuration.h" @@ -20,7 +21,6 @@ #include "opencl/test/unit_test/custom_event_listener.h" #include "opencl/test/unit_test/global_environment.h" #include "opencl/test/unit_test/helpers/kernel_binary_helper.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "opencl/test/unit_test/mocks/mock_gmm.h" #include "opencl/test/unit_test/mocks/mock_program.h" #include "opencl/test/unit_test/mocks/mock_sip.h" diff --git a/opencl/test/unit_test/mocks/mock_compilers.cpp b/opencl/test/unit_test/mocks/mock_compilers.cpp index b49b4360c8..883e50fc4f 100644 --- a/opencl/test/unit_test/mocks/mock_compilers.cpp +++ b/opencl/test/unit_test/mocks/mock_compilers.cpp @@ -9,9 +9,9 @@ #include "shared/source/helpers/file_io.h" #include "shared/source/helpers/hw_info.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/source/os_interface/os_inc_base.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "opencl/test/unit_test/mocks/mock_compilers.h" #include "opencl/test/unit_test/mocks/mock_sip.h" diff --git a/opencl/test/unit_test/mocks/mock_sip.cpp b/opencl/test/unit_test/mocks/mock_sip.cpp index 44c9db2c25..93b273c648 100644 --- a/opencl/test/unit_test/mocks/mock_sip.cpp +++ b/opencl/test/unit_test/mocks/mock_sip.cpp @@ -9,10 +9,10 @@ #include "shared/source/helpers/file_io.h" #include "shared/source/helpers/hw_info.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/source/memory_manager/os_agnostic_memory_manager.h" #include "opencl/source/os_interface/os_inc_base.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "opencl/test/unit_test/mocks/mock_compilers.h" #include "opencl/test/unit_test/mocks/mock_program.h" diff --git a/opencl/test/unit_test/offline_compiler/CMakeLists.txt b/opencl/test/unit_test/offline_compiler/CMakeLists.txt index eb85c9dbe7..a62c46b22a 100644 --- a/opencl/test/unit_test/offline_compiler/CMakeLists.txt +++ b/opencl/test/unit_test/offline_compiler/CMakeLists.txt @@ -60,7 +60,7 @@ set(IGDRCL_SRCS_offline_compiler_tests ${NEO_SHARED_DIRECTORY}/helpers/file_io.cpp ${NEO_SHARED_DIRECTORY}/memory_manager/deferred_deleter.cpp ${NEO_SHARED_DIRECTORY}/memory_manager/deferred_deleter.h - ${NEO_SOURCE_DIR}/opencl/test/unit_test/helpers/test_files.cpp + ${NEO_SHARED_TEST_DIRECTORY}/unit_test/helpers/test_files.cpp ${IGDRCL_SRCS_cloc} ${IGDRCL_SRCS_offline_compiler_mock} ${IGDRCL_SRCS_tests_compiler_mocks} diff --git a/opencl/test/unit_test/offline_compiler/decoder/encoder_tests.cpp b/opencl/test/unit_test/offline_compiler/decoder/encoder_tests.cpp index e93520268f..a9b549bf85 100644 --- a/opencl/test/unit_test/offline_compiler/decoder/encoder_tests.cpp +++ b/opencl/test/unit_test/offline_compiler/decoder/encoder_tests.cpp @@ -7,8 +7,7 @@ #include "shared/offline_compiler/source/decoder/binary_decoder.h" #include "shared/source/helpers/array_count.h" - -#include "opencl/test/unit_test/helpers/test_files.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "gmock/gmock.h" #include "mock/mock_encoder.h" diff --git a/opencl/test/unit_test/offline_compiler/environment.h b/opencl/test/unit_test/offline_compiler/environment.h index 1763f719ba..70691b29cd 100644 --- a/opencl/test/unit_test/offline_compiler/environment.h +++ b/opencl/test/unit_test/offline_compiler/environment.h @@ -8,9 +8,9 @@ #pragma once #include "shared/offline_compiler/source/offline_compiler.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/source/os_interface/os_inc_base.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "opencl/test/unit_test/mocks/mock_compilers.h" #include "gtest/gtest.h" diff --git a/opencl/test/unit_test/offline_compiler/main.cpp b/opencl/test/unit_test/offline_compiler/main.cpp index f1782d1bb0..2929bd085d 100644 --- a/opencl/test/unit_test/offline_compiler/main.cpp +++ b/opencl/test/unit_test/offline_compiler/main.cpp @@ -6,9 +6,9 @@ */ #include "shared/source/os_interface/os_library.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/test/unit_test/custom_event_listener.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "environment.h" #include "limits.h" diff --git a/opencl/test/unit_test/program/process_elf_binary_tests.cpp b/opencl/test/unit_test/program/process_elf_binary_tests.cpp index 0bfa3aca96..fb55998114 100644 --- a/opencl/test/unit_test/program/process_elf_binary_tests.cpp +++ b/opencl/test/unit_test/program/process_elf_binary_tests.cpp @@ -12,9 +12,9 @@ #include "shared/source/helpers/file_io.h" #include "shared/source/helpers/string.h" #include "shared/test/unit_test/device_binary_format/patchtokens_tests.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "shared/test/unit_test/mocks/mock_device.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "opencl/test/unit_test/mocks/mock_cl_device.h" #include "opencl/test/unit_test/mocks/mock_program.h" diff --git a/opencl/test/unit_test/program/program_spec_constants_tests.cpp b/opencl/test/unit_test/program/program_spec_constants_tests.cpp index f562e39313..ad66e6778b 100644 --- a/opencl/test/unit_test/program/program_spec_constants_tests.cpp +++ b/opencl/test/unit_test/program/program_spec_constants_tests.cpp @@ -10,10 +10,10 @@ #include "shared/source/helpers/file_io.h" #include "shared/source/helpers/hw_info.h" #include "shared/test/unit_test/helpers/debug_manager_state_restore.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/test/unit_test/fixtures/device_fixture.h" #include "opencl/test/unit_test/global_environment.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "opencl/test/unit_test/mocks/mock_cif.h" #include "opencl/test/unit_test/mocks/mock_compilers.h" #include "opencl/test/unit_test/mocks/mock_program.h" diff --git a/shared/test/unit_test/compiler_interface/compiler_interface_tests.cpp b/shared/test/unit_test/compiler_interface/compiler_interface_tests.cpp index 2c35caf177..55b9711966 100644 --- a/shared/test/unit_test/compiler_interface/compiler_interface_tests.cpp +++ b/shared/test/unit_test/compiler_interface/compiler_interface_tests.cpp @@ -11,10 +11,10 @@ #include "shared/source/helpers/hw_cmds.h" #include "shared/source/helpers/hw_info.h" #include "shared/test/unit_test/helpers/debug_manager_state_restore.h" +#include "shared/test/unit_test/helpers/test_files.h" #include "opencl/test/unit_test/fixtures/device_fixture.h" #include "opencl/test/unit_test/global_environment.h" -#include "opencl/test/unit_test/helpers/test_files.h" #include "opencl/test/unit_test/mocks/mock_cif.h" #include "opencl/test/unit_test/mocks/mock_compilers.h" diff --git a/opencl/test/unit_test/helpers/test_files.cpp b/shared/test/unit_test/helpers/test_files.cpp similarity index 100% rename from opencl/test/unit_test/helpers/test_files.cpp rename to shared/test/unit_test/helpers/test_files.cpp diff --git a/opencl/test/unit_test/helpers/test_files.h b/shared/test/unit_test/helpers/test_files.h similarity index 100% rename from opencl/test/unit_test/helpers/test_files.h rename to shared/test/unit_test/helpers/test_files.h