Skip to content
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

[naga] Remove unused types and global expressions in a single pass #6934

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

kentslaney
Copy link
Contributor

@kentslaney kentslaney commented Jan 16, 2025

Connections
closes #6788
alternative to #6806

Description
implements #6806 (comment)

Testing
This is tested by checking that going from expression to type and back, along with the opposite, is correctly marked as used. It also checks that adding an unused type using an expression gets compacted out.

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy. If applicable, add:
    • --target wasm32-unknown-unknown
    • --target wasm32-unknown-emscripten
  • Run cargo xtask test to run tests.
  • Add change to CHANGELOG.md. See simple instructions inside file.

@kentslaney kentslaney requested a review from a team as a code owner January 16, 2025 21:46
@kentslaney kentslaney mentioned this pull request Jan 16, 2025
7 tasks
@jimblandy jimblandy changed the title Compact leak single pass [naga] Compact types and global expressions in a single pass Jan 22, 2025
@jimblandy jimblandy changed the title [naga] Compact types and global expressions in a single pass [naga] Remove unused types and global expressions in a single pass Jan 22, 2025
@jimblandy
Copy link
Member

jimblandy commented Jan 23, 2025

@kentslaney Does this look okay? 24aa5e2

(Those comments assume that #6976 will be merged.) (edit: it's merged now)

@kentslaney
Copy link
Contributor Author

@jimblandy LGTM, thank you

@jimblandy
Copy link
Member

@kentslaney Okay, two more commits, just minor tweaks. If those look all right, then I think this is ready to go.

I'm so glad this idea worked out - thank you for giving it a shot!

@jimblandy
Copy link
Member

Confirmed with @kentslaney in chat that the two new commits look good.

Copy link
Member

@jimblandy jimblandy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great - thanks again for taking this on!

@jimblandy jimblandy force-pushed the compact-leak-single-pass branch from cd07fdd to d06878d Compare January 23, 2025 15:57
In compaction, correctly identify unused types and global expressions,
rather than treating all global expressions referred to by
`PendingArraySize::Expression` array lengths as used even if the array
type itself is not.

This is tested by checking that going from expression to type and
back, along with the opposite, is correctly marked as used. It also
checks that adding an unused type using an expression gets compacted
out.

See the comments on `ModuleTracer::type_expression_tandem` for
details.

Fixes gfx-rs#6788.
@jimblandy jimblandy force-pushed the compact-leak-single-pass branch from d06878d to b0aa1f2 Compare January 23, 2025 15:58
@jimblandy jimblandy enabled auto-merge (rebase) January 23, 2025 15:58
@jimblandy jimblandy merged commit 3cd2e7c into gfx-rs:trunk Jan 23, 2025
31 checks passed
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.

[naga] PendingArraySize::Expression breaks compaction
2 participants