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

7900X3D core pinning is reducing FPS and core parking does not work #453

Closed
mhmarf opened this issue Dec 26, 2023 · 8 comments · Fixed by #490
Closed

7900X3D core pinning is reducing FPS and core parking does not work #453

mhmarf opened this issue Dec 26, 2023 · 8 comments · Fixed by #490

Comments

@mhmarf
Copy link
Contributor

mhmarf commented Dec 26, 2023

Hello and thank you a lot for your work.

Describe the bug
I'm not sure this is a gamemode (1.8.1) bug or Linux Kernel does not really support 7900x3d, but pin_cores is resulting in fewer FPS and park_cores is not even working.
lstopo:
topo

Tested on Horizon Zero Dawn 720p resolution and lowest possible settings and same scene while looking at the ground:
/usr/share/gamemode/gamemode.ini -> pin_cores=yes: 265 FPS
core_pin

park_cores=yes: does not work (mangohud shows all cores are working) 350 FPS
core_park

gamemode disabled (via lutris): 350 FPS
gamemode off

(BTW playing on 1440p resolution and high graphics settings, core pinning does not reduce fps. I just wanted to make the game cpu bound by playing 720p to see what will happen...)

To Reproduce
Steps used to reproduce the behavior:

  1. Enable gamemod with Lutris (using default gamemode.ini pin_cores=yes option).
  2. Run Horizon Zero Dawn on 720p resolution.
  3. FPS decreases.
  4. use park_cores=yes
  5. all cores are active.

Expected behavior
FPS is supposed to increase (though not sure if Linux fully supports 3D V-cache on kernel level...) and park_cores=yes should disable cores with no 3d v-cache.

System Info (please complete the following information):

  • OS and version: Nobara 38
  • System:
Kernel: 6.6.7-203.fsync.fc38.x86_64 arch: x86_64 bits: 64 compiler: gcc
  v: 2.39-16.fc38 clocksource: tsc Desktop: GNOME v: 44.2 tk: GTK v: 3.24.38
  wm: gnome-shell dm: 1: GDM v: 43.0 2: LightDM v: 1.32.0 note: stopped
  Distro: Nobara release 38 (Thirty Eight) base: RHEL 38
Machine:
Type: Desktop Mobo: Micro-Star model: MAG B650 TOMAHAWK WIFI (MS-7D75)
  v: 1.0 serial: <superuser required> UEFI: American Megatrends LLC. v: 1.74
  date: 08/01/2023
CPU:
Info: 12-core model: AMD Ryzen 9 7900X3D bits: 64 type: MT MCP smt: enabled
  arch: Zen 4 rev: 2 cache: L1: 768 KiB L2: 12 MiB L3: 128 MiB
Speed (MHz): avg: 589 high: 4950 min/max: 400/5660 cores: 1: 400 2: 400
  3: 400 4: 400 5: 400 6: 400 7: 400 8: 400 9: 400 10: 400 11: 400 12: 400
  13: 400 14: 400 15: 400 16: 400 17: 4950 18: 400 19: 400 20: 400 21: 400
  22: 400 23: 400 24: 400 bogomips: 211179
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Graphics:
Device-1: AMD Navi 21 [Radeon RX 6800/6800 XT / 6900 XT] vendor: Tul /
  PowerColor Red Devil driver: amdgpu v: kernel arch: RDNA-2 pcie:
  speed: 16 GT/s lanes: 16 ports: active: DP-1 empty: DP-2,DP-3,HDMI-A-1
  bus-ID: 03:00.0 chip-ID: 1002:73bf class-ID: 0300
Device-2: AMD Raphael vendor: Micro-Star MSI driver: amdgpu v: kernel
  arch: RDNA-2 pcie: speed: 16 GT/s lanes: 16 bus-ID: 11:00.0
  chip-ID: 1002:164e class-ID: 0300 temp: 45.0 C
Display: wayland server: X.org v: 1.20.14 with: Xwayland v: 23.2.2
  compositor: gnome-shell driver: X: loaded: amdgpu
  unloaded: fbdev,modesetting,radeon,vesa dri: radeonsi gpu: amdgpu
  display-ID: 0
Monitor-1: DP-1 model: LG (GoldStar) ULTRAGEAR serial: <filter>
  res: 2560x1440 dpi: 93 size: 697x392mm (27.44x15.43") diag: 800mm (31.5")
  modes: max: 2560x1440 min: 640x480
API: OpenGL v: 4.6 vendor: amd mesa v: 23.3.0 glx-v: 1.4 es-v: 3.2
  direct-render: yes renderer: AMD Radeon RX 6900 XT (radeonsi navi21 LLVM
  16.0.6 DRM 3.54 6.6.7-203.fsync.fc38.x86_64) device-ID: 1002:73bf
  display-ID: :0.0
API: Vulkan v: 1.3.261 layers: 12 surfaces: xcb,xlib,wayland device: 0
  type: discrete-gpu hw: amd driver: mesa radv device-ID: 1002:73bf device: 1
  type: integrated-gpu hw: amd driver: mesa radv device-ID: 1002:164e
  device: 2 type: cpu driver: mesa llvmpipe device-ID: 10005:0000
API: EGL Message: EGL data requires eglinfo. Check --recommends.
Audio:
Device-1: AMD Navi 21/23 HDMI/DP Audio driver: snd_hda_intel v: kernel pcie:
  speed: 16 GT/s lanes: 16 bus-ID: 03:00.1 chip-ID: 1002:ab28 class-ID: 0403
Device-2: AMD Rembrandt Radeon High Definition Audio
  vendor: Micro-Star MSI driver: snd_hda_intel v: kernel pcie: speed: 16 GT/s
  lanes: 16 bus-ID: 11:00.1 chip-ID: 1002:1640 class-ID: 0403
Device-3: AMD Family 17h/19h HD Audio vendor: Micro-Star MSI
  driver: snd_hda_intel v: kernel pcie: speed: 16 GT/s lanes: 16
  bus-ID: 11:00.6 chip-ID: 1022:15e3 class-ID: 0403
Device-4: Micro Star [] driver: hid-generic,snd-usb-audio,usbhid type: USB
  rev: 2.0 speed: 480 Mb/s lanes: 1 bus-ID: 1-6:3 chip-ID: 0db0:422d
  class-ID: 0300
API: ALSA v: k6.6.7-203.fsync.fc38.x86_64 status: kernel-api
Server-1: JACK v: 1.9.22 status: off
Server-2: PipeWire v: 1.0.0 status: active with: 1: pipewire-pulse
  status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
Network:
Device-1: Realtek RTL8125 2.5GbE vendor: Micro-Star MSI driver: r8169
  v: kernel pcie: speed: 5 GT/s lanes: 1 port: e000 bus-ID: 0d:00.0
  chip-ID: 10ec:8125 class-ID: 0200
IF: enp13s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
Device-2: MEDIATEK MT7922 802.11ax PCI Express Wireless Network Adapter
  driver: mt7921e v: kernel pcie: speed: 5 GT/s lanes: 1 bus-ID: 0e:00.0
  chip-ID: 14c3:0616 class-ID: 0280
IF: wlp14s0 state: down mac: <filter>
Bluetooth:
Device-1: MediaTek [] driver: btusb v: 0.8 type: USB rev: 2.1
  speed: 480 Mb/s lanes: 1 bus-ID: 1-7:4 chip-ID: 0e8d:0616 class-ID: e001
  serial: <filter>
Report: btmgmt ID: hci0 rfk-id: 0 state: up address: <filter> bt-v: 5.2
  lmp-v: 11 class-ID: 7c0104
Drives:
Local Storage: total: 6.37 TiB used: 2 TiB (31.4%)
ID-1: /dev/nvme0n1 vendor: Samsung model: SSD 980 PRO 2TB size: 1.82 TiB
  speed: 63.2 Gb/s lanes: 4 tech: SSD serial: <filter> fw-rev: 5B2QGXA7
  temp: 43.9 C scheme: GPT
ID-2: /dev/nvme1n1 vendor: Western Digital model: WDS100T1X0E-00AFY0
  size: 931.51 GiB speed: 63.2 Gb/s lanes: 4 tech: SSD serial: <filter>
  fw-rev: 613000WD temp: 45.9 C scheme: GPT
ID-3: /dev/sda vendor: Toshiba model: HDWT840 size: 3.64 TiB
  speed: 6.0 Gb/s tech: HDD rpm: 5400 serial: <filter> fw-rev: 0L scheme: GPT
Partition:
ID-1: / size: 1.5 TiB used: 595.58 GiB (38.7%) fs: btrfs dev: /dev/nvme0n1p5
ID-2: /boot size: 973.4 MiB used: 345.4 MiB (35.5%) fs: ext4
  dev: /dev/nvme0n1p4
ID-3: /boot/efi size: 563.9 MiB used: 39.9 MiB (7.1%) fs: vfat
  dev: /dev/nvme0n1p3
ID-4: /home size: 1.5 TiB used: 595.58 GiB (38.7%) fs: btrfs
  dev: /dev/nvme0n1p5
Swap:
ID-1: swap-1 type: partition size: 27.94 GiB used: 0 KiB (0.0%) priority: -2
  dev: /dev/nvme0n1p2
ID-2: swap-2 type: zram size: 8 GiB used: 0 KiB (0.0%) priority: 100
  dev: /dev/zram0
Sensors:
System Temperatures: cpu: 50.8 C mobo: N/A
Fan Speeds (rpm): N/A
GPU: device: amdgpu temp: 46.0 C device: amdgpu temp: 54.0 C mem: 48.0 C
  fan: 0 watts: 13.00
Repos:
Packages: pm: rpm pkgs: N/A note: see --rpm pm: flatpak pkgs: 20
No active dnf repos in: /etc/dnf/dnf.conf
Active yum repos in: /etc/yum.repos.d/fedora-cisco-openh264.repo
  1: fedora-cisco-openh264 ~ https://mirrors.fedoraproject.org/metalink?repo=fedora-cisco-openh264-$releasever&arch=$basearch
Active yum repos in: /etc/yum.repos.d/fedora-updates.repo
  1: updates ~ https://nobara-fedora-updates.nobaraproject.org/$releasever/
Active yum repos in: /etc/yum.repos.d/fedora.repo
  1: fedora ~ https://nobara-fedora.nobaraproject.org/$releasever/
Active yum repos in: /etc/yum.repos.d/nobara.repo
  1: nobara-baseos-$releasever ~ https://nobara-baseos.nobaraproject.org/$releasever/
  2: nobara-appstream-$releasever ~ https://nobara-appstream.nobaraproject.org/$releasever/$basearch
  3: nobara-rocm-official ~ https://repo.radeon.com/rocm/rhel9/5.6.1/main/
No active yum repos in: /etc/yum.repos.d/rpmfusion-free-updates-testing.repo
Active yum repos in: /etc/yum.repos.d/rpmfusion-free-updates.repo
  1: rpmfusion-free-updates ~ https://mirrors.rpmfusion.org/metalink?repo=free-fedora-updates-released-$releasever&arch=$basearch
Active yum repos in: /etc/yum.repos.d/rpmfusion-free.repo
  1: rpmfusion-free ~ https://mirrors.rpmfusion.org/metalink?repo=free-fedora-$releasever&arch=$basearch
No active yum repos in: /etc/yum.repos.d/rpmfusion-nonfree-updates-testing.repo
Active yum repos in: /etc/yum.repos.d/rpmfusion-nonfree-updates.repo
  1: rpmfusion-nonfree-updates ~ https://mirrors.rpmfusion.org/metalink?repo=nonfree-fedora-updates-released-$releasever&arch=$basearch
Active yum repos in: /etc/yum.repos.d/rpmfusion-nonfree.repo
  1: rpmfusion-nonfree ~ https://mirrors.rpmfusion.org/metalink?repo=nonfree-fedora-$releasever&arch=$basearch
Info:
Processes: 797 Uptime: 11m wakeups: 0 Memory: total: 32 GiB note: est.
available: 30.5 GiB used: 4.94 GiB (16.2%) Init: systemd v: 253
target: graphical (5) default: graphical Compilers: gcc: 13.2.1
clang: 16.0.6 Shell: Bash v: 5.2.21 running-in: gnome-terminal inxi: 3.3.31
  • GameMode Version 1.8.1
@mhmarf
Copy link
Contributor Author

mhmarf commented Dec 26, 2023

I just tested on Remnant 2 and core pinning did NOT reduce fps at all but gave same fps as gamemode off... yet core parking still did not work.

@dux1chuanl
Copy link

dux1chuanl commented Feb 1, 2024

interested in this issue.
As I know, AMD is pushing X3D CPU kernel driver to the latest Linux kernel.
In this link:
https://lore.kernel.org/linux-pm/CAJZ5v0gzKdjZJBypEw1+czGN-SHbx0s0-h=Lq96+MDVAO11PYQ@mail.gmail.com/

@mhmarf

@mhmarf
Copy link
Contributor Author

mhmarf commented Jul 29, 2024

Hello again!
Updating this after 7 months!
I tested core pinning and core parking capabilities of gamemode 1.8.1 again on CachyOS 6.9.2 and also today on newly released Linux Mint 22 Wilma (which comes with kernel 6.8 and also default gamemode 1.8.1-2 BTW which is very nice!).

On CachyOS 6.9.2 surprisingly core_pinning=yes resulted in better performance of the games tested than original Nobara 38 but nowhere close to when disabling entire CCD1 (CCD with no extra v-cache) through BIOS! That resulted in MUCH more performance gain than core pinning. Later on I discovered I can disabled the entire CCD1 inside Linux and no need to go to BIOS by using HotPlug (thanks to CachyOS dev ptr1337 who told me this):

echo 0 > /sys/devices/system/cpu/cpu6/online
echo 0 > /sys/devices/system/cpu/cpu7/online
...
echo 0 > /sys/devices/system/cpu/cpu23/online

and so on... needless to say core_parking=yes also did not work on CachyOS either...

But today I have managed to finally make Core Parking feature of Gamemode work which gave me equivalent performance of disabling CCD1!! After googling for 30 seconds (:D) I realized there is a polkit rule for gamemode located:
/usr/share/polkit-1/rules.d/gamemode.rules

/*
 * Allow users in privileged gamemode group to run cpugovctl &
 * gpuclockctl without authentication
 */
polkit.addRule(function (action, subject) {
    if ((action.id == "com.feralinteractive.GameMode.governor-helper" ||
         action.id == "com.feralinteractive.GameMode.gpu-helper" ||
         action.id == "com.feralinteractive.GameMode.cpu-helper" ||
         action.id == "com.feralinteractive.GameMode.procsys-helper") &&
        subject.isInGroup("gamemode"))
    {
        return polkit.Result.YES;
    }
});

I replaced "gamemode" in subject.isInGroup("gamemode") with my user name (which can be known using whoami command) and core parking is working now! Wow!

Here is a benchmark of Outer Wilds (960x540 resolution) on Linux Mint 22 Wilma (7900X3D):
Gamemode off: 900 FPS
no gamemode

Gamemode Core Pinning: 916 FPS
corepinning

Gamemode Core Parking (notice how non v-cache cores no longer exist!!): 1300 FPS
parkcontrol
(BTW notice that mangohud is wrongly saying gamemode is off which is not true...)

To summarize, on 7900X3D, core pinning performance gain is minimal and not worth it, instead use core parking (/usr/share/gamemode/gamemode.ini -> core_parking=yes) but to make it work you need to edit /usr/share/polkit-1/rules.d/gamemode.rules as said above!

Thank you Feral Interactive!

@mhmarf mhmarf closed this as completed Jul 29, 2024
@mhmarf
Copy link
Contributor Author

mhmarf commented Jul 29, 2024

I reopened and leave it to gamemode devs to maybe check it to see if they want to make any changes to their code and close this as completed themselves...

@mhmarf mhmarf reopened this Jul 29, 2024
@rivenirvana
Copy link

I replaced "gamemode" in subject.isInGroup("gamemode") with my user name (which can be known using whoami command) and core parking is working now! Wow!

Have you made sure to add your user to the gamemode group? I don't think this rule edit is necessary if you have done so.

@mhmarf
Copy link
Contributor Author

mhmarf commented Jul 30, 2024

I replaced "gamemode" in subject.isInGroup("gamemode") with my user name (which can be known using whoami command) and core parking is working now! Wow!

Have you made sure to add your user to the gamemode group? I don't think this rule edit is necessary if you have done so.

Eh... I just did and it worked lol... how was I supposed to know this? I didn't even know gamemode is a group as it never showed when using groups command...
For fellow clueless gamers here's how to do this (took me another 30 seconds google search...):
sudo gpasswd -a YOURUSERNAME gamemode
Thank you!

@rivenirvana
Copy link

Eh... I just did and it worked lol... how was I supposed to know this? I didn't even know gamemode is a group as it never showed when using groups command... For fellow clueless gamers here's how to do this (took me another 30 seconds google search...): sudo gpasswd -a YOURUSERNAME gamemode Thank you!

Yknow what, I don't actually know where I first heard/saw/read about that as well. I can recall having seen multiple posts & discussions about it in passing, but that was already after the fact.

I checked just now and I think the only reference for it in the repo is in a very subtle comment in example/gamemode.ini. Since this seems to be an essential step in the installation process to make sure that gamemode is set up properly and that all its features are usable, it might be worthwhile to make a PR and include this information in the main README, or even get interactively prompted for it in bootstrap.sh.

@mhmarf
Copy link
Contributor Author

mhmarf commented Jul 30, 2024

I just did it... #490..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants