Expand Windows GPU support, add native FSR RR, and improve SR interop
Add a native D3D12 FSR Ray Regeneration route for gfx1200/gfx1201, using the game's device and queue with embedded HLSL guide preparation and output composition. Preserve the vkd3d compatibility route for RDNA3 and expose explicit route overrides and diagnostics. Improve Windows runtime compatibility: - Retry rejected application-ID initialization with a project identity. - Defer expensive RR backend creation until feature creation. - Recover from transient submission failures without disabling later frames. - Add shared-buffer export fallbacks through explicit heaps and a private device on the same adapter. - Safely evict old RR descriptor sets when input views change. - Treat requested RR presets as hints when a configured model is available. - Expand SR/RR input formats and handle diffuse/specular hit distances, packed normals, depth-stencil resources, and unused FSR guides. Reduce SR overhead by batching output downloads and format conversion under one completion wait. Optimize strict M enc2/tube attention with bounded FP32 accumulation and the original FP64 fallback for ambiguous rounding cases. Extend RDNA4 tooling with gfx1200/gfx1201 native FP8 RR model builds, capability checks, architecture-aware deployment, and experimental K/M kernel paths. Require matching model and runtime arithmetic families. Add optional embedded FSR shader optimizations keyed by shader hash and exact original SPIR-V contents. Preserve reflected metadata and record optimizer provenance, artifact hashes, and cache identity. Simplify Windows installation with automatic backend dependency downloads, download progress and ETA, backed-up absolute OptiScaler library paths, and recovery from interrupted RR model builds. Add build-kernels.bat and a kernels-only build matrix for all eleven registered RDNA targets, with code-object target validation and SHA256 manifests. Expand conversion probes, numerical stress tests, temporal benchmark tooling, installer/deployment tests, and setup documentation. Document synthetic regression and timing results, experimental build options, and remaining RDNA4 hardware validation requirements.
This commit is contained in:
1 parent
a617c818de
commit
ac4ee6c225
67 files changed
+3147
-326
No files matched your search
@@ -15,6 +15,58 @@ spec.loader.exec_module(installer)
|
||||
|
||||
|
||||
class InstallTests(unittest.TestCase):
|
||||
def test_download_prompt_and_default_install_for_every_gpu(self):
|
||||
targets = json.loads((REPO / 'tools/windows/gpu-targets.json').read_text())['targets']
|
||||
(self.runtime / 'd4r.ini').write_text('[RayReconstruction]\nBackend = off\n')
|
||||
(self.runtime / 'dll-pins.txt').write_text('')
|
||||
for target in targets:
|
||||
(self.runtime / 'package.json').write_text(json.dumps({'targets': {target['architecture']: {}}}))
|
||||
for answer, proceeds in (('y', True), ('Y', True), ('', True), ('n', False), (' N ', False)):
|
||||
with self.subTest(target=target['architecture'], answer=answer), \
|
||||
patch('sys.argv', ['install-dependencies.py', '--package-root', str(self.runtime),
|
||||
'--cache-root', str(self.root / 'cache'),
|
||||
'--backup-root', str(self.backups)]), \
|
||||
patch('builtins.input', return_value=answer), \
|
||||
patch('builtins.print'), patch.object(installer, 'PINS', {}), \
|
||||
patch.object(installer, 'collect', return_value=[]) as collect, \
|
||||
patch.object(installer, 'transaction', return_value={}) as transaction, \
|
||||
patch.object(installer, 'absolutize_library_paths'), \
|
||||
patch.object(installer, 'install_model') as model:
|
||||
installer.main()
|
||||
self.assertEqual(collect.called, proceeds)
|
||||
self.assertEqual(transaction.called, proceeds)
|
||||
model.assert_not_called()
|
||||
|
||||
def test_yes_installs_without_prompt_or_model(self):
|
||||
(self.runtime / 'd4r.ini').write_text('[RayReconstruction]\nBackend = off\n')
|
||||
(self.runtime / 'dll-pins.txt').write_text('')
|
||||
with patch('sys.argv', ['install-dependencies.py', '--package-root', str(self.runtime), '--yes',
|
||||
'--cache-root', str(self.root / 'cache'), '--backup-root', str(self.backups)]), \
|
||||
patch('builtins.input', side_effect=AssertionError('Unexpected prompt')), \
|
||||
patch('builtins.print'), patch.object(installer, 'PINS', {}), \
|
||||
patch.object(installer, 'collect', return_value=[]), \
|
||||
patch.object(installer, 'transaction', return_value={}) as transaction, \
|
||||
patch.object(installer, 'absolutize_library_paths'), \
|
||||
patch.object(installer, 'install_model') as model:
|
||||
installer.main()
|
||||
transaction.assert_called_once()
|
||||
model.assert_not_called()
|
||||
|
||||
def test_native_fsr_requires_explicit_rdna4_only_targets(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
runtime = Path(directory)
|
||||
self.assertFalse(installer.native_fsr_package(runtime))
|
||||
metadata = runtime / 'package.json'
|
||||
for targets, wanted in (({}, False), ({'gfx1201': {}}, True),
|
||||
({'gfx1200': {}, 'gfx1201': {}}, True),
|
||||
({'gfx1101': {}, 'gfx1201': {}}, False)):
|
||||
metadata.write_text(json.dumps({'targets': targets}))
|
||||
self.assertEqual(installer.native_fsr_package(runtime), wanted)
|
||||
(runtime / 'gpu-target.json').write_text(json.dumps({'architecture': 'gfx1101'}))
|
||||
self.assertFalse(installer.native_fsr_package(runtime))
|
||||
(runtime / 'gpu-target.json').write_text(json.dumps({'architecture': 'gfx1201'}))
|
||||
self.assertFalse(installer.native_fsr_package(runtime)) # mixed package still includes RDNA3
|
||||
|
||||
def setUp(self):
|
||||
self.work = tempfile.TemporaryDirectory(prefix='d4r-installer-test-')
|
||||
self.addCleanup(self.work.cleanup)
|
||||
|
||||
@@ -1,9 +1,38 @@
|
||||
import sys
|
||||
import json
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[2] / 'tools/windows'))
|
||||
from deploy_rr_model import select_native
|
||||
from deploy_rr_model import select_native, model_arithmetic
|
||||
|
||||
|
||||
class ModelTargetTests(unittest.TestCase):
|
||||
def test_rdna4_targets_require_exact_match(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
runtime = Path(directory)
|
||||
for target in ('gfx1200', 'gfx1201'):
|
||||
identity = {'preset': 'D', 'architecture': target, 'arithmetic': 'exact-gfx12'}
|
||||
(runtime / 'gpu-target.json').write_text(json.dumps({'architecture': target}))
|
||||
self.assertEqual(model_arithmetic(identity, runtime), 'gfx12')
|
||||
identity['architecture'] = 'gfx1201' if target == 'gfx1200' else 'gfx1200'
|
||||
with self.assertRaisesRegex(RuntimeError, 'does not match'):
|
||||
model_arithmetic(identity, runtime)
|
||||
|
||||
def test_rdna4_requires_target_metadata(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
identity = {'preset': 'E', 'architecture': 'gfx1201', 'arithmetic': 'exact-gfx12'}
|
||||
with self.assertRaisesRegex(RuntimeError, 'gpu-target.json'):
|
||||
model_arithmetic(identity, Path(directory))
|
||||
|
||||
def test_wrong_arithmetic_rejected_and_legacy_preserved(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
identity = {'preset': 'E', 'architecture': 'gfx1101', 'arithmetic': 'exact-gfx11'}
|
||||
self.assertEqual(model_arithmetic(identity, Path(directory)), 'gfx11')
|
||||
identity['architecture'] = 'gfx1201'
|
||||
with self.assertRaisesRegex(RuntimeError, 'identity'):
|
||||
model_arithmetic(identity, Path(directory))
|
||||
|
||||
|
||||
class ConfigSelectionTests(unittest.TestCase):
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import struct
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[2] / 'tools/windows'))
|
||||
from build_rr_model import require_fp8_matrices
|
||||
|
||||
|
||||
class NativeFp8Tests(unittest.TestCase):
|
||||
def check_module(self, capabilities, trailing=()):
|
||||
words = [0x07230203, 0x00010600, 0, 1, 0]
|
||||
for capability in capabilities:
|
||||
words += [(2 << 16) | 17, capability]
|
||||
words.extend(trailing)
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
path = Path(directory) / 'stage.spv'
|
||||
path.write_bytes(struct.pack('<' + 'I' * len(words), *words))
|
||||
require_fp8_matrices(path)
|
||||
|
||||
def test_native_fp8(self):
|
||||
self.check_module((4212, 4213, 6022))
|
||||
|
||||
def test_fp16_fallback_rejected(self):
|
||||
with self.assertRaisesRegex(RuntimeError, 'Native FP8'):
|
||||
self.check_module((9, 6022))
|
||||
|
||||
def test_scalar_fp8_rejected(self):
|
||||
with self.assertRaisesRegex(RuntimeError, 'Native FP8'):
|
||||
self.check_module((4212, 6022))
|
||||
|
||||
def test_truncated_instruction_rejected(self):
|
||||
with self.assertRaisesRegex(RuntimeError, 'instruction'):
|
||||
self.check_module((4212, 4213, 6022), ((3 << 16) | 17, 9))
|
||||
|
||||
def test_zero_length_instruction_rejected(self):
|
||||
with self.assertRaisesRegex(RuntimeError, 'instruction'):
|
||||
self.check_module((4212, 4213, 6022), (17,))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user