Repository navigation
Conversation
kotekompotek
left a comment
There was a problem hiding this comment.
Verified both layers of the dxil-spirv#380 fix. Lowering: when a conditional has back edges to two different headers, the outer (lower rpo) edge goes through a dedicated latch block that counts the iteration itself — so the inner edge keeps normal counting and no block branches back twice. The plan() pass is the safety net: any written block that would still reach two back-edge headers un-folds the extra successors. Both the unit test (folded empty outer latch stays a block) and the real GCN nest test assert <=1 back header everywhere.
fuzeofficlal
left a comment
There was a problem hiding this comment.
Reviewed and verified against main (63bcca43) on Windows 11 (RTX 5090 + WARP + dxil.dll, VICTORY_D3D12_DEBUG=1) — clean CFG transformation and ready to merge:
- Splitting dual-back-edge conditional branches in
lower.rs:10197-10239, 10320-10334vialatch(b, to)updatesself.edges,fill_phis,pending_masks, andcountersconsistently, andbitcode.rs:738-756prevents empty-block folding from re-creating multi-back-edge headers without breakingplan.srcPHI mappings or irreducible-loop splits. - Note on 512 KiB file-size cap: on
63bcca43,emit/lower.rsreaches 523,660 B (only 628 B below524,288 B), so merging after any otherlower.rsPR will require moving helpers to a submodule.
Local verification:
victory-shader(ir::,structure::,emit::bitcode::,emit::lower::tests,emit::flow_tests,emit::crosslane_tests,emit::synthetic_tests,emit::semantics_tests): 119 passed (only failure is pre-existing RTX 5090 baselinegathers_at_a_level_match_the_hardware), including both new latch testscargo clippy --locked -p victory-shader --tests -- -D warnings(default &--all-features) +cargo xtask policy(191 files ok): 0 warnings
|
Thanks, good catch on the size. For whoever merges: this PR and #2968 both grow |
|
Automated triage for the maintainers. Needs work; needs the maintainer's decision. This gives an inner latch that also continues the outer loop its own counted latch ( On your reply:
What would still help: a pipeline run of the 9 changed programs on a Windows host (native D3D12), from anyone who has one, to show the new shape costs nothing there. CI: passing. Generated by Claude Code |
…il-spirv in Proton From Marvisak/VIctory#2977 (opened by neonbyte1; original commits and authors kept). Not yet merged upstream. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A latch that branches back to both its loop's header and the outer loop's makes dxil-spirv recurse until its stack runs out when the shader also reads other lanes (HansKristian-Work/dxil-spirv#380; the dxil-spirv that GE-Proton's vkd3d-proton pins has it): pipeline creation never returns. The outer back edge now leaves through a latch of its own that counts the outer loop's iteration, and the writer no longer folds an empty outer latch into a block that already branches back (it keeps the block's own back edge, else the one to its innermost header). Over shaders.rpf for 32-lane hosts the emitted counts are unchanged; 9 programs change (the four InstanceCulling batch shaders, three ShallowWaterSim, WaterSimMgr's UpdateDynamicFoam, an IrradianceCache filter), the 9 that had such blocks (35 before, none after). The four InstanceCulling pipelines are now created on GE-Proton11-14's vkd3d-proton.
|
Fixed the doc comment's indentation on On the other points:
|
a9ad776 to
d9f1861
Compare
A latch block that branches back to both its own loop's header and the outer loop's makes dxil-spirv recurse until its stack runs out in
LoopMergeTracer::trace_from_parent, when the shader also reads other lanes. The pipeline creation never returns. I reported it as HansKristian-Work/dxil-spirv#380; the fix there (#381) isn't in any vkd3d-proton release yet, and the vkd3d-proton GE-Proton ships pins the affected dxil-spirv.DXC never emits this shape, because its loops get a latch per back edge. So the translator now does the same:
Translation over the whole shader pack: the emitted counts per stage are unchanged, and 9 programs emit different DXIL. Those are the 9 that had such blocks:
InstanceCulling:CS_Prop_BatchNoCull,CS_Prop_BatchCullReflect,CS_Tree_BatchNoCull,CS_Tree_BatchCullReflectShallowWaterSim:CS_PreSim,CS_PreSimWithDisturb,CS_SurfaceWaveSimUpdateWaterSimMgr:CS_UpdateDynamicFoamindirect_light_probes:CS_IrradianceCache_SpatialFilter_SeparableByte-identical everywhere else.
Pipelines (RTX 5090, driver 620.73.04, Wine 11.22, vkd3d-proton 3.1-83 from GE-Proton11-14,
victory translate --pipelinesonCS_Prop_BatchNoCull's container, shader cache off):mainthese programs are 64-lane waves, which a 32-lane host refuses before the converter runs. The hang appears once they're allowed in the console flow, as with Shaders: wave64 compute on 32-lane hosts, in halves and in the console flow #233/Shaders: one console wave sharing LDS runs in the console flow on 32-lane hosts #439.mainwith Shaders: wave64 compute on 32-lane hosts, in halves and in the console flow #233/Shaders: lane reads and writes where lanes branch differently run in the console flow #320/Shaders: one console wave sharing LDS runs in the console flow on 32-lane hosts #439 and this change), every instance-culling pipeline the title asks for is made.Tests: two new ones,
a_latch_branches_back_to_one_header(lowering) andan_inner_latch_keeps_the_outer_latch(writer).victory-shaderunder Wine: 300 passed and 4 failed, against 298/4 onmain; the same 4 Wine failures, fixed by #2968, #2973 and #1266. Clippy (with and withoutdiagnostics) andcargo xtask policyare clean.Not tested on Windows. There, DXC-shaped loops are simply what the driver usually sees, so I don't expect a change beyond the 9 programs.
AI-assisted (Claude); measured on my machine, no game data shared.