@@ -52,8 +52,6 @@ NEO::ConstStringRef hasBufferOffsetArg = "-ze-intel-has-buffer-offset-arg";
5252NEO::ConstStringRef debugKernelEnable = " -ze-kernel-debug-enable" ;
5353NEO::ConstStringRef profileFlags = " -zet-profile-flags" ;
5454NEO::ConstStringRef optLargeRegisterFile = " -ze-opt-large-register-file" ;
55- NEO::ConstStringRef enableLibraryCompile = " -library-compilation" ;
56- NEO::ConstStringRef enableGlobalVariableSymbols = " -ze-take-global-address" ;
5755} // namespace BuildOptions
5856
5957ModuleTranslationUnit::ModuleTranslationUnit (L0::Device *device)
@@ -175,70 +173,6 @@ bool ModuleTranslationUnit::processSpecConstantInfo(NEO::CompilerInterface *comp
175173 return true ;
176174}
177175
178- bool ModuleTranslationUnit::attemptGenBinaryCompile (NEO::TranslationInput inputArgs, bool staticLink, bool libraryExportRequired, bool globalExportRequired) {
179- auto result = this ->compileGenBinary (inputArgs, staticLink);
180- std::string enableGlobalFlag (BuildOptions::enableGlobalVariableSymbols.str ().c_str ());
181- std::string enableLibraryFlag (BuildOptions::enableLibraryCompile.str ().c_str ());
182- bool completedGlobalFlagRemovalCheck = false ;
183- bool completedLibraryFlagRemovalCheck = false ;
184- if (result == false ) {
185- if (!globalExportRequired || !libraryExportRequired) {
186- // If the build failed, attempt to remove the implicit flags for Global Variables and/or Library Compile
187- std::string reducedOptions (options);
188- // Attempt build with only removing the Global Variable Flag
189- if (!globalExportRequired) {
190- std::string globalFlagRemoved (options);
191- size_t optionPos = std::string::npos;
192- optionPos = reducedOptions.find (enableGlobalFlag.c_str ());
193- if (optionPos != std::string::npos) {
194- reducedOptions.erase (optionPos, BuildOptions::enableGlobalVariableSymbols.length ());
195- }
196- optionPos = globalFlagRemoved.find (enableGlobalFlag.c_str ());
197- if (optionPos != std::string::npos) {
198- globalFlagRemoved.erase (optionPos, BuildOptions::enableGlobalVariableSymbols.length ());
199- inputArgs.apiOptions = ArrayRef<const char >(globalFlagRemoved.c_str (), globalFlagRemoved.length ());
200- result = this ->compileGenBinary (inputArgs, staticLink);
201- if (result == true ) {
202- options.assign (globalFlagRemoved);
203- return result;
204- }
205- }
206- completedGlobalFlagRemovalCheck = true ;
207- }
208- // Attempt build with only removing the Library Export Symbol Flag
209- if (!libraryExportRequired) {
210- std::string libraryFlagRemoved (options);
211- size_t optionPos = std::string::npos;
212- optionPos = reducedOptions.find (enableLibraryFlag.c_str ());
213- if (optionPos != std::string::npos) {
214- reducedOptions.erase (optionPos, BuildOptions::enableLibraryCompile.length ());
215- }
216- optionPos = libraryFlagRemoved.find (enableLibraryFlag.c_str ());
217- if (optionPos != std::string::npos) {
218- libraryFlagRemoved.erase (optionPos, BuildOptions::enableLibraryCompile.length ());
219- inputArgs.apiOptions = ArrayRef<const char >(libraryFlagRemoved.c_str (), libraryFlagRemoved.length ());
220- result = this ->compileGenBinary (inputArgs, staticLink);
221- if (result == true ) {
222- options.assign (libraryFlagRemoved);
223- return result;
224- }
225- }
226- completedLibraryFlagRemovalCheck = true ;
227- }
228- // Attempt build with the removal of both library and Global Variable flags
229- if (completedGlobalFlagRemovalCheck && completedLibraryFlagRemovalCheck) {
230- inputArgs.apiOptions = ArrayRef<const char >(reducedOptions.c_str (), reducedOptions.length ());
231- result = this ->compileGenBinary (inputArgs, staticLink);
232- if (result == true ) {
233- options.assign (reducedOptions);
234- return result;
235- }
236- }
237- }
238- }
239- return result;
240- }
241-
242176bool ModuleTranslationUnit::compileGenBinary (NEO::TranslationInput inputArgs, bool staticLink) {
243177 auto compilerInterface = device->getNEODevice ()->getCompilerInterface ();
244178 UNRECOVERABLE_IF (nullptr == compilerInterface);
@@ -272,7 +206,7 @@ bool ModuleTranslationUnit::compileGenBinary(NEO::TranslationInput inputArgs, bo
272206}
273207
274208bool ModuleTranslationUnit::staticLinkSpirV (std::vector<const char *> inputSpirVs, std::vector<uint32_t > inputModuleSizes, const char *buildOptions, const char *internalBuildOptions,
275- std::vector<const ze_module_constants_t *> specConstants, bool libraryExportRequired, bool globalExportRequired ) {
209+ std::vector<const ze_module_constants_t *> specConstants) {
276210 auto compilerInterface = device->getNEODevice ()->getCompilerInterface ();
277211 UNRECOVERABLE_IF (nullptr == compilerInterface);
278212
@@ -292,11 +226,11 @@ bool ModuleTranslationUnit::staticLinkSpirV(std::vector<const char *> inputSpirV
292226 linkInputArgs.src = ArrayRef<const char >(reinterpret_cast <const char *>(spirvElfSource.data ()), spirvElfSource.size ());
293227 linkInputArgs.apiOptions = ArrayRef<const char >(options.c_str (), options.length ());
294228 linkInputArgs.internalOptions = ArrayRef<const char >(internalOptions.c_str (), internalOptions.length ());
295- return this ->attemptGenBinaryCompile (linkInputArgs, true , libraryExportRequired, globalExportRequired );
229+ return this ->compileGenBinary (linkInputArgs, true );
296230}
297231
298232bool ModuleTranslationUnit::buildFromSpirV (const char *input, uint32_t inputSize, const char *buildOptions, const char *internalBuildOptions,
299- const ze_module_constants_t *pConstants, bool libraryExportRequired, bool globalExportRequired ) {
233+ const ze_module_constants_t *pConstants) {
300234 auto compilerInterface = device->getNEODevice ()->getCompilerInterface ();
301235 UNRECOVERABLE_IF (nullptr == compilerInterface);
302236
@@ -311,10 +245,10 @@ bool ModuleTranslationUnit::buildFromSpirV(const char *input, uint32_t inputSize
311245 inputArgs.src = ArrayRef<const char >(input, inputSize);
312246 inputArgs.apiOptions = ArrayRef<const char >(options.c_str (), options.length ());
313247 inputArgs.internalOptions = ArrayRef<const char >(internalOptions.c_str (), internalOptions.length ());
314- return this ->attemptGenBinaryCompile (inputArgs, false , libraryExportRequired, globalExportRequired );
248+ return this ->compileGenBinary (inputArgs, false );
315249}
316250
317- bool ModuleTranslationUnit::createFromNativeBinary (const char *input, size_t inputSize, bool libraryExportRequired, bool globalExportRequired ) {
251+ bool ModuleTranslationUnit::createFromNativeBinary (const char *input, size_t inputSize) {
318252 UNRECOVERABLE_IF ((nullptr == device) || (nullptr == device->getNEODevice ()));
319253 auto productAbbreviation = NEO::hardwarePrefix[device->getNEODevice ()->getHardwareInfo ().platform .eProductFamily ];
320254
@@ -367,7 +301,7 @@ bool ModuleTranslationUnit::createFromNativeBinary(const char *input, size_t inp
367301 updateBuildLog (NEO::CompilerWarnings::recompiledFromIr.str ());
368302 }
369303
370- return buildFromSpirV (this ->irBinary .get (), static_cast <uint32_t >(this ->irBinarySize ), this ->options .c_str (), " " , nullptr , libraryExportRequired, globalExportRequired );
304+ return buildFromSpirV (this ->irBinary .get (), static_cast <uint32_t >(this ->irBinarySize ), this ->options .c_str (), " " , nullptr );
371305 } else {
372306 return processUnpackedBinary ();
373307 }
@@ -563,17 +497,13 @@ bool ModuleImp::initialize(const ze_module_desc_t *desc, NEO::Device *neoDevice)
563497 inputModuleSizes,
564498 buildOptions.c_str (),
565499 internalBuildOptions.c_str (),
566- specConstants,
567- this ->libraryExportRequired ,
568- this ->globalExportRequired );
500+ specConstants);
569501 } else {
570502 success = this ->translationUnit ->buildFromSpirV (reinterpret_cast <const char *>(programExpDesc->pInputModules [0 ]),
571503 inputModuleSizes[0 ],
572504 buildOptions.c_str (),
573505 internalBuildOptions.c_str (),
574- firstSpecConstants,
575- this ->libraryExportRequired ,
576- this ->globalExportRequired );
506+ firstSpecConstants);
577507 }
578508 } else {
579509 return false ;
@@ -595,16 +525,14 @@ bool ModuleImp::initialize(const ze_module_desc_t *desc, NEO::Device *neoDevice)
595525
596526 if (desc->format == ZE_MODULE_FORMAT_NATIVE) {
597527 success = this ->translationUnit ->createFromNativeBinary (
598- reinterpret_cast <const char *>(desc->pInputModule ), desc->inputSize , this -> libraryExportRequired , this -> globalExportRequired );
528+ reinterpret_cast <const char *>(desc->pInputModule ), desc->inputSize );
599529 } else if (desc->format == ZE_MODULE_FORMAT_IL_SPIRV) {
600530 this ->builtFromSPIRv = true ;
601531 success = this ->translationUnit ->buildFromSpirV (reinterpret_cast <const char *>(desc->pInputModule ),
602532 static_cast <uint32_t >(desc->inputSize ),
603533 buildOptions.c_str (),
604534 internalBuildOptions.c_str (),
605- desc->pConstants ,
606- this ->libraryExportRequired ,
607- this ->globalExportRequired );
535+ desc->pConstants );
608536 } else {
609537 return false ;
610538 }
@@ -753,18 +681,10 @@ void ModuleImp::createBuildOptions(const char *pBuildFlags, std::string &apiOpti
753681
754682 moveOptLevelOption (apiOptions, apiOptions);
755683 moveProfileFlagsOption (apiOptions, apiOptions);
756- this ->libraryExportRequired = moveBuildOption (apiOptions, apiOptions, BuildOptions::enableLibraryCompile, BuildOptions::enableLibraryCompile);
757- this ->globalExportRequired = moveBuildOption (apiOptions, apiOptions, BuildOptions::enableGlobalVariableSymbols, BuildOptions::enableGlobalVariableSymbols);
758684 }
759685 if (NEO::ApiSpecificConfig::getBindlessConfiguration ()) {
760686 NEO::CompilerOptions::concatenateAppend (internalBuildOptions, NEO::CompilerOptions::bindlessMode.str ());
761687 }
762- if (!this ->libraryExportRequired && NEO::DebugManager.flags .EnableDefaultProgramSymbolTableGeneration .get ()) {
763- NEO::CompilerOptions::concatenateAppend (apiOptions, BuildOptions::enableLibraryCompile.str ());
764- }
765- if (!this ->globalExportRequired && NEO::DebugManager.flags .EnableDefaultGlobalSymbolGeneration .get ()) {
766- NEO::CompilerOptions::concatenateAppend (apiOptions, BuildOptions::enableGlobalVariableSymbols.str ());
767- }
768688}
769689
770690bool ModuleImp::moveOptLevelOption (std::string &dstOptionsSet, std::string &srcOptionSet) {
0 commit comments