diff --git a/level_zero/core/source/module/module_imp.cpp b/level_zero/core/source/module/module_imp.cpp index 7e12f815f1..0691ccb697 100644 --- a/level_zero/core/source/module/module_imp.cpp +++ b/level_zero/core/source/module/module_imp.cpp @@ -326,7 +326,6 @@ ze_result_t ModuleTranslationUnit::createFromNativeBinary(const char *input, siz this->isGeneratedByIgc = singleDeviceBinary.generator == NEO::GeneratorType::igc; 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) { diff --git a/opencl/source/program/build.cpp b/opencl/source/program/build.cpp index 2242c33c16..1e731513ac 100644 --- a/opencl/source/program/build.cpp +++ b/opencl/source/program/build.cpp @@ -67,8 +67,6 @@ cl_int Program::build( break; } - disableZebinIfVmeEnabled(options, internalOptions, sourceCode); - TranslationInput inputArgs = {IGC::CodeType::oclC, IGC::CodeType::oclGenBin}; if (createdFrom != CreatedFrom::source) { inputArgs.srcType = isSpirV ? IGC::CodeType::spirV : IGC::CodeType::llvmBc; diff --git a/opencl/source/program/program.cpp b/opencl/source/program/program.cpp index cca9176a54..42c2de6570 100644 --- a/opencl/source/program/program.cpp +++ b/opencl/source/program/program.cpp @@ -217,10 +217,7 @@ cl_int Program::createProgramFromBinary( this->isGeneratedByIgc = singleDeviceBinary.generator == GeneratorType::igc; this->indirectDetectionVersion = singleDeviceBinary.generatorFeatureVersions.indirectMemoryAccessDetection; - auto isVmeUsed = containsVmeUsage(this->buildInfos[rootDeviceIndex].kernelInfoArray); - bool rebuild = isRebuiltToPatchtokensRequired(&clDevice.getDevice(), archive, this->options, this->isBuiltIn, isVmeUsed) || - AddressingModeHelper::containsBindlessKernel(decodedSingleDeviceBinary.programInfo.kernelInfos); - + bool rebuild = AddressingModeHelper::containsBindlessKernel(decodedSingleDeviceBinary.programInfo.kernelInfos); rebuild |= !clDevice.getDevice().getExecutionEnvironment()->isOneApiPvcWaEnv(); bool flagRebuild = debugManager.flags.RebuildPrecompiledKernels.get(); @@ -486,45 +483,6 @@ void Program::setBuildStatusSuccess(const ClDeviceVector &deviceVector, cl_progr } } -bool Program::containsVmeUsage(const std::vector &kernelInfos) const { - for (auto kernelInfo : kernelInfos) { - if (kernelInfo->isVmeUsed()) { - return true; - } - } - return false; -} - -void Program::disableZebinIfVmeEnabled(std::string &options, std::string &internalOptions, const std::string &sourceCode) { - - const char *vmeOptions[] = {"cl_intel_device_side_advanced_vme_enable", - "cl_intel_device_side_avc_vme_enable", - "cl_intel_device_side_vme_enable"}; - - const char *vmeEnabledExtensions[] = {"cl_intel_motion_estimation : enable", - "cl_intel_device_side_avc_motion_estimation : enable", - "cl_intel_advanced_motion_estimation : enable"}; - - auto containsVme = [](const auto &data, const auto &patterns) { - for (const auto &pattern : patterns) { - auto pos = data.find(pattern); - if (pos != std::string::npos) { - return true; - } - } - return false; - }; - - if (debugManager.flags.DontDisableZebinIfVmeUsed.get() == true) { - return; - } - - if (containsVme(options, vmeOptions) || containsVme(sourceCode, vmeEnabledExtensions)) { - const auto &rootDevice = getDevices()[0]->getDevice().getRootDevice(); - rootDevice->getCompilerInterface()->disableZebin(options, internalOptions); - } -} - bool Program::isValidCallback(void(CL_CALLBACK *funcNotify)(cl_program program, void *userData), void *userData) { return funcNotify != nullptr || userData == nullptr; } diff --git a/opencl/source/program/program.h b/opencl/source/program/program.h index db1f54d6ae..a0360669d9 100644 --- a/opencl/source/program/program.h +++ b/opencl/source/program/program.h @@ -300,9 +300,6 @@ class Program : public BaseObject<_cl_program> { void setBuildStatus(cl_build_status status); void setBuildStatusSuccess(const ClDeviceVector &deviceVector, cl_program_binary_type binaryType); - bool containsVmeUsage(const std::vector &kernelInfos) const; - void disableZebinIfVmeEnabled(std::string &options, std::string &internalOptions, const std::string &sourceCode); - void notifyModuleCreate(); void notifyModuleDestroy(); diff --git a/opencl/test/unit_test/mocks/mock_program.h b/opencl/test/unit_test/mocks/mock_program.h index 0c516f4ade..a7aaa0c09f 100644 --- a/opencl/test/unit_test/mocks/mock_program.h +++ b/opencl/test/unit_test/mocks/mock_program.h @@ -50,13 +50,11 @@ class MockProgram : public Program { using Program::allowNonUniform; using Program::areSpecializationConstantsInitialized; using Program::buildInfos; - using Program::containsVmeUsage; using Program::context; using Program::createdFrom; using Program::createProgramFromBinary; using Program::debuggerInfos; using Program::deviceBuildInfos; - using Program::disableZebinIfVmeEnabled; using Program::extractInternalOptions; using Program::getKernelInfo; using Program::getModuleAllocations; diff --git a/opencl/test/unit_test/program/program_tests.cpp b/opencl/test/unit_test/program/program_tests.cpp index 783e3758d8..a6a8fac42a 100644 --- a/opencl/test/unit_test/program/program_tests.cpp +++ b/opencl/test/unit_test/program/program_tests.cpp @@ -2783,31 +2783,6 @@ TEST(CreateProgramFromBinaryTests, givenBinaryProgramBuiltInWhenKernelRebuildIsF EXPECT_EQ(expectedOutput, output); } -TEST(CreateProgramFromBinaryTests, givenCreateProgramFromBinaryWhenIrBinaryIsNotPresentAndIsRebuiltToPatchtokensRequiredThenReturnClInvalidBinary) { - DebugManagerStateRestore dbgRestorer; - debugManager.flags.RebuildPrecompiledKernels.set(false); - cl_int retVal = CL_INVALID_BINARY; - - ZebinTestData::ValidEmptyProgram zebin; - - auto clDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(nullptr)); - auto rootDeviceIndex = clDevice->getRootDeviceIndex(); - std::unique_ptr pProgram(Program::createBuiltInFromGenBinary(nullptr, toClDeviceVector(*clDevice), zebin.storage.data(), zebin.storage.size(), &retVal)); - ASSERT_NE(nullptr, pProgram.get()); - EXPECT_EQ(CL_SUCCESS, retVal); - - pProgram->irBinarySize = 0x10; - pProgram->isBuiltIn = false; - KernelInfo kernelInfo; - kernelInfo.kernelDescriptor.kernelAttributes.flags.usesVme = true; - - pProgram->buildInfos[rootDeviceIndex].kernelInfoArray.push_back(&kernelInfo); - retVal = pProgram->createProgramFromBinary(zebin.storage.data(), zebin.storage.size(), *clDevice); - EXPECT_FALSE(pProgram->requiresRebuild); - EXPECT_EQ(CL_INVALID_BINARY, retVal); - pProgram->buildInfos[rootDeviceIndex].kernelInfoArray.clear(); -} - TEST(CreateProgramFromBinaryTests, givenBinaryProgramBuiltInWhenKernelRebulildIsForcedAndIrBinaryIsPresentThenDeviceBinaryIsNotUsed) { DebugManagerStateRestore dbgRestorer; debugManager.flags.RebuildPrecompiledKernels.set(true); @@ -3613,105 +3588,6 @@ TEST(ProgramPopulateZebinExtendedArgsMetadataTests, givenNonZebinaryFormatWhenCa buildInfo.kernelInfoArray.clear(); } -TEST(ProgramVmeUsage, givenVmeUsageWhenContainsVmeUsageIsCalledThenReturnTrue) { - MockClDevice device{new MockDevice()}; - MockProgram program(toClDeviceVector(device)); - - { - KernelInfo kernelInfo; - kernelInfo.kernelDescriptor.kernelAttributes.flags.usesVme = false; - std::vector kernelInfos{&kernelInfo}; - EXPECT_FALSE(program.containsVmeUsage(kernelInfos)); - } - { - KernelInfo kernelInfo; - kernelInfo.kernelDescriptor.kernelAttributes.flags.usesVme = true; - std::vector kernelInfos{&kernelInfo}; - EXPECT_TRUE(program.containsVmeUsage(kernelInfos)); - } -} - -TEST(ProgramVmeUsage, givenVmeOptionsWhenDisableZebinIfVmeEnabledIsCalledThenZebinIsDisabled) { - DebugManagerStateRestore debugManagerStateRestore{}; - MockClDevice device{new MockDevice()}; - MockProgram program(toClDeviceVector(device)); - - { - std::string options = ""; - std::string internalOptions = ""; - program.disableZebinIfVmeEnabled(options, internalOptions, ""); - EXPECT_TRUE(options.empty()); - EXPECT_FALSE(CompilerOptions::contains(internalOptions, CompilerOptions::disableZebin)); - } - { - std::string options = "cl_intel_device_side_vme_enable"; - std::string internalOptions = ""; - debugManager.flags.DontDisableZebinIfVmeUsed = false; - program.disableZebinIfVmeEnabled(options, internalOptions, ""); - EXPECT_STREQ(options.c_str(), "cl_intel_device_side_vme_enable"); - EXPECT_TRUE(CompilerOptions::contains(internalOptions, CompilerOptions::disableZebin)); - } - { - std::string options = "cl_intel_device_side_vme_enable"; - std::string internalOptions = ""; - debugManager.flags.DontDisableZebinIfVmeUsed = true; - program.disableZebinIfVmeEnabled(options, internalOptions, ""); - EXPECT_STREQ(options.c_str(), "cl_intel_device_side_vme_enable"); - EXPECT_FALSE(CompilerOptions::contains(internalOptions, CompilerOptions::disableZebin)); - } -} - -TEST(ProgramVmeUsage, givenVmeExtensionsEnabledInSourceCodeWhenDisableZebinIfVmeEnabledIsCalledThenZebinIsDisabled) { - DebugManagerStateRestore debugManagerStateRestore{}; - MockClDevice device{new MockDevice()}; - MockProgram program(toClDeviceVector(device)); - - { - std::string options = ""; - std::string internalOptions = ""; - std::string sourceCode = "cl_intel_motion_estimation"; - program.disableZebinIfVmeEnabled(options, internalOptions, sourceCode); - EXPECT_TRUE(options.empty()); - EXPECT_FALSE(CompilerOptions::contains(internalOptions, CompilerOptions::disableZebin)); - } - - { - std::string options = ""; - std::string internalOptions = ""; - std::string sourceCode = "cl_intel_motion_estimation : disable"; - program.disableZebinIfVmeEnabled(options, internalOptions, sourceCode); - EXPECT_TRUE(options.empty()); - EXPECT_FALSE(CompilerOptions::contains(internalOptions, CompilerOptions::disableZebin)); - } - - const char *vmeEnabledExtensions[] = {"cl_intel_motion_estimation : enable", - "cl_intel_device_side_avc_motion_estimation : enable", - "cl_intel_advanced_motion_estimation : enable"}; - - for (auto extension : vmeEnabledExtensions) { - - std::string sourceCode = extension; - - { - std::string options = ""; - std::string internalOptions = ""; - debugManager.flags.DontDisableZebinIfVmeUsed = false; - program.disableZebinIfVmeEnabled(options, internalOptions, sourceCode); - EXPECT_TRUE(options.empty()); - EXPECT_TRUE(CompilerOptions::contains(internalOptions, CompilerOptions::disableZebin)); - } - - { - std::string options = ""; - std::string internalOptions = ""; - debugManager.flags.DontDisableZebinIfVmeUsed = true; - program.disableZebinIfVmeEnabled(options, internalOptions, sourceCode); - EXPECT_TRUE(options.empty()); - EXPECT_FALSE(CompilerOptions::contains(internalOptions, CompilerOptions::disableZebin)); - } - } -} - TEST(ProgramPopulateZebinExtendedArgsMetadataTests, givenZebinaryFormatAndDecodeErrorOnDecodingArgsMetadataWhenCallingPopulateZebinExtendedArgsMetadataThenMetadataIsNotPopulated) { MockClDevice device{new MockDevice()}; MockProgram program(toClDeviceVector(device)); diff --git a/shared/source/debug_settings/debug_variables_base.inl b/shared/source/debug_settings/debug_variables_base.inl index 8ead85b167..7d2b5ed780 100644 --- a/shared/source/debug_settings/debug_variables_base.inl +++ b/shared/source/debug_settings/debug_variables_base.inl @@ -76,7 +76,6 @@ DECLARE_DEBUG_VARIABLE(bool, UseNewQueryTopoIoctl, true, "Use DRM_I915_QUERY_COM DECLARE_DEBUG_VARIABLE(bool, DisableGpuHangDetection, false, "Disable GPU hang detection") DECLARE_DEBUG_VARIABLE(bool, DisableForceToStateless, false, "Do not force stateless for buffers") DECLARE_DEBUG_VARIABLE(bool, ForceTheoreticalMaxWorkGroupCount, false, "Do not apply any limitation to max cooperative/concurrent work-group count queries") -DECLARE_DEBUG_VARIABLE(bool, DontDisableZebinIfVmeUsed, false, "When enabled, driver will not add -cl-intel-disable-zebin internal option when vme is used") DECLARE_DEBUG_VARIABLE(bool, AppendMemoryPrefetchForKmdMigratedSharedAllocations, true, "Allow prefetching shared memory to the device associated with the specified command list") DECLARE_DEBUG_VARIABLE(bool, ForceMemoryPrefetchForKmdMigratedSharedAllocations, false, "Force prefetch of shared memory in command queue execute command lists") DECLARE_DEBUG_VARIABLE(bool, ClKhrExternalMemoryExtension, true, "Enable cl_khr_external_memory extension") diff --git a/shared/source/program/kernel_info.h b/shared/source/program/kernel_info.h index cdc342eaf1..82a7bddec0 100644 --- a/shared/source/program/kernel_info.h +++ b/shared/source/program/kernel_info.h @@ -77,10 +77,6 @@ struct KernelInfo : NEO::NonCopyableAndNonMovableClass { return maxRequiredWorkGroupSize; } - bool isVmeUsed() const { - return kernelDescriptor.kernelAttributes.flags.usesVme; - } - uint32_t getConstantBufferSize() const; int32_t getArgNumByName(const char *name) const; diff --git a/shared/source/program/program_info.cpp b/shared/source/program/program_info.cpp index 276bb0f498..83551e9484 100644 --- a/shared/source/program/program_info.cpp +++ b/shared/source/program/program_info.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2023 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -46,15 +46,4 @@ bool requiresLocalMemoryWindowVA(const ProgramInfo &programInfo) { return false; } -bool isRebuiltToPatchtokensRequired(Device *neoDevice, ArrayRef archive, std::string &optionsString, bool isBuiltin, bool isVmeUsed) { - if (isBuiltin) { - return false; - } - auto isZebinFormat = NEO::isDeviceBinaryFormat(archive); - if (isVmeUsed && isZebinFormat) { - return neoDevice->getCompilerInterface()->disableZebin(optionsString, optionsString); - } - return false; -} - } // namespace NEO diff --git a/shared/source/program/program_info.h b/shared/source/program/program_info.h index b27cab27ec..92b50e7e52 100644 --- a/shared/source/program/program_info.h +++ b/shared/source/program/program_info.h @@ -56,6 +56,5 @@ static_assert(NEO::NonCopyable); size_t getMaxInlineSlmNeeded(const ProgramInfo &programInfo); bool requiresLocalMemoryWindowVA(const ProgramInfo &programInfo); -bool isRebuiltToPatchtokensRequired(Device *neoDevice, ArrayRef archive, std::string &optionsString, bool isBuiltin, bool isVmeUsed); } // namespace NEO diff --git a/shared/test/common/test_files/igdrcl.config b/shared/test/common/test_files/igdrcl.config index c2bd24d216..14f023db61 100644 --- a/shared/test/common/test_files/igdrcl.config +++ b/shared/test/common/test_files/igdrcl.config @@ -58,7 +58,6 @@ CFEFusedEUDispatch = -1 ForceAuxTranslationMode = -1 OverrideGpuAddressSpace = -1 OverrideMaxWorkgroupSize = -1 -DontDisableZebinIfVmeUsed = 0 DoCpuCopyOnReadBuffer = -1 DoCpuCopyOnWriteBuffer = -1 PauseOnEnqueue = -1 diff --git a/shared/test/unit_test/program/program_info_tests.cpp b/shared/test/unit_test/program/program_info_tests.cpp index 8b3c760c8f..bdcac9dc27 100644 --- a/shared/test/unit_test/program/program_info_tests.cpp +++ b/shared/test/unit_test/program/program_info_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -62,36 +62,3 @@ TEST(RequiresLocalMemoryWindowVA, GivenProgramWithKernelsWhenSomeOfKernelRequire programInfo.kernelInfos[1]->kernelDescriptor.payloadMappings.implicitArgs.localMemoryStatelessWindowStartAddres = 0U; EXPECT_TRUE(NEO::requiresLocalMemoryWindowVA(programInfo)); } - -TEST(RequiresRebuildWithPatchtokens, givenNoLegacyDebuggerAttachedWhenCheckingForRebuildRequirementThenReturnFalseAndDoNotFallback) { - ZebinTestData::ValidEmptyProgram<> zebin; - auto device = std::unique_ptr(NEO::MockDevice::createWithNewExecutionEnvironment(nullptr)); - - std::string options{NEO::CompilerOptions::disableZebin}; - bool isBuiltIn = false; - device->getRootDeviceEnvironmentRef().debugger.reset(nullptr); - bool rebuildRequired = isRebuiltToPatchtokensRequired(device.get(), ArrayRef::fromAny(zebin.storage.data(), zebin.storage.size()), options, isBuiltIn, false); - EXPECT_FALSE(rebuildRequired); - EXPECT_TRUE(NEO::CompilerOptions::contains(options, NEO::CompilerOptions::disableZebin)); -} - -TEST(RequiresRebuildWithPatchtokens, givenVmeUsedWhenIsRebuiltToPatchtokensRequiredThenReturnFalse) { - ZebinTestData::ValidEmptyProgram<> zebin; - auto device = std::unique_ptr(NEO::MockDevice::createWithNewExecutionEnvironment(nullptr)); - device->getRootDeviceEnvironmentRef().debugger.reset(nullptr); - std::string options = ""; - bool isBuiltIn = false; - - { - bool isVmeUsed = false; - bool rebuildRequired = isRebuiltToPatchtokensRequired(device.get(), ArrayRef::fromAny(zebin.storage.data(), zebin.storage.size()), options, isBuiltIn, isVmeUsed); - EXPECT_FALSE(rebuildRequired); - EXPECT_FALSE(NEO::CompilerOptions::contains(options, NEO::CompilerOptions::disableZebin)); - } - { - bool isVmeUsed = true; - bool rebuildRequired = isRebuiltToPatchtokensRequired(device.get(), ArrayRef::fromAny(zebin.storage.data(), zebin.storage.size()), options, isBuiltIn, isVmeUsed); - EXPECT_TRUE(rebuildRequired); - EXPECT_TRUE(NEO::CompilerOptions::contains(options, NEO::CompilerOptions::disableZebin)); - } -}