[Bug 276170] LLVM bug prevents from enabling PGO optimization for Python 3.11+

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 29 Dec 2024 07:36:21 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276170

--- Comment #26 from Mark Millard <marklmi26-fbsd@yahoo.com> ---
In a PkgBase stable/14 based poudriere aarch64 jail, I tried
building lang/python310 based on:

# git -C /usr/ports diff lang/python310
diff --git a/lang/python310/Makefile b/lang/python310/Makefile
index b352e8a2f9d7..d19406a47897 100644
--- a/lang/python310/Makefile
+++ b/lang/python310/Makefile
@@ -27,8 +27,8 @@ SHEBANG_FILES+=       Lib/test/ziptestdata/exe_with_z64 \

 DISABLED_EXTENSIONS=   _sqlite3 _tkinter _gdbm
 CONFIGURE_ARGS+=       --enable-shared --without-ensurepip \
-                       --with-system-ffi
-CONFIGURE_ENV+=                OPT="" # Null out OPT to respect user CFLAGS
and remove optimizations
+                       --with-system-ffi --enable-optimizations
+#CONFIGURE_ENV+=               OPT="" # Null out OPT to respect user CFLAGS
and remove optimizations

 INSTALL_TARGET=                altinstall                                     
        # Don't want cloberring of unprefixed files

@@ -45,7 +45,7 @@ PLIST_SUB=            ABI=${ABIFLAGS} \
                        OSMAJOR=${OSVERSION:C/([0-9]*)[0-9]{5}/\1/}            
# For plat-freebsd* in pkg-plist. https://bugs.python.org/issue19554

 OPTIONS_DEFINE=                DEBUG IPV6 LIBMPDEC LTO NLS PYMALLOC
-OPTIONS_DEFAULT=       LIBMPDEC PYMALLOC
+OPTIONS_DEFAULT=       LIBMPDEC PYMALLOC LTO
 OPTIONS_EXCLUDE_riscv64=       LTO
 OPTIONS_RADIO=         HASH
 OPTIONS_RADIO_HASH=    FNV SIPHASH



poudriere-devel got the result:

[00:05:35] [01] [00:00:00] Building   lang/python310 | python310-3.10.16
[00:10:49] [01] [00:05:14] Finished   lang/python310 | python310-3.10.16:
Success


The log file has the line:

Rebuilding with profile guided optimizations:

Also reported was:

--CONFIGURE_ARGS--
--enable-shared --without-ensurepip  --with-system-ffi --enable-optimizations
--without-pydebug --enable-ipv6 --with-system-libmpdec --with-lto
--with-pymalloc --prefix=/usr/local ${_LATE_CONFIGURE_ARGS}
--End CONFIGURE_ARGS--

and the cc commands show use of: -flto



I did similarly under main [so: 15 as stands] and got the
same sort of results. I've tried without commenting out the
CONFIGURE_ENV+= as well. Similarly without LTO being
enabled.

It would seem that more context than use of
--enable-optimizations is at issue for stable/14 and main
these days.

What changes to lang/python310/Makefile are sufficient to
lead to the poudriere(-devel) based builds showing the
issue? (Not necessarily for stable/14 and main. But I'd
likely try such changes under stable/14 or under main or
both, just for curiosity.)


For reference . . .

Note: Windows DevKit 2023, 8 aarch64 FreeBSD cpus,
32 GiBytes of RAM, swap partition not active. Also that
jail had no packages previously built at the start and:

[00:00:03] Building 11 packages using up to 8 builders

In use was (or, if indicted, was not):

ALLOW_MAKE_JOBS=yes
No use of MAKE_JOBS_NUMBER_LIMIT or the like.
USE_TMPFS=all
python310 not listed in TMPFS_BLACKLIST .
UFS context, not ZFS.

-- 
You are receiving this mail because:
You are the assignee for the bug.