Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toolchain.eclass: add workaround for hybrid CPUs #35877

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 19 additions & 1 deletion eclass/toolchain.eclass
Original file line number Diff line number Diff line change
Expand Up @@ -1567,6 +1567,24 @@ gcc_do_filter_flags() {
fi
fi

declare -A l1_cache_sizes=()
# Workaround for inconsistent cache sizes on hybrid P/E cores
# See PR111768 (and bug #904426, bug #908523, and bug #915389)
if [[ ${CBUILD} == x86_64* || ${CBUILD} == i?86* && ${CFLAGS} == *-march=native* ]] && tc-is-gcc ; then
local x
local l1_cache_size
# Iterate over all cores and find their L1 cache size
for x in $(seq 0 $(($(nproc)-1))) ; do
[[ -z ${x} || ${x} -gt 64 ]] && break
local l1_cache_size=$(taskset --cpu-list ${x} $(tc-getCC) -Q --help=params -O2 -march=native \
| awk '{ if ($1 ~ /^.*param.*l1-cache-size/) print $2; }' || die)
l1_cache_sizes[${l1_cache_size}]=1
done
# If any of them are different, just pick the first one.
if [[ ${#l1_cache_sizes} != 1 ]] ; then
append-flags --param=l1-cache-size=${l1_cache_size}
fi
fi

if ver_test -lt 13.6 ; then
# These aren't supported by the just-built compiler either.
Expand Down Expand Up @@ -1886,7 +1904,7 @@ toolchain_src_install() {
# See https://gcc.gnu.org/onlinedocs/gcc-11.3.0/jit/internals/index.html#packaging-notes
# and bug #843341.
#
# Both of the non-JIT and JIT builds are configured to install to $(DESTDIR)
# Both of the non-JIT and JIT builds are configured to install to $(DESTDIR)
# Install the configuration with --enable-host-shared first
# *then* the one without, so that the faster build
# of "cc1" et al overwrites the slower build.
Expand Down