- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
TLDR: Using Visual Studio to complile a trivial executable with IFX 2024.0 with /Qipo because the linker expects COFF format object file but LLVM IR bitcode is created instead. I expected that IPO would be supported.
I wanted to try out the new IFX compiler but am hitting failures when compiling in release mode with both the latest IFX 2024.0 and 2023.2.1 (IIRC). Debug mode works fine and the IFORT compiler has never had such errors. It also works if whole program optimisation is disabled. The errors I get are of the form:
x64\Release\AntennaTest\Path_Utils.obj : fatal error LNK1107: invalid or corrupt file: cannot read at 0xB2C
With the exact obj file with error changing depending on which source files are included in the project. I managed to reproduce this with a fairly minimal amount of code (10 lines of Fortran). These are attached to this post along with the vfproj file (with an .xml extension as it was rejected without this, also gzipped). Can others reproduce this with these files? I would appreciate it if someone connected to Intel could look at this.
Apparently plain text can't be attached here...
The attachment's antennatest.txt content type (text/plain) does not match its file extension and has been removed.
Edit: added /Qipo to title and TLDR.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The file Path_utils.obj that you attached is not a COFF object file; it is a LLVM IR bitcode file, which the linker is unable to process. You will have to look at your build log, compiler options passed, etc., to determine why this file was output in an improper manner (i.e., file suffix not matching actual file format).
The Windows version of IFX 2024.0, which I installed last evening, compiled the two .f90 files that you provided and produced proper AMD64 COFF objects.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Interesting. There is nothing special in the configuration that caused this.
Relevant part of the project file (I attached a version with more settings but this fails too):
<Configuration Name="Release|x64" UseCompiler="ifxCompiler" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)\$(ProjectName)" WholeProgramOptimization="true">
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true"/>
<Tool Name="VFLinkerTool" SuppressStartupBanner="true" SubSystem="subSystemConsole"/>
<Tool Name="VFResourceCompilerTool"/>
<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/>
</Configuration>
Note the critical setting is WholeProgramOptimisation everything works without that. Did you have that set in your successful build?
The output is:
Rebuild started...
1>------ Rebuild All started: Project: AntennaTest (IFX), Configuration: Release x64 ------
Deleting intermediate files and output files for project 'AntennaTest', configuration 'Release|x64'.
Compiling with Intel® Fortran Compiler 2024.0.0 [Intel(R) 64]...
Path_Utils.F90
AntennaTest.F90
Compiling manifest to resources...
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation. All rights reserved.
Linking...
x64\Release\AntennaTest\Path_Utils.obj : fatal error LNK1107: invalid or corrupt file: cannot read at 0xB28
Build log written to "file://C:/Users/quintin.hill/repos/ifx_test/x64/Release/AntennaTest/BuildLog.htm"
AntennaTest - 1 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
========== Rebuild started at 11:01 and took 00.696 seconds ==========
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I rarely use Visual Studio -- I compiled with the command
ifx /Od /MD /Qxhost /c Path_Utils.F90 AntennaTest.F90
and the output messages:
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.0 Build 20231017
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.
I did not request PGO (whole program optimization). Perhaps you could add the phrase to the thread title so that Intel reps will pay attention to that aspect.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you. I've added /Qipo to the title now. I ran your command with /Qipo added it gave no error but the question is are the object files in the correct format?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Checking myself the presence of /Qipo determines the type of the generated obj files.
ifx /Od /MD /Qxhost /c Path_Utils.F90 AntennaTest.F90
file *.obj
AntennaTest.obj: Intel amd64 COFF object file, not stripped, 7 sections, symbol offset=0x28b, 23 symbols, 1st section name ".text"
Path_Utils.obj: Intel amd64 COFF object file, not stripped, 4 sections, symbol offset=0x16e, 12 symbols, 1st section name ".text"
ifx /Od /MD /Qipo /Qxhost /c Path_Utils.F90 AntennaTest.F90
file *.obj
AntennaTest.obj: LLVM IR bitcode
Path_Utils.obj: LLVM IR bitcode
But the linker doesn't handle the latter case properly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
/ipo is implemented differently with ifx. ifx uses LLVM Link Time Optimization. The /ipo compiler option becomes -flto. The object files will be different.
Be sure to link with /ipo or -flto.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The problem is that the Visual Studio integration isn't changing the command line based on the whole program optimisisation. If I manually add /Qipo to the linker command line it works.
Gives command line:
/OUT:"x64\Release\AntennaTest.exe" /NOLOGO /MANIFEST /MANIFESTFILE:"x64\Release\AntennaTest\AntennaTest.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /SUBSYSTEM:CONSOLE /IMPLIB:"C:\Users\quintin.hill\repos\ifx_test\x64\Release\AntennaTest.lib"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not using IFX as my production build as yet but it does build and run OK.
If I do a release built in VS I have:
and
That gived /Qipo on the compile and nothing on the link. Is that what one would expect? The comments confused me a little.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you compiling/linking with IFX. It seems that IFORT doesn't need /Qipo on the linker command line but IFX does need it on the linker command line. And as you say the Visual Studio intergration is not adding /Qipo to the command line in either case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That is IFX and it add /Qipo only to the compile not to the link which gets nothing. The optimisation report is full of nothing!
Interesting if I add /Qipo manually to the link command it forces a compile of all the sources so a link option that effects com;piling! I still don't get an optimisation report. I have a hunch in both cases it is doing some opt work as the link is taking a long time compared to a none Qipo link.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FWIW the ipo processing occurs at link time, it always has been.
Think of ifort and ifx as being a pre-processor for ipo. The ipo option does cause the compilers to generate additional data structures/files, but the actual optimization occurs at link time.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@andrew_4619, do you have a reproducer that shows you're not get the optimization report? The optimization report functionality is different for ifx. For example, for /Qopt-report has levels 1, 2, 3. ifort has 5 levels. Not all the variations of /Qopt-report are supported yet in ifx.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually I mis-spoke it seems the Opt report was set to disabled in IFX presumably because of the incompatible level. If I set a valid level it seems to work ok.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So how do we proceed here? Please can someone raise a ticket to correct the Visual Studio integration such that it adds /Qipo to the linker command line when Interprocedural Optimisation is marked Yes in the linker options in the project properties dialog.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please provide a reproducer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
With a stock standard new solution the \qipo is set to yes - see below
but there is no evidence of it in the command line list is this the reproducer you want as I did not change the sln file from its creation.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page