Skip to content

Instantly share code, notes, and snippets.

@Tatsh
Last active February 24, 2023 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tatsh/9faeb20481cc38c58457d59c173cdf5a to your computer and use it in GitHub Desktop.
Save Tatsh/9faeb20481cc38c58457d59c173cdf5a to your computer and use it in GitHub Desktop.
import itertools
args = ('-march=rocketlake -mabm --param=l1-cache-line-size=64 '
'--param=l1-cache-size=48 --param=l2-cache-size=16384').split(' ')
def mabm(o: str):
if o.startswith('-mabm'):
return 'maz'
return o.replace('-', '')
z = (sorted((set(' '.join(sorted(x, key=mabm))
for x in itertools.permutations(args, y))
for y in range(1, len(args))),
key=len))
for line in sorted(sorted(itertools.chain(*z), key=len), key=mabm):
print(line)

Results

See below for methodology.

Flags Working?
-march=x86-64-v2
-march=x86-64-v3
-march=x86-64-v4
-march=rocketlake
-march=rocketlake -mabm
-march=rocketlake -mabm --param=l1-cache-line-size=64
-march=rocketlake -mabm --param=l1-cache-line-size=64 --param=l1-cache-size=48
-march=rocketlake -mabm --param=l1-cache-line-size=64 --param=l1-cache-size=48 --param=l2-cache-size=16384 (same as -march=native)
-march=rocketlake -mabm --param=l1-cache-line-size=64 --param=l2-cache-size=16384
-march=rocketlake -mabm --param=l1-cache-size=48
-march=rocketlake -mabm --param=l1-cache-size=48 --param=l2-cache-size=16384
-march=rocketlake -mabm --param=l2-cache-size=16384
-march=rocketlake --param=l1-cache-line-size=64
-march=rocketlake --param=l1-cache-line-size=64 --param=l1-cache-size=48
-march=rocketlake --param=l1-cache-line-size=64 --param=l1-cache-size=48 --param=l2-cache-size=16384
-march=rocketlake --param=l1-cache-line-size=64 --param=l2-cache-size=16384
-march=rocketlake --param=l1-cache-size=48
-march=rocketlake --param=l1-cache-size=48 --param=l2-cache-size=16384
-march=rocketlake --param=l2-cache-size=16384
-mabm
-mabm --param=l1-cache-size=48
-mabm --param=l2-cache-size=16384
-mabm --param=l1-cache-line-size=64
-mabm --param=l1-cache-size=48 --param=l2-cache-size=16384
-mabm --param=l1-cache-line-size=64 --param=l1-cache-size=48
-mabm --param=l1-cache-line-size=64 --param=l2-cache-size=16384
-mabm --param=l1-cache-line-size=64 --param=l1-cache-size=48 --param=l2-cache-size=16384
--param=l1-cache-line-size=64
--param=l1-cache-line-size=64 --param=l1-cache-size=48
--param=l1-cache-line-size=64 --param=l1-cache-size=48 --param=l2-cache-size=16384
--param=l1-cache-line-size=64 --param=l2-cache-size=16384
--param=l1-cache-size=48
--param=l1-cache-size=48 --param=l2-cache-size=16384
--param=l2-cache-size=16384
(no flags)

Methodology

Flag permutation generation script is attached.

  1. Build every variant into a binpkg:
    while IFS=$'\n' read -r flags; do
        echo "$flags" &&
        rm -fR ./kde-plasma &&
        env FEATURES=-getbinpkg "CFLAGS=$flags" "CXXFLAGS=$flags" emerge --usepkg=n -1 kwin &&
        qpkg -P "$(pwd -P)" kwin &&
        cp -v ./kde-plasma/kwin/*.tbz2 "${OUTDIR}/kwin_x11.${flags// /.}"
    done < <(python generate-flag-permutations.py.py)
  2. Install every binpkg, pausing to test each one by running kwin_x11 --replace in another terminal.
    cd "$OUTDIR"
    for i in *.tbz2; do
        flags="${i:12}" &&
        flags="${flags/.tbz2}" &&
        echo "${flags//./ }" &&
        rm -f /var/cache/binpkgs/kde-plasma/kwin/* &&
        cp "$i" "/var/cache/binpkgs/kde-plasma/kwin/${i:0:11}-1.xpak" &&
        emerge --usepkgonly -1 kwin &&
        echo 'Test!' &&
        read
    done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment