diff --git a/cmake/run_aub_test_target.cmake b/cmake/run_aub_test_target.cmake index 7487169398..d33959c219 100644 --- a/cmake/run_aub_test_target.cmake +++ b/cmake/run_aub_test_target.cmake @@ -60,6 +60,21 @@ if(NOT SKIP_NEO_UNIT_TESTS) COMMAND echo Running AUB generation for ${product} in ${TargetDir}/${product}_aub COMMAND ${aub_test_cmd_prefix} --product ${product} --slices ${slices} --subslices ${subslices} --eu_per_ss ${eu_per_ss} --gtest_repeat=1 ${aub_tests_options} ${IGDRCL_TESTS_LISTENER_OPTION} --rev_id ${revision_id} ) + if(BUILD_WITH_L0) + if(WIN32 OR NOT DEFINED NEO__GMM_LIBRARY_PATH) + set(l0_aub_test_cmd_prefix $) + else() + set(l0_aub_test_cmd_prefix LD_LIBRARY_PATH=${NEO__GMM_LIBRARY_PATH} $) + endif() + + add_custom_command( + TARGET run_${product}_${revision_id}_aub_tests + POST_BUILD + COMMAND WORKING_DIRECTORY ${TargetDir} + COMMAND echo Running Level Zero AUB generation for ${product} in ${TargetDir}/${product}_aub + COMMAND ${l0_aub_test_cmd_prefix} --product ${product} --slices ${slices} --subslices ${subslices} --eu_per_ss ${eu_per_ss} --gtest_repeat=1 ${aub_tests_options} --rev_id ${revision_id} + ) + endif() if(DO_NOT_RUN_AUB_TESTS) set_target_properties(run_${product}_${revision_id}_aub_tests PROPERTIES diff --git a/level_zero/core/source/helpers/api_specific_config_l0.cpp b/level_zero/core/source/helpers/api_specific_config_l0.cpp index 631a3bf8f8..61c4a98d40 100644 --- a/level_zero/core/source/helpers/api_specific_config_l0.cpp +++ b/level_zero/core/source/helpers/api_specific_config_l0.cpp @@ -25,4 +25,8 @@ ApiSpecificConfig::ApiType ApiSpecificConfig::getApiType() { return ApiSpecificConfig::L0; } +const char *ApiSpecificConfig::getAubPrefixForSpecificApi() { + return "l0_"; +} + } // namespace NEO \ No newline at end of file diff --git a/level_zero/core/test/aub_tests/CMakeLists.txt b/level_zero/core/test/aub_tests/CMakeLists.txt index 2c3289a704..ccba3ea7a4 100644 --- a/level_zero/core/test/aub_tests/CMakeLists.txt +++ b/level_zero/core/test/aub_tests/CMakeLists.txt @@ -13,6 +13,7 @@ get_property(NEO_SHARED_aub_tests_configurations GLOBAL PROPERTY NEO_SHARED_aub_ list(APPEND L0_AUB_TESTS__TARGET_OBJECTS ${CMAKE_CURRENT_SOURCE_DIR}/aub_hello_world_test.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/options_aub_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_mode.h ${NEO_SOURCE_DIR}/level_zero/core/test/unit_tests/main.cpp ${NEO_SHARED_aub_tests_configurations} @@ -27,6 +28,10 @@ endfunction() ADD_SUPPORTED_TEST_PRODUCT_FAMILIES_DEFINITION() +if(DEFINED AUB_STREAM_PROJECT_NAME) + list(APPEND L0_AUB_TESTS__TARGET_OBJECTS $) +endif() + add_executable(${TARGET_NAME} ${L0_AUB_TESTS__TARGET_OBJECTS} ) diff --git a/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp b/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp index c11d05de03..1b3f48a8d5 100644 --- a/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp +++ b/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp @@ -7,8 +7,20 @@ #include "aub_fixture.h" +#include "shared/source/helpers/api_specific_config.h" + namespace L0 { +void AUBFixtureL0::prepareCopyEngines(NEO::MockDevice &device, const std::string &filename) { + for (auto i = 0u; i < device.engines.size(); i++) { + if (EngineHelpers::isBcs(device.engines[i].getEngineType())) { + CommandStreamReceiver *pBcsCommandStreamReceiver = nullptr; + pBcsCommandStreamReceiver = AUBCommandStreamReceiver::create(filename, true, *device.executionEnvironment, device.getRootDeviceIndex(), device.getDeviceBitfield()); + device.resetCommandStreamReceiver(pBcsCommandStreamReceiver, i); + } + } +} + void AUBFixtureL0::SetUp(const HardwareInfo *hardwareInfo) { const HardwareInfo &hwInfo = hardwareInfo ? *hardwareInfo : *defaultHwInfo; @@ -17,6 +29,8 @@ void AUBFixtureL0::SetUp(const HardwareInfo *hardwareInfo) { const ::testing::TestInfo *const testInfo = ::testing::UnitTest::GetInstance()->current_test_info(); std::stringstream strfilename; + + strfilename << NEO::ApiSpecificConfig::getAubPrefixForSpecificApi(); strfilename << testInfo->test_case_name() << "_" << testInfo->name() << "_" << hwHelper.getCsTraits(engineType).name; executionEnvironment = new NEO::ExecutionEnvironment(); @@ -27,6 +41,7 @@ void AUBFixtureL0::SetUp(const HardwareInfo *hardwareInfo) { this->csr = AUBCommandStreamReceiver::create(strfilename.str(), true, *executionEnvironment, 0, neoDevice->getDeviceBitfield()); neoDevice->resetCommandStreamReceiver(this->csr); + prepareCopyEngines(*neoDevice, strfilename.str()); NEO::DeviceVector devices; devices.push_back(std::unique_ptr(neoDevice)); diff --git a/level_zero/core/test/aub_tests/fixtures/aub_fixture.h b/level_zero/core/test/aub_tests/fixtures/aub_fixture.h index cb67de1167..fb55642630 100644 --- a/level_zero/core/test/aub_tests/fixtures/aub_fixture.h +++ b/level_zero/core/test/aub_tests/fixtures/aub_fixture.h @@ -24,6 +24,7 @@ class AUBFixtureL0 { public: void SetUp(const HardwareInfo *hardwareInfo); void TearDown(); + static void prepareCopyEngines(NEO::MockDevice &device, const std::string &filename); const uint32_t rootDeviceIndex = 0; NEO::ExecutionEnvironment *executionEnvironment; diff --git a/level_zero/core/test/aub_tests/options_aub_tests.cpp b/level_zero/core/test/aub_tests/options_aub_tests.cpp new file mode 100644 index 0000000000..b54744844e --- /dev/null +++ b/level_zero/core/test/aub_tests/options_aub_tests.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2021 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include +#include + +namespace NEO { +const char *folderAUB = "aub_out"; + +uint32_t initialHardwareTag = std::numeric_limits::max(); +} // namespace NEO diff --git a/level_zero/core/test/unit_tests/sources/helper/api_specific_config_l0_tests.cpp b/level_zero/core/test/unit_tests/sources/helper/api_specific_config_l0_tests.cpp index 8b3887291b..860a407544 100644 --- a/level_zero/core/test/unit_tests/sources/helper/api_specific_config_l0_tests.cpp +++ b/level_zero/core/test/unit_tests/sources/helper/api_specific_config_l0_tests.cpp @@ -15,4 +15,8 @@ TEST(ApiSpecificConfigL0Tests, WhenGettingApiTypeThenCorrectTypeIsReturned) { EXPECT_EQ(ApiSpecificConfig::L0, ApiSpecificConfig::getApiType()); } +TEST(ApiSpecificConfigL0Tests, WhenGettingAUBPrefixByApiTypeL0IsReturned) { + EXPECT_EQ(0, strcmp("l0_", ApiSpecificConfig::getAubPrefixForSpecificApi())); +} + } // namespace NEO \ No newline at end of file diff --git a/opencl/source/helpers/api_specific_config_ocl.cpp b/opencl/source/helpers/api_specific_config_ocl.cpp index e642cf0ae2..7285d516da 100644 --- a/opencl/source/helpers/api_specific_config_ocl.cpp +++ b/opencl/source/helpers/api_specific_config_ocl.cpp @@ -22,4 +22,8 @@ bool ApiSpecificConfig::getBindlessConfiguration() { ApiSpecificConfig::ApiType ApiSpecificConfig::getApiType() { return ApiSpecificConfig::OCL; } + +const char *ApiSpecificConfig::getAubPrefixForSpecificApi() { + return "ocl_"; +} } // namespace NEO \ No newline at end of file diff --git a/opencl/test/unit_test/aub_tests/command_stream/aub_command_stream_fixture.cpp b/opencl/test/unit_test/aub_tests/command_stream/aub_command_stream_fixture.cpp index 18f7ad2276..59afcd2075 100644 --- a/opencl/test/unit_test/aub_tests/command_stream/aub_command_stream_fixture.cpp +++ b/opencl/test/unit_test/aub_tests/command_stream/aub_command_stream_fixture.cpp @@ -10,6 +10,7 @@ #include "shared/source/command_stream/command_stream_receiver.h" #include "shared/source/command_stream/tbx_command_stream_receiver.h" #include "shared/source/device/device.h" +#include "shared/source/helpers/api_specific_config.h" #include "shared/source/helpers/hw_helper.h" #include "shared/source/os_interface/os_context.h" #include "shared/test/common/cmd_parse/gen_cmd_parse.h" @@ -33,6 +34,8 @@ void AUBCommandStreamFixture::SetUp(CommandQueue *pCmdQ) { const ::testing::TestInfo *const testInfo = ::testing::UnitTest::GetInstance()->current_test_info(); std::stringstream strfilename; auto engineType = pCmdQ->getGpgpuCommandStreamReceiver().getOsContext().getEngineType(); + + strfilename << ApiSpecificConfig::getAubPrefixForSpecificApi(); strfilename << testInfo->test_case_name() << "_" << testInfo->name() << "_" << hwHelper.getCsTraits(engineType).name; pCommandStreamReceiver = AUBFixture::prepareComputeEngine(device, strfilename.str()); diff --git a/opencl/test/unit_test/aub_tests/command_stream/aub_mem_dump_tests.cpp b/opencl/test/unit_test/aub_tests/command_stream/aub_mem_dump_tests.cpp index 28b3c66d8a..95da16485d 100644 --- a/opencl/test/unit_test/aub_tests/command_stream/aub_mem_dump_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_stream/aub_mem_dump_tests.cpp @@ -14,6 +14,7 @@ #include "opencl/test/unit_test/fixtures/cl_device_fixture.h" #include "opencl/test/unit_test/mocks/mock_aub_csr.h" +using NEO::ApiSpecificConfig; using NEO::AUBCommandStreamReceiver; using NEO::AUBCommandStreamReceiverHw; using NEO::AUBFamilyMapper; @@ -57,8 +58,9 @@ HWTEST_F(AubMemDumpTests, givenAubFileStreamWhenOpenAndCloseIsCalledThenFileName HWTEST_F(AubMemDumpTests, GivenHeaderThenExpectationsAreMet) { typedef typename AUBFamilyMapper::AUB AUB; std::string filePath(folderAUB); + std::string filenameWithPrefix = ApiSpecificConfig::getAubPrefixForSpecificApi(); filePath.append(Os::fileSeparator); - filePath.append(getAubFileName(pDevice, "header.aub")); + filePath.append(getAubFileName(pDevice, filenameWithPrefix.append("header.aub"))); AUBCommandStreamReceiver::AubFileStream aubFile; aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary); @@ -72,8 +74,9 @@ HWTEST_F(AubMemDumpTests, GivenHeaderThenExpectationsAreMet) { HWTEST_F(AubMemDumpTests, GivenReserveMaxAddressThenExpectationsAreMet) { typedef typename AUBFamilyMapper::AUB AUB; std::string filePath(folderAUB); + std::string filenameWithPrefix = ApiSpecificConfig::getAubPrefixForSpecificApi(); filePath.append(Os::fileSeparator); - filePath.append(getAubFileName(pDevice, "reserveMaxAddress.aub")); + filePath.append(getAubFileName(pDevice, filenameWithPrefix.append("reserveMaxAddress.aub"))); AUBCommandStreamReceiver::AubFileStream aubFile; aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary); @@ -95,8 +98,9 @@ HWTEST_F(AubMemDumpTests, GivenReserveMaxAddressThenExpectationsAreMet) { HWTEST_F(AubMemDumpTests, GivenWriteVerifyOneBytePpgttThenExpectationsAreMet) { typedef typename AUBFamilyMapper::AUB AUB; std::string filePath(folderAUB); + std::string filenameWithPrefix = ApiSpecificConfig::getAubPrefixForSpecificApi(); filePath.append(Os::fileSeparator); - filePath.append(getAubFileName(pDevice, "writeVerifyOneBytePPGTT.aub")); + filePath.append(getAubFileName(pDevice, filenameWithPrefix.append("writeVerifyOneBytePPGTT.aub"))); AUBCommandStreamReceiver::AubFileStream aubFile; aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary); @@ -120,8 +124,9 @@ HWTEST_F(AubMemDumpTests, GivenWriteVerifyOneBytePpgttThenExpectationsAreMet) { HWTEST_F(AubMemDumpTests, GivenWriteVerifyOneByteGgttThenExpectationsAreMet) { typedef typename AUBFamilyMapper::AUB AUB; std::string filePath(folderAUB); + std::string filenameWithPrefix = ApiSpecificConfig::getAubPrefixForSpecificApi(); filePath.append(Os::fileSeparator); - filePath.append(getAubFileName(pDevice, "writeVerifyOneByteGGTT.aub")); + filePath.append(getAubFileName(pDevice, filenameWithPrefix.append("writeVerifyOneByteGGTT.aub"))); AUBCommandStreamReceiver::AubFileStream aubFile; aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary); @@ -143,8 +148,9 @@ HWTEST_F(AubMemDumpTests, GivenWriteVerifyOneByteGgttThenExpectationsAreMet) { HWTEST_F(AubMemDumpTests, GivenWriteVerifySevenBytesPpgttThenExpectationsAreMet) { typedef typename AUBFamilyMapper::AUB AUB; std::string filePath(folderAUB); + std::string filenameWithPrefix = ApiSpecificConfig::getAubPrefixForSpecificApi(); filePath.append(Os::fileSeparator); - filePath.append(getAubFileName(pDevice, "writeVerifySevenBytesPPGTT.aub")); + filePath.append(getAubFileName(pDevice, filenameWithPrefix.append("writeVerifySevenBytesPPGTT.aub"))); AUBCommandStreamReceiver::AubFileStream aubFile; aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary); @@ -168,8 +174,9 @@ HWTEST_F(AubMemDumpTests, GivenWriteVerifySevenBytesPpgttThenExpectationsAreMet) HWTEST_F(AubMemDumpTests, GivenWriteVerifySevenBytesGgttThenExpectationsAreMet) { typedef typename AUBFamilyMapper::AUB AUB; std::string filePath(folderAUB); + std::string filenameWithPrefix = ApiSpecificConfig::getAubPrefixForSpecificApi(); filePath.append(Os::fileSeparator); - filePath.append(getAubFileName(pDevice, "writeVerifySevenBytesGGTT.aub")); + filePath.append(getAubFileName(pDevice, filenameWithPrefix.append("writeVerifySevenBytesGGTT.aub"))); AUBCommandStreamReceiver::AubFileStream aubFile; aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary); diff --git a/opencl/test/unit_test/aub_tests/command_stream/aub_mem_dump_tests.h b/opencl/test/unit_test/aub_tests/command_stream/aub_mem_dump_tests.h index 4a19e9cab4..7c0b3d6919 100644 --- a/opencl/test/unit_test/aub_tests/command_stream/aub_mem_dump_tests.h +++ b/opencl/test/unit_test/aub_tests/command_stream/aub_mem_dump_tests.h @@ -8,6 +8,7 @@ #pragma once #include "shared/source/device/device.h" #include "shared/source/helpers/aligned_memory.h" +#include "shared/source/helpers/api_specific_config.h" #include "shared/source/helpers/ptr_math.h" #include "opencl/source/command_stream/aub_command_stream_receiver_hw.h" @@ -32,7 +33,8 @@ void setupAUB(const NEO::Device *pDevice, aub_stream::EngineType engineType) { NEO::AUBCommandStreamReceiver::AubFileStream aubFile; std::string filePath(NEO::folderAUB); filePath.append(Os::fileSeparator); - std::string baseName("simple"); + std::string baseName(NEO::ApiSpecificConfig::getAubPrefixForSpecificApi()); + baseName.append("simple"); baseName.append(csTraits.name); baseName.append(".aub"); filePath.append(getAubFileName(pDevice, baseName)); diff --git a/opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h b/opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h index 7a92da2b72..b64cc9154e 100644 --- a/opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h +++ b/opencl/test/unit_test/aub_tests/fixtures/aub_fixture.h @@ -8,6 +8,7 @@ #pragma once #include "shared/source/aub_mem_dump/page_table_entry_bits.h" #include "shared/source/command_stream/tbx_command_stream_receiver_hw.h" +#include "shared/source/helpers/api_specific_config.h" #include "shared/source/helpers/hw_helper.h" #include "shared/source/os_interface/os_interface.h" #include "shared/test/common/mocks/mock_device.h" @@ -62,6 +63,7 @@ class AUBFixture : public CommandQueueHwFixture { const ::testing::TestInfo *const testInfo = ::testing::UnitTest::GetInstance()->current_test_info(); std::stringstream strfilename; + strfilename << ApiSpecificConfig::getAubPrefixForSpecificApi(); strfilename << testInfo->test_case_name() << "_" << testInfo->name() << "_" << hwHelper.getCsTraits(engineType).name; executionEnvironment = platform()->peekExecutionEnvironment(); diff --git a/opencl/test/unit_test/helpers/api_specific_config_ocl_tests.cpp b/opencl/test/unit_test/helpers/api_specific_config_ocl_tests.cpp index 507626670f..5ac65c4011 100644 --- a/opencl/test/unit_test/helpers/api_specific_config_ocl_tests.cpp +++ b/opencl/test/unit_test/helpers/api_specific_config_ocl_tests.cpp @@ -15,4 +15,8 @@ TEST(ApiSpecificConfigOclTests, WhenGettingApiTypeThenCorrectTypeIsReturned) { EXPECT_EQ(ApiSpecificConfig::OCL, ApiSpecificConfig::getApiType()); } +TEST(ApiSpecificConfigL0Tests, WhenGettingAUBPrefixByApiTypeOCLIsReturned) { + EXPECT_EQ(0, strcmp("ocl_", ApiSpecificConfig::getAubPrefixForSpecificApi())); +} + } // namespace NEO \ No newline at end of file diff --git a/shared/source/helpers/api_specific_config.h b/shared/source/helpers/api_specific_config.h index 67d188f2a5..c1cc54df67 100644 --- a/shared/source/helpers/api_specific_config.h +++ b/shared/source/helpers/api_specific_config.h @@ -13,5 +13,6 @@ struct ApiSpecificConfig { static bool getHeapConfiguration(); static bool getBindlessConfiguration(); static ApiType getApiType(); + static const char *getAubPrefixForSpecificApi(); }; } // namespace NEO \ No newline at end of file