-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[naga] Remove non-essential override references via compaction #7703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
Adds a mode to compaction that removes unused functions, global variables, and named types and overrides. This mode is used everywhere except the compaction at the end of lowering, where it is important to preserve unused items for type checking and other validation of the module. Pruning all but the active entry point and then compacting makes `process_overrides` tolerant of missing values for overrides that are not used by the active entry point. Fixes gfx-rs#5885
There is a question what to do about the
I have listed in my order of preference, but I don't have all the context about use cases and build size concerns that might justify one of my non-preferred options. |
let (module, info) = naga::back::pipeline_constants::process_overrides( | ||
module, | ||
info, | ||
None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It already came in useful to be able to pass the actual entry point here, and I have the changes to do that, but unless there's a desire to have them in this PR, I'll hold them for a follow-up so that this one doesn't get any bigger.
Adds a mode to compaction that removes unused functions, global variables, and named types and overrides. This mode is used everywhere except the compaction at the end of lowering, where it is important to preserve unused items for type checking and other validation of the module.
Pruning all but the active entry point and then compacting makes
process_overrides
tolerant of missing values for overrides that are not used by the active entry point.Fixes #5885
I have opened this as a self-contained pull-request for ease of reviewing, but in order to pass CI, it will need to be rebased on top of the changes in #7711.
Testing
Adds several cases in the
validation
test to verify that compaction removes references to non-essential overrides.Squash or Rebase? Squash
Checklist
cargo fmt
.taplo format
.cargo clippy --tests
. If applicable, add:--target wasm32-unknown-unknown
cargo xtask test
to run tests.CHANGELOG.md
entry.