TL;DR: Add an experimental FSR Ray Regeneration backend on Windows, run the K
network natively on HIP with Vulkan->HIP shared memory, extend K kernels to
gfx11 (RDNA3), and add dependency/packaging/test tooling around them.
Windows: FSR RR backend, native HIP K runner, gfx11 K kernels, tooling
FSR Ray Regeneration (experimental)
- Add fsr_rr_backend.{h,cpp}, fsr_rr_passes.h and the fsr_rr/ prepare and
compose compute shaders. They run AMD's FidelityFX denoiser
(amd_fidelityfx_denoiser_dx12.dll, SDK 2.3, not bundled) on a private
vkd3d-proton device.
- Add the amdxc64 shim (tools/windows/amdxc64_shim) and two vkd3d-proton
patches for libcxx includes. AMD's amdxc64.dll is never loaded.
- d4r_nvngx_windows: RrFeature now selects between the native DLSS RR
backend and the FSR backend (D4R_RR_BACKEND=fsr). After the denoiser it
runs an internal Super Sampling stage (feature 1) to upscale. If SR is
unavailable and output != render size, the frame fails; it is never
returned noisy.
- d4r.ini / player_config: new [RayReconstruction] FsrDenoiser,
FsrStabilityBias (auto or >= 0) and FsrDetail (0-1), with validation, and
matching D4R_FSR_* environment variables.
- Add the FSR RR fixture, output-check and ngx test scripts, and a shader
compile script.
Native HIP K runner (Windows)
- CMake: add d4r_engine_k_hip (d4r-k-hip) plus separate volk/engine copies,
because VK_USE_PLATFORM_WIN32_KHR changes volk's entry points.
- Share Vulkan memory with HIP via Win32 opaque handles on Windows
(VK_KHR_external_memory_win32) and via fds on Linux. Handle types are now
intptr_t, and the platform choice is in D4R_EXT_MEMORY_* macros.
- HipNetwork: add debugRepeatHashes and debugNodeMicros, exposed as
D4R_HIP_REPEAT_CHECK, D4R_HIP_REPEAT_ALL and D4R_HIP_NODE_PROFILE in
replay.cpp.
- replay.cpp: display-resolution-motion frames (FrameFlagDisplayMotion) no
longer require near2rnd == out2rnd. Both values must still be in (0, 1].
K kernels on gfx11
- Allow position-token and enc1 tiling on __GFX11__ as well as gfx12.
- Add an opt-in ds_bpermute cross-half exchange
(D4R_WINDOWS_GFX11_DS_EXCHANGE, enabled for K on Windows gfx11). M keeps
its LDS path.
- Fix a block-barrier race in the position layer. Without POS_VSHARE a fast
wave could overwrite its hb rows while a slower wave still read them for a
later head, giving rare wrong results on gfx1101 (enc0 outputs differing
between identical launches).
Packaging and install
- install.bat, d4r.ini, WINDOWS_README: FSR option, and
install_dependencies.py to install pinned NVIDIA dependencies with staged,
hash-verified replacement and rollback.
- Update the release package, local package refresh and test scripts.
- Add the InteropBatchInputCopies option (default false). Batching is faster
on some synthetic runs, but player temporal exactness is unresolved.
Tooling and tests
- K model: capture_k_weights, build_k_model, compare_k_outputs,
benchmark_k_hip, build_capture_runtime, test_k_model and the
zluda-k-output-capture patch. Captured weights and models are private
local assets and must not enter release archives.
- Synthetic probes: test_m_ngx, test_sr_dynamic,
prepare_rr_dynamic_fixture and the d3d12/rr_ngx probe updates.
- Add tests/windows/test_install_dependencies.py.
Docs
- Update the windows-fsr-rr, k-performance, local-package, rr-interop and
rr-model-cache docs. Add windows-parity-handoff.md and
windows-parity-continuation-prompt.md.
This commit is contained in:
1 parent
247fe1092d
commit
a617c818de
62 files changed
+5894
-89
No files matched your search
@@ -17,6 +17,11 @@ def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
for name in ('base-zip', 'shim', 'output', 'archive'):
|
||||
parser.add_argument('--' + name, required=True, type=lambda value: Path(value).resolve())
|
||||
parser.add_argument('--rr-tools', required=True, type=lambda value: Path(value).resolve())
|
||||
parser.add_argument('--native-fix', type=lambda value: Path(value).resolve(),
|
||||
help='directory of rebuilt gfx1101 K layer .hsaco files that replace same-named packaged objects')
|
||||
parser.add_argument('--fsr-payload', type=lambda value: Path(value).resolve(),
|
||||
help='build_fsr_payload.py output to add as d4r/fsr (experimental FSR RR; AMD denoiser never bundled)')
|
||||
args = parser.parse_args()
|
||||
repo = Path(__file__).resolve().parents[2]
|
||||
build = (repo / 'build').resolve()
|
||||
@@ -26,8 +31,10 @@ def main():
|
||||
if args.archive.is_relative_to(args.output):
|
||||
parser.error('archive must be outside the package directory')
|
||||
base_hash = sha(args.base_zip)
|
||||
if base_hash != 'e93be288f4013616cc2229be0132b40395d5031d8733bfa63886ba75ce1389ca':
|
||||
parser.error('base must be the verified local v3 ZIP')
|
||||
# verified local ZIPs this refresher may start from: v3, and v8 (build/d4r-windows-gfx1101-local-v8.zip)
|
||||
if base_hash not in ('e93be288f4013616cc2229be0132b40395d5031d8733bfa63886ba75ce1389ca',
|
||||
'962530d1a914268cc6f9d2ec908185f8e4d9e5baafca6800d77ebc3281a647fe'):
|
||||
parser.error('base must be a verified local ZIP (v3 or v8)')
|
||||
with zipfile.ZipFile(args.base_zip) as base:
|
||||
manifest = json.loads(base.read('d4r/package.json').decode('utf-8-sig'))
|
||||
if not manifest.get('localDevelopment') or set(manifest['targets']) != {'gfx1101'}:
|
||||
@@ -60,7 +67,76 @@ def main():
|
||||
raise RuntimeError('Overlay is not part of the validated package layout: ' + name)
|
||||
shutil.copy2(source, args.output / name)
|
||||
records[name] = {'path': name, 'sha256': sha(source).upper(), 'version': None}
|
||||
prohibited = {'nvngx_dlss.dll', 'nvngx_dlssd.dll'}
|
||||
native_report = None
|
||||
if args.native_fix:
|
||||
# Replace named K layer code objects with rebuilt ones (e.g. the pwin_pos.h barrier fix). Each must already be part
|
||||
# of the package's gfx1101 native folder and must be a gfx1101 AMDGPU ELF (e_machine 224, EF_AMDGPU_MACH byte 70).
|
||||
replaced = {}
|
||||
for source in sorted(args.native_fix.glob('*.hsaco')):
|
||||
relative = 'd4r/native/gfx1101/' + source.name
|
||||
data = source.read_bytes()
|
||||
if relative not in records or data[:4] != b'\x7fELF' or data[4] != 2 or data[18] != 0xe0 or data[48] != 70:
|
||||
raise RuntimeError('Native fix is not a replacement gfx1101 code object: ' + source.name)
|
||||
shutil.copy2(source, args.output / relative)
|
||||
replaced[relative] = {'before': records[relative]['sha256'], 'after': sha(source).upper()}
|
||||
records[relative] = {'path': relative, 'sha256': sha(source).upper(), 'version': None}
|
||||
if not replaced:
|
||||
raise RuntimeError('--native-fix directory has no .hsaco files')
|
||||
native_report = replaced
|
||||
installer = repo / 'tools/windows/install_dependencies.py'
|
||||
shutil.copy2(installer, args.output / 'install-dependencies.py')
|
||||
records['install-dependencies.py'] = {'path': 'install-dependencies.py', 'sha256': sha(installer).upper(), 'version': None}
|
||||
fsr_report = None
|
||||
if args.fsr_payload:
|
||||
# Experimental FSR RR: d4r-built vkd3d-proton core (LGPL, SOURCE.txt is the source offer) and d4r's amdxc64 shim.
|
||||
payload = json.loads((args.fsr_payload / 'fsr-payload.json').read_text(encoding='utf-8'))
|
||||
if payload.get('kind') != 'd4r-fsr-payload' or payload.get('amdDenoiserBundled') is not False:
|
||||
raise RuntimeError('Unsupported FSR payload manifest')
|
||||
additions = {}
|
||||
for name, digest in payload['files'].items():
|
||||
source = args.fsr_payload / name
|
||||
if sha(source) != digest:
|
||||
raise RuntimeError('FSR payload file changed: ' + name)
|
||||
if name.startswith('fsr/'):
|
||||
additions['d4r/' + name] = source
|
||||
elif name.startswith('licenses/'):
|
||||
additions['d4r/' + name] = source
|
||||
elif name == 'SOURCE.txt':
|
||||
additions['d4r/fsr/SOURCE.txt'] = source
|
||||
for patch in sorted((repo / 'patches/vkd3d-proton-windows').glob('*.patch')):
|
||||
additions['d4r/fsr/patches/' + patch.name] = patch
|
||||
for relative, source in additions.items():
|
||||
if relative in records:
|
||||
raise RuntimeError('FSR payload path already in package: ' + relative)
|
||||
destination = args.output / relative
|
||||
destination.parent.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copy2(source, destination)
|
||||
records[relative] = {'path': relative, 'sha256': sha(source).upper(), 'version': None}
|
||||
fsr_report = {'payloadManifestSha256': sha(args.fsr_payload / 'fsr-payload.json'), 'files': sorted(additions),
|
||||
'vkd3dProtonCommit': payload['vkd3dProtonCommit'], 'amdDenoiserBundled': False}
|
||||
# Consume the pristine archive, never an extracted/used tool directory.
|
||||
if sha(args.rr_tools) != '297289a57a82142eb952479c99112b1c352a6753eb15bc6b2431bf686aed9b22':
|
||||
raise RuntimeError('Requires verified clean portable-tools v2 ZIP')
|
||||
with zipfile.ZipFile(args.rr_tools) as tools:
|
||||
tool_manifest = json.loads(tools.read('rr-tools.json'))
|
||||
expected_files = tool_manifest['files']
|
||||
names = [entry.filename for entry in tools.infolist() if not entry.is_dir()]
|
||||
if len(names) != len(set(names)) or set(names) != set(expected_files) | {'rr-tools.json'}:
|
||||
raise RuntimeError('Portable-tools ZIP entries differ from manifest')
|
||||
for name in names:
|
||||
parts = PurePosixPath(name)
|
||||
if parts.is_absolute() or '..' in parts.parts or '\\' in name or ':' in name:
|
||||
raise RuntimeError('Unsafe portable-tools path')
|
||||
data = tools.read(name)
|
||||
digest = hashlib.sha256(data).hexdigest()
|
||||
if name in expected_files and digest != expected_files[name]:
|
||||
raise RuntimeError('Portable-tools hash mismatch: ' + name)
|
||||
relative = 'd4r/model-tools/' + name
|
||||
destination = args.output / relative
|
||||
destination.parent.mkdir(parents=True, exist_ok=True)
|
||||
destination.write_bytes(data)
|
||||
records[relative] = {'path': relative, 'sha256': digest.upper(), 'version': None}
|
||||
prohibited = {'nvngx_dlss.dll', 'nvngx_dlssd.dll', 'amd_fidelityfx_denoiser_dx12.dll'}
|
||||
for path in args.output.rglob('*'):
|
||||
if path.is_file() and (path.name.lower() in prohibited or path.suffix.lower() in ('.spv', '.ptx', '.cubin', '.weights')):
|
||||
raise RuntimeError('Proprietary/model artifact cannot be bundled: ' + str(path))
|
||||
@@ -69,7 +145,10 @@ def main():
|
||||
files=list(records.values()),
|
||||
localRefresh={'baseZipSha256': base_hash, 'binaryProvenance': 'local modified build; hashes authoritative',
|
||||
'overlays': {name: sha(path) for name, path in overlays.items()},
|
||||
'rr': 'experimental synthetic validation; disabled by default; models generated separately'})
|
||||
'rrToolsZipSha256': sha(args.rr_tools),
|
||||
'installerSha256': sha(installer),
|
||||
'fsrPayload': fsr_report, 'nativeFix': native_report,
|
||||
'rr': 'experimental synthetic validation; optional local D/E model generation; disabled by default'})
|
||||
manifest['targets']['gfx1101']['binarySourceCommit'] = None
|
||||
manifest['targets']['gfx1101']['hardwareValidation'] = 'SR prior limited evidence; native RR synthetic NGX lifecycle only; no game RR or performance parity'
|
||||
(args.output / 'd4r/package.json').write_text(json.dumps(manifest, indent=2) + '\n')
|
||||
|
||||
Reference in new issue
Block a user