Skip to content

Conversation

@LegNeato
Copy link
Collaborator

@LegNeato LegNeato commented Jan 9, 2026

Disclosure: I had AI write this and I only superficially understand the code.

Replace OpLoad from Private/Function
storage class variables with their constant initializers. This eliminates pointer-to-pointer patterns like &&123 which would otherwise generate invalid SPIR-V in Logical addressing mode (pointer-to-pointer is only allowed for StorageBuffer/Workgroup, not Private).

The optimization runs after inlining (which may expose such patterns) and before DCE (so the now-unused variables can be removed).

Also extend DCE to treat Private storage class variables as pure, allowing them to be removed when unused.

Newer versions of spirv-val catch this, causing our compiletests to fail.

Disclosure: I had AI write this and I only superficially understand the code.

Replace OpLoad from Private/Function
storage class variables with their constant initializers. This eliminates
pointer-to-pointer patterns like `&&123` which would otherwise generate
invalid SPIR-V in Logical addressing mode (pointer-to-pointer is only
allowed for StorageBuffer/Workgroup, not Private).

The optimization runs after inlining (which may expose such patterns)
and before DCE (so the now-unused variables can be removed).

Also extend DCE to treat Private storage class variables as pure,
allowing them to be removed when unused.

Newer versions of spirv-val catch this, acusing compiletests to fail.
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.

1 participant