keylase / nvidia-patch

This patch removes restriction on maximum number of simultaneous NVENC video encoding sessions imposed by Nvidia to consumer-grade GPUs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I don't know why, but patch not working for me for 535.129.03

PartTheSeas opened this issue · comments

Hey guys,

it's not a question directly. I'm using this patch for more than a year and never had problems. Now I've rolled back my machine (Manjaro) from the unstable branch back to their stable branch. For stability reasons (what else).

However, the patch runs fine, but if I test it, it doesn't seem to work and I don't get why? Help would be great in this.

Here're the outputs from the patch itself and from the ffmpeg test (I rolled it back to show the patch itself is working):

sudo bash ./patch.sh                                                                                            
Detected nvidia driver version: 535.129.03
libnvidia-encode.so
9b7f9b1cdce5a1ba1bba875cad7dfdb83b76a218  /opt/nvidia/libnvidia-encode-backup/libnvidia-encode.so.535.129.03
fac84945211a8f0809f9bf49b05490661fe101d5  /usr/lib64/libnvidia-encode.so.535.129.03
Patched!

ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda \                                                   ✔ 
      -f lavfi -i testsrc -t 50 \
      -vf hwupload -c:a copy -c:v h264_nvenc -b:v 4M -f null - \
      -vf hwupload -c:a copy -c:v h264_nvenc -b:v 1M -f null - \
      -vf hwupload -c:a copy -c:v h264_nvenc -b:v 8M -f null - \
      -vf hwupload -c:a copy -c:v h264_nvenc -b:v 6M -f null - \
      -vf hwupload -c:a copy -c:v h264_nvenc -b:v 5M -f null - \
      -vf hwupload -c:a copy -c:v h264_nvenc -b:v 7M -f null -
ffmpeg version n6.0 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.2.1 (GCC) 20230801
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-version3 --enable-vulkan
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
-vsync is deprecated. Use -fps_mode
Passing a number to -vsync is deprecated, use a string argument as described in the manual.
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: wrapped_avframe, rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (wrapped_avframe (native) -> h264 (h264_nvenc))
  Stream #0:0 -> #1:0 (wrapped_avframe (native) -> h264 (h264_nvenc))
  Stream #0:0 -> #2:0 (wrapped_avframe (native) -> h264 (h264_nvenc))
  Stream #0:0 -> #3:0 (wrapped_avframe (native) -> h264 (h264_nvenc))
  Stream #0:0 -> #4:0 (wrapped_avframe (native) -> h264 (h264_nvenc))
  Stream #0:0 -> #5:0 (wrapped_avframe (native) -> h264 (h264_nvenc))
Press [q] to stop, [?] for help
zsh: segmentation fault (core dumped)  ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -f lavfi -i  -t 

Is there a way to revert the patch(es) and start from scratch?

@PartTheSeas which GPU are you using?

Is there a way to revert the patch(es) and start from scratch?

Yes, ./patch.sh -r read the help -h for more details :)

zsh: segmentation fault (core dumped) ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -f lavfi -i -t

That's surprising.. do you see the segfault if you try with 5 sessions as well?
What happens when you revert the patch?

Usually session limit causes OOM error reported by the library and not a segfault.

By any chance did you forget to restart the system after downgrading drivers?

Yes, ./patch.sh -r

Okay yeah that's what I've tried, to no avail

which GPU are you using?

I'm using an RTX 3090 and as I said I've never witnessed this behavior with the patch

did you forget to restart the system after downgrading drivers?

I also thought it might have to do with a missing reboot or something I've forgotten, but just rebooted and the issue still persists. It's weird, as the patch worked upon the first reboot after the downgrades. Then I wanted to make sure that it's up and running, rolled it back and patched again, then it stopped working 🤔

Just to rule out some corruption caused by patch (highly unlikely), you can pacman -Rn all nvidia packages and reinstall them.

Then try to do just a simple <5 session encode before trying the patch.

you can pacman -Rn all nvidia packages and reinstall them

I'm sorry, but how would that command exactly look like? (Still new with Pacman and its commands) Is it something like sudo pacman -Rn *nvidia?

EDIT: Still new to pacman and its standard commands 🙈

I don't know either, but on my system I only have nvidia and nvidia-utils - so maybe just reinstall those two.

So I reinstalled the drivers using manjaro's mhwd command, but the issue with the patch still remains. I totally don't get it

do you see the segfault if you try with 5 sessions as well?

Yes 🤷‍♂️ I even see it with 3, isn't that weird?

Maybe something else broke with your GPU? Can you try to switch to the beta drivers again?

Anyway I am pretty sure at this point this is not related to the patch.

I completely uninstalled and reinstalled nvidia drivers, but still no dice 😒

I am pretty sure at this point this is not related to the patch.

Yeah I'm quite sure it isn't too. Damn. I have no idea how to solve this either. Will try to find a way to completely wipe nvidia related stuff and then reinstall it from scratch. If everything fails I'll reinstall the OS. Thank you for your help attempts tho! ☺️

@jailuthra just wanted to update you that I cleanly reinstalled my OS, using the same NVIDIA drivers and patch is working just fine! So it definitely had to do with something messy in my previous system. Nothing to do with your driver. Thanks for the support tho and have a great day ahead!