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

Add support for Propeller Optimization #359

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions linux-cachyos-rc/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,18 @@ _autofdo=${_autofdo-}
# Name for the AutoFDO profile
_autofdo_profile_name=${_autofdo_profile_name-}

# Propeller should be applied, after the kernel is optimized with AutoFDO
# Workflow:
# 1. Proceed with above AutoFDO Optimization, but enable at the final compilation also _propeller
# 2. Boot into the AutoFDO Kernel and profile it
# 3. Convert the profile into the propeller profile, example:
# create_llvm_prof --binary=/usr/src/debug/linux-cachyos-rc/vmlinux --profile=propeller.data --format=propeller --propeller_output_module_name --out=/home/ptr1337/bench/propeller_cc_profile.txt --propeller_symorder=/home/ptr1337/bench/propeller_ld_profile.txt
# 4. Place the propeller_cc_profile.txt and propeller_ld_profile.txt into the sourcedir
# 5. Enable _propeller_prefix
_propeller=${_propeller-}

# Enable for final compilation with name "propeller"
_propeller_prefix=${_propeller_prefix-propeller}

# ATTENTION: Do not modify after this line
_is_lto_kernel() {
Expand Down Expand Up @@ -261,6 +273,15 @@ if [ -n "$_autofdo" ] && [ -n "$_autofdo_profile_name" ]; then
fi
fi

# Use generated Propeller Profile
if [ -n "$_propeller" ] && [ -n "$_propeller_prefix" ]; then
if [ -e "$_autofdo_profile_name" ]; then
source+=("$_propeller_prefix")
else
_die "Failed to find file ${_propeller_prefix}"
fi
fi

## List of CachyOS schedulers
case "$_cpusched" in
cachyos|bore|rt-bore|hardened) # CachyOS Scheduler (BORE)
Expand Down Expand Up @@ -486,6 +507,15 @@ prepare() {
BUILD_FLAGS+=(CLANG_AUTOFDO_PROFILE="${srcdir}/${_autofdo_profile_name}")
fi

# Propeller Optimization
if [ -n "$_propeller" ]; then
scripts/config -e PROPELLER_CLANG
fi
if [ -n "$_propeller" ] && [ -n "$_propeller_prefix" ]; then
echo "Propeller profile has been found..."
BUILD_FLAGS+=(CLANG_PROPELLER_PROFILE_PREFIX="${srcdir}/_propeller_prefix")
fi

echo "Enable USER_NS_UNPRIVILEGED"
scripts/config -e USER_NS

Expand Down