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:
ayo committed 2026-10-17 07:40:34 -04:00
1 parent a617c818de
commit ac4ee6c225
67 files changed
+3147 -326

No files matched your search

+33 -3
View File
@@ -35,6 +35,18 @@ foreach(index RANGE ${d4r_target_last})
endforeach()
configure_file(tools/windows/gpu_targets.generated.h.in gpu_targets.generated.h @ONLY)
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
foreach(pass prepare compose)
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/tools/windows/fsr_rr/fsr_rr_${pass}.hlsl" d4r_hlsl_fsr_rr_${pass})
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "tools/windows/fsr_rr/fsr_rr_${pass}.hlsl")
endforeach()
configure_file(tools/windows/fsr_rr_shaders_hlsl.h.in fsr_rr_shaders_hlsl.generated.h @ONLY)
add_executable(d4r_fsr_rr_native_probe tools/windows/fsr_rr_native_probe.cpp)
target_include_directories(d4r_fsr_rr_native_probe PRIVATE "${D4R_HIP_ROOT}/include")
target_compile_definitions(d4r_fsr_rr_native_probe PRIVATE __HIP_PLATFORM_AMD__ NOMINMAX WIN32_LEAN_AND_MEAN)
target_link_libraries(d4r_fsr_rr_native_probe PRIVATE d3d12 dxgi dxguid)
if(MINGW)
target_link_options(d4r_fsr_rr_native_probe PRIVATE -static)
endif()
set(D4R_GPU_ARCH "gfx1201" CACHE STRING "Native Windows package GPU target")
set_property(CACHE D4R_GPU_ARCH PROPERTY STRINGS ${d4r_supported_targets})
if(NOT D4R_GPU_ARCH IN_LIST d4r_supported_targets)
@@ -42,8 +54,8 @@ if(NOT D4R_GPU_ARCH IN_LIST d4r_supported_targets)
endif()
add_compile_definitions(D4R_TARGET_ARCH="${D4R_GPU_ARCH}")
configure_file(tools/windows/gpu-target.json.in gpu-target.json @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/gpu-target.json" DESTINATION .)
install(FILES tools/windows/gpu-targets.json DESTINATION .)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/gpu-target.json" DESTINATION . COMPONENT kernels)
install(FILES tools/windows/gpu-targets.json DESTINATION . COMPONENT kernels)
set(d4r_device_flags)
if(D4R_GPU_ARCH MATCHES "^gfx11")
# Windows-only workaround informed by realdody/d4r 1897b4a. Keep the real
@@ -115,13 +127,21 @@ foreach(family k m)
DEPENDS "${source}" ${native_headers} kernels/common/wmma_layout.h kernels/common/wave32_exchange.h
kernels/common/hip_device_minimal.h VERBATIM)
list(APPEND native_objects "${native_object}")
install(FILES "${native_object}" DESTINATION "experimental/${family}")
install(FILES "${native_object}" DESTINATION "experimental/${family}" COMPONENT kernels)
endforeach()
endforeach()
add_custom_target(d4r_native_compile ALL DEPENDS ${native_objects})
# Retain the old manual build target for existing scripts.
add_custom_target(d4r_native_gfx1201_compile DEPENDS d4r_native_compile)
# Compile every native object without building the host tools or fetching their
# dependencies. Use the same flags and sources as the complete Windows package.
option(D4R_KERNELS_ONLY "Configure only Windows HIP kernel compilation" OFF)
if(D4R_KERNELS_ONLY)
install(FILES "${probe_object}" "${pixel_object}" "${wmma_object}" DESTINATION bin COMPONENT kernels)
return()
endif()
# Standalone Vulkan inference does not depend on the D3D12 NGX shim. Volk loads
# the Windows Vulkan runtime dynamically, so no import library is required.
option(D4R_BUILD_NATIVE_ENGINE "Build standalone K/M/L Vulkan inference runners" ON)
@@ -365,6 +385,16 @@ install(FILES kernels/tools/model_enc3.py kernels/tools/swin_model.py kernels/to
install(FILES docs/windows-rdna4-port.md DESTINATION docs)
install(FILES docs/windows-gpu-support.md DESTINATION docs)
include(CTest)
add_test(NAME fsr_rr_native_conversion COMMAND d4r_fsr_rr_native_probe)
add_test(NAME fsr_rr_native_conversion_warp COMMAND d4r_fsr_rr_native_probe --warp)
add_test(NAME fsr_rr_native_sky COMMAND d4r_fsr_rr_native_probe --sky)
add_test(NAME fsr_rr_native_hardware_depth COMMAND d4r_fsr_rr_native_probe --hardware-depth)
add_test(NAME fsr_rr_native_depth_stencil COMMAND d4r_fsr_rr_native_probe --depth-stencil)
add_test(NAME fsr_rr_native_subrect COMMAND d4r_fsr_rr_native_probe --subrect)
set_tests_properties(fsr_rr_native_conversion fsr_rr_native_sky fsr_rr_native_hardware_depth
fsr_rr_native_depth_stencil fsr_rr_native_subrect
PROPERTIES TIMEOUT 60 LABELS "hardware;d3d12;fsr;conversion")
set_tests_properties(fsr_rr_native_conversion_warp PROPERTIES TIMEOUT 60 LABELS "software;d3d12;fsr;conversion")
add_test(NAME binary16_rounding COMMAND d4r_binary16_probe)
set_tests_properties(binary16_rounding PROPERTIES TIMEOUT 30 LABELS "software;numerics")
add_test(NAME gpu_target_contract COMMAND d4r_gpu_target_probe "${probe_object}" "${pixel_object}")