Skip to content

Conversation

@Keenuts
Copy link
Collaborator

@Keenuts Keenuts commented Dec 4, 2025

This PR requires #7967

Inline SPIR-V provides mutliple attributes with overlapping
capabilities:

  • vk::builtin
  • vk::ext_input_builtin
  • vk::ext_output_builtin
  • vk::storage_class
  • vk::decorate

The issue is that what should be syntactic sugar was not implemented as
such: ext_input_builtin should be sugar for decorate + storage_class.
This meant codegen has different paths depending on the attributes used,
even if they should in the end have the same effect.
As expected, those paths have different behaviors, and some are buggy.

This commits adds a new step in sema: attribute normalization.
The target idea is to desugar some attributes into a more basic
format, but it requires large changes in CG. As of now, this commits
normalizes a bit the attributes in sema, but might lift
decoration+storage into ext_input_builtin.

Properly doing de-sugar will require additional changes, especially
around parameters & builtin through decorations which works only because
codegen checks are not complete.

Before this commit, non-static global variables with a inline
SPIR-V ext_storage_class attribute were added to the default
constant buffer global struct. This is an issue as the point of a custom
storage class is to create globals such as acceleration structures.

Fixes microsoft#7742
Inline SPIR-V provides mutliple attributes with overlapping
capabilities:
 - vk::builtin
 - vk::ext_input_builtin
 - vk::ext_output_builtin
 - vk::storage_class
 - vk::decorate

The issue is that what should be syntactic sugar was not implemented as
such: ext_input_builtin should be sugar for decorate + storage_class.
This meant codegen has different paths depending on the attributes used,
even if they should in the end have the same effect.
As expected, those paths have different behaviors, and some are buggy.

This commits adds a new step in sema: attribute normalization.
The target idea is to `desugar` some attributes into a more basic
format, but it requires large changes in CG. As of now, this commits
normalizes a bit the attributes in sema, but might lift
decoration+storage into ext_input_builtin.

Properly doing de-sugar will require additional changes, especially
around parameters & builtin through decorations which works only because
codegen checks are not complete.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

1 participant