Disable Zebin on pre-Gen12 platforms with debugger active and spirv

Related-To: NEO-7328
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2022-12-07 14:49:51 +00:00
committed by Compute-Runtime-Automation
parent b6c51c6793
commit 1961842601
10 changed files with 125 additions and 5 deletions

View File

@@ -110,11 +110,18 @@ if(SUPPORT_GEN9 OR SUPPORT_GEN11 OR SUPPORT_GEN12LP)
)
endif()
if(SUPPORT_GEN12LP)
list(APPEND L0_RUNTIME_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/hw_helpers/l0_hw_helper_tgllp_and_later.inl
)
endif()
if(SUPPORT_XEHP_AND_LATER)
list(APPEND L0_RUNTIME_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/cmdlist/cmdlist_hw_xehp_and_later.inl
${CMAKE_CURRENT_SOURCE_DIR}/cmdqueue/cmdqueue_xe_hp_core_and_later.inl
${CMAKE_CURRENT_SOURCE_DIR}/hw_helpers/l0_hw_helper_xehp_and_later.inl
${CMAKE_CURRENT_SOURCE_DIR}/hw_helpers/l0_hw_helper_tgllp_and_later.inl
)
endif()

View File

@@ -10,6 +10,7 @@
#include "level_zero/core/source/helpers/l0_populate_factory.h"
#include "level_zero/core/source/hw_helpers/l0_hw_helper_base.inl"
#include "level_zero/core/source/hw_helpers/l0_hw_helper_skl_to_tgllp.inl"
#include "level_zero/core/source/hw_helpers/l0_hw_helper_tgllp_and_later.inl"
#include "level_zero/core/source/hw_helpers/l0_hw_helper_tgllp_to_dg2.inl"
#include "level_zero/tools/source/debug/eu_thread.h"

View File

@@ -20,6 +20,7 @@ enum class EngineGroupType : uint32_t;
struct HardwareInfo;
struct EngineGroupT;
struct RootDeviceEnvironment;
class SourceLevelDebugger;
} // namespace NEO
namespace L0 {
@@ -56,7 +57,7 @@ class L0GfxCoreHelper {
virtual bool platformSupportsFrontEndTracking() const = 0;
virtual bool platformSupportsPipelineSelectTracking() const = 0;
virtual bool platformSupportsRayTracing() const = 0;
virtual bool isZebinAllowed(const NEO::SourceLevelDebugger *debugger) const = 0;
virtual uint32_t getEventMaxKernelCount(const NEO::HardwareInfo &hwInfo) const = 0;
virtual uint32_t getEventBaseMaxPacketCount(const NEO::HardwareInfo &hwInfo) const = 0;
@@ -88,7 +89,7 @@ class L0GfxCoreHelperHw : public L0GfxCoreHelper {
bool platformSupportsFrontEndTracking() const override;
bool platformSupportsPipelineSelectTracking() const override;
bool platformSupportsRayTracing() const override;
bool isZebinAllowed(const NEO::SourceLevelDebugger *debugger) const override;
uint32_t getEventMaxKernelCount(const NEO::HardwareInfo &hwInfo) const override;
uint32_t getEventBaseMaxPacketCount(const NEO::HardwareInfo &hwInfo) const override;
};

View File

@@ -76,4 +76,9 @@ std::vector<EuThread::ThreadId> L0GfxCoreHelperHw<Family>::getThreadsFromAttenti
return threads;
}
template <typename Family>
bool L0GfxCoreHelperHw<Family>::isZebinAllowed(const NEO::SourceLevelDebugger *debugger) const {
return !debugger;
}
} // namespace L0

View File

@@ -0,0 +1,17 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "level_zero/core/source/hw_helpers/l0_hw_helper.h"
namespace L0 {
template <typename Family>
bool L0GfxCoreHelperHw<Family>::isZebinAllowed(const NEO::SourceLevelDebugger *debugger) const {
return true;
}
} // namespace L0

View File

@@ -33,6 +33,7 @@
#include "level_zero/core/source/device/device.h"
#include "level_zero/core/source/driver/driver_handle.h"
#include "level_zero/core/source/hw_helpers/l0_hw_helper.h"
#include "level_zero/core/source/kernel/kernel.h"
#include "level_zero/core/source/module/module_build_log.h"
@@ -243,17 +244,28 @@ ze_result_t ModuleTranslationUnit::buildFromSpirV(const char *input, uint32_t in
return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE;
}
std::string internalOptions = this->generateCompilerOptions(buildOptions, internalBuildOptions);
auto specConstantResult = this->processSpecConstantInfo(compilerInterface, pConstants, input, inputSize);
if (!specConstantResult) {
return ZE_RESULT_ERROR_MODULE_BUILD_FAILURE;
}
auto &l0GfxCoreHelper = this->device->getNEODevice()->getRootDeviceEnvironment().getHelper<L0GfxCoreHelper>();
std::string internalOptions = this->generateCompilerOptions(buildOptions, internalBuildOptions);
auto isZebinAllowed = l0GfxCoreHelper.isZebinAllowed(this->device->getSourceLevelDebugger());
if (isZebinAllowed == false) {
auto pos = this->options.find(NEO::CompilerOptions::allowZebin.str());
if (pos != std::string::npos) {
updateBuildLog("Cannot build zebinary for this device with debugger enabled. Remove \"-ze-intel-allow-zebin\" build flag.");
return ZE_RESULT_ERROR_MODULE_BUILD_FAILURE;
}
internalOptions += " " + NEO::CompilerOptions::disableZebin.str();
}
NEO::TranslationInput inputArgs = {IGC::CodeType::spirV, IGC::CodeType::oclGenBin};
inputArgs.src = ArrayRef<const char>(input, inputSize);
inputArgs.apiOptions = ArrayRef<const char>(options.c_str(), options.length());
inputArgs.apiOptions = ArrayRef<const char>(this->options.c_str(), this->options.length());
inputArgs.internalOptions = ArrayRef<const char>(internalOptions.c_str(), internalOptions.length());
inputArgs.allowCaching = true;
return this->compileGenBinary(inputArgs, false);

View File

@@ -9,6 +9,7 @@
#include "level_zero/core/source/helpers/l0_populate_factory.h"
#include "level_zero/core/source/hw_helpers/l0_hw_helper_base.inl"
#include "level_zero/core/source/hw_helpers/l0_hw_helper_tgllp_and_later.inl"
#include "level_zero/core/source/hw_helpers/l0_hw_helper_tgllp_to_dg2.inl"
#include "level_zero/core/source/hw_helpers/l0_hw_helper_xehp_and_later.inl"

View File

@@ -10,6 +10,7 @@
#include "level_zero/core/source/helpers/l0_populate_factory.h"
#include "level_zero/core/source/hw_helpers/l0_hw_helper_base.inl"
#include "level_zero/core/source/hw_helpers/l0_hw_helper_pvc_and_later.inl"
#include "level_zero/core/source/hw_helpers/l0_hw_helper_tgllp_and_later.inl"
#include "level_zero/core/source/hw_helpers/l0_hw_helper_xehp_and_later.inl"
namespace L0 {

View File

@@ -9,6 +9,7 @@
#include "level_zero/core/source/helpers/l0_populate_factory.h"
#include "level_zero/core/source/hw_helpers/l0_hw_helper_base.inl"
#include "level_zero/core/source/hw_helpers/l0_hw_helper_tgllp_and_later.inl"
#include "level_zero/core/source/hw_helpers/l0_hw_helper_tgllp_to_dg2.inl"
#include "level_zero/core/source/hw_helpers/l0_hw_helper_xehp_and_later.inl"