Hello Thomas,

19.12.2023 07:20, Thomas Munro wrote:
On Tue, Dec 19, 2023 at 11:42 AM Thomas Munro <thomas.mu...@gmail.com> wrote:
Hrmph.  Well something weird is going on, but it might indeed involve
me being confused about debug options of the compiler itself.  How can
one find out which build options were used for clang/llvm compiler +
libraries?  My earlier reports were from a little machine at home, so
let's try again on an i9-9900 CPU @ 3.10GHz (a bit snappier) running
Debian 12, again using packages from apt.llvm.org:

17 ~198s
16 ~14s
15 ~11s
And on another Debian machine (this time a VM) also using apt.llvm.org
packages, the huge ~3 minute time occurs with clang-16... hrrrnnnff...
seems like there must be some other variable here that I haven't
spotted yet...

Reproduced here, with clang-16 and clang-17 (on Ubuntu 22.04, on Fedora 39).
Namely, I tried on Ubuntu
clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04 and
clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04
from https://github.com/llvm/llvm-project/releases, as follows:
PATH=".../clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04/bin:$PATH" CC=clang-17 CPPFLAGS="-O2" sh -c "./configure -q --enable-debug --enable-cassert && time make >make.log"
and then
PATH=".../clang+llvm-17.0.6-x86_64-linux-gnu-ubuntu-22.04/bin:$PATH" sh -c "cd src/interfaces/ecpg/preproc; time clang-17 -v -g -I../include -I../../../../src/interfaces/ecpg/include -I. -I../../../../src/interfaces/ecpg/ecpglib -I../../../../src/interfaces/libpq -I../../../../src/include -O2 -D_GNU_SOURCE -c -o preproc.o preproc.c"
144.59user 0.25system 2:24.94elapsed 99%CPU (0avgtext+0avgdata 
217320maxresident)k

The same is observed with clang-16 (16.0.6 20231112100510+7cbf1a259152...)
installed from http://apt.llvm.org/jammy/.
(Adding parameters -fno-slp-vectorize or -mllvm -slp-threshold=100000 or
-mllvm -slp-max-vf=3 decreases/normalizes compilation time.)

On a fresh vagrant image "fedora/39-cloud-base", I tried versions
16.0.0~rc4, 17.0.0~rc3, 17.0.6 downloaded from
https://koji.fedoraproject.org/koji/packageinfo?packageID=21848
https://koji.fedoraproject.org/koji/packageinfo?packageID=5646
All of them also give 2+ minutes for me.
But I see no slowdown with version 15.0.7 on the same VM.

Also, I see no issue with clang-18, installed on Ubuntu from apt.llvm.org.
So, as far as I can see, this anomaly started from clang-16, and ended with
clang-18.
Comparing histories of SLPVectorizer.cpp:
https://github.com/llvm/llvm-project/commits/main/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
https://github.com/llvm/llvm-project/commits/release/17.x/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
I see a commit that probably could fix the issue in the master branch (for
clang-18):
[SLP][NFC]Improve compile time by storing all nodes for the given ...

Though I still can't explain how you get ~14s with clang-16. Could you show
the exact sequence of commands you use to measure the duration?

Best regards,
Alexander


Reply via email to