Fix the rebase onto the native engine: Vulkan frontend staging, RR gating, lazy RR debug stages

The native Vulkan frontend stages packed rows and refuses Ray Reconstruction, whose guides it
does not stage. make_ptx loads the denoiser's per-layer debug stages only when one is
requested, so builds without the denoiser's PTX corpus (preset L's texture kernels) work.
This commit is contained in:
woutermans committed 2026-10-12 12:47:53 +02:00
1 parent 417abc64b5
commit 30472ae195
3 files changed
+14 -12

No files matched your search

+11 -10
View File
@@ -708,16 +708,16 @@ SWIN_DEBUG_STAGES = {
# Per-layer extra debug stages, so a layer can add its own without editing this file: # Per-layer extra debug stages, so a layer can add its own without editing this file:
# kernels/rr/swin_<layer>_debug_stages.py exposing stages() -> {name: (line, [regs])}. They are keyed # kernels/rr/swin_<layer>_debug_stages.py exposing stages() -> {name: (line, [regs])}. They are keyed
# by (layer, stage) because two layers can use the same stage name; the entries above stay unkeyed # by (layer, stage) because two layers can use the same stage name; the entries above stay unkeyed
# and belong to enc0. # and belong to enc0. Loaded only when a debug stage is requested: some read the denoiser's PTX
for _extra in sorted((Path(__file__).resolve().parent.parent / "rr").glob("swin_*_debug_stages.py")): # corpus, which builds that do not touch the denoiser do not have.
_layer = _extra.stem[len("swin_"):-len("_debug_stages")] def load_layer_debug_stages():
_spec = importlib.util.spec_from_file_location(_extra.stem, _extra) for extra in sorted((Path(__file__).resolve().parent.parent / "rr").glob("swin_*_debug_stages.py")):
_mod = importlib.util.module_from_spec(_spec) layer = extra.stem[len("swin_"):-len("_debug_stages")]
_spec.loader.exec_module(_mod) spec = importlib.util.spec_from_file_location(extra.stem, extra)
for _stage, _where in _mod.stages().items(): module = importlib.util.module_from_spec(spec)
SWIN_DEBUG_STAGES[(_layer, _stage)] = _where spec.loader.exec_module(module)
for stage, where in module.stages().items():
SWIN_DEBUG_STAGES[(layer, stage)] = where
def swin_debug_block(regs, entry="cuda_dldn_engine_swin_enc0_kernel", base=None): def swin_debug_block(regs, entry="cuda_dldn_engine_swin_enc0_kernel", base=None):
@@ -762,6 +762,7 @@ def swin_debug(name):
match = re.fullmatch(r"cuda_dldn_engine_swin_(\w+)_kernel", name) match = re.fullmatch(r"cuda_dldn_engine_swin_(\w+)_kernel", name)
if not stage or match is None: if not stage or match is None:
return None return None
load_layer_debug_stages()
where = SWIN_DEBUG_STAGES.get((match.group(1), stage)) where = SWIN_DEBUG_STAGES.get((match.group(1), stage))
if where is None: if where is None:
where = SWIN_DEBUG_STAGES.get(stage) where = SWIN_DEBUG_STAGES.get(stage)
+2 -1
View File
@@ -7231,7 +7231,8 @@ static NgxResult create_feature(unsigned int featureId, void* parameters, NgxHan
// feature 13; the NGX core dispatches the second to the denoiser it loaded, and is // feature 13; the NGX core dispatches the second to the denoiser it loaded, and is
// offered feature 13 only once it has reported that denoiser working. // offered feature 13 only once it has reported that denoiser working.
const bool rayReconstruction = featureId == NGX_FEATURE_RAY_RECONSTRUCTION; const bool rayReconstruction = featureId == NGX_FEATURE_RAY_RECONSTRUCTION;
if (featureId != NGX_FEATURE_SUPER_SAMPLING && !rayReconstruction) // The native Vulkan frontend stages only Super Sampling's four inputs, not the denoiser's guides.
if ((featureId != NGX_FEATURE_SUPER_SAMPLING && !rayReconstruction) || (rayReconstruction && nativeVulkan))
{ {
logf("NVSDK_NGX_D3D12_CreateFeature(feature=%u) unsupported", featureId); logf("NVSDK_NGX_D3D12_CreateFeature(feature=%u) unsupported", featureId);
return NGX_FAIL_FEATURE_NOT_SUPPORTED; return NGX_FAIL_FEATURE_NOT_SUPPORTED;
+1 -1
View File
@@ -441,7 +441,7 @@ static void native_vk_run(Feature* feature, NativeVkFrame* frame)
staging.width = p.image.width; staging.height = p.image.height; staging.width = p.image.width; staging.height = p.image.height;
staging.format = p.format; staging.format = p.format;
staging.layout.Footprint.RowPitch = static_cast<UINT>(p.rowBytes); staging.layout.Footprint.RowPitch = static_cast<UINT>(p.rowBytes);
stage_plane(static_cast<Plane>(i), staging, slot.host[i], nullptr, i); stage_plane(static_cast<Plane>(i), staging, slot.host[i], nullptr, i, 0);
} }
auto& p = frame->params; auto& p = frame->params;
const auto staged = ProfileClock::now(); const auto staged = ProfileClock::now();