Shaders: add opt-in block-local expression reuse #4573
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!4573
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4572"
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?
@john-9474 on GitHub · 2026-11-30 22:56 UTC · original
john-9474:codex/local-reuse-compatibility→main· +382 −149 · 4 files · 1 commits · openWhat it changes
On an RTX 3080 Ti with driver 610.47, five compute pipelines that fail native creation with the default mask 447 all create with the new opt-in mask 959. The first pair was repeated as failure/success/failure/success. Baseline failures were actual
CreateComputePipelineStateE_OUTOFMEMORYresults with memory admission allowed and substantial observed headroom.Adds
LOCAL_REUSE(bit 512): keep pure-expression REUSE within each block while retaining same-block reuse, phi deduplication, known-And/Or select folding and the other requested passes.959is the usual 447 plus this modifier. Default 447 and ALL 511 stay unchanged; 512 alone enables no pass. Parser, test override and optimizer invocation preserve the bit, and existing cache fingerprints include its effective value.This is a compiler compatibility option. The observations do not establish invalid IR or a general CSE semantic defect. The setting applies to all translated stages, while native evidence so far covers compute on one GPU. Keeping extra computations can add instructions and compilation work.
How it was tested
--locked, two jobs. 31 pure optimizer tests passed with the hardware namespace excluded. Parser/default/ALL/modifier-alone controls and the owned code-difference witness passed separately.7d93ee07, default and diagnostics shader-library checks and strict shader all-target Clippy passed (cargo clippy --locked --jobs 2 -p victory-shader --all-targets [--features diagnostics] -- -D warnings). The 31 pure optimizer tests, parser control and CPU emission witness were rerun successfully. Explicit locked staged policy passed for four files; Cargo.lock is unchanged. This is focused shader validation, not a full workspace CI claim.--release --features diagnostics, opt-level 3, fat LTO, one codegen unit), with the unchanged host observer and background/mute harness held constant between masks: five paired native compute creation probes produced 0/5 at 447 versus 5/5 at 959, plus the repeated first pair. Success required positive native creation markers, not the CLI exit code. The original four PR files hash-match that tested e125-based integration source (app SHA prefix055ff48a). The refresh to7d93ee07preserves all production code byte for byte; its only difference from the original feature is six upstream test-only lines from #4321. Native/GPU results below belong to the original e125 integration, not a new-main native run. The observer and harness are excluded from this PR. These isolated tests have no display resolution, upscaler or frame generation rate.No game assets, extracted shader data, images or runtime harness changes are included.
Checked for overlap
Historical CI on original head
9dacc88astopped at workspace Clippy on three unchanged e125 baseline findings:Lowered::loop_capsdead code,Shadow::rangeddead code andhost.rsmanual-is-multiple-of. The same shader finding was reproduced on clean e125. Upstream #4297 has since addressed these baseline findings; refreshed-head strict shader all-target checks now pass in both configurations. New remote workspace CI is separate from these local results. No authored source/config lint allowances or unrelated baseline fixes were added.9dacc88a14toe2774f4cdf@VibeCodeGuy on GitHub · 2026-12-01 01:12 UTC · original
Offline corpus check (every shader container in a v1.0.2.1 dump: 25,699 unique programs), this PR at
e2774f4cwithVICTORY_SHADER_OPT=959against the same build at the default mask.maintoo (oversized mesh outputs).The 22298 changed programs by family
MS_VS_Transform_PositionOnlyPS_DeferredTexturedMS_VS_TransformPS_MirrorReflectionDeferredTexturedMSNC_VS_TransformSkin_PositionOnlyPS_VfxVBuffer_AlphaClipPS_MirrorReflectionTextured_EightPS_Textured_EightPS_LinearDepthPS_DeferredTextured_AlphaClipPS_MirrorReflectionDeferredTextured_AlphaClipPS_VoxelizeVisiblityMSNC_VS_TransformSkinPS_AlphaPrepassPS_EntityMaskMS_VS_MirrorReflectionTransformMS_VS_CascadeShadows_drawMS_VS_CascadeShadows_drawTextureMS_VS_TransformDPS_MirrorReflectionDeferredDecalTexturedMS_VS_LinearDepthMSNC_VS_MirrorReflectionTransformSkinPS_CascadeShadows_textureMS_VS_MirrorReflectionTransformDVS_Transform_VfxVBuffer_AlphaClipMS_VS_TransformEntityMaskVS_Transform_VfxVBufferVS_TransformSkin_VfxVBuffer_AlphaClipVS_TransformSkin_VfxVBufferMSNC_VS_TransformSkinDMS_VS_TransformTransmissionMSNC_VS_LinearDepthSkinMSNC_VS_MirrorReflectionTransformSkinDMS_VS_TransformAlphaPrepassMSNC_VS_TransformSkinEntityMaskMSNC_VS_CascadeShadows_drawskinnedTextureMSNC_VS_CascadeShadows_drawskinnedMSNC_VS_TransformSkinTransmissionMSNC_VS_TransformSkin_AlphaPrepassMS_VS_MirrorReflectionTransformDecalsDMSNC_VS_MirrorReflectionTransformSkinDecalsDPS_MirrorPedTextured_EightPS_PedAlphaPrepassPS_PedTextured_Eight_AlphaPS_StudioPedTextured_EightPS_TexturedDeferredPS_PedAlphaPrepass_DecalsPS_PedTextured_Eight_DecalsMS_VS_TransformLitMSNC_VS_PedTransformSkinAlphaPS_TrailmapDeformDataMS_VS_TrailmapDeformDataMS_VS_TransformSkin_PositionOnlyMS_VS_PedTransformAlphaPS_MirrorReflectionTexturedDeferredPS_CascadeShadows_texture_alphaPS_PuddleDetectPS_TexturedLit_8MSNC_VS_TrailmapDeformDataSkinnedPS_DeferredPedTexturedNCPS_MirrorReflectionDeferredPedTexturedNCPS_DeferredPedDecalTexturedPS_DeferredTextured_AlphaClipNCPS_MirrorReflectionDeferredTextured_AlphaClipNCMS_VS_CascadeShadows_PedTransformPreSkinDPS_AlphaTransmissionPS_TexturedLitMSR_VS_TransformSkin_PositionOnlyMSNC_VS_PedTransformSkinD_PositionOnlyPS_AlphaPrepass_FireMSNC_VS_PedTransformSkinEntityMaskDMS_VS_PedTransformD_PositionOnlyPS_Textured_Eight_FireMSNC_VS_MirrorReflectionPedTransformSkinMSNC_VS_PedTransformSkinTransmissionAlphaMSNC_VS_PedTransformSkin_DecalsPS_AlphaTransmission_FireMSNC_VS_PedTransformSkinAlpha_DecalsMSNC_VS_PedTransformSkinTransmission_DecalsMS_VS_PedTransformPreSkinD_PositionOnlyPS_PedEntityMaskMS_VS_PedTransformEntityMaskPS_MirrorReflectionTexturedDeferredAlphaClipNCPS_TexturedDeferredAlphaClipNCPS_PedEntityMaskDMS_VS_LinearDepthPreSkinPS_CascadeShadows_texture_fireMSNC_VS_MirrorReflectionPedTransformSkinDMSNC_VS_PedTransformSkinDPS_PedTexturedCutOutTint_ZeroPS_TrailMapPropDeepSurfaceFlatten_UAVMS_VS_MirrorReflectionPedTransformMS_VS_PedTransformTransmissionAlphaMS_VS_PedTransform_DecalsPS_LinearDepth_FireMSNC_VS_MirrorReflectionPedTransformSkinDecalsDMS_VS_MirrorReflectionPedTransformDMS_VS_PedTransformAlpha_DecalsMS_VS_PedTransformDMS_VS_PedTransformTransmissionAlpha_DecalsMS_VS_MirrorReflectionPedTransformDecalsDPS_AlphaPrepassSpatterPS_AlphaTransmissionSpatterMS_VS_PedTransformPreSkinDPS_TwoLayerEntityMaskVS_VoxelizeGenericPS_AlphaPrepassSpatter_FirePS_AlphaTransmissionSpatter_FirePS_PropVehicleDeferredPS_VehicleLiveryOffComplexDirtOffDeferredPS_VehicleLiveryOffComplexDirtOffDetailMapsOffDeferredPS_VehicleLiveryOffDetailMapsOffComplexDirtOffStickersOffFlakesOffDeferredPS_VehicleLiveryOffDetailMapsOffDeferredPS_VehicleLiveryOffOnlyDeferredPS_VehicleLiveryOnDetailMapsOffDeferredPS_VehicleVariationDeferredptfx_PSptfx_PS_alphathreshold_mv_uvdistortptfx_PS_alphathreshold_mv_uvdistort_nolocallightsptfx_PS_nolocallightsMS_VS_TransformTransmissionFireMS_VS_Transform_FireMS_VS_Transform_Fire_AlphaPrepassMSNC_VS_BakeDecorationsMSR_VS_TransformSkinMS_VS_TransformSkinPS_DeferredPedTexturedNC_PackedPS_TexturedLit_ReflectionMapMSNC_VS_TransformSkinTransmissionFireMSNC_VS_TransformSkin_FireMSNC_VS_TransformSkin_Fire_AlphaPrepassPS_BakeDecorationsPS_DeferredPedTextured_AlphaClipNC_TintVS_TransformPreSkin_VfxVBufferMSR_VS_MirrorReflectionTransformSkinDMSR_VS_TransformSkinDMS_VS_MirrorReflectionTransformSkinDMS_VS_TransformSkinDMS_VS_TransformSpatterAlphaPrepassMS_VS_TransformTransmissionSpatterPS_DeferredPedTextured_AlphaClip_Decal_TintMSR_VS_CascadeShadows_drawskinnedMST_DS_TerrainTransformMS_VS_CascadeShadows_drawskinnedMS_VS_MirrorReflectionTransformLitPS_PedVfxVBuffer_AlphaClipMSR_VS_LinearDepthSkinMS_VS_CascadeShadows_draw_fireMS_VS_LinearDepthSkinMSNC_VS_CascadeShadows_drawskinned_fireHow:
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).The default is untouched, as the description says. This PR's head with the default mask produces DXIL identical to
maine1251c31for all 25,699 programs. (It does not merge cleanly ontomain, and its merge-base,0c8c2092, does not build, so I compared the head with itself.)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.