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] compaction may miss used constants' types #7072

Closed
jimblandy opened this issue Feb 6, 2025 · 1 comment · Fixed by #7077
Closed

[naga] compaction may miss used constants' types #7072

jimblandy opened this issue Feb 6, 2025 · 1 comment · Fixed by #7077

Comments

@jimblandy
Copy link
Member

I think part of the compaction code is either wrong or redundant.

When compact::compact marks a name constants as used by definition, it also marks its initialization expression as used. But then later in that function, it marks the types of all used constants as used. I'm not sure why these two cases, type and initialization expression, should be handled differently. It seems to me that either the type marking can be moved up (removing that entire loop altogether) or the initializer marking must be moved down, because new constants are getting marked and we'd better include their initialization expressions.

Whatever the case, overrides deserve similar scrutiny.

(I'm not sure this is actually a bug, but there's an asymmetry to naga::compact::compact that seems wrong, and I'm afraid I'll forget about this doubt if I don't write it down.)

@jimblandy jimblandy changed the title [naga] compaction may miss used constant types [naga] compaction may miss used constant's types Feb 6, 2025
@jimblandy jimblandy changed the title [naga] compaction may miss used constant's types [naga] compaction may miss used constants' types Feb 6, 2025
@jimblandy
Copy link
Member Author

We have this comment:

    // Constants' initializers are taken care of already, because
    // expression tracing sees through constants. But we still need to
    // note type usage.

I'm not sure it's right.

jimblandy added a commit to jimblandy/wgpu that referenced this issue Feb 7, 2025

Verified

This commit was signed with the committer’s verified signature.
Vrixyz Thierry Berger
Ensure that unnamed overrides' types are retained, even when the
overrides are used only by global expressions. Add a test case.

Fixes gfx-rs#7072.
jimblandy added a commit to jimblandy/wgpu that referenced this issue Feb 7, 2025

Verified

This commit was signed with the committer’s verified signature.
Vrixyz Thierry Berger
Ensure that unnamed overrides' types are retained, even when the
overrides are used only by global expressions. Add a test case.

Fixes gfx-rs#7072.
jimblandy added a commit to jimblandy/wgpu that referenced this issue Feb 7, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Ensure that unnamed overrides' types are retained, even when the
overrides are used only by global expressions. Add a test case.

Fixes gfx-rs#7072.
@github-project-automation github-project-automation bot moved this from Todo to Done in WebGPU for Firefox Feb 12, 2025
davnotdev pushed a commit to davnotdev/wgpu that referenced this issue Mar 4, 2025
Ensure that unnamed overrides' types are retained, even when the
overrides are used only by global expressions. Add a test case.

Fixes gfx-rs#7072.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant