Compile kernels per platform type (core/lp)

compiled kernels are in (binary dir)/(family name with type) folder

Change-Id: Ied1827ab7f4ecc5c1de4c3535b1c0ba3b5cd86ee
This commit is contained in:
Mateusz Jablonski
2018-04-17 18:11:50 +02:00
committed by sys_ocldev
parent 34ff5852eb
commit abbc0a5471
26 changed files with 297 additions and 220 deletions

View File

@ -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()

View File

@ -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 <cstddef>\n";
out << "#include <cstdint>\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());
}
}

View File

@ -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;

View File

@ -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")

View File

@ -200,11 +200,11 @@ std::unique_ptr<Program> 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) {

View File

@ -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()

View File

@ -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=$<TARGET_FILE_DIR:cloc> $<TARGET_FILE: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(cloc_cmd_prefix LD_LIBRARY_PATH=$<TARGET_FILE_DIR:cloc> $<TARGET_FILE:cloc>)
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")

View File

@ -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);
}

View File

@ -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 <cl_device_info Param>

View File

@ -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 = {

View File

@ -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 = {

View File

@ -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 = {

View File

@ -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 = {

View File

@ -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 = {

View File

@ -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 = {

View File

@ -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

View File

@ -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

View File

@ -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$<JOIN:${IGDRCL__IGC_INCLUDE_DIR}, -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=$<TARGET_FILE_DIR:cloc> $<TARGET_FILE: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(cloc_cmd_prefix LD_LIBRARY_PATH=$<TARGET_FILE_DIR:cloc> $<TARGET_FILE:cloc>)
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()

View File

@ -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=$<TARGET_FILE_DIR:cloc> $<TARGET_FILE:cloc>)
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)

View File

@ -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}")

View File

@ -305,7 +305,8 @@ int main(int argc, char **argv) {
device.pSysInfo = &gtSystemInfo;
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("/");

View File

@ -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()

View File

@ -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()

View File

@ -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;
};

View File

@ -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 <direct.h>
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 <unistd.h>
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<Environment *>(::testing::AddGlobalTestEnvironment(new Environment(devicePrefix)));
gEnvironment = reinterpret_cast<Environment *>(::testing::AddGlobalTestEnvironment(new Environment(devicePrefix, familyNameWithType)));
retVal = RUN_ALL_TESTS();

View File

@ -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 <cstddef>\n"
"#include <cstdint>\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;