llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
25.95k stars 10.59k forks source link

[Flang] [OpenMP] Geometric proliferation of error message lines for each unterminated OpenMP block construct in a Fortran scoping unit. #90452

Open thtsikas opened 2 weeks ago

thtsikas commented 2 weeks ago

I noticed that multiple OpenMP errors of this kind cause substantial slowdown and excessive error message output.

#!/bin/bash

constructs=(parallel sections workshare paralleldo task master single critical)
for z in $(seq 0 31)
do
    (
        for i in $(seq 0 "${z}")
        do
            echo "!\$omp " "${constructs[$(( i % 8 ))]}"
        done
        echo end
    ) > src.f90
    srcs=$(wc -l src.f90 | cut -d " " -f 1)
#   cat src.f90
    flang-new -c -fopenmp src.f90 |& wc -l > errs.txt
    errs=$(cat errs.txt)
    echo "$srcs" "$errs"
done
kiranchandramohan commented 2 weeks ago

Hello Themos, Are you requesting for better error messages from the compiler for unterminated block constructs?

thtsikas commented 2 weeks ago

Yes. At the moment, a 20 line source, can take 20 seconds to produce 835,000+ lines of error messages.

llvmbot commented 2 weeks ago

@llvm/issue-subscribers-flang-frontend

Author: None (thtsikas)

I noticed that multiple OpenMP errors of this kind cause substantial slowdown and excessive error message output. ``` #!/bin/bash constructs=(parallel sections workshare paralleldo task master single critical) for z in $(seq 0 31) do ( for i in $(seq 0 "${z}") do echo "!\$omp " "${constructs[$(( i % 8 ))]}" done echo end ) > src.f90 srcs=$(wc -l src.f90 | cut -d " " -f 1) # cat src.f90 flang-new -c -fopenmp src.f90 |& wc -l > errs.txt errs=$(cat errs.txt) echo "$srcs" "$errs" done ```
kiranchandramohan commented 2 weeks ago

Does https://github.com/llvm/llvm-project/pull/90480 make it better?

thtsikas commented 2 weeks ago

Sadly, no. It's not the quality of the messages that is the problem in this Issue. It is the quantity of them and the cpu time expended.

kiranchandramohan commented 2 weeks ago

The parser is reporting the scope of the error. As the nesting of the scope increases there are more messages in the error message for the nested scopes. This can be reproduced without OpenMP in the following example.

block
block
block
block
block
block
block
block
block
block
end
kiranchandramohan commented 2 weeks ago

Reopened since the patch does not fix this issue. I missed removing the fixes tag before submitting.