fix(zebin): Enforce fallback to CTNI on TGL/ICL for nGEN dummy kernel

For TGL and ICL platforms - if on clCreateProgramWithSource()
call we detect a nGen dummy kernel usage - enforce fallback to the
patchtokens format (only for this kernel).
- corrected naming
- minor ULTs refactor (less dependencies).
Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit is contained in:
Kacper Nowak
2023-01-11 16:46:43 +00:00
committed by Compute-Runtime-Automation
parent 0c3cde2141
commit d2a2656caa
19 changed files with 216 additions and 26 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -20,8 +20,8 @@ bool AILConfiguration::isKernelHashCorrect(const std::string &kernelsSources, ui
return hash == expectedHash;
}
bool AILConfiguration::sourcesContainKernel(const std::string &kernelsSources, std::string_view kernelName) const {
return (kernelsSources.find(kernelName) != std::string::npos);
bool AILConfiguration::sourcesContain(const std::string &sources, std::string_view contentToFind) const {
return (sources.find(contentToFind) != std::string::npos);
}
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -49,11 +49,13 @@ class AILConfiguration {
virtual void modifyKernelIfRequired(std::string &kernel) = 0;
virtual void forceFallbackToPatchtokensIfRequired(const std::string &kernelSources, bool &requiresFallback) = 0;
protected:
virtual void applyExt(RuntimeCapabilityTable &runtimeCapabilityTable) = 0;
std::string processName;
bool sourcesContainKernel(const std::string &kernelSources, std::string_view kernelName) const;
bool sourcesContain(const std::string &sources, std::string_view contentToFind) const;
MOCKABLE_VIRTUAL bool isKernelHashCorrect(const std::string &kernelSources, uint64_t expectedHash) const;
};
@@ -70,6 +72,7 @@ class AILConfigurationHw : public AILConfiguration {
void applyExt(RuntimeCapabilityTable &runtimeCapabilityTable) override;
void modifyKernelIfRequired(std::string &kernel) override;
void forceFallbackToPatchtokensIfRequired(const std::string &kernelSources, bool &requiresFallback) override;
};
template <PRODUCT_FAMILY product>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Intel Corporation
* Copyright (C) 2022-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -15,6 +15,10 @@ template <PRODUCT_FAMILY Product>
void AILConfigurationHw<Product>::modifyKernelIfRequired(std::string &kernel) {
}
template <PRODUCT_FAMILY Product>
inline void AILConfigurationHw<Product>::forceFallbackToPatchtokensIfRequired(const std::string &kernelSources, bool &requiresFallback) {
}
template <PRODUCT_FAMILY Product>
inline void AILConfigurationHw<Product>::applyExt(RuntimeCapabilityTable &runtimeCapabilityTable) {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Intel Corporation
* Copyright (C) 2022-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -34,5 +34,17 @@ inline void AILConfigurationHw<IGFX_ICELAKE_LP>::applyExt(RuntimeCapabilityTable
}
}
// To avoid a known oneDNN issue in ZEBin handling, affecting ICL and TGL platforms,
// fall back to legacy (patchtoken) format when dummy kernel used by nGen is detected.
// Only this specific kernel with that exact source code will be affected.
template <>
inline void AILConfigurationHw<IGFX_ICELAKE_LP>::forceFallbackToPatchtokensIfRequired(const std::string &kernelSources, bool &setFallback) {
std::string_view dummyKernelSource{"kernel void _(){}"};
if (sourcesContain(kernelSources, dummyKernelSource)) {
setFallback = true;
}
}
template class AILConfigurationHw<IGFX_ICELAKE_LP>;
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -15,6 +15,18 @@ static EnableAIL<IGFX_TIGERLAKE_LP> enableAILTGLLP;
std::map<std::string_view, std::vector<AILEnumeration>> applicationMapTGLLP = {};
// To avoid a known oneDNN issue in ZEBin handling, affecting ICL and TGL platforms,
// fall back to legacy (patchtoken) format when dummy kernel used by nGen is detected.
// Only this specific kernel with that exact source code will be affected.
template <>
inline void AILConfigurationHw<IGFX_TIGERLAKE_LP>::forceFallbackToPatchtokensIfRequired(const std::string &kernelSources, bool &requiresFallback) {
std::string_view dummyKernelSource{"kernel void _(){}"};
if (sourcesContain(kernelSources, dummyKernelSource)) {
requiresFallback = true;
}
}
template class AILConfigurationHw<IGFX_TIGERLAKE_LP>;
} // namespace NEO

View File

@@ -1,11 +1,11 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/ail/ail_configuration.h"
#include "shared/source/ail/ail_configuration_base.inl"
#include "shared/source/helpers/hw_info.h"
#include <algorithm>
@@ -62,7 +62,7 @@ void AILConfigurationHw<IGFX_DG2>::modifyKernelIfRequired(std::string &kernelsSo
if (it != applicationsKernelFixesDG2.end()) {
if (sourcesContainKernel(kernelsSources, it->kernelName) && isKernelHashCorrect(kernelsSources, it->kernelHash)) {
if (sourcesContain(kernelsSources, it->kernelName) && isKernelHashCorrect(kernelsSources, it->kernelHash)) {
kernelsSources.insert(it->fixStartPosition, it->fixCode);
}
}