mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +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
@@ -9,6 +9,7 @@
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/device_binary_format/device_binary_formats.h"
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/helpers/addressing_mode_helper.h"
|
||||
#include "shared/source/helpers/compiler_options_parser.h"
|
||||
#include "shared/source/program/kernel_info.h"
|
||||
#include "shared/source/source_level_debugger/source_level_debugger.h"
|
||||
@@ -34,8 +35,7 @@ cl_int Program::build(
|
||||
const char *buildOptions,
|
||||
bool enableCaching) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
std::string internalOptions;
|
||||
initInternalOptions(internalOptions);
|
||||
|
||||
auto defaultClDevice = deviceVector[0];
|
||||
UNRECOVERABLE_IF(defaultClDevice == nullptr);
|
||||
auto &defaultDevice = defaultClDevice->getDevice();
|
||||
@@ -69,6 +69,9 @@ cl_int Program::build(
|
||||
} else if (this->createdFrom != CreatedFrom::BINARY) {
|
||||
options = "";
|
||||
}
|
||||
std::string internalOptions;
|
||||
initInternalOptions(internalOptions);
|
||||
|
||||
extractInternalOptions(options, internalOptions);
|
||||
applyAdditionalOptions(internalOptions);
|
||||
|
||||
@@ -170,6 +173,12 @@ cl_int Program::build(
|
||||
phaseReached[clDevice->getRootDeviceIndex()] = BuildPhase::BinaryProcessing;
|
||||
}
|
||||
|
||||
const auto &kernelInfoArray = buildInfos[clDevices[0]->getRootDeviceIndex()].kernelInfoArray;
|
||||
auto sharedSystemAllocationsAllowed = clDevices[0]->areSharedSystemAllocationsAllowed();
|
||||
if (AddressingModeHelper::containsStatefulAccess(kernelInfoArray) && AddressingModeHelper::forceToStatelessNeeded(options, CompilerOptions::smallerThan4gbBuffersOnly.str(), sharedSystemAllocationsAllowed) && !isBuiltIn) {
|
||||
retVal = CL_BUILD_PROGRAM_FAILURE;
|
||||
}
|
||||
|
||||
if (retVal != CL_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "shared/source/device_binary_format/elf/elf_encoder.h"
|
||||
#include "shared/source/device_binary_format/elf/ocl_elf.h"
|
||||
#include "shared/source/device_binary_format/patchtokens_decoder.h"
|
||||
#include "shared/source/helpers/addressing_mode_helper.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/source/helpers/compiler_options_parser.h"
|
||||
#include "shared/source/helpers/debug_helpers.h"
|
||||
@@ -74,7 +75,8 @@ void Program::initInternalOptions(std::string &internalOptions) const {
|
||||
CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::arch32bit);
|
||||
}
|
||||
|
||||
if ((isBuiltIn && is32bit) || pClDevice->areSharedSystemAllocationsAllowed() ||
|
||||
auto sharedSystemAllocationsAllowed = clDevices[0]->areSharedSystemAllocationsAllowed();
|
||||
if ((isBuiltIn && is32bit) || AddressingModeHelper::forceToStatelessNeeded(options, CompilerOptions::smallerThan4gbBuffersOnly.str(), sharedSystemAllocationsAllowed) ||
|
||||
DebugManager.flags.DisableStatelessToStatefulOptimization.get()) {
|
||||
CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::greaterThan4gbBuffersRequired);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user