Skip to content

Conversation

@Firestar99
Copy link
Member

@Firestar99 Firestar99 commented Nov 3, 2025

This fixes validation errors caused by unused shared memory and enables it to be DCE-ed away.

Params of entry point interfaces will now be DCE-ed by rust-gpu as well, previously only spirv-opt does some DCE on them but it leaves unused shared memory params as-is. As with spirv-opt, SpirvBuilder.optimizer.preserve_bindings = true will disable any DCE of unused entry point params.

On a vulkan1.1/spv1.3 or lower preserve_bindings does not work on any param that is not of class input or output, so shared memory will be DCE-ed anyway, due to there being no references to those instructions. Whereas vulkan1.2+/spv1.4+ added the requirement for all OpVariables to be mentioned in the entry point instruction, allowing us to preserve them.

close #455

@Firestar99
Copy link
Member Author

Firestar99 commented Nov 3, 2025

@eddyb requesting rereview for the 2 new commits. I noticed that on vulkan1.1 we did DCE the unused shared memory, so investigated a bit and found a way to DCE it on other targets as well (see desc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DCE for unused shared memory arguments

3 participants