Skip to content

Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.

C++

docs(30-series): sm_86 feasibility result from the driver-JIT probe

Veyra Goal Agent636d91be1f5b
diff --git a/docs/DLSSG_30SERIES_DECISION_2026-09-16.md b/docs/DLSSG_30SERIES_DECISION_2026-09-16.md
index 20abaaf5..e2de2114 100644
--- a/docs/DLSSG_30SERIES_DECISION_2026-09-16.md
+++ b/docs/DLSSG_30SERIES_DECISION_2026-09-16.md
@@ -31,6 +31,38 @@ experimental"*、可能完全不工作。这些 kernel cache 是构建输入的
同类里许可证明确的是 `Nukem9/dlssg-to-fsr3`(GPL-3.0)。如果将来要做"代理式"方案,
应当以它为上游(GPL-3.0 与 Veyra 兼容),而不是用无源码的 sm86 包。
+## 2026-09-16 二次评估:sm_86 指令集可行性实测(不依赖 30 系硬件)
+
+用户追问 30 系后补做了实验,结论先行:**30 系跑 DLSS-G 的障碍不是硬件能力,是供应商
+没有为 sm_86 发布任何目标**。证据(可复现,脚本 `scripts/diagnostics/sm86-ptx-feasibility.py`):
+
+1. 结构事实:审计版 `nvngx_dlssg.dll` 310.7 含 69 个 fatbin;sm_89 PTX 69 个
+ (解压后共 1,250,185 字节)+ sm_120 PTX 31 个 + sm_89 cubin 31 个。
+ **sm_86 目标:0 个**(既无 PTX 也无 cubin)。
+2. 兼容性实验:把全部 69 个 sm_89 PTX 的 `.target sm_89` 改写为 `.target sm_86`,
+ 逐个交给 NVIDIA 驱动 JIT(本机 RTX 5070 / 驱动 32.0.16.1656,JIT 在强制 sm_86
+ 特性集下编译):**69/69 通过,0 失败**。说明这批 kernel 没有使用任何 Ada 专有
+ 指令(如 FP8 转换),指令集层面 sm_86 完全可承载。
+3. dashdogy 的 30 系方案拆解:他的 `ampere_backend`(MIT,源码全公开)就是
+ "自产 SM86 程序 + 在进程内替换 provider 的 kernel 加载"。他的 `BUILD.md` 里
+ 不发布的是**编译并验证过的 SM86 kernel 数据**(native-cache/*.fatbin + manifest);
+ 而 `ampere_native_cache` 本身支持 ePtx 模式(PTX 直载)——本实验证明我们能自产
+ 这批数据,不需要索取他的未公开材料。
+4. 边界(必须如实):JIT 通过只证明指令集合法性,**不证明 sm_86 硬件上的数值行为、
+ 性能与稳定性**;那需要 30 系实机。dashdogy 自己标注该路径 "very early and
+ experimental. It may not work in some games or configurations"。
+
+### 30 系的三条路(供决策)
+
+| 路线 | 内容 | 状态 |
+| --- | --- | --- |
+| A 原生 DLSS-G | 移植 dashdogy ampere 框架(`ampere_backend` 133KB + `ampere_gpu` 76KB + 契约系统,MIT)+ 自产 SM86 程序 + 30 系实机验证 | 技术可行性已证实,未开工;工程量最大(天级),且需 30 系实机配合 |
+| B FSR 补帧 | Veyra 自带 AMD FidelityFX 帧生成(E 工作流,已实现)。AMD 官方 FSR3 FG 支持 RTX 30 系及以上 | **已完成代码**,待 30 系实机验证(`veyra.exe --fg-fsr --smoke-seconds 10 <视频>`) |
+| C 代理式 | `Nukem9/dlssg-to-fsr3`(GPL-3.0)代理 | 不推荐:它会替换磁盘 DLL 语义,与"进程内修改"路线冲突 |
+
+建议:先用 B 在 30 系实机拿到第一份可用补帧(成本 5 分钟);是否投入 A 的完整移植
+按用户对"30 系原生 6X"价值/成本的判断另行授权。
+
## 30 系用户现在的 2X 路径
Veyra 已经落地了 AMD FSR 帧生成(E 工作流,本机 RTX 5070 实测 2X 可用):
diff --git a/scripts/diagnostics/sm86-ptx-feasibility.py b/scripts/diagnostics/sm86-ptx-feasibility.py
new file mode 100644
index 00000000..0142702c
--- /dev/null
+++ b/scripts/diagnostics/sm86-ptx-feasibility.py
@@ -0,0 +1,156 @@
+# Feasibility probe for the RTX 30 (sm_86) native DLSS-G path.
+#
+# dashdogy's Ampere backend re-compiles the provider's sm_89 PTX for sm_86 and
+# loads it through the CUDA driver; he does not ship the compiled kernels.
+# This script checks the one thing we can check without a 30-series card:
+# whether the provider's PTX is a *legal sm_86 program* at all.
+#
+# Method: extract every PTX entry from the audited nvngx_dlssg.dll 310.7,
+# rewrite ".target sm_89" to ".target sm_86", and hand each module to the
+# NVIDIA driver JIT on this machine (RTX 5070, sm_120). The JIT compiles the
+# module for the local device while enforcing the declared target's feature
+# set, so an sm_89-only instruction fails right here. Success means the
+# instruction set is carryable; it does NOT prove sm_86 hardware behaviour.
+import ctypes
+import struct
+import sys
+from pathlib import Path
+
+DLL = Path(sys.argv[1] if len(sys.argv) > 1 else r"runtime_local/nvidia/nvngx_dlssg.dll")
+OUT = Path("out/build/sm86-ptx")
+OUT.mkdir(parents=True, exist_ok=True)
+
+
+def lz4_block(src, dst_size):
+ out = bytearray()
+ i = 0
+ while i < len(src):
+ token = src[i]
+ i += 1
+ literals = token >> 4
+ if literals == 15:
+ while True:
+ ext = src[i]
+ i += 1
+ literals += ext
+ if ext != 0xFF:
+ break
+ out += src[i:i + literals]
+ i += literals
+ if i >= len(src):
+ break
+ back = src[i] | (src[i + 1] << 8)
+ i += 2
+ match = 4 + (token & 0x0F)
+ if (token & 0x0F) == 15:
+ while True:
+ ext = src[i]
+ i += 1
+ match += ext
+ if ext != 0xFF:
+ break
+ for _ in range(match):
+ out.append(out[-back])
+ return bytes(out) if len(out) == dst_size else None
+
+
+def extract():
+ data = DLL.read_bytes()
+ magic = struct.pack("<I", 0xBA55ED50)
+ modules = []
+ pos = 0
+ while True:
+ i = data.find(magic, pos)
+ if i < 0:
+ break
+ pos = i + 1
+ hdr = struct.unpack_from("<H", data, i + 6)[0]
+ declared = struct.unpack_from("<Q", data, i + 8)[0]
+ total = declared + 16
+ if hdr != 16 or total < 1024 or i + total > len(data):
+ continue
+ p = i + 16
+ while p + 64 <= i + total:
+ kind = struct.unpack_from("<H", data, p)[0]
+ ehdr = struct.unpack_from("<I", data, p + 4)[0]
+ payload = struct.unpack_from("<Q", data, p + 8)[0]
+ comp = struct.unpack_from("<I", data, p + 16)[0]
+ arch = struct.unpack_from("<I", data, p + 28)[0]
+ raw = struct.unpack_from("<Q", data, p + 56)[0]
+ if ehdr < 64 or payload == 0 or p + ehdr + payload > i + total:
+ break
+ if kind == 1 and arch == 89 and comp:
+ blob = data[p + ehdr:p + ehdr + comp]
+ ptx = lz4_block(blob, raw)
+ if ptx and (ptx[:1] == b"/" or ptx[:2] == b"\r\n"):
+ modules.append((i, p, ptx))
+ p += ehdr + payload
+ return modules
+
+
+modules = extract()
+print(f"extracted {len(modules)} sm_89 PTX modules from {DLL}")
+
+entries = []
+for fat, p, ptx in modules:
+ text = ptx.decode("utf-8", errors="replace")
+ names = []
+ for line in text.splitlines():
+ line = line.strip()
+ if ".entry " in line:
+ after = line.split(".entry ", 1)[1]
+ name = after.split("(", 1)[0].strip().split()[-1]
+ names.append(name)
+ entries.append((fat, names))
+total_entries = sum(len(n) for _, n in entries)
+print(f"declared .entry kernels: {total_entries}")
+
+# CUDA driver via ctypes.
+cuda = ctypes.WinDLL("nvcuda.dll")
+for fn, argtypes in (
+ ("cuInit", [ctypes.c_uint]),
+ ("cuDeviceGet", [ctypes.POINTER(ctypes.c_int), ctypes.c_int]),
+ ("cuCtxCreate_v2", [ctypes.POINTER(ctypes.c_void_p), ctypes.c_uint, ctypes.c_int]),
+ ("cuCtxDestroy_v2", [ctypes.c_void_p]),
+ ("cuModuleLoadDataEx", [ctypes.POINTER(ctypes.c_void_p), ctypes.c_void_p,
+ ctypes.c_uint, ctypes.c_void_p, ctypes.c_void_p]),
+ ("cuModuleUnload", [ctypes.c_void_p]),
+ ("cuGetErrorString", [ctypes.c_int, ctypes.POINTER(ctypes.c_char_p)]),
+):
+ getattr(cuda, fn).argtypes = argtypes
+ getattr(cuda, fn).restype = ctypes.c_int
+
+
+def err(code):
+ s = ctypes.c_char_p()
+ cuda.cuGetErrorString(code, ctypes.byref(s))
+ return (s.value or b"?").decode()
+
+
+assert cuda.cuInit(0) == 0, "cuInit failed"
+dev = ctypes.c_int()
+assert cuda.cuDeviceGet(ctypes.byref(dev), 0) == 0
+ctx = ctypes.c_void_p()
+assert cuda.cuCtxCreate_v2(ctypes.byref(ctx), 0, dev) == 0, "cuCtxCreate failed"
+
+ok = 0
+fail = []
+for idx, (fat, p, ptx) in enumerate(modules):
+ text = ptx.decode("utf-8", errors="replace")
+ if ".target sm_89" not in text:
+ fail.append((idx, fat, p, "no .target sm_89 marker", 0))
+ continue
+ rewritten = text.replace(".target sm_89", ".target sm_86")
+ buf = rewritten.encode("utf-8") + b"\x00"
+ mod = ctypes.c_void_p()
+ rc = cuda.cuModuleLoadDataEx(ctypes.byref(mod), buf, 0, None, None)
+ if rc == 0:
+ ok += 1
+ cuda.cuModuleUnload(mod)
+ else:
+ fail.append((idx, fat, p, err(rc), rc))
+
+cuda.cuCtxDestroy_v2(ctx)
+print(f"JIT as sm_86: {ok}/{len(modules)} modules compiled, {len(fail)} failed")
+for idx, fat, p, message, rc in fail[:20]:
+ print(f" FAIL[{idx}] fatbin@0x{fat:x} entry@0x{p:x}: rc={rc} {message}")