csgo-osx-linux icon indicating copy to clipboard operation
csgo-osx-linux copied to clipboard

Counter Strike 2 - Huge performance loss compared to Windows client

Open MacTavishAO opened this issue 1 year ago • 168 comments

Your system information

  • System information from steam (Steam -> Help -> System Information) in a [gist](https://gist.github.com/):
  • Have you checked for system updates?: Yes

Please describe your issue in as much detail as possible:

Below are the screenshots from native linux client with vulkan and CS2 running through Wine + DXVK, respectively. 20230929034453_1 20230929040743_1

I've played the Limited Test on Windows and there seems to be performance loss of anywhere between 40 to 60% compared to Windows client.

Steps for reproducing this issue:

  1. Run the game on the same hardware with both Operating Systems.
  2. Compare how they perform.

MacTavishAO avatar Sep 29 '23 01:09 MacTavishAO

One temporary solution could be compiling the game against DXVK and adding "-dxvk" launch option until native Vulkan implementation matures enough.

In both screenshots the game is GPU limited, everything at low except for model and texture at very high, FSR disabled, AA set to CMAA2 and the game is running with RX6800

MacTavishAO avatar Sep 29 '23 01:09 MacTavishAO

I have the opposite (nvidia gpu, map: Mirage).

DX11 100% FPS on Windows - 600-700 FPS 99% FPS on Windows - 300 FPS

Vulkan 100% FPS on Linux - 700 FPS 99% FPS on Linux - 600 FPS

szmarczak avatar Sep 29 '23 02:09 szmarczak

This appears to be limited to AMD GPUs on Linux. I also get about 50% better FPS on Win10 vs Arch with AMDGPU and x11, and there are also graphical bugs (#3287) with AMD and Linux that do not occur on Windows or with Nvidia on Linux.

R9 390 GPU load is always at 100%, Ryzen 3500x CPU between 20-40% on all cores.

henrym11106 avatar Sep 29 '23 04:09 henrym11106

I have the opposite (nvidia gpu, map: Mirage).

DX11 100% FPS on Windows - 600-700 FPS 99% FPS on Windows - 300 FPS

Vulkan 100% FPS on Linux - 700 FPS 99% FPS on Linux - 600 FPS

what GPU ? and what resolut/setting you on? even when i set my game to 1080p and settings to low i get sub 200fps on my Nvidia 3080 and really bad frame pacing spikes into the 40-80ms randomly but often so like from 200fps to 30-60fps for a split second

emko avatar Sep 29 '23 05:09 emko

I have the same issue with a 7900x+7900XT on Arch and Hyprland. I average about 150 with bad stutters and max around 220. The whole time the game is rendering on Linux, my GPU is pegged at 100% usage. With the same settings i am locked to 400 most of the time on Windows.

However, I also had poor performance with DXVK through Proton when trying during the beta. I'm not sure if anything has changed since then.

sawb avatar Sep 29 '23 06:09 sawb

Same issue here:

OS: Ubuntu 22.04 jammy Kernel: x86_64 Linux 6.2.0-33-generic DE: KDE 5.92.0 / Plasma 5.24.7 CPU: AMD Ryzen 5 5600 6-Core @ 12x 3,5GHz GPU: AMD Radeon RX 6600 (navi23, LLVM 15.0.7, DRM 3.49, 6.2.0-33-generic) RAM: 6596MiB / 32007MiB

I get around 170fps with drops to ~100fps from time to time. On my 2nd SSD I habe win10 and there I get 350-400fps with drops to like 280fps.

x0r13 avatar Sep 29 '23 09:09 x0r13

I have the same issue with a 7900x+7900XT on Arch and Hyprland. I average about 150 with bad stutters and max around 220. The whole time the game is rendering on Linux, my GPU is pegged at 100% usage. With the same settings i am locked to 400 most of the time on Windows.

However, I also had poor performance with DXVK through Proton when trying during the beta. I'm not sure if anything has changed since then.

Does your console show something like

[RenderSystem] FrameSync() - bailing out of vkWaitForFences( fenceCount = 1 ) after 0.255553 seconds, error = VK_TIMEOUT

while its stuttering?

an0nfunc avatar Sep 29 '23 10:09 an0nfunc

Replying to https://github.com/ValveSoftware/csgo-osx-linux/issues/3325#issuecomment-1740644862

No, there are no errors in my game console. And also not sure what changed, but now I am only getting ~20 FPS in game without it utilizing more than about 30% of my GPU.

Edit: actually just changed from rt kernel to mainline and I'm getting 400 FPS now. Not sure if an update happened, but I was also getting bad FPS on mainline kernel yesterday.

Edit again: back down to 30-100 FPS in game while still on mainline kernel. No change on my system

sawb avatar Sep 29 '23 10:09 sawb

This appears to be limited to AMD GPUs on Linux. I also get about 50% better FPS on Win10 vs Arch with AMDGPU and x11, and there are also graphical bugs (#3287) with AMD and Linux that do not occur on Windows or with Nvidia on Linux.

R9 390 GPU load is always at 100%, Ryzen 3500x CPU between 20-40% on all cores.

It is not. With nvidia proprietary drivers and no launch params I observe significantly lower avg framerate and common stuttering (a few times a second) compared to Windows 10. With gamemoderun %command%, the stutters are gone but I observe 30-40% lower framerate again compared to Windows 10. In the second case, the gpu usage is pegged at 100% with no sudden drops and the cpu usage is about 60-70%.

spinzed avatar Sep 29 '23 10:09 spinzed

https://github.com/ValveSoftware/csgo-osx-linux/issues/3325#issuecomment-1740690788 Which card and which driver version ?

Yuri-K7 avatar Sep 29 '23 13:09 Yuri-K7

#3325 (comment) Which card and which driver version ?

GTX 1050 4GB (notebook), 535.113.01

spinzed avatar Sep 29 '23 14:09 spinzed

#3325 (comment) Which card and which driver version ?

GTX 1050 4GB (notebook), 535.113.01

Well non RTX nvidia card have bad vulkan support so that would not be surprising. They lack some vulkan extensions, VKD3D also suffers bad performance with pascal nvidia cards.

Yuri-K7 avatar Sep 29 '23 15:09 Yuri-K7

#3325 (comment) Which card and which driver version ?

GTX 1050 4GB (notebook), 535.113.01

Well non RTX nvidia card have bad vulkan support so that would not be surprising. They lack some vulkan extensions, VKD3D also suffers bad performance with pascal nvidia cards.

Is that true? I played csgo with -vulkan with updated dxvk binaries (v2.2) and I had better avg framerate than with opengl. Also, considering that others with newer nvidia cards have the same issue, I don't think it is due to bad vulkan support.

spinzed avatar Sep 29 '23 16:09 spinzed

Is that true?

DXVK is not VKD3D, it doesn't suffers bad perf on pascal cards and yes opengl has bad perf. For the rest I can't say, the rest of the thread was claiming that nvidia cards was not impacted.

Yuri-K7 avatar Sep 29 '23 19:09 Yuri-K7

#3325 (comment) Which card and which driver version ?

GTX 1050 4GB (notebook), 535.113.01

Well non RTX nvidia card have bad vulkan support so that would not be surprising. They lack some vulkan extensions, VKD3D also suffers bad performance with pascal nvidia cards.

I have a turing card (GTX 1650) which has all the required extensions and I can comfortably say that the performance is definitely not the same

dphaldes avatar Sep 29 '23 19:09 dphaldes

DXVK is not VKD3D, it doesn't suffers bad perf on pascal cards and yes opengl has bad perf. For the rest I can't say, the rest of the thread was claiming that nvidia cards was not impacted.

Interesting... But that should not matter in this case since vkd3d isn't being used. I have seen comments of people in r/linux_gaming with turing and higher nvidia cards that had the issue and of people that had pascal cards and had no issues. Seems quite random whom it affects.

spinzed avatar Sep 29 '23 19:09 spinzed

I performed a rudimentary static benchmark between different backends on Windows and Linux.

Benchmarks

setpos -2090 3100 100; setang -7 130 0 setpos 1700 2220 30; setang 0 -144 0 setpos -2470 -2072 2057; setang 28 57 0
Windows DirectX ~451 FPS 100% cs2-windows-dx-1 635 FPS - Performance: 100% cs2-windows-dx-2 426 FPS - Performance: 100% cs2-windows-dx-3 293 FPS - Performance: 100%
Windows Vulkan ~402 FPS ~89% cs2-windows-vk-1 551FPS - Performance: 87% cs2-windows-vk-2 380FPS - Performance: 89% cs2-windows-vk-3 276FPS - Performance: 94%
Linux Vulkan ~360 FPS ~80% cs2-linux-vk-1 471FPS - Performance: 74% cs2-linux-vk-2 354FPS - Performance: 83% cs2-linux-vk-3 256FPS - Performance: 87%

Note: The brightness for Windows Vulkan is only borked on screenshots, it was OK in-game.

TL;DR

Windows Vulkan performs up to 11% worse than Windows DirectX. Linux Vulkan performs up to 9% worse than Windows Vulkan. Linux Vulkan performs up to 20% worse than Windows DirectX.


Software

Game Build: Sep 28 16:47:43 System: ArchLinux Kernel: 6.5.5-arch1-1 Nvidia: 535.113.01-2 Filesystem: ext4 inside LVM on the same logical volume as /home Windowing: X11 (awesome v4.3-1602-g485661b70 LuaJIT) Overlay: Linux: MangoHud; Windows: Afterburner + RivaTuner

Hardware

Processor: AMD Ryzen 5600X Graphics: MSI RTX 3070 SUPRIM X 8GB (non-LHR) Motherboard: MSI MAG B550 Tomahawk Memory: Corsair Vengeance SL 3600MHz (2x8GB)

Nvidia

DRM enabled: nvidia_drm.modeset=1 with nvidia nvidia_modeset nvidia_uvm nvidia_drm modules loaded Coolbits: 12 PowerMizer: Perfer Maximum Performance OpenGL Image Settings: High Performance OpenGL Sync to VBlank: off OpenGL Allow Flipping: off Force (Full) Composition Pipeline: off Resizable BAR: enabled

In-game settings

Resolution: 2560x1440 stretched to 3440x1440 Refresh Rate: 144 Hz Boost Player Contrast: Enabled Wait for Vertical Sync: Disabled Multisampling Anti-Aliasing Mode: CMAA2 Texture Filtering Mode: Anisotropic 4X Shader Detail: Low Particle Detail: Low Ambient Occlusion: Medium High Dynamic Range: Quality FidelityFX Super Resolution: Disabled

Misc

Global CPU scaling governor: performance

Launch parameters: __GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1 SDL_AUDIO_DRIVER=pipewire mangohud %command%

Related system-wide environment variables:

export NVD_BACKEND="direct"       # VA-API backend
export LIBVA_DRIVER_NAME="nvidia" # VA-API driver
export PROTON_HIDE_NVIDIA_GPU=0   # Report as Nvidia
export PROTON_ENABLE_NVAPI=1      # Enable NVAPI library
export VKD3D_CONFIG="dxr"         # Enable DirectX Raytracing

adamnejm avatar Sep 29 '23 23:09 adamnejm

these bugfixes don't fixed performance for me It fixes some graphic artifacts from here: https://github.com/ValveSoftware/csgo-osx-linux/issues/3287

JacKeTUs avatar Sep 29 '23 23:09 JacKeTUs

I performed a rudimentary static benchmark between different backends on Windows and Linux.

wonder if there is a debug tool to record the stutter to see what exactly causes it?

emko avatar Sep 30 '23 00:09 emko

I used in-game benchmark tool to record some stats. They were recorded in Inferno with same spawn location as a T player. The game is GPU limited in all scenarios, with same in-game graphics settings using an RX6800.

Launch arguments used to start a benchmark: -novid -nojoy -high -bench -benchframes 10000 -benchnoexit -warmtime 120 +map de_inferno -nobots +mp_warmup_offline_enabled true +mp_humanteam T

Performance loss for Linux Vulkan vs. Windows DX11: 40,93% Performance loss for Windows Vulkan vs. Windows DX11: 17,9% Performance loss for Linux Vulkan vs. Windows Vulkan: 28,05%

Windows DX11:

   Bench started at 120.001316
   Bench ended at 141.322387
   469.02 FPS 2.132 ms
   Settings: WarmTime: 120.000000, BenchTime: 86400.000000, BenchFrames: 10000
   Frames: 10000
   Total time: 21.321071
   --- Sample statistics:
   Total samples: 10000
   Total sample time: 21321.070896 ms
   Average frame time: 2.132107 ms (469.019593 FPS)
   Minimum frame time: 1.196500 ms (835.771038 FPS)
   Maximum frame time: 5.243900 ms (190.697770 FPS)
   Standard deviation: 0.360411 ms
   --- Sample statistics after sorting and discarding the lowest and highest 10% (20% total discarded):
   Total samples: 8000
   Total sample time: 16906.226201 ms
   Average frame time: 2.113278 ms (473.198448 FPS)
   Minimum frame time: 1.662900 ms (601.359082 FPS)
   Maximum frame time: 2.805400 ms (356.455421 FPS)
   Standard deviation: 0.182494 ms

Windows Vulkan:

   Bench started at 120.001572
   Bench ended at 145.955724
   385.29 FPS 2.595 ms
   Settings: WarmTime: 120.000000, BenchTime: 86400.000000, BenchFrames: 10000
   Frames: 10000
   Total time: 25.954151
   --- Sample statistics:
   Total samples: 10000
   Total sample time: 25954.151002 ms
   Average frame time: 2.595415 ms (385.294822 FPS)
   Minimum frame time: 1.612000 ms (620.347399 FPS)
   Maximum frame time: 4.090200 ms (244.486825 FPS)
   Standard deviation: 0.311289 ms
   --- Sample statistics after sorting and discarding the lowest and highest 10% (20% total discarded):
   Total samples: 8000
   Total sample time: 20653.900802 ms
   Average frame time: 2.581738 ms (387.336033 FPS)
   Minimum frame time: 2.186300 ms (457.393762 FPS)
   Maximum frame time: 3.071800 ms (325.542028 FPS)
   Standard deviation: 0.168463 ms

Linux Vulkan:

   Bench started at 120.000298
   Bench ended at 156.035308
   277.51 FPS 3.604 ms
   Settings: WarmTime: 120.000000, BenchTime: 86400.000000, BenchFrames: 10000
   Frames: 10000
   Total time: 36.035010
   --- Sample statistics:
   Total samples: 10000
   Total sample time: 36035.010408 ms
   Average frame time: 3.603501 ms (277.507898 FPS)
   Minimum frame time: 2.006523 ms (498.374578 FPS)
   Maximum frame time: 94.568443 ms (10.574352 FPS)
   Standard deviation: 1.072100 ms
   --- Sample statistics after sorting and discarding the lowest and highest 10% (20% total discarded):
   Total samples: 8000
   Total sample time: 28524.990077 ms
   Average frame time: 3.565624 ms (280.455838 FPS)
   Minimum frame time: 3.124315 ms (320.070157 FPS)
   Maximum frame time: 4.183387 ms (239.040769 FPS)
   Standard deviation: 0.309257 ms

MacTavishAO avatar Sep 30 '23 01:09 MacTavishAO

@MacTavishAO that frame time on Linux Vulkan is exactly what i am seeing that makes it unplayable, trying to find out if there is some kind of tool to profile the performance some how to find the reason for it so Valve can fix it or maybe they already know

Linux Vulkan

   Bench ended at 150.243155
   330.68 FPS 3.024 ms
   Settings: WarmTime: 120.000000, BenchTime: 86400.000000, BenchFrames: 10000
   Frames: 10000
   Total time: 30.240617
   --- Sample statistics:
   Total samples: 10000
   Total sample time: 30240.616911 ms
   Average frame time: 3.024062 ms (330.681085 FPS)
   Minimum frame time: 1.530037 ms (653.578946 FPS)
   Maximum frame time: 77.594879 ms (12.887448 FPS)
   Standard deviation: 1.031739 ms
   --- Sample statistics after sorting and discarding the lowest and highest 10% (20% total discarded):
   Total samples: 8000
   Total sample time: 23802.351021 ms
   Average frame time: 2.975294 ms (336.101253 FPS)
   Minimum frame time: 2.346618 ms (426.145213 FPS)
   Maximum frame time: 3.821702 ms (261.663520 FPS)
   Standard deviation: 0.413560 ms

emko avatar Sep 30 '23 02:09 emko

Shader stutter workaround for AMDVLK:

  1. Install fossilize. AUR or GitHub.
  2. Open your terminal.
  3. Run export VK_ICD_FILENAMES="/usr/share/vulkan/icd.d/amd_icd32.json:/usr/share/vulkan/icd.d/amd_icd64.json"
  4. Run fossilize-replay /mnt/kioxia/SteamLibrary/steamapps/shadercache/730/fozpipelinesv6/steam_pipeline_cache.foz (Your SteamLibrary folder is going to be different, adjust it for your system)
  5. While fossilize-replay running, go to ~/.cache/AMD/VkCache and find the cache name. It's easy to find, just look for the one growing in size.
  6. After fossilize-replay is finished, copy the cache.parc to /mnt/kioxia/SteamLibrary/steamapps/shadercache/730/AMDv1 and rename it to steamapp_shader_cache.parc (create AMDv1 folder if doesn't exist)

Most shader stutters are eliminated this way. It's night and day.

MacTavishAO avatar Sep 30 '23 07:09 MacTavishAO

It is performing quite badly on my 6750XT.

image

https://flightlessmango.com/logs/4453

Will try the Fossilize workaround posted above to see if it helps :/

KeironO avatar Sep 30 '23 09:09 KeironO

Will try the Fossilize workaround posted above to see if it helps :/

Make sure you launch the game using amdvlk.

MacTavishAO avatar Sep 30 '23 09:09 MacTavishAO

Will try the Fossilize workaround posted above to see if it helps :/

Make sure you launch the game using amdvlk.

How exactly do I ensure this?

KeironO avatar Sep 30 '23 09:09 KeironO

➜  fozpipelinesv6 export VK_ICD_FILENAMES="/usr/share/vulkan/icd.d/amd_icd32.json:/usr/share/vulkan/icd.d/amd_icd64.json"
➜  fozpipelinesv6 fossilize-replay steam_pipeline_cache.foz 
Fossilize ERROR: Got parse error: 1
Fossilize WARN: Did not replay blob (tag: AppInfo, hash: 0000000000000000). See previous logs for context.
Fossilize ERROR: Failed to create instance.
Fossilize ERROR: Failed to create Vulkan device, bailing ...

KeironO avatar Sep 30 '23 09:09 KeironO

Will try the Fossilize workaround posted above to see if it helps :/

Make sure you launch the game using amdvlk.

How exactly do I ensure this?

Most if not all distro's come with mesa drivers, amdvlk is AMD's own open source driver, you need to install it manually. There isn't a universal way to install it, if you're using arch, it's amdvlk. AMD themselves release Ubuntu debs here. If you're using Ubuntu or Ubuntu based distro you need to install both i386 and amd64 debs.

MacTavishAO avatar Sep 30 '23 09:09 MacTavishAO

How large is the parc file?

KeironO avatar Sep 30 '23 09:09 KeironO

How large is the parc file?

It depends on your GPU and amdvlk version. It was bigger than 1.3 GB for me. Make sure you launch the game using AMDVLK after compiling the shaders. VK_ICD_FILENAMES="/usr/share/vulkan/icd.d/amd_icd32.json:/usr/share/vulkan/icd.d/amd_icd64.json" %command%

MacTavishAO avatar Sep 30 '23 09:09 MacTavishAO

I'm still having the following error:

Fossilize ERROR: Got parse error: 1
Fossilize WARN: Did not replay blob (tag: AppInfo, hash: 0000000000000000). See previous logs for context.
Fossilize ERROR: Failed to create instance.
Fossilize ERROR: Failed to create Vulkan device, bailing ...

KeironO avatar Sep 30 '23 09:09 KeironO