llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

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

Open amd-thtsikas opened this issue 2 years ago • 9 comments

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

amd-thtsikas avatar Apr 29 '24 10:04 amd-thtsikas

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

kiranchandramohan avatar Apr 29 '24 11:04 kiranchandramohan

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

amd-thtsikas avatar Apr 29 '24 11:04 amd-thtsikas

@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

llvmbot avatar Apr 29 '24 14:04 llvmbot

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

kiranchandramohan avatar Apr 29 '24 14:04 kiranchandramohan

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.

amd-thtsikas avatar Apr 29 '24 16:04 amd-thtsikas

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 avatar Apr 30 '24 06:04 kiranchandramohan

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

kiranchandramohan avatar May 02 '24 11:05 kiranchandramohan

Hi @tblah, just checking that after your merged PRs, can we potentially close this issue? Thanks!

NimishMishra avatar Jan 04 '26 14:01 NimishMishra

Closing. After my changes the progression of error messages is approximately linear and completes in a short amount of time.

My changes only fixed the OpenMP case, Kiran's non-OpenMP reproducer will still have the same issue.

tblah avatar Jan 04 '26 19:01 tblah