-
Notifications
You must be signed in to change notification settings - Fork 195
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
Implement module compaction #2472
Conversation
This should be easier to review commit by commit. |
This is a step towards having the output loop depend only on `params`, rather than both `params` and `args`.
Change `--generate-debug-symbols` from an option that requires a value, "true" or "false", to a switch, whose mere presence enables the feature.
This lets us gather up the code that influences SPV input.
Add a new Naga feature, `"compact"`, which adds a new function `naga::compact::compact`, which removes unused expressions, types, and constants from a `Module`.
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.
This is some nice machinery!
I was wondering if we can move the type/expression tracing in the analyzer so that we can always generate the usage metadata.
The backends will then use the metadata for naming expressions and (unnamed) types instead of having to mutate the IR.
Can be done later but do let me know what you think!
Oh, in the sense that the relocated handle indices are actually the names we want to use in output, so we can skip the compaction step. That makes sense. I think there's some advantage to mutating the IR, though. Ideally the tests should use the backend code exactly the same way applications do. Mutation lets the backends remain ignorant of whether we performed compaction or not. I think there are ideas to pursue here, but let's land this as-is for now. |
I was proposing to always (without it being gated behind a feature flag) create the metadata and use it in the backends. |
Add a new Naga feature,
"compact"
, which adds a new functionnaga::compact::compact
, which removes unused expressions, types, and constants from aModule
.