diff --git a/common_macros.cmake b/common_macros.cmake index 9e5c47c3cfec7..601e10afc841c 100644 --- a/common_macros.cmake +++ b/common_macros.cmake @@ -93,3 +93,9 @@ macro(apply_macro_for_each_test_config type) macro_for_each_test_config() endforeach() endmacro() + +macro(get_family_name_with_type gen_type platform_type) + string(REPLACE "GEN" "Gen" gen_type_capitalized ${gen_type}) + string(TOLOWER ${platform_type} platform_type_lower) + set(family_name_with_type ${gen_type_capitalized}${platform_type_lower}) +endmacro() diff --git a/offline_compiler/offline_compiler.cpp b/offline_compiler/offline_compiler.cpp index 9780ff9e713c3..244d383285196 100644 --- a/offline_compiler/offline_compiler.cpp +++ b/offline_compiler/offline_compiler.cpp @@ -248,6 +248,9 @@ int OfflineCompiler::getHardwareInfo(const char *pDeviceName) { if (stringsAreEqual(pDeviceName, hardwarePrefix[productId])) { if (hardwareInfoTable[productId]) { hwInfo = hardwareInfoTable[productId]; + familyNameWithType.clear(); + familyNameWithType.append(familyName[hwInfo->pPlatform->eRenderCoreFamily]); + familyNameWithType.append(getPlatformType(*hwInfo)); retVal = CL_SUCCESS; break; } @@ -530,15 +533,15 @@ void OfflineCompiler::parseDebugSettings() { //////////////////////////////////////////////////////////////////////////////// // ParseBinAsCharArray //////////////////////////////////////////////////////////////////////////////// -std::string OfflineCompiler::parseBinAsCharArray(uint8_t *binary, size_t size, std::string &deviceName, std::string &fileName) { +std::string OfflineCompiler::parseBinAsCharArray(uint8_t *binary, size_t size, std::string &fileName) { std::string builtinName = convertToPascalCase(fileName); std::ostringstream out; // Convert binary to cpp out << "#include \n"; out << "#include \n\n"; - out << "size_t " << builtinName << "BinarySize_" << deviceName << " = " << size << ";\n"; - out << "uint32_t " << builtinName << "Binary_" << deviceName << "[" << (size + 3) / 4 << "] = {" + out << "size_t " << builtinName << "BinarySize_" << familyNameWithType << " = " << size << ";\n"; + out << "uint32_t " << builtinName << "Binary_" << familyNameWithType << "[" << (size + 3) / 4 << "] = {" << std::endl << " "; @@ -572,11 +575,11 @@ std::string OfflineCompiler::parseBinAsCharArray(uint8_t *binary, size_t size, s out << "static RegisterEmbeddedResource register" << builtinName << "Bin(" << std::endl; out << " createBuiltinResourceName(" << std::endl; out << " EBuiltInOps::" << builtinName << "," << std::endl; - out << " BuiltinCode::getExtension(BuiltinCode::ECodeType::Binary), \"" << deviceName << "\", 0)" << std::endl; + out << " BuiltinCode::getExtension(BuiltinCode::ECodeType::Binary), \"" << familyNameWithType << "\", 0)" << std::endl; out << " .c_str()," << std::endl; out << " (const char *)" << builtinName << "Binary" - << "_" << deviceName << "," << std::endl; - out << " " << builtinName << "BinarySize_" << deviceName << ");" << std::endl; + << "_" << familyNameWithType << "," << std::endl; + out << " " << builtinName << "BinarySize_" << familyNameWithType << ");" << std::endl; out << "}" << std::endl; return out.str(); @@ -733,9 +736,9 @@ void OfflineCompiler::writeOutAllFiles() { std::string fileBase; std::string fileTrunk = getFileNameTrunk(inputFile); if (outputFile.empty()) { - fileBase = fileTrunk + "_" + deviceName; + fileBase = fileTrunk + "_" + familyNameWithType; } else { - fileBase = outputFile + "_" + deviceName; + fileBase = outputFile + "_" + familyNameWithType; } if (outputDirectory != "") { @@ -789,7 +792,7 @@ void OfflineCompiler::writeOutAllFiles() { if (useCppFile) { std::string cppOutputFile = (outputDirectory == "") ? "" : outputDirectory + "/"; cppOutputFile.append(fileBase + ".cpp"); - std::string cpp = parseBinAsCharArray((uint8_t *)genBinary, genBinarySize, deviceName, fileTrunk); + std::string cpp = parseBinAsCharArray((uint8_t *)genBinary, genBinarySize, fileTrunk); writeDataToFile(cppOutputFile.c_str(), cpp.c_str(), cpp.size()); } } diff --git a/offline_compiler/offline_compiler.h b/offline_compiler/offline_compiler.h index c1aaaf0e68e46..4d9f5b6342943 100644 --- a/offline_compiler/offline_compiler.h +++ b/offline_compiler/offline_compiler.h @@ -56,7 +56,7 @@ class OfflineCompiler { return quiet; } - std::string parseBinAsCharArray(uint8_t *binary, size_t size, std::string &deviceName, std::string &fileName); + std::string parseBinAsCharArray(uint8_t *binary, size_t size, std::string &fileName); static bool readOptionsFromFile(std::string &optionsOut, const std::string &file); protected: @@ -76,6 +76,7 @@ class OfflineCompiler { const HardwareInfo *hwInfo = nullptr; std::string deviceName; + std::string familyNameWithType; std::string inputFile; std::string outputFile; std::string outputDirectory; diff --git a/platforms.cmake b/platforms.cmake index 0ff2aee6d9f7b..326607673760f 100644 --- a/platforms.cmake +++ b/platforms.cmake @@ -158,6 +158,14 @@ macro(SET_FLAGS_FOR GEN_TYPE) endforeach() endif() endmacro() +macro(ADD_PLATFORM_FOR_GEN LIST_TYPE GEN_TYPE PLATFORM_NAME PLATFORM_TYPE) + ADD_ITEM_FOR_GEN("PLATFORMS" ${LIST_TYPE} ${GEN_TYPE} ${PLATFORM_NAME}) + set(${GEN_TYPE}_HAS_${PLATFORM_TYPE} TRUE) + set(${PLATFORM_NAME}_IS_${PLATFORM_TYPE} TRUE) + if(NOT DEFAULT_${LIST_TYPE}_${GEN_TYPE}_${PLATFORM_TYPE}_PLATFORM) + string(TOLOWER ${PLATFORM_NAME} DEFAULT_${LIST_TYPE}_${GEN_TYPE}_${PLATFORM_TYPE}_PLATFORM) + endif() +endmacro() SET_FLAGS_FOR("GEN8" "BDW") SET_FLAGS_FOR("GEN9" "SKL" "KBL" "BXT" "GLK" "CFL") @@ -174,8 +182,8 @@ INIT_LIST("CONFIGURATIONS" "MT_TESTS") # Add supported and tested platforms if(SUPPORT_GEN8) - ADD_ITEM_FOR_GEN("PLATFORMS" "SUPPORTED" "GEN8" "BDW") - ADD_ITEM_FOR_GEN("PLATFORMS" "SUPPORTED_2_0" "GEN8" "BDW") + ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN8" "BDW" "CORE") + ADD_PLATFORM_FOR_GEN("SUPPORTED_2_0" "GEN8" "BDW" "CORE") if(TESTS_GEN8) ADD_ITEM_FOR_GEN("FAMILY_NAME" "TESTED" "GEN8" "BDWFamily") ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN8" "BDW") @@ -191,8 +199,8 @@ if(SUPPORT_GEN9) ADD_ITEM_FOR_GEN("FAMILY_NAME" "TESTED" "GEN9" "SKLFamily") endif() if(SUPPORT_SKL) - ADD_ITEM_FOR_GEN("PLATFORMS" "SUPPORTED" "GEN9" "SKL") - ADD_ITEM_FOR_GEN("PLATFORMS" "SUPPORTED_2_0" "GEN9" "SKL") + ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN9" "SKL" "CORE") + ADD_PLATFORM_FOR_GEN("SUPPORTED_2_0" "GEN9" "SKL" "CORE") if(TESTS_SKL) ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN9" "SKL") ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED_APPVERIFIER" "GEN9" "SKL") @@ -203,8 +211,8 @@ if(SUPPORT_GEN9) endif() if(SUPPORT_KBL) - ADD_ITEM_FOR_GEN("PLATFORMS" "SUPPORTED" "GEN9" "KBL") - ADD_ITEM_FOR_GEN("PLATFORMS" "SUPPORTED_2_0" "GEN9" "KBL") + ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN9" "KBL" "CORE") + ADD_PLATFORM_FOR_GEN("SUPPORTED_2_0" "GEN9" "KBL" "CORE") if(TESTS_KBL) ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN9" "KBL") ADD_ITEM_FOR_GEN("CONFIGURATIONS" "UNIT_TESTS" "GEN9" "kbl/1/3/6") @@ -212,7 +220,7 @@ if(SUPPORT_GEN9) endif() if(SUPPORT_GLK) - ADD_ITEM_FOR_GEN("PLATFORMS" "SUPPORTED" "GEN9" "GLK") + ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN9" "GLK" "LP") if(TESTS_GLK) ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN9" "GLK") ADD_ITEM_FOR_GEN("CONFIGURATIONS" "UNIT_TESTS" "GEN9" "glk/1/3/6") @@ -220,7 +228,7 @@ if(SUPPORT_GEN9) endif() if(SUPPORT_CFL) - ADD_ITEM_FOR_GEN("PLATFORMS" "SUPPORTED" "GEN9" "CFL") + ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN9" "CFL" "CORE") ADD_ITEM_FOR_GEN("PLATFORMS" "SUPPORTED_2_0" "GEN9" "CFL") if(TESTS_CFL) ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN9" "CFL") @@ -229,7 +237,7 @@ if(SUPPORT_GEN9) endif() if(SUPPORT_BXT) - ADD_ITEM_FOR_GEN("PLATFORMS" "SUPPORTED" "GEN9" "BXT") + ADD_PLATFORM_FOR_GEN("SUPPORTED" "GEN9" "BXT" "LP") if(TESTS_BXT) ADD_ITEM_FOR_GEN("PLATFORMS" "TESTED" "GEN9" "BXT") ADD_ITEM_FOR_GEN("CONFIGURATIONS" "AUB_TESTS" "GEN9" "bxt/1/3/6") diff --git a/runtime/built_ins/built_ins_storage.cpp b/runtime/built_ins/built_ins_storage.cpp index 5d21498b5e8a6..7444df954b8a7 100644 --- a/runtime/built_ins/built_ins_storage.cpp +++ b/runtime/built_ins/built_ins_storage.cpp @@ -200,11 +200,11 @@ std::unique_ptr BuiltinsLib::createProgramFromCode(const BuiltinCode &b BuiltinResourceT BuiltinsLib::getBuiltinResource(EBuiltInOps builtin, BuiltinCode::ECodeType requestedCodeType, Device &device) { BuiltinResourceT bc; std::string resourceNameGeneric = createBuiltinResourceName(builtin, BuiltinCode::getExtension(requestedCodeType)); - std::string resourceNameForPlatform = createBuiltinResourceName(builtin, BuiltinCode::getExtension(requestedCodeType), device.getProductAbbrev()); - std::string resourceNameForPlatformAndStepping = createBuiltinResourceName(builtin, BuiltinCode::getExtension(requestedCodeType), device.getProductAbbrev(), - device.getHardwareInfo().pPlatform->usRevId); + std::string resourceNameForPlatformType = createBuiltinResourceName(builtin, BuiltinCode::getExtension(requestedCodeType), device.getFamilyNameWithType()); + std::string resourceNameForPlatformTypeAndStepping = createBuiltinResourceName(builtin, BuiltinCode::getExtension(requestedCodeType), device.getFamilyNameWithType(), + device.getHardwareInfo().pPlatform->usRevId); - for (auto &rn : {resourceNameForPlatformAndStepping, resourceNameForPlatform, resourceNameGeneric}) { // first look for dedicated version, only fallback to generic one + for (auto &rn : {resourceNameForPlatformTypeAndStepping, resourceNameForPlatformType, resourceNameGeneric}) { // first look for dedicated version, only fallback to generic one for (auto &s : allStorages) { bc = s.get()->load(rn); if (bc.size() != 0) { diff --git a/runtime/built_ins/builtins_binary.cmake b/runtime/built_ins/builtins_binary.cmake index 0b4cc0d261d55..0dd3363afc6c2 100644 --- a/runtime/built_ins/builtins_binary.cmake +++ b/runtime/built_ins/builtins_binary.cmake @@ -42,14 +42,13 @@ if(COMPILE_BUILT_INS) add_subdirectory(kernels) endif() -macro(macro_for_each_platform) - foreach(GENERATED_BUILTIN ${GENERATED_BUILTINS}) - list(APPEND GENERATED_BUILTINS_CPPS ${BUILTINS_INCLUDE_DIR}/${RUNTIME_GENERATED_${GENERATED_BUILTIN}_${GEN_TYPE_LOWER}_${PLATFORM_IT}}) - endforeach() -endmacro() - macro(macro_for_each_gen) - apply_macro_for_each_platform() + foreach(PLATFORM_TYPE "CORE" "LP") + get_family_name_with_type(${GEN_TYPE} ${PLATFORM_TYPE}) + foreach(GENERATED_BUILTIN ${GENERATED_BUILTINS}) + list(APPEND GENERATED_BUILTINS_CPPS ${BUILTINS_INCLUDE_DIR}/${RUNTIME_GENERATED_${GENERATED_BUILTIN}_${family_name_with_type}}) + endforeach() + endforeach() source_group("generated files\\${GEN_TYPE_LOWER}" FILES ${GENERATED_BUILTINS_CPPS}) endmacro() diff --git a/runtime/built_ins/kernels/CMakeLists.txt b/runtime/built_ins/kernels/CMakeLists.txt index 89ba303e67633..30b7d1c02e831 100644 --- a/runtime/built_ins/kernels/CMakeLists.txt +++ b/runtime/built_ins/kernels/CMakeLists.txt @@ -39,16 +39,17 @@ set(BUILTINS_INCLUDE_DIR ${TargetDir} PARENT_SCOPE) set(BUILTIN_CPP "") # Define function for compiling built-ins (with cloc) -function(compile_builtin gen_name builtin) - set(OUTPUTDIR "${BUILTINS_OUTDIR_WITH_ARCH}/${gen_name}") - +function(compile_builtin gen_type platform_type builtin) + string(TOLOWER ${gen_type} gen_type_lower) + get_family_name_with_type(${gen_type} ${platform_type}) + set(OUTPUTDIR "${BUILTINS_OUTDIR_WITH_ARCH}/${gen_type_lower}") # get filename get_filename_component(FILENAME ${builtin} NAME) # get name of the file w/o extension get_filename_component(BASENAME ${builtin} NAME_WE) - set(OUTPUTPATH_BASE "${OUTPUTDIR}/${BASENAME}_${gen_name}") + set(OUTPUTPATH_BASE "${OUTPUTDIR}/${BASENAME}_${family_name_with_type}") set(OUTPUT_FILES ${OUTPUTPATH_BASE}.bc ${OUTPUTPATH_BASE}.bin @@ -59,48 +60,38 @@ function(compile_builtin gen_name builtin) # function returns builtin cpp filename unset(BUILTIN_CPP) # set variable outside function - set(BUILTIN_CPP built_ins/${NEO_ARCH}/${gen_name}/${BASENAME}_${gen_name}.cpp PARENT_SCOPE) - - if(MSVC) - add_custom_command( - OUTPUT ${OUTPUT_FILES} - COMMAND cloc -q -file ${FILENAME} -device ${gen_name} ${BUILTIN_OPTIONS} -${NEO_BITS} -out_dir ${OUTPUTDIR} -cpp_file -options "-cl-kernel-arg-info ${BUILTIN_DEBUG_OPTION}" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS ${builtin} cloc copy_compiler_files - ) + set(BUILTIN_CPP built_ins/${NEO_ARCH}/${gen_type_lower}/${BASENAME}_${family_name_with_type}.cpp PARENT_SCOPE) + if(WIN32) + set(cloc_cmd_prefix cloc) else() - add_custom_command( - OUTPUT ${OUTPUT_FILES} - COMMAND LD_LIBRARY_PATH=$ $ -q -file ${FILENAME} -device ${gen_name} ${BUILTIN_OPTIONS} -${NEO_BITS} -out_dir ${OUTPUTDIR} -cpp_file -options "-cl-kernel-arg-info ${BUILTIN_DEBUG_OPTION}" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS ${builtin} cloc copy_compiler_files - ) + set(cloc_cmd_prefix LD_LIBRARY_PATH=$ $) endif() + add_custom_command( + OUTPUT ${OUTPUT_FILES} + COMMAND ${cloc_cmd_prefix} -q -file ${FILENAME} -device ${DEFAULT_SUPPORTED_${gen_type}_${platform_type}_PLATFORM} ${BUILTIN_OPTIONS} -${NEO_BITS} -out_dir ${OUTPUTDIR} -cpp_file -options "-cl-kernel-arg-info ${BUILTIN_DEBUG_OPTION}" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${builtin} cloc copy_compiler_files + ) endfunction() -macro(compile_builtins GEN_TYPE PLATFORM_IT) - string(TOLOWER ${PLATFORM_IT} PLATFORM_LOWER) - string(CONCAT GEN "_" ${GEN_TYPE} "_" ${PLATFORM_IT}) - - set (BUILTINS_COMMANDS) - foreach(GENERATED_BUILTIN ${GENERATED_BUILTINS}) - compile_builtin(${PLATFORM_LOWER} ${GENERATED_BUILTIN}.igdrcl_built_in) - list(APPEND BUILTINS_COMMANDS ${TargetDir}/${BUILTIN_CPP}) - set (RUNTIME_GENERATED_${GENERATED_BUILTIN}${GEN} ${BUILTIN_CPP} PARENT_SCOPE) - endforeach() - - set(target_name builtins_${PLATFORM_LOWER}) - add_custom_target(${target_name} DEPENDS ${BUILTINS_COMMANDS}) - add_dependencies(builtins ${target_name}) - set_target_properties(${target_name} PROPERTIES FOLDER "built_ins/${PLATFORM_LOWER}") -endmacro() - -macro(macro_for_each_platform) - compile_builtins(${GEN_TYPE_LOWER} ${PLATFORM_IT}) -endmacro() - macro(macro_for_each_gen) - apply_macro_for_each_platform() + foreach(PLATFORM_TYPE "CORE" "LP") + if(${GEN_TYPE}_HAS_${PLATFORM_TYPE}) + get_family_name_with_type(${GEN_TYPE} ${PLATFORM_TYPE}) + string(TOLOWER ${PLATFORM_TYPE} PLATFORM_TYPE_LOWER) + unset(BUILTINS_COMMANDS) + foreach(GENERATED_BUILTIN ${GENERATED_BUILTINS}) + compile_builtin(${GEN_TYPE} ${PLATFORM_TYPE} ${GENERATED_BUILTIN}.igdrcl_built_in) + list(APPEND BUILTINS_COMMANDS ${TargetDir}/${BUILTIN_CPP}) + set(RUNTIME_GENERATED_${GENERATED_BUILTIN}_${family_name_with_type} ${BUILTIN_CPP} PARENT_SCOPE) + endforeach() + + set(target_name builtins_${family_name_with_type}) + add_custom_target(${target_name} DEPENDS ${BUILTINS_COMMANDS}) + add_dependencies(builtins ${target_name}) + set_target_properties(${target_name} PROPERTIES FOLDER "built_ins/${family_name_with_type}") + endif() + endforeach() endmacro() apply_macro_for_each_gen("SUPPORTED") diff --git a/runtime/device/device.cpp b/runtime/device/device.cpp index 17fa55604afa6..85916416ca5e0 100644 --- a/runtime/device/device.cpp +++ b/runtime/device/device.cpp @@ -213,6 +213,12 @@ const char *Device::getProductAbbrev() const { return hardwarePrefix[hwInfo.pPlatform->eProductFamily]; } +const std::string Device::getFamilyNameWithType() const { + std::string platformName = familyName[hwInfo.pPlatform->eRenderCoreFamily]; + platformName.append(getPlatformType(hwInfo)); + return platformName; +} + double Device::getProfilingTimerResolution() { return osTime->getDynamicDeviceTimerResolution(hwInfo); } diff --git a/runtime/device/device.h b/runtime/device/device.h index 28f35ab66e508..a3e9581f0a508 100644 --- a/runtime/device/device.h +++ b/runtime/device/device.h @@ -97,6 +97,7 @@ class Device : public BaseObject<_cl_device_id> { volatile uint32_t *getTagAddress() const; const char *getProductAbbrev() const; + const std::string getFamilyNameWithType() const; // This helper template is meant to simplify getDeviceInfo template diff --git a/runtime/gen8/hw_info_bdw.cpp b/runtime/gen8/hw_info_bdw.cpp index 29d76f7f6bf42..a3f8023cf4c4f 100644 --- a/runtime/gen8/hw_info_bdw.cpp +++ b/runtime/gen8/hw_info_bdw.cpp @@ -73,7 +73,8 @@ const RuntimeCapabilityTable BDW::capabilityTable{ {true, 50000, true, 5000, true, 200000}, // KmdNotifyProperties false, // ftr64KBpages EngineType::ENGINE_RCS, // defaultEngineType - MemoryConstants::pageSize //requiredPreemptionSurfaceSize + MemoryConstants::pageSize, //requiredPreemptionSurfaceSize + true // isBigCore }; const HardwareInfo BDW_1x2x6::hwInfo = { diff --git a/runtime/gen9/hw_info_bxt.cpp b/runtime/gen9/hw_info_bxt.cpp index 5631e814ef368..c61b6a6f856a8 100644 --- a/runtime/gen9/hw_info_bxt.cpp +++ b/runtime/gen9/hw_info_bxt.cpp @@ -69,7 +69,8 @@ const RuntimeCapabilityTable BXT::capabilityTable{ {false, 0, false, 0, false, 0}, // KmdNotifyProperties false, // ftr64KBpages EngineType::ENGINE_RCS, // defaultEngineType - MemoryConstants::pageSize //requiredPreemptionSurfaceSize + MemoryConstants::pageSize, //requiredPreemptionSurfaceSize + false // isBigCore }; const HardwareInfo BXT_1x2x6::hwInfo = { diff --git a/runtime/gen9/hw_info_cfl.cpp b/runtime/gen9/hw_info_cfl.cpp index 2297696c98711..0bd649bf7465e 100644 --- a/runtime/gen9/hw_info_cfl.cpp +++ b/runtime/gen9/hw_info_cfl.cpp @@ -64,7 +64,8 @@ const RuntimeCapabilityTable CFL::capabilityTable{ {false, 0, false, 0, false, 0}, // KmdNotifyProperties true, // ftr64KBpages EngineType::ENGINE_RCS, // defaultEngineType - MemoryConstants::pageSize //requiredPreemptionSurfaceSize + MemoryConstants::pageSize, //requiredPreemptionSurfaceSize + true // isBigCore }; const HardwareInfo CFL_1x2x6::hwInfo = { diff --git a/runtime/gen9/hw_info_glk.cpp b/runtime/gen9/hw_info_glk.cpp index b2f841f02e732..a8f6a13a2c2e5 100644 --- a/runtime/gen9/hw_info_glk.cpp +++ b/runtime/gen9/hw_info_glk.cpp @@ -64,7 +64,8 @@ const RuntimeCapabilityTable GLK::capabilityTable{ {true, 30000, false, 0, false, 0}, // KmdNotifyProperties false, // ftr64KBpages EngineType::ENGINE_RCS, // defaultEngineType - MemoryConstants::pageSize //requiredPreemptionSurfaceSize + MemoryConstants::pageSize, //requiredPreemptionSurfaceSize + false // isBigCore }; const HardwareInfo GLK_1x3x6::hwInfo = { diff --git a/runtime/gen9/hw_info_kbl.cpp b/runtime/gen9/hw_info_kbl.cpp index 1575dc7eeaa92..73dd2946182e2 100644 --- a/runtime/gen9/hw_info_kbl.cpp +++ b/runtime/gen9/hw_info_kbl.cpp @@ -64,7 +64,8 @@ const RuntimeCapabilityTable KBL::capabilityTable{ {false, 0, false, 0, false, 0}, // KmdNotifyProperties true, // ftr64KBpages EngineType::ENGINE_RCS, // defaultEngineType - MemoryConstants::pageSize //requiredPreemptionSurfaceSize + MemoryConstants::pageSize, //requiredPreemptionSurfaceSize + true // isBigCore }; const HardwareInfo KBL_1x2x6::hwInfo = { diff --git a/runtime/gen9/hw_info_skl.cpp b/runtime/gen9/hw_info_skl.cpp index a90133c4ed041..707bf0472a53f 100644 --- a/runtime/gen9/hw_info_skl.cpp +++ b/runtime/gen9/hw_info_skl.cpp @@ -72,7 +72,8 @@ const RuntimeCapabilityTable SKL::capabilityTable{ {false, 0, false, 0, false, 0}, // KmdNotifyProperties true, // ftr64KBpages EngineType::ENGINE_RCS, // defaultEngineType - MemoryConstants::pageSize //requiredPreemptionSurfaceSize + MemoryConstants::pageSize, //requiredPreemptionSurfaceSize + true // isBigCore }; const HardwareInfo SKL_1x2x6::hwInfo = { diff --git a/runtime/helpers/hw_info.cpp b/runtime/helpers/hw_info.cpp index a893d215209c1..47c08581fed76 100644 --- a/runtime/helpers/hw_info.cpp +++ b/runtime/helpers/hw_info.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -53,4 +53,11 @@ const HardwareInfo unknownHardware = { &emptyWaTable, &unknownSysInfo, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, PreemptionMode::Disabled, {false, false}, nullptr}}; + +const char *getPlatformType(const HardwareInfo &hwInfo) { + if (hwInfo.capabilityTable.isBigCore) { + return "core"; + } + return "lp"; +} } // namespace OCLRT diff --git a/runtime/helpers/hw_info.h b/runtime/helpers/hw_info.h index 924274d0cdd61..0a194e5db41a9 100644 --- a/runtime/helpers/hw_info.h +++ b/runtime/helpers/hw_info.h @@ -72,6 +72,7 @@ struct RuntimeCapabilityTable { EngineType defaultEngineType; size_t requiredPreemptionSurfaceSize; + bool isBigCore; }; struct HardwareCapabilities { @@ -113,4 +114,6 @@ struct EnableGfxFamilyHw { } }; +const char *getPlatformType(const HardwareInfo &hwInfo); + } // namespace OCLRT diff --git a/runtime/scheduler/scheduler_binary.cmake b/runtime/scheduler/scheduler_binary.cmake index 4ee0de78b8cbf..7b7c5458baa76 100644 --- a/runtime/scheduler/scheduler_binary.cmake +++ b/runtime/scheduler/scheduler_binary.cmake @@ -19,63 +19,61 @@ # OTHER DEALINGS IN THE SOFTWARE. add_custom_target(scheduler) -set (SCHEDULER_OUTDIR_WITH_ARCH "${TargetDir}/scheduler/${NEO_ARCH}") +set(SCHEDULER_OUTDIR_WITH_ARCH "${TargetDir}/scheduler/${NEO_ARCH}") set_target_properties(scheduler PROPERTIES FOLDER "scheduler") set (SCHEDULER_KERNEL scheduler.cl) set (SCHEDULER_INCLUDE_OPTIONS "-I$") if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) - set(SCHEDULER_DEBUG_OPTION "-D DEBUG") + set(SCHEDULER_DEBUG_OPTION "-D DEBUG") else() - set(SCHEDULER_DEBUG_OPTION "") + set(SCHEDULER_DEBUG_OPTION "") endif() set(SCHEDULER_INCLUDE_DIR ${TargetDir}) -function(compile_kernel target gen_name gen_type kernel) - set(OUTPUTDIR "${SCHEDULER_OUTDIR_WITH_ARCH}/${gen_name}") - set(SCHEDULER_INCLUDE_OPTIONS "${SCHEDULER_INCLUDE_OPTIONS} -I ../${gen_type}") +function(compile_kernel target gen_type platform_type kernel) + get_family_name_with_type(${gen_type} ${platform_type}) + string(TOLOWER ${gen_type} gen_type_lower) + # get filename + set(OUTPUTDIR "${SCHEDULER_OUTDIR_WITH_ARCH}/${gen_type_lower}") + set(SCHEDULER_INCLUDE_OPTIONS "${SCHEDULER_INCLUDE_OPTIONS} -I ../${gen_type_lower}") get_filename_component(BASENAME ${kernel} NAME_WE) - set(OUTPUTPATH "${OUTPUTDIR}/${BASENAME}_${gen_name}.bin") + set(OUTPUTPATH "${OUTPUTDIR}/${BASENAME}_${family_name_with_type}.bin") - set(SCHEDULER_CPP "${OUTPUTDIR}/${BASENAME}_${gen_name}.cpp") - - if(MSVC) - add_custom_command( - OUTPUT ${OUTPUTPATH} - COMMAND cloc -q -file ${kernel} -device ${gen_name} -cl-intel-greater-than-4GB-buffer-required -${NEO_BITS} -out_dir ${OUTPUTDIR} -cpp_file -options "-cl-kernel-arg-info ${SCHEDULER_INCLUDE_OPTIONS} ${SCHEDULER_DEBUG_OPTION} -cl-std=CL2.0" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS ${kernel} cloc copy_compiler_files - ) + set(SCHEDULER_CPP "${OUTPUTDIR}/${BASENAME}_${family_name_with_type}.cpp") + if(WIN32) + set(cloc_cmd_prefix cloc) else() - add_custom_command( - OUTPUT ${OUTPUTPATH} ${SCHEDULER_CPP} - COMMAND LD_LIBRARY_PATH=$ $ -q -file ${kernel} -device ${gen_name} -cl-intel-greater-than-4GB-buffer-required -${NEO_BITS} -out_dir ${OUTPUTDIR} -cpp_file -options "-cl-kernel-arg-info ${SCHEDULER_INCLUDE_OPTIONS} ${SCHEDULER_DEBUG_OPTION} -cl-std=CL2.0" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS ${kernel} cloc copy_compiler_files - ) + set(cloc_cmd_prefix LD_LIBRARY_PATH=$ $) endif() + add_custom_command( + OUTPUT ${OUTPUTPATH} ${SCHEDULER_CPP} + COMMAND ${cloc_cmd_prefix} -q -file ${kernel} -device ${DEFAULT_SUPPORTED_${gen_type}_${platform_type}_PLATFORM} -cl-intel-greater-than-4GB-buffer-required -${NEO_BITS} -out_dir ${OUTPUTDIR} -cpp_file -options "-cl-kernel-arg-info ${SCHEDULER_INCLUDE_OPTIONS} ${SCHEDULER_DEBUG_OPTION} -cl-std=CL2.0" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${kernel} cloc copy_compiler_files + ) set(SCHEDULER_CPP ${SCHEDULER_CPP} PARENT_SCOPE) add_custom_target(${target} DEPENDS ${OUTPUTPATH}) - set_target_properties(${target} PROPERTIES FOLDER "scheduler/${gen_name}") + set_target_properties(${target} PROPERTIES FOLDER "scheduler/${gen_type_lower}") endfunction() -macro(macro_for_each_platform) - PLATFORM_HAS_2_0(${GEN_TYPE} ${PLATFORM_IT} PLATFORM_SUPPORTS_2_0) - if(COMPILE_BUILT_INS AND ${PLATFORM_SUPPORTS_2_0}) - string(TOLOWER ${PLATFORM_IT} PLATFORM_IT_LOWER) - compile_kernel(scheduler_${PLATFORM_IT_LOWER} ${PLATFORM_IT_LOWER} ${GEN_TYPE_LOWER} ${SCHEDULER_KERNEL}) - add_dependencies(scheduler scheduler_${PLATFORM_IT_LOWER}) - list(APPEND GENERATED_SCHEDULER_CPPS ${SCHEDULER_CPP}) - endif() -endmacro() - macro(macro_for_each_gen) - apply_macro_for_each_platform() + foreach(PLATFORM_TYPE "CORE" "LP") + if(${GEN_TYPE}_HAS_${PLATFORM_TYPE}) + get_family_name_with_type(${GEN_TYPE} ${PLATFORM_TYPE}) + set(PLATFORM_2_0_LOWER ${DEFAULT_SUPPORTED_2_0_${GEN_TYPE}_${PLATFORM_TYPE}_PLATFORM}) + if(COMPILE_BUILT_INS AND PLATFORM_2_0_LOWER) + compile_kernel(scheduler_${family_name_with_type} ${GEN_TYPE} ${PLATFORM_TYPE} ${SCHEDULER_KERNEL}) + add_dependencies(scheduler scheduler_${family_name_with_type}) + list(APPEND GENERATED_SCHEDULER_CPPS ${SCHEDULER_CPP}) + endif() + endif() + endforeach() source_group("generated files\\${GEN_TYPE_LOWER}" FILES ${GENERATED_SCHEDULER_CPPS}) endmacro() diff --git a/unit_tests/CMakeLists.txt b/unit_tests/CMakeLists.txt index 8a82fbe69c8a8..a4d20c219133a 100644 --- a/unit_tests/CMakeLists.txt +++ b/unit_tests/CMakeLists.txt @@ -72,8 +72,6 @@ add_executable(igdrcl_tests ${IGDRCL_SRCS_tests_local} ) -add_subdirectories() - if(NOT GTEST_REPEAT) set(GTEST_REPEAT 1 CACHE STRING "Google test iterations") endif() @@ -133,8 +131,8 @@ function(neo_copy_test_files target product) COMMAND ${CMAKE_COMMAND} -E make_directory ${outputdir}/cl_cache COMMAND echo copying built-in kernel files from ${BUILT_IN_KERNEL_DIR}/kernels to ${outputdir}/test_files COMMAND ${CMAKE_COMMAND} -E copy_directory ${BUILT_IN_KERNEL_DIR}/kernels ${outputdir}/test_files - COMMAND echo copying test files from ${CMAKE_CURRENT_SOURCE_DIR}/test_files to ${outputdir}/test_files - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/test_files ${outputdir}/test_files + COMMAND echo copying test files from ${IGDRCL_SOURCE_DIR}/unit_tests/test_files to ${outputdir}/test_files + COMMAND ${CMAKE_COMMAND} -E copy_directory ${IGDRCL_SOURCE_DIR}/unit_tests/test_files ${outputdir}/test_files COMMAND WORKING_DIRECTORY ${TargetDir} ) add_dependencies(${target} copy_compiler_files) @@ -163,8 +161,8 @@ else() set(cloc_cmd_prefix LD_LIBRARY_PATH=$ $) endif() -function(neo_gen_kernels target product) - set(outputdir "${TargetDir}/${product}/test_files/${NEO_ARCH}/") +function(neo_gen_kernels target platform_name suffix) + set(outputdir "${TargetDir}/${suffix}/test_files/${NEO_ARCH}/") set(workdir "${CMAKE_CURRENT_SOURCE_DIR}/test_files/") set(results) @@ -172,7 +170,7 @@ function(neo_gen_kernels target product) get_filename_component(filename ${filepath} NAME) get_filename_component(basename ${filepath} NAME_WE) - set(outputpath_base "${outputdir}${basename}_${product}") + set(outputpath_base "${outputdir}${basename}_${suffix}") set(output_files ${outputpath_base}.bc ${outputpath_base}.bin @@ -181,7 +179,7 @@ function(neo_gen_kernels target product) add_custom_command( OUTPUT ${output_files} - COMMAND ${cloc_cmd_prefix} -q -file ${filename} -device ${product} -${NEO_BITS} -out_dir ${outputdir} + COMMAND ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} WORKING_DIRECTORY ${workdir} DEPENDS ${filepath} cloc ) @@ -189,21 +187,21 @@ function(neo_gen_kernels target product) list(APPEND results ${output_files}) endforeach() add_custom_target(${target} DEPENDS ${results} copy_compiler_files) - set_target_properties(${target} PROPERTIES FOLDER "kernels/${product}") + set_target_properties(${target} PROPERTIES FOLDER "kernels/${suffix}") endfunction() -function(neo_gen_kernel_with_options target product filepath) +function(neo_gen_kernel_with_options target platform_name suffix filepath) get_filename_component(filename ${filepath} NAME) get_filename_component(basename ${filepath} NAME_WE) - set(outputdir "${TargetDir}/${product}/test_files/${NEO_ARCH}/") + set(outputdir "${TargetDir}/${suffix}/test_files/${NEO_ARCH}/") set(workdir "${CMAKE_CURRENT_SOURCE_DIR}/test_files/") set(results) foreach(arg ${ARGN}) string(REPLACE " " "_" argwospaces ${arg}) - set(outputpath_base "${outputdir}/${basename}_${product}") + set(outputpath_base "${outputdir}/${basename}_${suffix}") set(output_files ${outputpath_base}.bc${argwospaces} ${outputpath_base}.bin${argwospaces} @@ -212,7 +210,7 @@ function(neo_gen_kernel_with_options target product filepath) add_custom_command( OUTPUT ${output_files} - COMMAND ${cloc_cmd_prefix} -q -file ${filename} -device ${product} -${NEO_BITS} -out_dir ${outputdir} -options ${arg} -options_name + COMMAND ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -options ${arg} -options_name WORKING_DIRECTORY ${workdir} DEPENDS ${filepath} cloc ) @@ -220,24 +218,24 @@ function(neo_gen_kernel_with_options target product filepath) list(APPEND results ${output_files}) endforeach() add_custom_target(${target} DEPENDS ${results} copy_compiler_files) - set_target_properties(${target} PROPERTIES FOLDER "kernels/${product}") + set_target_properties(${target} PROPERTIES FOLDER "kernels/${suffix}") endfunction() set(TEST_KERNEL_kernel_debug_enable "-cl-kernel-debug-enable" ) -function(neo_gen_kernel_with_kernel_debug_options target product filepath) +function(neo_gen_kernel_with_kernel_debug_options target platform_name suffix filepath) get_filename_component(filename ${filepath} NAME) get_filename_component(basename ${filepath} NAME_WE) - set(outputdir "${TargetDir}/${product}/test_files/${NEO_ARCH}/") + set(outputdir "${TargetDir}/${suffix}/test_files/${NEO_ARCH}/") set(workdir "${CMAKE_CURRENT_SOURCE_DIR}/test_files/") set(results) string(REPLACE " " "_" argwospaces ${TEST_KERNEL_kernel_debug_enable}) - set(outputpath_base "${outputdir}/${argwospaces}_${product}") + set(outputpath_base "${outputdir}/${argwospaces}_${suffix}") set(output_files ${outputpath_base}.bc ${outputpath_base}.bin @@ -247,25 +245,25 @@ function(neo_gen_kernel_with_kernel_debug_options target product filepath) add_custom_command( OUTPUT ${output_files} - COMMAND ${cloc_cmd_prefix} -q -file ${filename} -device ${product} -${NEO_BITS} -out_dir ${outputdir} -output ${argwospaces} -internal_options ${TEST_KERNEL_kernel_debug_enable} -options "-g" + COMMAND ${cloc_cmd_prefix} -q -file ${filename} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -output ${argwospaces} -internal_options ${TEST_KERNEL_kernel_debug_enable} -options "-g" WORKING_DIRECTORY ${workdir} DEPENDS ${filepath} cloc ) list(APPEND results ${output_files}) add_custom_target(${target} DEPENDS ${results} copy_compiler_files) - set_target_properties(${target} PROPERTIES FOLDER "kernels/${product}") + set_target_properties(${target} PROPERTIES FOLDER "kernels/${suffix}") endfunction() -function(neo_gen_kernel_from_ll target product filepath output_name compile_options) +function(neo_gen_kernel_from_ll target platform_name suffix filepath output_name compile_options) get_filename_component(filename ${filepath} NAME) get_filename_component(basename ${filepath} NAME_WE) - set(outputdir "${TargetDir}/${product}/test_files/${NEO_ARCH}") + set(outputdir "${TargetDir}/${suffix}/test_files/${NEO_ARCH}") set(workdir "${CMAKE_CURRENT_SOURCE_DIR}/test_files/") set(results) - set(outputpath_base "${outputdir}/${output_name}_${product}") + set(outputpath_base "${outputdir}/${output_name}_${suffix}") set(output_files ${outputpath_base}.bin ${outputpath_base}.gen @@ -274,7 +272,7 @@ function(neo_gen_kernel_from_ll target product filepath output_name compile_opti add_custom_command( OUTPUT ${output_files} - COMMAND ${cloc_cmd_prefix} -q -file ${filename} -output ${output_name} -device ${product} -${NEO_BITS} -out_dir ${outputdir} -internal_options ${compile_options} -llvm_input + COMMAND ${cloc_cmd_prefix} -q -file ${filename} -output ${output_name} -device ${platform_name} -${NEO_BITS} -out_dir ${outputdir} -internal_options ${compile_options} -llvm_input WORKING_DIRECTORY ${workdir} DEPENDS ${filepath} cloc ) @@ -282,7 +280,7 @@ function(neo_gen_kernel_from_ll target product filepath output_name compile_opti list(APPEND results ${output_files}) add_custom_target(${target} DEPENDS ${results} copy_compiler_files) - set_target_properties(${target} PROPERTIES FOLDER "kernels/${product}") + set_target_properties(${target} PROPERTIES FOLDER "kernels/${suffix}") endfunction() set(TEST_KERNEL test_files/CopyBuffer_simd8.cl) @@ -367,55 +365,72 @@ macro(macro_for_each_test_config) if(MSVC AND ${TESTED_WITH_APPVERIFIER}) gen_run_tests_with_appverifier(${PLATFORM_IT_LOWER} ${SLICES} ${SUBSLICES} ${EU_PER_SS}) endif() + if(MSVC OR CMAKE_SIZEOF_VOID_P EQUAL 8) + foreach(PLATFORM_TYPE "CORE" "LP") + if(${PLATFORM_IT}_IS_${PLATFORM_TYPE}) + get_family_name_with_type(${GEN_TYPE} ${PLATFORM_TYPE}) + add_dependencies(run_${PLATFORM_IT_LOWER}_unit_tests test_kernels_${family_name_with_type}) + add_dependencies(run_${PLATFORM_IT_LOWER}_unit_tests test_kernel_${family_name_with_type}) + if(NOT ("${GEN_TYPE_LOWER}" STREQUAL "gen8")) + add_dependencies(run_${PLATFORM_IT_LOWER}_unit_tests test_kernel_debug_enable_${family_name_with_type}) + endif() + PLATFORM_HAS_2_0(${GEN_TYPE} ${PLATFORM_IT} PLATFORM_SUPPORTS_2_0) + if(PLATFORM_SUPPORTS_2_0) + add_dependencies(run_${PLATFORM_IT_LOWER}_unit_tests test_kernel_2_0_${family_name_with_type}) + endif() + endif() + endforeach() + endif() endmacro() macro(macro_for_each_platform) - PLATFORM_HAS_2_0(${GEN_TYPE} ${PLATFORM_IT} PLATFORM_SUPPORTS_2_0) PLATFORM_TESTED_WITH_APPVERIFIER(${GEN_TYPE} ${PLATFORM_IT} TESTED_WITH_APPVERIFIER) - if(MSVC OR CMAKE_SIZEOF_VOID_P EQUAL 8) - 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}) - - # Temporarily disabled debug kernel generation on gen8 - if(NOT ("${GEN_TYPE_LOWER}" STREQUAL "gen8")) - neo_gen_kernel_with_kernel_debug_options(test_kernel_debug_enable_${PLATFORM_IT_LOWER} ${PLATFORM_IT_LOWER} ${TEST_KERNEL}) - endif() - - add_dependencies(unit_tests test_kernels_${PLATFORM_IT_LOWER}) - add_dependencies(unit_tests test_kernel_${PLATFORM_IT_LOWER}) - - # Temporarily disabled debug kernel generation on gen8 - if(NOT ("${GEN_TYPE_LOWER}" STREQUAL "gen8")) - add_dependencies(unit_tests test_kernel_debug_enable_${PLATFORM_IT_LOWER}) - endif() - - set(sip_kernel_file_name) - set(sip_kernel_output_file) - set(sip_debug_kernel_output_file) - set(sip_debug_local_kernel_output_file) - list(APPEND sip_kernel_file_name "test_files/sip_dummy_kernel_${NEO_BITS}.ll") - list(APPEND sip_debug_kernel_output_file "sip_dummy_kernel_debug_${NEO_BITS}") - list(APPEND sip_debug_local_kernel_output_file "sip_dummy_kernel_debug_local_${NEO_BITS}") - - # Temporarily disabled sip kernel generation - # if("${GEN_TYPE_LOWER}" STREQUAL "gen9" ) - # neo_gen_kernel_from_ll(test_kernel_sip_debug_local_${PLATFORM_IT_LOWER} ${PLATFORM_IT_LOWER} ${sip_kernel_file_name} ${sip_debug_local_kernel_output_file} ${TEST_KERNEL_SIP_DEBUG_LOCAL_options}) - # add_dependencies(unit_tests test_kernel_sip_debug_local_${PLATFORM_IT_LOWER}) - # endif() - - # neo_gen_kernel_from_ll(test_kernel_sip_debug_${PLATFORM_IT_LOWER} ${PLATFORM_IT_LOWER} ${sip_kernel_file_name} ${sip_debug_kernel_output_file} ${TEST_KERNEL_SIP_DEBUG_options}) - # add_dependencies(unit_tests test_kernel_sip_debug_${PLATFORM_IT_LOWER}) - - if(${PLATFORM_SUPPORTS_2_0}) - neo_gen_kernel_with_options(test_kernel_2_0_${PLATFORM_IT_LOWER} ${PLATFORM_IT_LOWER} ${TEST_KERNEL_2_0} ${TEST_KERNEL_2_0_options}) - add_dependencies(unit_tests test_kernel_2_0_${PLATFORM_IT_LOWER}) - endif() - endif() apply_macro_for_each_test_config("UNIT_TESTS") endmacro() macro(macro_for_each_gen) + foreach(PLATFORM_TYPE "CORE" "LP") + 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}) + set(PLATFORM_2_0_LOWER ${DEFAULT_SUPPORTED_2_0_${GEN_TYPE}_${PLATFORM_TYPE}_PLATFORM}) + + if(MSVC OR CMAKE_SIZEOF_VOID_P EQUAL 8) + neo_gen_kernels(test_kernels_${family_name_with_type} ${PLATFORM_LOWER} ${family_name_with_type} ${TEST_KERNELS}) + neo_gen_kernel_with_options(test_kernel_${family_name_with_type} ${PLATFORM_LOWER} ${family_name_with_type} ${TEST_KERNEL} ${TEST_KERNEL_options}) + + # Temporarily disabled debug kernel generation on gen8 + if(NOT ("${GEN_TYPE_LOWER}" STREQUAL "gen8")) + neo_gen_kernel_with_kernel_debug_options(test_kernel_debug_enable_${family_name_with_type} ${PLATFORM_LOWER} ${family_name_with_type} ${TEST_KERNEL}) + endif() + + + set(sip_kernel_file_name) + set(sip_kernel_output_file) + set(sip_debug_kernel_output_file) + set(sip_debug_local_kernel_output_file) + list(APPEND sip_kernel_file_name "test_files/sip_dummy_kernel_${NEO_BITS}.ll") + list(APPEND sip_debug_kernel_output_file "sip_dummy_kernel_debug_${NEO_BITS}") + list(APPEND sip_debug_local_kernel_output_file "sip_dummy_kernel_debug_local_${NEO_BITS}") + + # Temporarily disabled sip kernel generation + # if("${GEN_TYPE_LOWER}" STREQUAL "gen9" ) + # neo_gen_kernel_from_ll(test_kernel_sip_debug_local_${family_name_with_type} ${PLATFORM_LOWER} ${family_name_with_type} ${sip_kernel_file_name} ${sip_debug_local_kernel_output_file} ${TEST_KERNEL_SIP_DEBUG_LOCAL_options}) + # add_dependencies(unit_tests test_kernel_sip_debug_local_${family_name_with_type}) + # endif() + + # neo_gen_kernel_from_ll(test_kernel_sip_debug_${family_name_with_type} ${PLATFORM_LOWER} ${family_name_with_type} ${sip_kernel_file_name} ${sip_debug_kernel_output_file} ${TEST_KERNEL_SIP_DEBUG_options}) + # add_dependencies(unit_tests test_kernel_sip_debug_${family_name_with_type}) + + if(PLATFORM_2_0_LOWER) + neo_gen_kernel_with_options(test_kernel_2_0_${family_name_with_type} ${PLATFORM_2_0_LOWER} ${family_name_with_type} ${TEST_KERNEL_2_0} ${TEST_KERNEL_2_0_options}) + endif() + endif() + endif() + endforeach() apply_macro_for_each_platform() endmacro() apply_macro_for_each_gen("TESTED") +add_subdirectories() create_project_source_tree(igdrcl_tests ${IGDRCL_SOURCE_DIR}/runtime) diff --git a/unit_tests/aub_tests/CMakeLists.txt b/unit_tests/aub_tests/CMakeLists.txt index e5d733a2b3e09..498a4eba20069 100644 --- a/unit_tests/aub_tests/CMakeLists.txt +++ b/unit_tests/aub_tests/CMakeLists.txt @@ -75,12 +75,17 @@ macro(macro_for_each_platform) DEPENDS igdrcl_aub_tests DEPENDS copy_test_files_${PLATFORM_IT_LOWER} ) - add_dependencies(${PLATFORM_IT_LOWER}_aub_tests test_kernels_${PLATFORM_IT_LOWER}) - add_dependencies(${PLATFORM_IT_LOWER}_aub_tests test_kernel_${PLATFORM_IT_LOWER}) - PLATFORM_HAS_2_0(${GEN_TYPE} ${PLATFORM_IT} PLATFORM_SUPPORTS_2_0) - if(${PLATFORM_SUPPORTS_2_0}) - add_dependencies(${PLATFORM_IT_LOWER}_aub_tests test_kernel_2_0_${PLATFORM_IT_LOWER}) - endif(${PLATFORM_SUPPORTS_2_0}) + foreach(PLATFORM_TYPE "CORE" "LP") + if(${PLATFORM_IT}_IS_${PLATFORM_TYPE}) + get_family_name_with_type(${GEN_TYPE} ${PLATFORM_TYPE}) + add_dependencies(${PLATFORM_IT_LOWER}_aub_tests test_kernels_${family_name_with_type}) + add_dependencies(${PLATFORM_IT_LOWER}_aub_tests test_kernel_${family_name_with_type}) + PLATFORM_HAS_2_0(${GEN_TYPE} ${PLATFORM_IT} PLATFORM_SUPPORTS_2_0) + if(PLATFORM_SUPPORTS_2_0) + add_dependencies(${PLATFORM_IT_LOWER}_aub_tests test_kernel_2_0_${family_name_with_type}) + endif() + endif() + endforeach() add_custom_target(run_${PLATFORM_IT_LOWER}_aub_tests ALL DEPENDS ${PLATFORM_IT_LOWER}_aub_tests) add_dependencies(run_aub_tests run_${PLATFORM_IT_LOWER}_aub_tests) set_target_properties(${PLATFORM_IT_LOWER}_aub_tests PROPERTIES FOLDER "${PLATFORM_SPECIFIC_TARGETS_FOLDER}/${PLATFORM_IT_LOWER}") diff --git a/unit_tests/main.cpp b/unit_tests/main.cpp index 58ebb99e555ce..0c5ca84b13958 100644 --- a/unit_tests/main.cpp +++ b/unit_tests/main.cpp @@ -305,7 +305,8 @@ int main(int argc, char **argv) { device.pSysInfo = >SystemInfo; device.capabilityTable = hardwareInfo->capabilityTable; - binaryNameSuffix.append(hardwarePrefix[productFamily]); + binaryNameSuffix.append(familyName[device.pPlatform->eRenderCoreFamily]); + binaryNameSuffix.append(getPlatformType(device)); std::string nBinaryKernelFiles = getRunPath(argv[0]); nBinaryKernelFiles.append("/"); diff --git a/unit_tests/mt_tests/CMakeLists.txt b/unit_tests/mt_tests/CMakeLists.txt index f4ea4fb7f86c5..bb5a4c76f510e 100644 --- a/unit_tests/mt_tests/CMakeLists.txt +++ b/unit_tests/mt_tests/CMakeLists.txt @@ -92,12 +92,17 @@ target_include_directories(igdrcl_mt_tests BEFORE PRIVATE ${IGDRCL_SOURCE_DIR}/u macro(macro_for_each_test_config) run_mt_tests(${PLATFORM_IT_LOWER} ${SLICES} ${SUBSLICES} ${EU_PER_SS}) + if(MSVC OR CMAKE_SIZEOF_VOID_P EQUAL 8) + foreach(PLATFORM_TYPE "CORE" "LP") + if(${PLATFORM_IT}_IS_${PLATFORM_TYPE}) + get_family_name_with_type(${GEN_TYPE} ${PLATFORM_TYPE}) + add_dependencies(run_${PLATFORM_IT_LOWER}_mt_unit_tests test_kernels_${family_name_with_type}) + endif() + endforeach() + endif() endmacro() macro(macro_for_each_platform) - if(MSVC OR CMAKE_SIZEOF_VOID_P EQUAL 8) - add_dependencies(igdrcl_mt_tests test_kernels_${PLATFORM_IT_LOWER}) - endif() apply_macro_for_each_test_config("MT_TESTS") endmacro() diff --git a/unit_tests/offline_compiler/CMakeLists.txt b/unit_tests/offline_compiler/CMakeLists.txt index d6400e3c20169..1bd091d8724d6 100644 --- a/unit_tests/offline_compiler/CMakeLists.txt +++ b/unit_tests/offline_compiler/CMakeLists.txt @@ -70,9 +70,25 @@ string(TOLOWER ${DEFAULT_TESTED_PLATFORM} CLOC_DEFAULT_DEVICE) add_custom_target(run_cloc_tests ALL DEPENDS cloc_tests - DEPENDS copy_test_files_${CLOC_DEFAULT_DEVICE} - DEPENDS test_kernels_${CLOC_DEFAULT_DEVICE} ) +macro(macro_for_each_platform) + if("${PLATFORM_IT_LOWER}" STREQUAL "${CLOC_DEFAULT_DEVICE}") + foreach(PLATFORM_TYPE "CORE" "LP") + if(${PLATFORM_IT}_IS_${PLATFORM_TYPE}) + get_family_name_with_type(${GEN_TYPE} ${PLATFORM_TYPE}) + add_dependencies(run_cloc_tests test_kernels_${family_name_with_type}) + neo_copy_test_files(copy_test_files_${family_name_with_type} ${family_name_with_type}) + add_dependencies(run_cloc_tests copy_test_files_${family_name_with_type}) + set(run_tests_cmd cloc_tests --device ${CLOC_DEFAULT_DEVICE} --family_type ${family_name_with_type}) + endif() + endforeach() + endif() +endmacro() +macro(macro_for_each_gen) + apply_macro_for_each_platform() +endmacro() + +apply_macro_for_each_gen("TESTED") set_property(TARGET run_cloc_tests PROPERTY FOLDER ${CLOC_FOLDER}) @@ -85,7 +101,7 @@ if(WIN32) COMMAND ${CMAKE_COMMAND} -E remove ${TargetDir}/${CLOC_DEFAULT_DEVICE}/copybuffer_${CLOC_DEFAULT_DEVICE}.gen COMMAND ${CMAKE_COMMAND} -E remove ${TargetDir}/${CLOC_DEFAULT_DEVICE}/copybuffer_${CLOC_DEFAULT_DEVICE}.bin COMMAND ${CMAKE_COMMAND} -E remove_directory ${TargetDir}/${CLOC_DEFAULT_DEVICE}/offline_compiler_test - COMMAND cloc_tests --device ${CLOC_DEFAULT_DEVICE} + COMMAND ${run_tests_cmd} WORKING_DIRECTORY ${TargetDir} ) else() @@ -98,7 +114,7 @@ else() COMMAND ${CMAKE_COMMAND} -E remove ${TargetDir}/${CLOC_DEFAULT_DEVICE}/*.ll COMMAND ${CMAKE_COMMAND} -E remove ${TargetDir}/${CLOC_DEFAULT_DEVICE}/*.bin COMMAND ${CMAKE_COMMAND} -E remove_directory "${TargetDir}/offline_compiler_test" - COMMAND cloc_tests --device ${CLOC_DEFAULT_DEVICE} + COMMAND ${run_tests_cmd} WORKING_DIRECTORY ${TargetDir} ) endif() diff --git a/unit_tests/offline_compiler/environment.h b/unit_tests/offline_compiler/environment.h index a457397dc1ad2..e0d899a4385ba 100644 --- a/unit_tests/offline_compiler/environment.h +++ b/unit_tests/offline_compiler/environment.h @@ -22,6 +22,7 @@ #pragma once +#include "offline_compiler/offline_compiler.h" #include "runtime/os_interface/os_inc_base.h" #include "gtest/gtest.h" #include "unit_tests/mocks/mock_compilers.h" @@ -29,8 +30,8 @@ class Environment : public ::testing::Environment { public: - Environment(const std::string &devicePrefix) - : libraryFrontEnd(nullptr), libraryIGC(nullptr), devicePrefix(devicePrefix) { + Environment(const std::string &devicePrefix, const std::string &familyNameWithType) + : libraryFrontEnd(nullptr), libraryIGC(nullptr), devicePrefix(devicePrefix), familyNameWithType(familyNameWithType) { } void SetInputFileName( @@ -66,4 +67,5 @@ class Environment : public ::testing::Environment { OCLRT::MockCompilerEnableGuard mockCompilerGuard; const std::string devicePrefix; + const std::string familyNameWithType; }; diff --git a/unit_tests/offline_compiler/main.cpp b/unit_tests/offline_compiler/main.cpp index c91d84e19362c..3b6343a8e7fe6 100644 --- a/unit_tests/offline_compiler/main.cpp +++ b/unit_tests/offline_compiler/main.cpp @@ -51,6 +51,7 @@ int main(int argc, char **argv) { int retVal = 0; bool useDefaultListener = false; std::string devicePrefix("skl"); + std::string familyNameWithType("Gen9core"); #if defined(__linux__) if (getenv("CLOC_SELFTEST") == nullptr) { @@ -81,6 +82,9 @@ int main(int argc, char **argv) { } else if (strcmp("--device", argv[i]) == 0) { ++i; devicePrefix = argv[i]; + } else if (strcmp("--family_type", argv[i]) == 0) { + ++i; + familyNameWithType = argv[i]; } } } @@ -90,21 +94,21 @@ int main(int argc, char **argv) { // working directories std::string nTestFiles = getRunPath(); nTestFiles.append("/"); - nTestFiles.append(devicePrefix); + nTestFiles.append(familyNameWithType); nTestFiles.append("/"); nTestFiles.append(testFiles); testFiles = nTestFiles; - binaryNameSuffix.append(devicePrefix); + binaryNameSuffix.append(familyNameWithType); #ifdef WIN32 #include - if (_chdir(devicePrefix.c_str())) { - std::cout << "chdir into " << devicePrefix << " directory failed.\nThis might cause test failures." << std::endl; + if (_chdir(familyNameWithType.c_str())) { + std::cout << "chdir into " << familyNameWithType << " directory failed.\nThis might cause test failures." << std::endl; } #elif defined(__linux__) #include - if (chdir(devicePrefix.c_str()) != 0) { - std::cout << "chdir into " << devicePrefix << " directory failed.\nThis might cause test failures." << std::endl; + if (chdir(familyNameWithType.c_str()) != 0) { + std::cout << "chdir into " << familyNameWithType << " directory failed.\nThis might cause test failures." << std::endl; } #endif @@ -118,7 +122,7 @@ int main(int argc, char **argv) { listeners.Append(customEventListener); } - gEnvironment = reinterpret_cast(::testing::AddGlobalTestEnvironment(new Environment(devicePrefix))); + gEnvironment = reinterpret_cast(::testing::AddGlobalTestEnvironment(new Environment(devicePrefix, familyNameWithType))); retVal = RUN_ALL_TESTS(); diff --git a/unit_tests/offline_compiler/offline_compiler_tests.cpp b/unit_tests/offline_compiler/offline_compiler_tests.cpp index c581add28b935..f7d814037d138 100644 --- a/unit_tests/offline_compiler/offline_compiler_tests.cpp +++ b/unit_tests/offline_compiler/offline_compiler_tests.cpp @@ -40,7 +40,7 @@ namespace OCLRT { std::string getCompilerOutputFileName(const std::string &fileName, const std::string &type) { std::string fName(fileName); fName.append("_"); - fName.append(gEnvironment->devicePrefix); + fName.append(gEnvironment->familyNameWithType); fName.append("."); fName.append(type); return fName; @@ -151,30 +151,30 @@ TEST_F(OfflineCompilerTests, GoodParseBinToCharArray) { 0x34, 0x5, 0x60, 0x78, 0x9, 0x66, 0xff, }; - std::string deviceName = gEnvironment->devicePrefix; + std::string familyNameWithType = gEnvironment->familyNameWithType; std::string fileName = "scheduler"; - std::string retArray = pOfflineCompiler->parseBinAsCharArray(binary, sizeof(binary), deviceName, fileName); + std::string retArray = pOfflineCompiler->parseBinAsCharArray(binary, sizeof(binary), fileName); std::string target = "#include \n" "#include \n\n" "size_t SchedulerBinarySize_" + - deviceName + " = 37;\n" - "uint32_t SchedulerBinary_" + - deviceName + "[10] = {\n" - " 0x40032302, 0x90800756, 0x05340301, 0x66097860, 0x101010ff, 0x40032302, 0x90800756, 0x05340301, \n" - " 0x66097860, 0xff000000};\n\n" - "#include \"runtime/built_ins/registry/built_ins_registry.h\"\n\n" - "namespace OCLRT {\n" - "static RegisterEmbeddedResource registerSchedulerBin(\n" - " createBuiltinResourceName(\n" - " EBuiltInOps::Scheduler,\n" - " BuiltinCode::getExtension(BuiltinCode::ECodeType::Binary), \"" + - deviceName + "\", 0)\n" - " .c_str(),\n" - " (const char *)SchedulerBinary_" + - deviceName + ",\n" - " SchedulerBinarySize_" + - deviceName + ");\n" - "}\n"; + familyNameWithType + " = 37;\n" + "uint32_t SchedulerBinary_" + + familyNameWithType + "[10] = {\n" + " 0x40032302, 0x90800756, 0x05340301, 0x66097860, 0x101010ff, 0x40032302, 0x90800756, 0x05340301, \n" + " 0x66097860, 0xff000000};\n\n" + "#include \"runtime/built_ins/registry/built_ins_registry.h\"\n\n" + "namespace OCLRT {\n" + "static RegisterEmbeddedResource registerSchedulerBin(\n" + " createBuiltinResourceName(\n" + " EBuiltInOps::Scheduler,\n" + " BuiltinCode::getExtension(BuiltinCode::ECodeType::Binary), \"" + + familyNameWithType + "\", 0)\n" + " .c_str(),\n" + " (const char *)SchedulerBinary_" + + familyNameWithType + ",\n" + " SchedulerBinarySize_" + + familyNameWithType + ");\n" + "}\n"; EXPECT_EQ(retArray, target); delete pOfflineCompiler;