mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00

Related-To: NEO-6075 After this change driver will fail clBuildProgram/zeModuleCreate api calls whenever stateful access is discovered on PVC. This is required since in this case allocation greater than 4GB will not work. If user still wants to use stateful addressing mode, -cl-opt-smaller-than-4GB-buffers-only / -ze-opt-smaller-than-4GB-buffers-only build option should be passed as build option, but then user can not use bufers greater than 4GB. Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
46 lines
1.8 KiB
C++
46 lines
1.8 KiB
C++
/*
|
|
* Copyright (C) 2021-2022 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "shared/source/helpers/addressing_mode_helper.h"
|
|
|
|
#include "shared/source/compiler_interface/compiler_options/compiler_options_base.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 forceToStatelessNeeded(const std::string &options, const std::string &smallerThan4GbBuffersOnlyOption, const HardwareInfo &hwInfo) {
|
|
auto preferStateful = false;
|
|
if (NEO::CompilerOptions::contains(options, smallerThan4GbBuffersOnlyOption)) {
|
|
preferStateful = true;
|
|
}
|
|
if (NEO::DebugManager.flags.UseSmallerThan4gbBuffersOnly.get() != -1) {
|
|
preferStateful = static_cast<bool>(NEO::DebugManager.flags.UseSmallerThan4gbBuffersOnly.get());
|
|
}
|
|
|
|
const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(hwInfo.platform.eProductFamily);
|
|
auto forceStateless = !preferStateful && compilerHwInfoConfig.isForceToStatelessRequired();
|
|
return forceStateless;
|
|
}
|
|
|
|
bool containsStatefulAccess(const std::vector<KernelInfo *> &kernelInfos) {
|
|
for (const auto &kernelInfo : kernelInfos) {
|
|
for (const auto &arg : kernelInfo->kernelDescriptor.payloadMappings.explicitArgs) {
|
|
auto isStatefulAccess = arg.is<NEO::ArgDescriptor::ArgTPointer>() &&
|
|
(NEO::isValidOffset(arg.as<NEO::ArgDescPointer>().bindless) ||
|
|
NEO::isValidOffset(arg.as<NEO::ArgDescPointer>().bindful));
|
|
if (isStatefulAccess) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
} // namespace NEO::AddressingModeHelper
|