hdl / conda-eda

Conda recipes for FPGA EDA tools for simulation, synthesis, place and route and bitstream generation.
https://anaconda.org/LiteX-Hub
Apache License 2.0
95 stars 26 forks source link

Disable interprocedural optimization for VTR #272

Closed poname closed 1 year ago

poname commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

Do you have more information about the LTO issues?

poname commented 1 year ago

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

poname commented 1 year ago

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 commented 1 year ago

@mithro Do we need any changes?

mithro commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

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.

mithro commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

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

mithro commented 1 year ago

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

poname commented 1 year ago

@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