Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable interprocedural optimization for VTR #272

Closed
wants to merge 1 commit into from

Conversation

poname
Copy link

@poname poname commented Dec 26, 2022

By default the CMAKE_INTERPROCEDURAL_OPTIMIZATION flag is on for VTR, this may cause LTO version incompatibility when using the binaries out of VTR scope in other projects.
Thir PR disables INTERPROCEDURAL_OPTIMIZATION for VTR package while installing by turning off the VTR_IPO_BUILD flag in the build script.

@poname
Copy link
Author

poname commented Dec 26, 2022

@mithro the binaries from VTR package are needed in yosys-f4pga-plugins. LTO is enabled by default and creates issues when linking with other projects.

@mithro mithro changed the title disable interprocedural optimization for VTR Disable interprocedural optimization for VTR Dec 27, 2022
@mithro
Copy link
Member

mithro commented Dec 27, 2022

Do you have more information about the LTO issues?

@poname
Copy link
Author

poname commented Dec 27, 2022

As an example when linking yosys-f4pga-plugins with the binaries from VTR package (litex-hub) the following error pops out:

  • build locally:
lto1: fatal error: bytecode stream in file ‘/lib/libarchfpga.a’ generated with LTO version 11.0 instead of the expected 11.3
compilation terminated.
lto-wrapper: fatal error: g++ returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
  • when running the CI:
lto1: fatal error: bytecode stream in file ‘/home/runner/work/yosys-f4pga-plugins/yosys-f4pga-plugins/env/conda/envs/yosys-plugins/lib/libarchfpga.a’ generated with LTO version 12979.5 instead of the expected 8.1
  compilation terminated.
  lto-wrapper: fatal error: /usr/bin/g++ returned 1 exit status
  make[1]: Leaving directory '/home/runner/work/yosys-f4pga-plugins/yosys-f4pga-plugins/parmys-plugin'
  compilation terminated.
  /usr/bin/ld: error: lto-wrapper failed
  collect2: error: ld returned 1 exit status

Perhaps the problem is from the compiler versions. I think the best solution is to disable LTO for VTR package and according to the VTR documentation, it only improves the performance and disabling should cause no harm.

@poname
Copy link
Author

poname commented Dec 27, 2022

Also, when the VTR binaries are built on the same machine that the linking is being performed later, there are no issues since the compilers are of the exact same version (and the system architectures are the same) . I'm no expert but AFAIK LTO depends on the compiler version and system architecture.

@poname
Copy link
Author

poname commented Dec 29, 2022

@mithro Do we need any changes?

@mithro
Copy link
Member

mithro commented Dec 29, 2022

@poname - I think the error points out there is something going wrong with the compiler toolchain being used. The fix is to understand that problem rather than disabling LTO.

@poname
Copy link
Author

poname commented Dec 29, 2022

@mithro I am usin the default compiler toolchain in yosys-f4pga-plugins build and I think resolvig the LTO version issue requires changing the compiler there, which is unlikely to be accepted.

Instead of changing the main VTR package here, can we have a new package named VTR-libs but whithout LTO?

@mithro
Copy link
Member

mithro commented Dec 29, 2022

@poname - I'm pretty sure the yosys-f4pga-plugins repository should be using the same compiler as hdl/conda-eda when building against tools from the hdl/conda-eda repository. The fact that it is not is somewhat concerning.

@poname
Copy link
Author

poname commented Jan 4, 2023

from the vtr-linux ci log in hdl/conda-eda actions:
-- The CXX compiler identification is GNU 11.2.0

while the chipsalliance/yosys-f4pga-plugins explicitly uses g++-9:
sudo apt-get install git g++-9 build-essential bison flex \ ...

I am closing this PR to keep other packages intact and a new PR will be added to introduce a new package named vtr-libs to provide a lightweight package of only VTR binaries with their header files.

@poname poname closed this Jan 4, 2023
@mithro
Copy link
Member

mithro commented Jan 4, 2023

@poname - If these are building against hdl/conda-eda then they should be also be using the compilers from conda not from the local system.

@poname
Copy link
Author

poname commented Jan 4, 2023

@mithro Yes,the chipsalliance/yosys-f4pga-plugins ci is not using the conda c/cxx compilers. This is hardcoded within the ci scripts and I think changing their global ci ecosystem is not an option.

Since playing with build flags would solve the problem, if it is OK from your side we can have a new mini package of vtr binaries and use it without touching anything else.

@mithro
Copy link
Member

mithro commented Jan 4, 2023

@poname - I think we need to chat with chipsalliance/yosys-f4pga-plugins and get them to fix that.

@mithro
Copy link
Member

mithro commented Jan 4, 2023

@poname - Can you point out where you think they are not using the conda compilers?

@poname
Copy link
Author

poname commented Jan 4, 2023

@mithro check here: https://github.com/chipsalliance/yosys-f4pga-plugins/blob/main/.github/workflows/ci.yml

they are using apt-get install to get dependencies.

    - name: Install
      run: |
        sudo apt-get update
        sudo apt-get install git g++-9 build-essential bison flex \
          libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot \
          pkg-config libboost-system-dev libboost-python-dev \
          libboost-filesystem-dev zlib1g-dev clang-format-8 cmake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants