mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
fix: read ONEAPI_PVC_SEND_WAR_WA env
- disable optimization with compiler internal option when env is set to zero Related-To: NEO-15378, GSD-10884 Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
fc37b98b69
commit
703497b067
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "shared/source/built_ins/built_ins.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/helpers/compiler_product_helper.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
|
||||
@@ -353,9 +354,11 @@ std::unique_ptr<BuiltinFunctionsLibImpl::BuiltinData> BuiltinFunctionsLibImpl::l
|
||||
}
|
||||
|
||||
StackVec<BuiltInCodeType, 2> supportedTypes{};
|
||||
if (!NEO::debugManager.flags.RebuildPrecompiledKernels.get()) {
|
||||
bool requiresRebuild = !device->getNEODevice()->getExecutionEnvironment()->isOneApiPvcWaEnv();
|
||||
if (!requiresRebuild && !NEO::debugManager.flags.RebuildPrecompiledKernels.get()) {
|
||||
supportedTypes.push_back(BuiltInCodeType::binary);
|
||||
}
|
||||
|
||||
supportedTypes.push_back(BuiltInCodeType::intermediate);
|
||||
|
||||
NEO::BuiltinCode builtinCode{};
|
||||
|
||||
@@ -53,6 +53,8 @@ void DriverImp::initialize(ze_result_t *result) {
|
||||
envVariables.fp64Emulation =
|
||||
envReader.getSetting("NEO_FP64_EMULATION", false);
|
||||
|
||||
bool oneApiPvcWa = envReader.getSetting("ONEAPI_PVC_SEND_WAR_WA", true);
|
||||
|
||||
auto executionEnvironment = new NEO::ExecutionEnvironment();
|
||||
UNRECOVERABLE_IF(nullptr == executionEnvironment);
|
||||
|
||||
@@ -69,6 +71,7 @@ void DriverImp::initialize(ze_result_t *result) {
|
||||
}
|
||||
|
||||
executionEnvironment->setMetricsEnabled(envVariables.metrics);
|
||||
executionEnvironment->setOneApiPvcWaEnv(oneApiPvcWa);
|
||||
|
||||
executionEnvironment->incRefInternal();
|
||||
auto neoDevices = NEO::DeviceFactory::createDevices(*executionEnvironment);
|
||||
|
||||
@@ -327,6 +327,8 @@ ze_result_t ModuleTranslationUnit::createFromNativeBinary(const char *input, siz
|
||||
|
||||
bool rebuild = NEO::debugManager.flags.RebuildPrecompiledKernels.get() && irBinarySize != 0;
|
||||
rebuild |= NEO::isRebuiltToPatchtokensRequired(device->getNEODevice(), archive, this->options, this->isBuiltIn, false);
|
||||
rebuild |= !device->getNEODevice()->getExecutionEnvironment()->isOneApiPvcWaEnv();
|
||||
|
||||
if (rebuild && irBinarySize == 0) {
|
||||
driverHandle->clearErrorDescription();
|
||||
return ZE_RESULT_ERROR_INVALID_NATIVE_BINARY;
|
||||
@@ -927,6 +929,9 @@ void ModuleImp::createBuildOptions(const char *pBuildFlags, std::string &apiOpti
|
||||
this->isFunctionSymbolExportEnabled = moveBuildOption(apiOptions, apiOptions, BuildOptions::enableLibraryCompile, BuildOptions::enableLibraryCompile);
|
||||
this->isGlobalSymbolExportEnabled = moveBuildOption(apiOptions, apiOptions, BuildOptions::enableGlobalVariableSymbols, BuildOptions::enableGlobalVariableSymbols);
|
||||
|
||||
if (getDevice()->getNEODevice()->getExecutionEnvironment()->isOneApiPvcWaEnv() == false) {
|
||||
NEO::CompilerOptions::concatenateAppend(internalBuildOptions, NEO::CompilerOptions::optDisableSendWarWa);
|
||||
}
|
||||
createBuildExtraOptions(apiOptions, internalBuildOptions);
|
||||
}
|
||||
if (NEO::ApiSpecificConfig::getBindlessMode(*device->getNEODevice())) {
|
||||
|
||||
@@ -325,5 +325,19 @@ HWTEST_F(BuiltInTestsL0, givenDeviceWithUnregisteredBinaryBuiltinWhenGettingBuil
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(BuiltInTestsL0, givenOneApiPvcSendWarWaEnvFalseWhenGettingBuiltinThenIntermediateFormatIsUsed) {
|
||||
pDevice->incRefInternal();
|
||||
pDevice->getExecutionEnvironment()->setOneApiPvcWaEnv(false);
|
||||
|
||||
MockDeviceForBuiltinTests testDevice(pDevice);
|
||||
testDevice.builtins.reset(new BuiltinFunctionsLibImpl(&testDevice, pDevice->getBuiltIns()));
|
||||
for (uint32_t builtId = 0; builtId < static_cast<uint32_t>(Builtin::count); builtId++) {
|
||||
testDevice.getBuiltinFunctionsLib()->initBuiltinKernel(static_cast<Builtin>(builtId));
|
||||
}
|
||||
|
||||
EXPECT_TRUE(testDevice.createModuleCalled);
|
||||
EXPECT_EQ(ZE_MODULE_FORMAT_IL_SPIRV, testDevice.formatForModule);
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
|
||||
@@ -540,6 +540,40 @@ TEST_F(DriverImpTest, givenMissingMetricApiDependenciesWhenInitializingDriverImp
|
||||
EXPECT_TRUE(globalDriverHandles->empty());
|
||||
}
|
||||
|
||||
TEST_F(DriverImpTest, givenOneApiPvcSendWarWaEnvWhenCreatingExecutionEnvironmentThenCorrectEnvValueIsStored) {
|
||||
VariableBackup<uint32_t> mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0);
|
||||
{
|
||||
std::unordered_map<std::string, std::string> mockableEnvs = {{"ONEAPI_PVC_SEND_WAR_WA", "1"}};
|
||||
VariableBackup<std::unordered_map<std::string, std::string> *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs);
|
||||
|
||||
ze_result_t result = ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
DriverImp driverImp;
|
||||
driverImp.initialize(&result);
|
||||
|
||||
ASSERT_FALSE(globalDriverHandles->empty());
|
||||
auto driverHandle = static_cast<L0::DriverHandleImp *>((*globalDriverHandles)[0]);
|
||||
EXPECT_TRUE(driverHandle->devices[0]->getNEODevice()->getExecutionEnvironment()->isOneApiPvcWaEnv());
|
||||
|
||||
delete driverHandle;
|
||||
globalDriverHandles->clear();
|
||||
}
|
||||
{
|
||||
std::unordered_map<std::string, std::string> mockableEnvs = {{"ONEAPI_PVC_SEND_WAR_WA", "0"}};
|
||||
VariableBackup<std::unordered_map<std::string, std::string> *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs);
|
||||
|
||||
ze_result_t result = ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
DriverImp driverImp;
|
||||
driverImp.initialize(&result);
|
||||
|
||||
ASSERT_FALSE(globalDriverHandles->empty());
|
||||
auto driverHandle = static_cast<L0::DriverHandleImp *>((*globalDriverHandles)[0]);
|
||||
EXPECT_FALSE(driverHandle->devices[0]->getNEODevice()->getExecutionEnvironment()->isOneApiPvcWaEnv());
|
||||
|
||||
delete driverHandle;
|
||||
globalDriverHandles->clear();
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(DriverImpTest, givenEnabledProgramDebuggingWhenCreatingExecutionEnvironmentThenDebuggingEnabledIsTrue) {
|
||||
|
||||
VariableBackup<uint32_t> mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0);
|
||||
|
||||
@@ -3052,9 +3052,17 @@ struct MockModuleTU : public L0::ModuleTranslationUnit {
|
||||
return L0::ModuleTranslationUnit::createFromNativeBinary(input, inputSize, internalBuildOptions);
|
||||
}
|
||||
|
||||
ze_result_t processUnpackedBinary() override {
|
||||
if (processUnpackedBinaryReturnSuccess) {
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
return L0::ModuleTranslationUnit::processUnpackedBinary();
|
||||
}
|
||||
|
||||
bool callRealBuildFromSpirv = false;
|
||||
bool wasBuildFromSpirVCalled = false;
|
||||
bool wasCreateFromNativeBinaryCalled = false;
|
||||
bool processUnpackedBinaryReturnSuccess = false;
|
||||
DebugManagerStateRestore restore;
|
||||
};
|
||||
|
||||
@@ -3350,6 +3358,78 @@ HWTEST_F(ModuleTranslationUnitTest, WhenCreatingFromZebinThenDontAppendAllowZebi
|
||||
EXPECT_STREQ(expectedOptions, moduleTu.options.c_str());
|
||||
}
|
||||
|
||||
HWTEST_F(ModuleTranslationUnitTest, GivenOneApiPvcSendWarWaEnvFalseAndFileWithIntermediateCodeWhenCreatingModuleFromNativeBinaryThenModuleIsRecompiledWithInternalOption) {
|
||||
|
||||
auto pMockCompilerInterface = new MockCompilerInterface;
|
||||
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
|
||||
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
|
||||
this->neoDevice->executionEnvironment->setOneApiPvcWaEnv(false);
|
||||
|
||||
auto additionalSections = {ZebinTestData::AppendElfAdditionalSection::spirv};
|
||||
auto zebinData = std::make_unique<ZebinTestData::ZebinWithL0TestCommonModule>(device->getHwInfo(), additionalSections);
|
||||
const auto &src = zebinData->storage;
|
||||
|
||||
ze_module_desc_t moduleDesc = {};
|
||||
moduleDesc.format = ZE_MODULE_FORMAT_NATIVE;
|
||||
moduleDesc.pInputModule = reinterpret_cast<const uint8_t *>(src.data());
|
||||
moduleDesc.inputSize = src.size();
|
||||
|
||||
Module module(device, nullptr, ModuleType::user);
|
||||
MockModuleTU *tu = new MockModuleTU(device);
|
||||
tu->callRealBuildFromSpirv = true;
|
||||
tu->processUnpackedBinaryReturnSuccess = true;
|
||||
module.translationUnit.reset(tu);
|
||||
|
||||
ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE;
|
||||
result = module.initialize(&moduleDesc, neoDevice);
|
||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
EXPECT_TRUE(tu->wasCreateFromNativeBinaryCalled);
|
||||
EXPECT_TRUE(tu->wasBuildFromSpirVCalled);
|
||||
EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-ze-opt-disable-sendwarwa"), std::string::npos);
|
||||
}
|
||||
|
||||
HWTEST_F(ModuleTranslationUnitTest, GivenOneApiPvcSendWarWaEnvFalseWhenCreatingModuleFromSpirvBinaryThenModuleIsCompiledWithInternalOption) {
|
||||
|
||||
auto pMockCompilerInterface = new MockCompilerInterface;
|
||||
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
|
||||
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
|
||||
this->neoDevice->executionEnvironment->setOneApiPvcWaEnv(false);
|
||||
|
||||
uint8_t binary[10];
|
||||
ze_module_desc_t moduleDesc = {};
|
||||
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
|
||||
moduleDesc.pInputModule = binary;
|
||||
moduleDesc.inputSize = 10;
|
||||
|
||||
ModuleBuildLog *moduleBuildLog = nullptr;
|
||||
|
||||
auto module = std::unique_ptr<L0::ModuleImp>(new L0::ModuleImp(device, moduleBuildLog, ModuleType::user));
|
||||
ASSERT_NE(nullptr, module.get());
|
||||
module->initialize(&moduleDesc, device->getNEODevice());
|
||||
|
||||
EXPECT_TRUE(CompilerOptions::contains(pMockCompilerInterface->inputInternalOptions, "-ze-opt-disable-sendwarwa"));
|
||||
}
|
||||
|
||||
HWTEST_F(ModuleTranslationUnitTest, GivenDefaultOneApiPvcSendWarWaEnvWhenCreatingModuleFromSpirvBinaryThenModuleIsCompiledWithoutInternalOption) {
|
||||
auto pMockCompilerInterface = new MockCompilerInterface;
|
||||
auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()];
|
||||
rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface);
|
||||
|
||||
uint8_t binary[10];
|
||||
ze_module_desc_t moduleDesc = {};
|
||||
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
|
||||
moduleDesc.pInputModule = binary;
|
||||
moduleDesc.inputSize = 10;
|
||||
|
||||
ModuleBuildLog *moduleBuildLog = nullptr;
|
||||
|
||||
auto module = std::unique_ptr<L0::ModuleImp>(new L0::ModuleImp(device, moduleBuildLog, ModuleType::user));
|
||||
ASSERT_NE(nullptr, module.get());
|
||||
module->initialize(&moduleDesc, device->getNEODevice());
|
||||
|
||||
EXPECT_FALSE(CompilerOptions::contains(pMockCompilerInterface->inputInternalOptions, "-ze-opt-disable-sendwarwa"));
|
||||
}
|
||||
|
||||
HWTEST2_F(ModuleTranslationUnitTest, givenLargeGrfAndSimd16WhenProcessingBinaryThenKernelGroupSizeReducedToFitWithinSubslice, IsXeCore) {
|
||||
std::string validZeInfo = std::string("version :\'") + versionToString(NEO::Zebin::ZeInfo::zeInfoDecoderVersion) + R"===('
|
||||
kernels:
|
||||
|
||||
@@ -98,6 +98,9 @@ cl_int CL_API_CALL clGetPlatformIDs(cl_uint numEntries,
|
||||
if (envReader.getSetting("NEO_FP64_EMULATION", false)) {
|
||||
executionEnvironment->setFP64EmulationEnabled();
|
||||
}
|
||||
bool oneApiPvcWa = envReader.getSetting("ONEAPI_PVC_SEND_WAR_WA", true);
|
||||
executionEnvironment->setOneApiPvcWaEnv(oneApiPvcWa);
|
||||
|
||||
auto allDevices = DeviceFactory::createDevices(*executionEnvironment);
|
||||
executionEnvironment->decRefInternal();
|
||||
if (allDevices.empty()) {
|
||||
|
||||
@@ -112,6 +112,9 @@ std::string Program::getInternalOptions() const {
|
||||
CompilerOptions::concatenateAppend(internalOptions, compilerProductHelper.getCachingPolicyOptions(isDebuggerActive));
|
||||
CompilerOptions::applyExtraInternalOptions(internalOptions, hwInfo, compilerProductHelper, NEO::CompilerOptions::HeaplessMode::defaultMode);
|
||||
|
||||
if (pClDevice->getDevice().getExecutionEnvironment()->isOneApiPvcWaEnv() == false) {
|
||||
NEO::CompilerOptions::concatenateAppend(internalOptions, NEO::CompilerOptions::optDisableSendWarWa);
|
||||
}
|
||||
return internalOptions;
|
||||
}
|
||||
|
||||
@@ -218,6 +221,8 @@ cl_int Program::createProgramFromBinary(
|
||||
bool rebuild = isRebuiltToPatchtokensRequired(&clDevice.getDevice(), archive, this->options, this->isBuiltIn, isVmeUsed) ||
|
||||
AddressingModeHelper::containsBindlessKernel(decodedSingleDeviceBinary.programInfo.kernelInfos);
|
||||
|
||||
rebuild |= !clDevice.getDevice().getExecutionEnvironment()->isOneApiPvcWaEnv();
|
||||
|
||||
bool flagRebuild = debugManager.flags.RebuildPrecompiledKernels.get();
|
||||
|
||||
if (0u == this->irBinarySize) {
|
||||
|
||||
@@ -136,6 +136,49 @@ TEST(clGetPlatformIDsNegativeTests, whenFailToInitializePlatformThenClGetPlatfom
|
||||
platformsImpl->clear();
|
||||
}
|
||||
|
||||
TEST(clGetPlatformIDsTest, givenOneApiPvcSendWarWaEnvWhenCreatingExecutionEnvironmentThenCorrectEnvValueIsStored) {
|
||||
VariableBackup<uint32_t> mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0);
|
||||
|
||||
{
|
||||
std::unordered_map<std::string, std::string> mockableEnvs = {{"ONEAPI_PVC_SEND_WAR_WA", "1"}};
|
||||
VariableBackup<std::unordered_map<std::string, std::string> *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs);
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_platform_id platformRet = nullptr;
|
||||
cl_uint numPlatforms = 0;
|
||||
|
||||
platformsImpl->clear();
|
||||
|
||||
retVal = clGetPlatformIDs(1, &platformRet, &numPlatforms);
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
auto executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
EXPECT_TRUE(executionEnvironment->isOneApiPvcWaEnv());
|
||||
|
||||
platformsImpl->clear();
|
||||
}
|
||||
{
|
||||
std::unordered_map<std::string, std::string> mockableEnvs = {{"ONEAPI_PVC_SEND_WAR_WA", "0"}};
|
||||
VariableBackup<std::unordered_map<std::string, std::string> *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs);
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_platform_id platformRet = nullptr;
|
||||
cl_uint numPlatforms = 0;
|
||||
|
||||
platformsImpl->clear();
|
||||
|
||||
retVal = clGetPlatformIDs(1, &platformRet, &numPlatforms);
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
auto executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
EXPECT_FALSE(executionEnvironment->isOneApiPvcWaEnv());
|
||||
|
||||
platformsImpl->clear();
|
||||
}
|
||||
}
|
||||
|
||||
TEST(clGetPlatformIDsTest, givenEnabledExperimentalSupportAndEnabledProgramDebuggingWhenGettingPlatformIdsThenDebuggingEnabledIsSetInExecutionEnvironment) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
NEO::debugManager.flags.ExperimentalEnableL0DebuggerForOpenCL.set(1);
|
||||
|
||||
@@ -1980,6 +1980,15 @@ TEST_F(BuiltInTests, givenDebugFlagForceUseSourceWhenArgIsAnyThenReturnBuiltinCo
|
||||
EXPECT_EQ(pDevice, code.targetDevice);
|
||||
}
|
||||
|
||||
TEST_F(BuiltInTests, givenOneApiPvcSendWarWaEnvFalseWhenGettingBuiltinCodeThenSourceCodeTypeIsUsed) {
|
||||
pDevice->getExecutionEnvironment()->setOneApiPvcWaEnv(false);
|
||||
auto builtinsLib = std::unique_ptr<BuiltinsLib>(new BuiltinsLib());
|
||||
BuiltinCode code = builtinsLib->getBuiltinCode(EBuiltInOps::copyBufferToBuffer, BuiltinCode::ECodeType::any, *pDevice);
|
||||
EXPECT_EQ(BuiltinCode::ECodeType::source, code.type);
|
||||
EXPECT_NE(0u, code.resource.size());
|
||||
EXPECT_EQ(pDevice, code.targetDevice);
|
||||
}
|
||||
|
||||
using BuiltInOwnershipWrapperTests = BuiltInTests;
|
||||
|
||||
TEST_F(BuiltInOwnershipWrapperTests, givenBuiltinWhenConstructedThenLockAndUnlockOnDestruction) {
|
||||
|
||||
@@ -107,6 +107,7 @@ set(IGDRCL_SRCS_offline_compiler_tests
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/libult/signal_utils.h
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/libult/create_directory.cpp
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/libult/debug_settings_reader_creator.cpp
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/libult/mock_io_functions.cpp
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/test_macros/test_excludes.cpp
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/virtual_file_system_listener.cpp
|
||||
${IGDRCL_SRCS_cloc}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_compiler_cache.h"
|
||||
#include "shared/test/common/mocks/mock_compilers.h"
|
||||
#include "shared/test/common/mocks/mock_io_functions.h"
|
||||
#include "shared/test/common/mocks/mock_modules_zebin.h"
|
||||
#include "shared/test/common/mocks/mock_release_helper.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
@@ -5778,6 +5779,10 @@ TEST(OfflineCompilerTest, GivenValidPathWhenCreatingDirectoryThenDirIsCreated) {
|
||||
}
|
||||
|
||||
TEST(OfflineCompilerTest, GivenNonExistentPathWhenCreatingDirectoryThenReturnInvalidFile) {
|
||||
VariableBackup<decltype(IoFunctions::mkdirPtr)> mockCreateDir(&IoFunctions::mkdirPtr, [](const char *path) -> int {
|
||||
errno = 0;
|
||||
return -1;
|
||||
});
|
||||
MockOfflineCompiler mockOfflineCompiler{};
|
||||
auto ret = mockOfflineCompiler.createDir("/nonexistent/path/dirName");
|
||||
|
||||
@@ -5807,4 +5812,26 @@ TEST(OfflineCompilerTest, GivenPathWithPermissionDeniedWhenCreatingDirectoryThen
|
||||
EXPECT_EQ(ret, OCLOC_INVALID_FILE);
|
||||
}
|
||||
|
||||
TEST_F(OfflineCompilerTests, givenOneApiPvcSendWarWaEnvSetToFalseWhenInitializingThenInternalOptionShouldContainInternalOption) {
|
||||
|
||||
VariableBackup<uint32_t> mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0);
|
||||
|
||||
std::unordered_map<std::string, std::string> mockableEnvs = {{"ONEAPI_PVC_SEND_WAR_WA", "0"}};
|
||||
VariableBackup<std::unordered_map<std::string, std::string> *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs);
|
||||
|
||||
std::vector<std::string> argv = {
|
||||
"ocloc",
|
||||
"-file",
|
||||
clCopybufferFilename.c_str(),
|
||||
"-device",
|
||||
gEnvironment->devicePrefix.c_str()};
|
||||
|
||||
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
|
||||
ASSERT_NE(nullptr, mockOfflineCompiler);
|
||||
mockOfflineCompiler->initialize(argv.size(), argv);
|
||||
|
||||
std::string internalOptions = mockOfflineCompiler->internalOptions;
|
||||
EXPECT_TRUE(hasSubstr(internalOptions, "-ze-opt-disable-sendwarwa"));
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -2200,6 +2200,31 @@ TEST_F(ProgramTests, GivenGtpinReraFlagWhenBuildingProgramThenCorrectOptionsAreS
|
||||
EXPECT_TRUE(CompilerOptions::contains(cip->buildInternalOptions, CompilerOptions::gtpinRera)) << cip->buildInternalOptions;
|
||||
}
|
||||
|
||||
TEST_F(ProgramTests, givenOneApiPvcSendWarWaEnvFalseWhenBuildingProgramThenInternalOptionIsAdded) {
|
||||
auto cip = new MockCompilerInterfaceCaptureBuildOptions();
|
||||
auto pDevice = pContext->getDevice(0);
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->compilerInterface.reset(cip);
|
||||
auto program = std::make_unique<SucceedingGenBinaryProgram>(toClDeviceVector(*pDevice));
|
||||
program->sourceCode = "__kernel mock() {}";
|
||||
program->createdFrom = Program::CreatedFrom::source;
|
||||
|
||||
cl_int retVal = program->build(program->getDevices(), "");
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
// Check internal build options that were applied
|
||||
EXPECT_FALSE(CompilerOptions::contains(cip->buildInternalOptions, CompilerOptions::optDisableSendWarWa)) << cip->buildInternalOptions;
|
||||
|
||||
cip->buildOptions.clear();
|
||||
cip->buildInternalOptions.clear();
|
||||
pDevice->getExecutionEnvironment()->setOneApiPvcWaEnv(false);
|
||||
|
||||
retVal = program->build(program->getDevices(), CompilerOptions::concatenate(CompilerOptions::gtpinRera, CompilerOptions::finiteMathOnly).c_str());
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
// Check internal build options that were applied
|
||||
EXPECT_TRUE(CompilerOptions::contains(cip->buildInternalOptions, CompilerOptions::optDisableSendWarWa)) << cip->buildInternalOptions;
|
||||
}
|
||||
|
||||
TEST_F(ProgramTests, GivenFailureDuringProcessGenBinaryWhenProcessGenBinariesIsCalledThenErrorIsReturned) {
|
||||
auto program = std::make_unique<FailingGenBinaryProgram>(toClDeviceVector(*pClDevice));
|
||||
|
||||
|
||||
@@ -81,7 +81,6 @@ set(CLOC_LIB_SRCS_LIB
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/os_library.h
|
||||
${NEO_SHARED_DIRECTORY}/sku_info/definitions${BRANCH_DIR_SUFFIX}sku_info.cpp
|
||||
${NEO_SHARED_DIRECTORY}/utilities/directory.h
|
||||
${NEO_SHARED_DIRECTORY}/utilities/io_functions.cpp
|
||||
${NEO_SHARED_DIRECTORY}/utilities/io_functions.h
|
||||
${NEO_SHARED_DIRECTORY}/utilities/logger.cpp
|
||||
${NEO_SHARED_DIRECTORY}/utilities/logger.h
|
||||
@@ -350,6 +349,7 @@ set(CLOC_LIB_SRCS
|
||||
)
|
||||
add_library(${OCLOC_NAME}_lib SHARED ${CLOC_LIB_SRCS}
|
||||
${NEO_SOURCE_DIR}/shared/source/utilities/debug_settings_reader_creator.cpp
|
||||
${NEO_SHARED_DIRECTORY}/utilities/io_functions.cpp
|
||||
)
|
||||
add_subdirectories()
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "shared/source/helpers/debug_helpers.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
#include "shared/source/helpers/validators.h"
|
||||
#include "shared/source/os_interface/debug_env_reader.h"
|
||||
#include "shared/source/release_helper/release_helper.h"
|
||||
#include "shared/source/utilities/io_functions.h"
|
||||
|
||||
@@ -965,6 +966,11 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &
|
||||
appendExtensionsToInternalOptions(hwInfo, options, internalOptions);
|
||||
appendExtraInternalOptions(internalOptions);
|
||||
}
|
||||
NEO::EnvironmentVariableReader envReader;
|
||||
|
||||
if (envReader.getSetting("ONEAPI_PVC_SEND_WAR_WA", true) == false) {
|
||||
CompilerOptions::concatenateAppend(internalOptions, NEO::CompilerOptions::optDisableSendWarWa);
|
||||
}
|
||||
parseDebugSettings();
|
||||
|
||||
if (allowCaching) {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "shared/source/built_ins/built_ins.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
@@ -190,7 +191,8 @@ BuiltinCode BuiltinsLib::getBuiltinCode(EBuiltInOps::Type builtin, BuiltinCode::
|
||||
|
||||
if (requestedCodeType == BuiltinCode::ECodeType::any) {
|
||||
uint32_t codeType = static_cast<uint32_t>(BuiltinCode::ECodeType::binary);
|
||||
if (debugManager.flags.RebuildPrecompiledKernels.get()) {
|
||||
bool requiresRebuild = !device.getExecutionEnvironment()->isOneApiPvcWaEnv();
|
||||
if (requiresRebuild || debugManager.flags.RebuildPrecompiledKernels.get()) {
|
||||
codeType = static_cast<uint32_t>(BuiltinCode::ECodeType::source);
|
||||
}
|
||||
for (uint32_t e = static_cast<uint32_t>(BuiltinCode::ECodeType::count);
|
||||
|
||||
@@ -45,6 +45,7 @@ inline constexpr ConstStringRef numThreadsPerEu = "-cl-intel-reqd-eu-thread-coun
|
||||
inline constexpr ConstStringRef useCMCompiler = "-cmc";
|
||||
inline constexpr ConstStringRef enableFP64GenEmu = "-cl-fp64-gen-emu";
|
||||
inline constexpr ConstStringRef enableDivergentBarriers = "-cl-intel-enable-divergent-barrier-handling";
|
||||
inline constexpr ConstStringRef optDisableSendWarWa = "-ze-opt-disable-sendwarwa";
|
||||
|
||||
inline constexpr size_t nullterminateSize = 1U;
|
||||
inline constexpr size_t spaceSeparatorSize = 1U;
|
||||
|
||||
@@ -65,6 +65,11 @@ class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment>
|
||||
}
|
||||
bool isFP64EmulationEnabled() const { return fp64EmulationEnabled; }
|
||||
|
||||
void setOneApiPvcWaEnv(bool val) {
|
||||
oneApiPvcWaEnv = val;
|
||||
}
|
||||
bool isOneApiPvcWaEnv() const { return oneApiPvcWaEnv; }
|
||||
|
||||
DirectSubmissionController *initializeDirectSubmissionController();
|
||||
void initializeUnifiedMemoryReuseCleaner(bool isAnyDirectSubmissionLightEnabled);
|
||||
|
||||
@@ -89,6 +94,7 @@ class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment>
|
||||
void restoreCcsMode();
|
||||
bool metricsEnabled = false;
|
||||
bool fp64EmulationEnabled = false;
|
||||
bool oneApiPvcWaEnv = true;
|
||||
|
||||
DeviceHierarchyMode deviceHierarchyMode = DeviceHierarchyMode::composite;
|
||||
DebuggingMode debuggingEnabledMode = DebuggingMode::disabled;
|
||||
|
||||
Reference in New Issue
Block a user