Shaders: use one select for the first lane of a split wave #4358
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!4358
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4357"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@faycalbaklouti on GitHub · 2026-11-30 19:18 UTC · original
faycalbaklouti:fix/wave32-readfirstlane-single-select→main· +4 −4 · 1 files · 1 commits · openWhat it changes
On a wave of 64 split across two host waves, choose the upper half only when the lower half has no active lane and the upper has one. No active lanes means lane zero from the lower half. This is the same four-case truth table as the old nested selects but uses one select. The donor recorded different behavior of the nested form on NVIDIA 595.112.07 and 620.70.06 (
0fc1ff58); this PR has not been run on either driver. Related: dfmbrollins/victory-linux-nvidia#2 and fxceless/victory-fork#1518.Base:
84bd61e2,crates/victory-shader/src/emit/lower.rs:10549–10558.How it was tested
Pending: victory-shader / split-wave translation and driver validation. This is a source-level check, not a Rust type check or runtime result.
Checked for overlap
Radicle project hub (open-source porting and preservation history): https://radicle.network/nodes/rosa.radicle.network/rad:z3rqQw7796wMbgj8RszExtWR4wMSE
Live development stream: https://vdo.ninja/?view=gta6rtx4090live1080p60
@babuakhil on GitHub · 2026-11-30 19:37 UTC · original
Ran this on NVIDIA, since the description says it wasn't: Windows 11, RTX 3060, driver 621.40, Rust 1.98.1 (pinned), applied on current
main(e1251c31); cherry-picks cleanly and builds.The logic is the same. Old:
in_lo ? lo : (in_hi ? hi : lo). New:(!in_lo && in_hi) ? hi : lo. In the four cases (low active or not, high active or not), both givelo,lo,hi,lo.On hardware, the four test files that exercise first-lane reads across halves, on
mainand with this PR:mainemit::wave64_testsemit::folded_testsemit::folded_join_testsemit::water_tiles_testsone_console_wave_divergent_loop_wave_ops_widen_for_one_and_two_block_loopsruns this path on the GPU, with rounds where both halves are active (lo) and rounds where only the upper half is (hi). To make sure it reaches the new select, I swapped its arms (select(c, upper, lo, hi), not part of this PR), and it fails on the 3060 (hardware, two_blocks=false, kind=firstlane). So the passing run above covers the change. The neither-active case doesn't occur in that test.One thing for the description: on driver 621.40,
main's nested form also passes all of these, so this driver doesn't reproduce the difference recorded on 595.112.07 and 620.70.06. The change is equivalent and passes here, but it doesn't show the old form failing. If the donor's case (0fc1ff58) has a shader that showed it, that would be the test to add.@VibeCodeGuy on GitHub · 2026-11-30 22:28 UTC · original
Offline corpus check (every shader container in a v1.0.2.1 dump: 25,699 unique programs),
maine1251c31againstmain+ this PR at7b1b1cf1.The 50 changed programs
f83f0ca30c60c3acCsDepthOfField:CS_TileClassificationNeighborhood3x3WithLookingGlassMask2b17036bf3a1d615CsDepthOfField:CS_TileClassificationNeighborhood3x3445c61b3089eb8f0CsDepthOfField:CS_TileClassificationNeighborhoodBoundaryWithLookingGlassMaskf8a6133bfedc5759CsDepthOfField:CS_TileClassificationNeighborhoodBoundarya1f6cdf8874960a9CsDistantObjects:CS_DistanceWindowEmissivesCullingb4db8c3785b6fbc5CsEntityCoarseVoxelization:CS_EntityCoarseVoxelizationc6a4ca484a40cc64CsGpuParticleEmit:CS_EmitCounts_WaterSim0bf394f8aa729a58CsGpuParticleEmit:CS_Emit_AppendAddCPURequestscd5aaf9ca7c2d8eeCsGpuParticleEmit:CS_Emit_Static_Boxdf3cf10a274e26caCsGpuParticleEmit:CS_Emit_Static_Cylinder06cf47dbd76827cdCsGpuParticleEmit:CS_Emit_Static_Spherefd6e1cbec58e93a9CsGpuParticleEmit:CS_Emit_WaterSimeab96ed5d1684967Cscascadeshadows_classify:CS_ShadowUnifiedClearRT0c028454b58543f0Cscascadeshadows_classify:CS_ShadowUnifiedClearRaster4e9b58cc637d9272Cscascadeshadows_classify:CS_WriteRTClassificationResultsb8f3f7979d6bbc50Cscascadeshadows_classify:CS_WriteRasterClassificationResults45f0c5430e25b956Csgimg_renderer:CS_GenerateGeomImagePatches92c12c7a7d607a9aCshair_resolve:CS_GenBlurArgs2809db6c31de483dCsindirect_diffuse_lighting:CS_GenerateRayBinOffsetsa953d5b93efe8424Csindirect_diffuse_lighting:CS_ScreenProbes_TraceRays_Fallbacke07a678d3f79d4cdCsindirect_light_probes:CS_IrradianceCache_RegisterAllocationRequests14264103296aa43aCsindirect_light_probes:CS_Primary_RegisterAllocationRequests119ee96f602f1668Cslens_flares:CS_MergeQuads0ea6fac38d096770Csshadowmask:CS_DenoiseShadowMaskLDSPackeda7ea75e2653e54d1Csshadowmask:CS_DenoiseShadowMaskLDSe99d19aac5b0bcb4Cssmh_modify:CS_CalculateFireVolumes9d1d228b02e56a96Cssr_tracing:CS_GenerateRayBinOffsetsfd8393c7f4e0e3daCssr_tracing:CS_RayPrePass_Opaque058b0f6379a8e312Csterrain_virtual_texture:CS_ComputeFeedbackListfef7c913d65ac121CstrailmapCompute:CS_TrailMapDepthBlur_ClassifyAndClearMask227a043578e42fd8CstrailmapCompute:CS_TrailMapDepthBlur_Classifyc5cb8ef6e18af21aCstrailmapCompute:CS_TrailMapFullBlur_Classify1372e2d51663b33dCsvfx_proj_decal_trail:CS_DefragHeap_RelocateAllocations5c85d508f4659843Csvfx_proj_decal_trail:CS_RelocateProjDecalTrailNodes80e25fa666764942Csvfx_proj_decal_trail:CS_RelocateProjDecalTrail0e90505eff274aa4Csvfx_proj_decal_vbuffer:CS_ProjDecalClassifyc85cb6bc1cd8e2adCsvfx_triangleClip:CS_DefragHeap_RelocateAllocations339d476c267c03c7Csvfx_triangleClip:CS_RelocateVfxStartIndexLocation6d5e8adf383092f1Csvfx_vegetation:CSVegetationPtFxBulletGpuSpawne75ab410050ae3e0Csvfx_vegetation:CSVegetationPtFxOBBGpuSpawncbf9b65f2249ba96Cswater_micro_geom_renderer:CS_CullWaterPatchesUsingCalmingInfod44aa899b31c6491Cswater_micro_geom_renderer:CS_CullWaterPatches73ac67482f6b6a5dCswater_micro_geom_renderer:CS_GenerateWaterPatchWritingJobs_WithLODStitchinge918b781c12d5815Cswater_micro_geom_renderer:CS_GenerateWaterPatchWritingJobs8955e67c20fcd59aCswater_micro_geom_renderer:CS_GenerateWaterPatches_WithLODStitching45c1a23674cc965eCswater_micro_geom_renderer:CS_GenerateWaterPatches1aa247ed3653b616Cswater_shading:CS_TransmissionVolumetrics_GenerateTilesac11be2c8599804eCswater_shading:CS_VolumePortalTiling_Generate9ba86fa7dcb9f314Cswater_underwater_mask_mesh_helper:CS_SurfacePrimitives3d828e61f0b6bdddCswater_underwater_mask_mesh_helper:CS_SurfacePrimitives_MeshletsHow:
victory translate <dump> --validate --listbuilt for each side (release, cross-built with cargo-xwin, run under Wine),VICTORY_HOST_WAVE=32, plus the four shader-cache-key settingsplaystarts with (VICTORY_EARLY_DEPTH=1,VICTORY_NAN_SCRUB=1,VICTORY_BVH_MISS=1,VICTORY_SAMPLED_MARKS=1). Validator:dxil.dllfrom DXC v1.9.2609. "Changed" compares translate'semittedhash of each module and its bindings. There was no GPU on this side, so no host pipelines were made and nothing was run on a card. Onmainthe same run has 72 failures: 71 mesh programs over the 32 KiB output limit (the known shortcut inmesh_prologue) andCS_TraceShadowRays_FullAdaptive(#2993).This is the translation and validation check the description lists as pending, at 32 lanes only. It says nothing about what the drivers do with the new select.
7b1b1cf1f8to3615d2c3b9@faycalbaklouti on GitHub · 2026-12-01 00:44 UTC · original
Thanks, @babuakhil, for the hardware run and swapped-arm check, and @VibeCodeGuy for the corpus comparison.
On an RTX PRO 4500 Blackwell with NVIDIA 620.70.06 through GE-Proton/Wine + vkd3d-proton, I tested
7d93ee07and the #4358 patch cherry-picked onto it (3db7a3abb). Both passed wave64 (47), folded (20), and folded-join (1). Water tiles was ignored by default and passed all 200 cases when run explicitly on each. The separate divergent-loop test passed on both, with GPU readbacks matching the oracle for first-lane, reduction, and ballot in both loop layouts. I did not reproduce a failure of the nested form in these tests.0fc1ff58does have a donor case: the original tile-sort histogram/scatter with a CPU oracle. It explicitly reports a wrong nested-form result on 595.112.07 and a correct result on 620.70.06. I recovered the oracle, but not the two original containers it needs, so I did not rerun that case. I would narrow the description to the historical 595.112.07 observation and the 620.70.06 results above, and not add a regression test without a case that distinguishes the two forms.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.