Generate revision-specific kernels for L0

Resolves: NEO-6504

Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
This commit is contained in:
Igor Venevtsev
2022-03-02 19:31:16 +00:00
committed by Compute-Runtime-Automation
parent 38086029ed
commit 2263fe59ec
12 changed files with 65 additions and 61 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -34,7 +34,7 @@ struct L0BindlessAub : Test<AUBFixtureL0> {
void createModuleFromFile(const std::string &fileName, ze_context_handle_t context, L0::Device *device) {
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, fileName + "_", ".bin");
retrieveBinaryKernelFilenameApiSpecific(testFile, fileName + "_", ".bin");
size_t size = 0;
auto src = loadDataFromFile(
@@ -113,4 +113,4 @@ HWTEST2_F(L0BindlessAub, GivenBindlessKernelWhenExecutedThenOutputIsCorrect, IsA
}
} // namespace ult
} // namespace L0
} // namespace L0

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -21,7 +21,7 @@ struct AUBAppendKernelIndirectL0 : Test<AUBFixtureL0> {
static ze_module_handle_t createModuleFromFile(const std::string &fileName, ze_context_handle_t context, ze_device_handle_t device) {
ze_module_handle_t moduleHandle;
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, fileName + "_", ".bin");
retrieveBinaryKernelFilenameApiSpecific(testFile, fileName + "_", ".bin");
size_t size = 0;
auto src = loadDataFromFile(
@@ -207,4 +207,4 @@ TEST_F(AUBAppendKernelIndirectL0, whenAppendKernelIndirectThenWorkDimIsProperlyP
}
} // namespace ult
} // namespace L0
} // namespace L0

View File

@@ -24,18 +24,20 @@ set(TEST_KERNEL_BINDLESS
set(l0_test_kernels_outputs)
macro(macro_for_each_core_type)
foreach(PLATFORM_TYPE ${PLATFORM_TYPES})
if(${CORE_TYPE}_HAS_${PLATFORM_TYPE})
get_family_name_with_type(${CORE_TYPE} ${PLATFORM_TYPE})
string(TOLOWER ${PLATFORM_TYPE} PLATFORM_TYPE_LOWER)
set(PLATFORM_LOWER ${DEFAULT_SUPPORTED_${CORE_TYPE}_${PLATFORM_TYPE}_PLATFORM})
string(TOLOWER ${CORE_TYPE} CORE_TYPE_LOWER)
level_zero_generate_kernels(l0_test_kernel_outputs ${PLATFORM_LOWER} ${family_name_with_type} "-g" ${TEST_MODULES})
foreach(REVISION_ID ${${PLATFORM_TYPE}_${CORE_TYPE}_REVISIONS})
if(${CORE_TYPE}_HAS_${PLATFORM_TYPE})
get_family_name_with_type(${CORE_TYPE} ${PLATFORM_TYPE})
string(TOLOWER ${PLATFORM_TYPE} PLATFORM_TYPE_LOWER)
set(PLATFORM_LOWER ${DEFAULT_SUPPORTED_${CORE_TYPE}_${PLATFORM_TYPE}_PLATFORM})
string(TOLOWER ${CORE_TYPE} CORE_TYPE_LOWER)
level_zero_generate_kernels(l0_test_kernel_outputs ${PLATFORM_LOWER} ${family_name_with_type} ${REVISION_ID} "-g" ${TEST_MODULES})
#skip Gen8 bindless kernel generation
if(NOT ("${CORE_TYPE_LOWER}" STREQUAL "gen8"))
level_zero_generate_kernels_with_internal_options(l0_bindless_test_kernel_outputs ${PLATFORM_LOWER} ${family_name_with_type} "bindless" "-g" ${TEST_KERNEL_BINDLESS_internal_options} ${TEST_KERNEL_BINDLESS})
#skip Gen8 bindless kernel generation
if(NOT ("${CORE_TYPE_LOWER}" STREQUAL "gen8"))
level_zero_generate_kernels_with_internal_options(l0_bindless_test_kernel_outputs ${PLATFORM_LOWER} ${family_name_with_type} "bindless" ${REVISION_ID} "-g" ${TEST_KERNEL_BINDLESS_internal_options} ${TEST_KERNEL_BINDLESS})
endif()
endif()
endif()
endforeach()
endforeach()
endmacro()
apply_macro_for_each_core_type("TESTED")
@@ -63,4 +65,4 @@ set_target_properties(l0_libult PROPERTIES FOLDER ${TARGET_NAME_L0})
set_property(TARGET l0_libult APPEND_STRING PROPERTY COMPILE_FLAGS ${ASAN_FLAGS} ${TSAN_FLAGS})
target_include_directories(l0_libult PRIVATE $<TARGET_PROPERTY:${L0_MOCKABLE_LIB_NAME},INTERFACE_INCLUDE_DIRECTORIES>)
target_compile_definitions(l0_libult PRIVATE $<TARGET_PROPERTY:${L0_MOCKABLE_LIB_NAME},INTERFACE_COMPILE_DEFINITIONS>)
create_project_source_tree(l0_libult)
create_project_source_tree(l0_libult)

View File

@@ -4,11 +4,11 @@
# SPDX-License-Identifier: MIT
#
function(level_zero_generate_kernels target_list platform_name suffix options)
function(level_zero_generate_kernels target_list platform_name suffix revision_id options)
list(APPEND results copy_compiler_files)
set(outputdir "${TargetDir}/level_zero/${suffix}/test_files/${NEO_ARCH}/")
set(outputdir "${TargetDir}/level_zero/${suffix}/${revision_id}/test_files/${NEO_ARCH}/")
foreach(filepath ${ARGN})
get_filename_component(filename ${filepath} NAME)
@@ -26,9 +26,9 @@ function(level_zero_generate_kernels target_list platform_name suffix options)
)
add_custom_command(
COMMAND echo generate ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_name} -out_dir ${outputdir} -options "${options}"
COMMAND echo generate ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_name} -out_dir ${outputdir} -revision_id ${revision_id} -options "${options}"
OUTPUT ${output_files}
COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_name} -out_dir ${outputdir} -options "${options}"
COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_name} -out_dir ${outputdir} -revision_id ${revision_id} -options "${options}"
WORKING_DIRECTORY ${workdir}
DEPENDS ${filepath} ocloc
)
@@ -51,11 +51,11 @@ function(level_zero_generate_kernels target_list platform_name suffix options)
set(${target_list} ${${target_list}} PARENT_SCOPE)
endfunction()
function(level_zero_generate_kernels_with_internal_options target_list platform_name suffix prefix options internal_options)
function(level_zero_generate_kernels_with_internal_options target_list platform_name suffix prefix revision_id options internal_options)
list(APPEND results copy_compiler_files)
set(outputdir "${TargetDir}/level_zero/${suffix}/test_files/${NEO_ARCH}/")
set(outputdir "${TargetDir}/level_zero/${suffix}/${revision_id}/test_files/${NEO_ARCH}/")
foreach(filepath ${ARGN})
get_filename_component(filename ${filepath} NAME)
@@ -78,9 +78,9 @@ function(level_zero_generate_kernels_with_internal_options target_list platform_
string(CONCAT internal_options \" ${internal_options} \" )
add_custom_command(
COMMAND echo generate ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_name} -out_dir ${outputdir} ${output_name} -options ${options} -internal_options ${internal_options} , workdir is ${workdir}
COMMAND echo generate ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_name} -out_dir ${outputdir} ${output_name} -revision_id ${revision_id} -options ${options} -internal_options ${internal_options} , workdir is ${workdir}
OUTPUT ${output_files}
COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_name} -out_dir ${outputdir} ${output_name} -options ${options} -internal_options ${internal_options}
COMMAND ${ocloc_cmd_prefix} -q -file ${absolute_filepath} -device ${platform_name} -out_dir ${outputdir} ${output_name} -revision_id ${revision_id} -options ${options} -internal_options ${internal_options}
WORKING_DIRECTORY ${workdir}
DEPENDS ${filepath} ocloc
)

View File

@@ -152,7 +152,7 @@ struct ModuleImmutableDataFixture : public DeviceFixture {
void createModuleFromBinary(uint32_t perHwThreadPrivateMemorySize, bool isInternal, MockImmutableData *mockKernelImmData) {
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, binaryFilename + "_", ".bin");
retrieveBinaryKernelFilenameApiSpecific(testFile, binaryFilename + "_", ".bin");
size_t size = 0;
auto src = loadDataFromFile(
@@ -206,7 +206,7 @@ struct ModuleFixture : public DeviceFixture {
void createModuleFromBinary(ModuleType type = ModuleType::User) {
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, binaryFilename + "_", ".bin");
retrieveBinaryKernelFilenameApiSpecific(testFile, binaryFilename + "_", ".bin");
size_t size = 0;
auto src = loadDataFromFile(
@@ -254,7 +254,7 @@ struct MultiDeviceModuleFixture : public MultiDeviceFixture {
void createModuleFromBinary(uint32_t rootDeviceIndex) {
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, binaryFilename + "_", ".bin");
retrieveBinaryKernelFilenameApiSpecific(testFile, binaryFilename + "_", ".bin");
size_t size = 0;
auto src = loadDataFromFile(testFile.c_str(), size);

View File

@@ -329,17 +329,19 @@ int main(int argc, char **argv) {
binaryNameSuffix.append(hwInfoForTests.capabilityTable.platformType);
std::string testBinaryFiles = getRunPath(argv[0]);
std::string testBinaryFilesNoRev = testBinaryFiles;
testBinaryFilesNoRev.append("/level_zero/");
std::string testBinaryFilesApiSpecific = testBinaryFiles;
testBinaryFilesApiSpecific.append("/level_zero/");
testBinaryFiles.append("/" + binaryNameSuffix + "/");
testBinaryFilesNoRev.append(binaryNameSuffix + "/");
testBinaryFilesApiSpecific.append(binaryNameSuffix + "/");
testBinaryFiles.append(std::to_string(revId));
testBinaryFiles.append("/");
testBinaryFiles.append(testFiles);
testBinaryFilesNoRev.append(testFiles);
testBinaryFilesApiSpecific.append(std::to_string(revId));
testBinaryFilesApiSpecific.append("/");
testBinaryFilesApiSpecific.append(testFilesApiSpecific);
testFiles = testBinaryFiles;
testFilesNoRev = testBinaryFilesNoRev;
testFilesApiSpecific = testBinaryFilesApiSpecific;
std::string executionDirectory(hardwarePrefix[productFamily]);
executionDirectory += NEO::executionDirectorySuffix; //_aub for aub_tests, empty otherwise

View File

@@ -700,7 +700,7 @@ HWTEST_F(NotifyModuleLoadTest, givenDebuggingEnabledWhenModuleIsCreatedAndFullyL
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(debugger);
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, binaryFilename + "_", ".bin");
retrieveBinaryKernelFilenameApiSpecific(testFile, binaryFilename + "_", ".bin");
size_t size = 0;
auto src = loadDataFromFile(testFile.c_str(), size);
@@ -742,7 +742,7 @@ HWTEST_F(NotifyModuleLoadTest, givenDebuggingEnabledWhenModuleWithUnresolvedSymb
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(debugger);
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, binaryFilename + "_", ".bin");
retrieveBinaryKernelFilenameApiSpecific(testFile, binaryFilename + "_", ".bin");
size_t size = 0;
auto src = loadDataFromFile(testFile.c_str(), size);
@@ -796,7 +796,7 @@ HWTEST_F(NotifyModuleLoadTest, givenDebuggingEnabledWhenModuleWithUnresolvedSymb
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(debugger);
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, binaryFilename + "_", ".bin");
retrieveBinaryKernelFilenameApiSpecific(testFile, binaryFilename + "_", ".bin");
size_t size = 0;
auto src = loadDataFromFile(testFile.c_str(), size);

View File

@@ -498,7 +498,7 @@ TEST_F(KernelImmutableDataTests, givenInternalModuleWhenKernelIsCreatedIsaIsNotC
TEST_F(KernelImmutableDataTests, givenKernelInitializedWithPrivateMemoryThenContainerHasOneExtraSpaceForAllocation) {
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, binaryFilename + "_", ".bin");
retrieveBinaryKernelFilenameApiSpecific(testFile, binaryFilename + "_", ".bin");
size_t size = 0;
auto src = loadDataFromFile(
@@ -554,7 +554,7 @@ TEST_F(KernelImmutableDataTests, givenKernelInitializedWithPrivateMemoryThenCont
TEST_F(KernelImmutableDataTests, givenKernelWithPrivateMemoryBiggerThanGlobalMemoryThenPrivateMemoryIsNotAllocated) {
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, binaryFilename + "_", ".bin");
retrieveBinaryKernelFilenameApiSpecific(testFile, binaryFilename + "_", ".bin");
size_t size = 0;
auto src = loadDataFromFile(

View File

@@ -1594,7 +1594,7 @@ TEST_F(MultipleDevicePeerAllocationFailTest,
struct MultipleDevicePeerAllocationTest : public ::testing::Test {
void createModuleFromBinary(L0::Device *device, ModuleType type = ModuleType::User) {
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, binaryFilename + "_", ".bin");
retrieveBinaryKernelFilenameApiSpecific(testFile, binaryFilename + "_", ".bin");
size_t size = 0;
auto src = loadDataFromFile(

View File

@@ -498,7 +498,7 @@ struct ModuleSpecConstantsFixture : public DeviceFixture {
void runTest() {
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, binaryFilename + "_", ".spv");
retrieveBinaryKernelFilenameApiSpecific(testFile, binaryFilename + "_", ".spv");
size_t size = 0;
auto src = loadDataFromFile(testFile.c_str(), size);
@@ -537,7 +537,7 @@ struct ModuleSpecConstantsFixture : public DeviceFixture {
void runTestStatic() {
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, binaryFilename + "_", ".spv");
retrieveBinaryKernelFilenameApiSpecific(testFile, binaryFilename + "_", ".spv");
size_t sizeModule1, sizeModule2 = 0;
auto srcModule1 = loadDataFromFile(testFile.c_str(), sizeModule1);
@@ -627,7 +627,7 @@ TEST_F(ModuleSpecConstantsLongTests, givenSpecializationConstantsSetWhenCompiler
auto rootDeviceEnvironment = neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0].get();
rootDeviceEnvironment->compilerInterface.reset(mockCompiler);
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, binaryFilename + "_", ".spv");
retrieveBinaryKernelFilenameApiSpecific(testFile, binaryFilename + "_", ".spv");
size_t size = 0;
auto src = loadDataFromFile(testFile.c_str(), size);
@@ -660,7 +660,7 @@ TEST_F(ModuleSpecConstantsLongTests, givenSpecializationConstantsSetWhenCompiler
TEST_F(ModuleSpecConstantsLongTests, givenSpecializationConstantsSetWhenUserPassTooMuchConstsIdsThenModuleInitFails) {
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, binaryFilename + "_", ".spv");
retrieveBinaryKernelFilenameApiSpecific(testFile, binaryFilename + "_", ".spv");
size_t size = 0;
auto src = loadDataFromFile(testFile.c_str(), size);
@@ -718,7 +718,7 @@ TEST_F(ModuleSpecConstantsLongTests, givenSpecializationConstantsSetWhenCompiler
auto rootDeviceEnvironment = neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0].get();
rootDeviceEnvironment->compilerInterface.reset(mockCompiler);
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, binaryFilename + "_", ".spv");
retrieveBinaryKernelFilenameApiSpecific(testFile, binaryFilename + "_", ".spv");
size_t sizeModule1, sizeModule2 = 0;
auto srcModule1 = loadDataFromFile(testFile.c_str(), sizeModule1);
@@ -779,7 +779,7 @@ struct ModuleStaticLinkFixture : public DeviceFixture {
void loadModules(bool multiple) {
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, binaryFilename + "_", ".spv");
retrieveBinaryKernelFilenameApiSpecific(testFile, binaryFilename + "_", ".spv");
srcModule1 = loadDataFromFile(testFile.c_str(), sizeModule1);
if (multiple) {
@@ -1344,7 +1344,7 @@ TEST_F(ModuleDynamicLinkTests, givenUnresolvedSymbolsWhenModuleIsCreatedThenIsaA
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->compilerInterface.reset(cip);
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, binaryFilename + "_", ".bin");
retrieveBinaryKernelFilenameApiSpecific(testFile, binaryFilename + "_", ".bin");
size_t size = 0;
auto src = loadDataFromFile(testFile.c_str(), size);
@@ -1492,7 +1492,7 @@ using ContextModuleCreateTest = Test<ContextFixture>;
HWTEST_F(ContextModuleCreateTest, givenCallToCreateModuleThenModuleIsReturned) {
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, "test_kernel_", ".bin");
retrieveBinaryKernelFilenameApiSpecific(testFile, "test_kernel_", ".bin");
size_t size = 0;
auto src = loadDataFromFile(testFile.c_str(), size);
@@ -1540,7 +1540,7 @@ HWTEST_F(ModuleTranslationUnitTest, GivenRebuildPrecompiledKernelsFlagAndFileWit
NEO::DebugManager.flags.RebuildPrecompiledKernels.set(true);
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, "test_kernel_", ".gen");
retrieveBinaryKernelFilenameApiSpecific(testFile, "test_kernel_", ".gen");
size_t size = 0;
auto src = loadDataFromFile(testFile.c_str(), size);
@@ -1568,7 +1568,7 @@ HWTEST_F(ModuleTranslationUnitTest, GivenRebuildPrecompiledKernelsFlagAndFileWit
NEO::DebugManager.flags.RebuildPrecompiledKernels.set(true);
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, "test_kernel_", ".bin");
retrieveBinaryKernelFilenameApiSpecific(testFile, "test_kernel_", ".bin");
size_t size = 0;
auto src = loadDataFromFile(testFile.c_str(), size);
@@ -1596,7 +1596,7 @@ HWTEST_F(ModuleTranslationUnitTest, GivenRebuildFlagWhenCreatingModuleFromNative
NEO::DebugManager.flags.RebuildPrecompiledKernels.set(true);
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, "test_kernel_", ".bin");
retrieveBinaryKernelFilenameApiSpecific(testFile, "test_kernel_", ".bin");
size_t size = 0;
auto src = loadDataFromFile(testFile.c_str(), size);
@@ -1634,7 +1634,7 @@ HWTEST_F(ModuleTranslationUnitTest, GivenRebuildFlagWhenCreatingModuleFromNative
NEO::DebugManager.flags.RebuildPrecompiledKernels.set(true);
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, "test_kernel_", ".bin");
retrieveBinaryKernelFilenameApiSpecific(testFile, "test_kernel_", ".bin");
size_t size = 0;
auto src = loadDataFromFile(testFile.c_str(), size);
@@ -1854,7 +1854,7 @@ using PrintfModuleTest = Test<DeviceFixture>;
HWTEST_F(PrintfModuleTest, GivenModuleWithPrintfWhenKernelIsCreatedThenPrintfAllocationIsPlacedInResidencyContainer) {
std::string testFile;
retrieveBinaryKernelFilenameNoRevision(testFile, "test_kernel_", ".gen");
retrieveBinaryKernelFilenameApiSpecific(testFile, "test_kernel_", ".gen");
size_t size = 0;
auto src = loadDataFromFile(testFile.c_str(), size);