Skip to content

[flang] OpenBLAS 0.3.27 (with openmp) not buildable on windows with flang 18 #86463

Closed
@h-vetinari

Description

@h-vetinari

I had been under the impression that flang had already been able to compile BLAS/LAPACK and OpenBLAS successfully (c.f. #64750, #67675, #70458).

However, while trying to use flang 19.0.0 (as of edf5782) to compile OpenBLAS 0.3.27, there's a missing omp_lib module

[...]
[3643/19184] Building Fortran object CMakeFiles\LAPACK_OVERRIDES.dir\lapack-netlib\SRC\stplqt.f.obj
[3644/19184] Building Fortran object CMakeFiles\LAPACK_OVERRIDES.dir\lapack-netlib\SRC\stplqt2.f.obj
[3645/19184] Building Fortran object CMakeFiles\LAPACK_OVERRIDES.dir\lapack-netlib\SRC\stpmlqt.f.obj
[3646/19184] Building Fortran object CMakeFiles\LAPACK_OVERRIDES.dir\lapack-netlib\SRC\ssytrd_2stage.f.obj
[3647/19184] Building Fortran object CMakeFiles\LAPACK_OVERRIDES.dir\lapack-netlib\SRC\ssytrd_sb2st.F.obj
FAILED: CMakeFiles/LAPACK_OVERRIDES.dir/lapack-netlib/SRC/ssytrd_sb2st.F.obj 
%BUILD_PREFIX%\Library\bin\flang.exe -I%SRC_DIR%\lapack-netlib\SRC -I%SRC_DIR%\lapack-netlib\LAPACKE\include -fopenmp -fopenmp -ffixed-line-length-72 -o CMakeFiles\LAPACK_OVERRIDES.dir\lapack-netlib\SRC\ssytrd_sb2st.F.obj -c CMakeFiles\LAPACK_OVERRIDES.dir\lapack-netlib\SRC\ssytrd_sb2st.F-pp.f
error: Semantic errors in CMakeFiles\LAPACK_OVERRIDES.dir\lapack-netlib\SRC\ssytrd_sb2st.F-pp.f
D:\\bld\\openblas_1719536014536\\work\\lapack-netlib\\SRC\\ssytrd_sb2st.F:237:11: error: Cannot read module file for module 'omp_lib': Source file 'omp_lib.mod' was not found
        use omp_lib
            ^^^^^^^

Previously:

While trying1 to use flang 18.1.2 to compile the latest OpenBLAS 0.3.26 (aside from from backporting a small fix due to flang 18 being stricter on unknown flags), things fail pretty early with what looks like a parsing problem...

[2005/19090] Building Fortran object CMakeFiles\LAPACK_OVERRIDES.dir\lapack-netlib\SRC\sgbcon.f.obj
FAILED: CMakeFiles/LAPACK_OVERRIDES.dir/lapack-netlib/SRC/sgbcon.f.obj 
%BUILD_PREFIX%\Library\bin\flang.exe -I%SRC_DIR%\lapack-netlib\SRC -I%SRC_DIR%\lapack-netlib\LAPACKE\include -ffixed-line-length-72 -o CMakeFiles\LAPACK_OVERRIDES.dir\lapack-netlib\SRC\sgbcon.f.obj -c CMakeFiles\LAPACK_OVERRIDES.dir\lapack-netlib\SRC\sgbcon.f-pp.f
error: loc("D:\\bld\\openblas_1711274852957\\work\\lapack-netlib\\SRC\\sgbcon.f":206:7): operation with block successors must terminate its parent block

error: verification of lowering to FIR failed

Looking for the error message, the only open issue I've found is #61281, but that issue explicitly says "This case is OK in OpenMP". There's also #74348 (which got fixed in 18.1) and #72792 (where it's unclear when/what was fixed).

Footnotes

  1. despite the title of the PR, the error here is for the case with USE_OPENMP=0, i.e. no OpenMP; with OpenMP I still have to fix stuff around OpenMP_Fortran

Metadata

Metadata

Assignees

No one assigned

    Labels

    flang:irquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions