mirror of
https://github.com/Heretek-AI/mo-vidia.git
synced 2026-11-23 07:59:28 -10:00
main
mo-vidia — Optimized NVIDIA Open GPU Kernel Modules
mo-vidia provides a high-performance kernel optimization patchset and automated Fedora / RPM Fusion RPM packaging pipeline for NVIDIA/open-gpu-kernel-modules.
Kernel Optimizations Included
- VRAM Physical Fragmentation & Premature OOM Prevention (
video_mem.c,mem_mgr_gm107.c):- Non-Contiguous-First PMA Allocation: Allocates non-contiguous physical VRAM frames immediately when
NVOS32_ATTR_PHYSICALITY_ALLOW_NONCONTIGUOUSis set on non-NUMA discrete GPUs, preserving 2 MB contiguous physical blocks and avoiding failed-contiguous + Copy Engine scrubber stalls. - 2 MB
\rightarrow64 KB Page Size Fallback: Automatically falls back fromRM_PAGE_SIZE_2MtoRM_PAGE_SIZE_64Kwhen a default-page-size\ge 2\text{ MB}VRAM allocation fails 2 MB PMA allocation due to physical fragmentation. - Graceful Hardware Compression (
comptag) Fallback: Falls back to an uncompressed PTE kind (NVOS32_ATTR_COMPR_NONE) whenkmemsysAllocComprResources_HALexhausts compression resources under heavy VRAM pressure instead of failing the allocation.
- Non-Contiguous-First PMA Allocation: Allocates non-contiguous physical VRAM frames immediately when
- Fast VRAM Recycling (
PMA_FREE_SKIP_SCRUB) (mem_mgr.c):- Skips asynchronous Copy Engine scrubbing on free for non-compressible surfaces on non-CC/non-MIG systems while preserving full hardware comptag scrubbing for compressible surfaces.
- 64 KB Large & 2 MB Huge System Memory Pages & Pools on Discrete GPUs (
g_mem_mgr_nvoc.c,mem_mgr.c,system_mem.c,virt_mem_allocator_gm107.c):- Enables
bSysmemPageSizeDefaultAllowLargePages = NV_TRUEandbAllowSysmemHugePages = NV_TRUEacross all discrete GPU architectures (TU102..AD107+). - Selects 2 MB (order-9) and 64 KB (order-4) compound pages for aligned system memory allocations, activating the high-order
sysmem_page_poolsand reducing PCIe GMMU page table entries by $16\times$–512\times.
- Enables
- Zero-IPI Cache-Type-Aware (
WBvsUC/WC) Page Pools (nv-vm.c):- Retains
NV_MEMORY_WRITECOMBINE/NV_MEMORY_UNCACHEDPAT state inside dedicateduc_clean_listanduc_dirty_listpools innv_page_pool_t, eliminating synchronous cross-core CPU IPI TLB/cache shootdowns (cpa_flushviaset_memory_array_uc/set_memory_array_wb) when recycling staging buffers. - Keeps
sysmem_page_poolsactive whenNVreg_InitializeSystemMemoryAllocations=0.
- Retains
- Default PCIe & BAR1 Performance Parameters (
nv-reg.h):NVreg_EnableResizableBar = 1(enables Static BAR1 full-VRAM mapping when Resizable BAR is supported)NVreg_EnablePCIERelaxedOrderingMode = 1NVreg_EnableStreamMemOPs = 1NVreg_InitializeSystemMemoryAllocations = 0NVreg_PreserveVideoMemoryAllocations = 1&/var/tmptemporary file path for Fedora SELinux compatibility.
Installing RPM Packages on Fedora (Drop-in RPM Fusion Replacement)
The built packages (xorg-x11-drv-nvidia-kmodsrc, akmod-nvidia, and kmod-nvidia) use Epoch: 3 and Release: 100.mo_vidia.*, acting as a drop-in upgrade over RPM Fusion's kernel module packages while preserving full compatibility with RPM Fusion's xorg-x11-drv-nvidia, xorg-x11-drv-nvidia-cuda, and nvidia-settings userspace packages.
Option 1: Install from the Automated DNF Repository (GitHub Pages)
sudo dnf config-manager addrepo --from-repofile=https://heretek-ai.github.io/mo-vidia/mo-vidia.repo
sudo dnf upgrade -y xorg-x11-drv-nvidia-kmodsrc akmod-nvidia
sudo akmods --force
Option 2: Install Directly from Local Build or GitHub Releases
sudo dnf install -y ./dist/rpms/*.x86_64.rpm
Building RPMs Locally
# Build xorg-x11-drv-nvidia-kmodsrc, akmod-nvidia, and binary kmod-nvidia-$(uname -r) RPMs:
./scripts/build-rpms.sh --with-binary-kmod
# Or clone a specific upstream NVIDIA/open-gpu-kernel-modules tag, apply patches, and build RPMs:
./scripts/build-rpms.sh --upstream-ref 595 --with-binary-kmod
Built .rpm and .src.rpm packages are written to dist/rpms/.