Your GeForce runs AI at half speed. This fixes it for 20/30/40 series cards. Up to 2× FP16 / BF16 / TF32 tensor throughput
C
Add unraid support
Zagitta1fc6d628c49c
diff --git a/.github/workflows/unraid.yml b/.github/workflows/unraid.ymlnew file mode 100644index 0000000..73ec3d5--- /dev/null+++ b/.github/workflows/unraid.yml@@ -0,0 +1,99 @@+# SPDX-License-Identifier: GPL-2.0-only+name: Unraid++on:+ push:+ branches: [main]+ schedule:+ - cron: '17 5 * * *'+ workflow_dispatch:++permissions:+ contents: write++# Runs one at a time: publish rewrites built.txt in the release.+concurrency:+ group: unraid++# Builds the package of this VERSION for every stable Unraid release that+# has none yet, and publishes the packages and the plugin to the unraid+# release, which the plugin downloads from.+jobs:+ discover:+ if: github.ref == 'refs/heads/main'+ runs-on: ubuntu-24.04+ outputs:+ releases: ${{ steps.find.outputs.releases }}+ steps:+ - uses: actions/checkout@v5+ - id: find+ env:+ GH_TOKEN: ${{ github.token }}+ run: echo "releases=$(sh packaging/unraid/discover.sh)" >> "$GITHUB_OUTPUT"++ build:+ name: build (Unraid ${{ matrix.unraid.version }})+ needs: discover+ if: needs.discover.outputs.releases != '[]'+ runs-on: ubuntu-24.04+ strategy:+ fail-fast: false+ matrix:+ unraid: ${{ fromJSON(needs.discover.outputs.releases) }}+ steps:+ - uses: actions/checkout@v5+ - name: Unraid kernel source+ run: |+ sudo apt-get update -q+ sudo apt-get install -qy squashfs-tools+ curl -sSfL -o unraid.zip '${{ matrix.unraid.url }}'+ echo '${{ matrix.unraid.sha256 }} unraid.zip' | sha256sum -c -+ unzip -q unraid.zip bzmodules+ unsquashfs -q -d usr bzmodules src+ rm unraid.zip bzmodules+ # In a container of the gcc major version the kernel was built with.+ - name: Build+ run: |+ src=$(echo usr/src/linux-*-Unraid)+ gcc=$(sed -n 's/^CONFIG_CC_VERSION_TEXT="gcc (GCC) \([0-9]*\)\..*/\1/p' "$src/config")+ docker run --rm -v "$PWD:/repo" -w /repo "gcc:$gcc" sh -euc '+ apt-get update -q+ apt-get install -qy --no-install-recommends bc bison flex libelf-dev libssl-dev kmod xz-utils patch+ sh packaging/unraid/build.sh "$1" dist+ chown -R "$2" dist' sh "$src" "$(id -u):$(id -g)"+ echo "${{ matrix.unraid.version }} $(cat VERSION)" > 'dist/${{ matrix.unraid.version }}.built'+ - uses: actions/upload-artifact@v4+ with:+ name: unraid-${{ matrix.unraid.version }}+ path: dist++ # Also when some builds failed, so the others are published.+ publish:+ needs: [discover, build]+ if: ${{ !cancelled() && needs.discover.result == 'success' }}+ runs-on: ubuntu-24.04+ env:+ GH_TOKEN: ${{ github.token }}+ steps:+ - uses: actions/checkout@v5+ - if: needs.discover.outputs.releases != '[]'+ uses: actions/download-artifact@v4+ with:+ pattern: unraid-*+ merge-multiple: true+ path: dist+ - name: Publish+ run: |+ gh release view unraid >/dev/null 2>&1 ||+ gh release create unraid --prerelease --target main --title 'Unraid packages' \+ --notes 'Packages for the Unraid plugin, see packaging/unraid. Install it from the gpu-unlock.plg URL below.'+ mkdir -p dist+ set -- dist/*.txz+ if [ -e "$1" ]; then+ gh release upload unraid --clobber dist/*.txz dist/*.md5+ fi+ gh release download unraid -p built.txt -O built.txt 2>/dev/null || : > built.txt+ { cat built.txt; cat dist/*.built 2>/dev/null || :; } | sort -u -o built.txt+ sed "s/@VERSION@/$(cat VERSION)/" packaging/unraid/gpu-unlock.plg > gpu-unlock.plg+ # The plugin last, once the packages it downloads are there.+ gh release upload unraid --clobber built.txt gpu-unlock.plgdiff --git a/README.md b/README.mdindex 2fe2ed2..46199d5 100644--- a/README.md+++ b/README.md@@ -2,7 +2,7 @@### Your GeForce runs AI at half speed. This fixes it.-+**Up to 2× FP16 / BF16 / TF32 tensor throughput** · **+25–55% LLM prefill** · **+25–50% fine-tuning** · **+30–55% image generation**@@ -108,12 +108,15 @@ your boot images/entries (e.g. `sudo mkinitcpio -P` for mkinitcpio UKIs).# FAQ+- Q: Do you have a website/coin/installer?+A: No this is the one and only OG source for gpu-unlock. Crypto, websites, installers and what else is not associated with this project or the developer in any way shape or form.- Q: Does this depend on a specific driver version? I see `610.43.03` is pinned.A: No the driver is only fetched to extract firmware this unlock depends on- Q: What about Windows?-A: I don't run windows and don't plan to maintain it but [https://github.com/impacifist/Windows-GPU-UNLOCK](https://github.com/impacifist/Windows-GPU-UNLOCK) has built a port, YMMV.+A: I don't run windows and don't plan to maintain it but [https://github.com/impacifist/Windows-GPU-UNLOCK](https://github.com/impacifist/Windows-GPU-UNLOCK) has built a port, YMMV.+There are windows installer's floating around but I would recommend being ++**very**++ careful with those.- Q: What about Blackwell (RTX 50)?-A: Not supported.+A: Not supported and unlikely to happen.- Q: Why did Nvidia handicap my GPU?A: Market segmentation, they want businesses to purchase the professional cards without these limitations at significantly higher prices.- Q: Does this hurt my GPU?diff --git a/packaging/unraid/build.sh b/packaging/unraid/build.shnew file mode 100755index 0000000..2a1aa53--- /dev/null+++ b/packaging/unraid/build.sh@@ -0,0 +1,67 @@+#!/bin/sh+# SPDX-License-Identifier: GPL-2.0-only+# Build the Unraid package of gpu_unlock for one Unraid kernel. The source+# is /usr/src/linux-*-Unraid from the bzmodules of an Unraid 7.3 or later+# release: the kernel config, Unraid's patches and drivers overlay, and+# System.map. Needs curl, patch, xz, kmod and what a kernel build needs,+# with the gcc major version the kernel was built with. Run from the+# repository root:+# packaging/unraid/build.sh <linux-*-Unraid> <output directory>+set -eu+src=$(realpath "$1")+out=$(mkdir -p "$2" && realpath "$2")+krel=${src##*/linux-}+kver=${krel%%-*}+version=$(cat VERSION)+nv=$(sed -n 's/^NV *:= *//p' Makefile)+work=$(mktemp -d)+trap 'rm -rf "$work"' EXIT++# The vanilla kernel with Unraid's changes, prepared for external modules.+curl -sSfL -o "$work/linux.tar.xz" "https://cdn.kernel.org/pub/linux/kernel/v${kver%%.*}.x/linux-$kver.tar.xz"+tar -xJf "$work/linux.tar.xz" -C "$work"+kdir=$work/linux-$kver+cp -r "$src/drivers/." "$kdir/drivers/"+for patch in "$src"/*.patch; do+ patch -s -p1 -d "$kdir" <"$patch"+done+cp "$src/config" "$kdir/.config"+make -s -C "$kdir" olddefconfig+make -s -C "$kdir" -j"$(nproc)" modules_prepare+[ "$(make -s -C "$kdir" kernelrelease)" = "$krel" ] || {+ echo "kernel release is $(make -s -C "$kdir" kernelrelease), not $krel" >&2+ exit 1+}++# Without a full kernel build there is no Module.symvers, so modpost cannot+# resolve symbols; Unraid has CONFIG_MODVERSIONS off, and every symbol the+# module uses is checked against the kernel's exports instead.+cp -r kernel/gpu_unlock "$work/module"+make -C "$work/module" KDIR="$kdir" KBUILD_MODPOST_WARN=1+ko=$work/module/gpu_unlock.ko+modinfo -F vermagic "$ko" | grep -q "^$krel " || {+ echo "vermagic is $(modinfo -F vermagic "$ko"), not $krel" >&2+ exit 1+}+for sym in $(nm -u "$ko" | awk '{print $2}'); do+ grep -q " __ksymtab_$sym\$" "$src/System.map" || {+ echo "$krel does not export $sym" >&2+ exit 1+ }+done++# The module, and what gpu-unlock-firmware needs to generate the firmware.+pkg=$work/pkg+share=$pkg/usr/local/share/gpu-unlock+install -Dm644 "$ko" "$pkg/lib/modules/$krel/extra/gpu_unlock.ko"+install -Dm644 -t "$share" firmware/fetch_artifacts.py firmware/extract_gsp.py \+ firmware/extract_boot_assets.py firmware/NOTICE.md licenses/*.txt+mkdir -p "$pkg/usr/local/sbin"+sed "s/@NV@/$nv/" packaging/unraid/gpu-unlock-firmware >"$pkg/usr/local/sbin/gpu-unlock-firmware"+chmod 755 "$pkg/usr/local/sbin/gpu-unlock-firmware"+name=gpu-unlock-${version}_$(echo "$krel" | tr - _)-x86_64-1.txz+# Slackware packages list their files without a leading ./+tar --owner=0 --group=0 --sort=name --xform='sx^\./\(.\)x\1x' \+ -C "$pkg" -cJf "$out/$name" .+(cd "$out" && md5sum "$name" >"$name.md5")+echo "$out/$name"diff --git a/packaging/unraid/discover.sh b/packaging/unraid/discover.shnew file mode 100755index 0000000..3cadbee--- /dev/null+++ b/packaging/unraid/discover.sh@@ -0,0 +1,13 @@+#!/bin/sh+# SPDX-License-Identifier: GPL-2.0-only+# Print as a JSON list the stable Unraid releases with no package of this+# VERSION yet, from 7.3.0, the first to ship its kernel config and patches.+# The built.txt asset of the unraid release lists "<Unraid> <VERSION>" per+# package built. Needs curl, jq and gh. Run from the repository root.+set -eu+built=$(gh release download unraid -p built.txt -O - 2>/dev/null || :)+curl -sSf https://releases.unraid.net/json | jq -c --arg built "$built" --arg v "$(cat VERSION)" '+ ($built | split("\n")) as $done+ | [.[] | select((.version | split(".") | map(tonumber? // 0)) >= [7, 3, 0])+ | select("\(.version) \($v)" | IN($done[]) | not)+ | {version, url: (.url | split("?")[0]), sha256}]'diff --git a/packaging/unraid/gpu-unlock-firmware b/packaging/unraid/gpu-unlock-firmwarenew file mode 100755index 0000000..baed918--- /dev/null+++ b/packaging/unraid/gpu-unlock-firmware@@ -0,0 +1,29 @@+#!/bin/sh+# SPDX-License-Identifier: GPL-2.0-only+# Generate the firmware gpu_unlock loads from the pinned NVIDIA @NV@+# downloads, as the other packages do at build time, and keep it on the+# flash drive. Unraid has no Python, so this runs in a throwaway container+# and needs Docker to be running. Does nothing once the firmware is there.+set -eu+dir=/boot/config/plugins/gpu-unlock/firmware+nv=@NV@+[ ! -d "$dir/$nv" ] || exit 0+if ! docker info >/dev/null 2>&1; then+ echo "gpu-unlock: start Docker, then run gpu-unlock-firmware to generate the firmware" >&2+ exit 1+fi+echo "gpu-unlock: downloading about 370 MB from NVIDIA to generate the firmware"+rm -rf "$dir/$nv.new"+mkdir -p "$dir/$nv.new"+docker run --rm -e NV="$nv" -v /usr/local/share/gpu-unlock:/src:ro -v "$dir/$nv.new:/out" \+ python:3.13-alpine sh -euc '+apk add -q --no-cache tar xz zstd+python3 /src/fetch_artifacts.py /tmp/inputs+tar -xf "/tmp/inputs/NVIDIA-kernel-module-source-$NV.tar.xz" -C /tmp+python3 /src/extract_gsp.py "/tmp/inputs/NVIDIA-Linux-x86_64-$NV-no-compat32.run" /out+python3 /src/extract_boot_assets.py "/tmp/NVIDIA-kernel-module-source-$NV" /out'+cp /usr/local/share/gpu-unlock/NOTICE.md "$dir/$nv.new/"+mv "$dir/$nv.new" "$dir/$nv"+# Firmware of earlier NVIDIA versions.+find "$dir" -mindepth 1 -maxdepth 1 ! -name "$nv" -exec rm -rf {} ++echo "gpu-unlock: firmware generated in $dir/$nv"diff --git a/packaging/unraid/gpu-unlock.plg b/packaging/unraid/gpu-unlock.plgnew file mode 100644index 0000000..d0e38db--- /dev/null+++ b/packaging/unraid/gpu-unlock.plg@@ -0,0 +1,73 @@+<?xml version='1.0' standalone='yes'?>+<!-- SPDX-License-Identifier: GPL-2.0-only -->+<!-- The Unraid workflow fills in the version and publishes this next to the+ packages it builds for each Unraid kernel. -->+<!DOCTYPE PLUGIN [+ <!ENTITY name "gpu-unlock">+ <!ENTITY author "Zagitta">+ <!ENTITY version "@VERSION@">+ <!ENTITY repoURL "https://github.com/&author;/&name;">+ <!ENTITY relURL "&repoURL;/releases/download/unraid">+ <!ENTITY plugin "/boot/config/plugins/&name;">+]>++<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&relURL;/&name;.plg"+ min="7.3.0" icon="microchip" support="&repoURL;/issues">++<CHANGES>+###&version;+- See &repoURL;+</CHANGES>++<!-- Every boot: install the module for the running kernel and have it run+ before nvidia, which the Nvidia Driver plugin loads with modprobe. -->+<FILE Run="/bin/bash">+<INLINE>+krel=$(uname -r)+pkg=&name;-&version;_${krel//-/_}-x86_64-1.txz+dir=&plugin;/packages+mkdir -p "$dir"+# Packages of other versions and kernels.+find "$dir" -type f ! -name "$pkg" ! -name "$pkg.md5" -delete+if [ ! -f "$dir/$pkg.md5" ]; then+ echo "Downloading $pkg"+ if ! wget -q -O "$dir/$pkg" "&relURL;/$pkg" || ! wget -q -O "$dir/$pkg.md5" "&relURL;/$pkg.md5"; then+ rm -f "$dir/$pkg" "$dir/$pkg.md5"+ echo "gpu-unlock: no &version; package for kernel $krel yet, see &repoURL;/issues"+ exit 1+ fi+fi+if [ "$(md5sum "$dir/$pkg" | cut -d' ' -f1)" != "$(cut -d' ' -f1 "$dir/$pkg.md5")" ]; then+ rm -f "$dir/$pkg" "$dir/$pkg.md5"+ echo "gpu-unlock: checksum mismatch for $pkg, install the plugin again"+ exit 1+fi+upgradepkg --install-new "$dir/$pkg"+depmod -a++# TARGETS is "all" or comma-separated PCI addresses, as for gpu_unlock.targets=.+[ -f &plugin;/&name;.cfg ] || echo 'TARGETS="all"' > &plugin;/&name;.cfg+source &plugin;/&name;.cfg+printf '%s\n' '# Written by the gpu-unlock plugin from &plugin;/&name;.cfg' \+ 'softdep nvidia pre: gpu_unlock' "options gpu_unlock targets=$TARGETS" > /etc/modprobe.d/&name;.conf++# The firmware is generated once and kept on the flash drive.+ln -sfn &plugin;/firmware /lib/firmware/&name;+gpu-unlock-firmware || true++if [ -d /sys/module/nvidia ] ; then+ [ -d /sys/module/gpu_unlock ] || echo "gpu-unlock: nvidia is already loaded, reboot to unlock"+fi+</INLINE>+</FILE>++<FILE Run="/bin/bash" Method="remove">+<INLINE>+removepkg &name;+rm -f /etc/modprobe.d/&name;.conf /lib/firmware/&name;+rm -rf &plugin;+echo "gpu-unlock: removed, reboot to drop the unlock"+</INLINE>+</FILE>++</PLUGIN>