/* * Copyright (C) 2022 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "addressing_mode_helper.h" #include "shared/source/debug_settings/debug_settings_manager.h" #include "shared/source/helpers/compiler_hw_info_config.h" #include "shared/source/program/kernel_info.h" namespace NEO::AddressingModeHelper { bool failBuildProgramWithStatefulAccess(const HardwareInfo &hwInfo) { auto failBuildProgram = false; if (NEO::DebugManager.flags.FailBuildProgramWithStatefulAccess.get() != -1) { failBuildProgram = static_cast(NEO::DebugManager.flags.FailBuildProgramWithStatefulAccess.get()); } const auto &compilerProductHelper = *CompilerProductHelper::get(hwInfo.platform.eProductFamily); auto forceToStatelessRequired = compilerProductHelper.isForceToStatelessRequired(); return failBuildProgram && forceToStatelessRequired; } bool containsStatefulAccess(const std::vector &kernelInfos) { for (const auto &kernelInfo : kernelInfos) { for (const auto &arg : kernelInfo->kernelDescriptor.payloadMappings.explicitArgs) { auto isStatefulAccess = arg.is() && (NEO::isValidOffset(arg.as().bindless) || NEO::isValidOffset(arg.as().bindful)); if (isStatefulAccess) { return true; } } } return false; } } // namespace NEO::AddressingModeHelper