mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
Fail build program in shared system USM + stateful access case
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com> Related-To: NEO-6075 After this change driver will fail clBuildProgram/zeModuleCreate api calls whenever stateful access is discovered and device has shared system usm caps enabled.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 buffers greater than 4GB.
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
d497392b55
commit
0ad8afc0b3
@@ -15,6 +15,7 @@
|
||||
#include "shared/source/device_binary_format/elf/elf.h"
|
||||
#include "shared/source/device_binary_format/elf/elf_encoder.h"
|
||||
#include "shared/source/device_binary_format/elf/ocl_elf.h"
|
||||
#include "shared/source/helpers/addressing_mode_helper.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/source/helpers/constants.h"
|
||||
#include "shared/source/helpers/kernel_helpers.h"
|
||||
@@ -41,6 +42,7 @@ namespace BuildOptions {
|
||||
NEO::ConstStringRef optDisable = "-ze-opt-disable";
|
||||
NEO::ConstStringRef optLevel = "-ze-opt-level";
|
||||
NEO::ConstStringRef greaterThan4GbRequired = "-ze-opt-greater-than-4GB-buffer-required";
|
||||
NEO::ConstStringRef smallerThan4GbBuffersOnly = "-ze-opt-smaller-than-4GB-buffers-only";
|
||||
NEO::ConstStringRef hasBufferOffsetArg = "-ze-intel-has-buffer-offset-arg";
|
||||
NEO::ConstStringRef debugKernelEnable = "-ze-kernel-debug-enable";
|
||||
} // namespace BuildOptions
|
||||
@@ -122,8 +124,8 @@ std::string ModuleTranslationUnit::generateCompilerOptions(const char *buildOpti
|
||||
internalOptions = NEO::CompilerOptions::concatenate(internalOptions, BuildOptions::debugKernelEnable);
|
||||
}
|
||||
|
||||
if (NEO::DebugManager.flags.DisableStatelessToStatefulOptimization.get() ||
|
||||
device->getNEODevice()->areSharedSystemAllocationsAllowed()) {
|
||||
auto sharedSystemAllocationsAllowed = device->getNEODevice()->areSharedSystemAllocationsAllowed();
|
||||
if (NEO::DebugManager.flags.DisableStatelessToStatefulOptimization.get() || NEO::AddressingModeHelper::forceToStatelessNeeded(options, BuildOptions::smallerThan4GbBuffersOnly.str(), sharedSystemAllocationsAllowed)) {
|
||||
internalOptions = NEO::CompilerOptions::concatenate(internalOptions, NEO::CompilerOptions::greaterThan4gbBuffersRequired);
|
||||
}
|
||||
|
||||
@@ -529,6 +531,12 @@ bool ModuleImp::initialize(const ze_module_desc_t *desc, NEO::Device *neoDevice)
|
||||
this->updateBuildLog(neoDevice);
|
||||
verifyDebugCapabilities();
|
||||
|
||||
auto isUserKernel = (this->type == ModuleType::User);
|
||||
auto sharedSystemAllocationsAllowed = device->getNEODevice()->areSharedSystemAllocationsAllowed();
|
||||
if (NEO::AddressingModeHelper::containsStatefulAccess(this->translationUnit->programInfo.kernelInfos) && NEO::AddressingModeHelper::forceToStatelessNeeded(this->translationUnit->options, BuildOptions::smallerThan4GbBuffersOnly.str(), sharedSystemAllocationsAllowed) && isUserKernel) {
|
||||
success = false;
|
||||
}
|
||||
|
||||
if (false == success) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user