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

Make the location map run per entry point #6688

Merged
merged 3 commits into from
Jun 12, 2024
Merged

Conversation

s-perron
Copy link
Collaborator

@s-perron s-perron commented Jun 11, 2024

The code that adds the input and output decoration in the entry points
inputs and outputs assumes that there is a single entry point in the
module. When using the lib profile that is not true.

This commit modifies the code so that it groups the stage variables by
entry point, and runs the current code on each group separably.

I hesitate to make this change because it will change the locations for
code that currently works, and will force users to update their
applications accordingly. Or they could modify their shaders
to use explicit locations attributes. Neither is great.

However, the advantage is that this allows the implicit locations to match what would happen if the shader were compiled individually. It also makes the locations more predictable because change in another shader would change all shader after it. This is a better design, and worth the breakage.

Fixes #6678
Fixes #5213

The code that addes the input and output decoration in the entry points
inputs and outputs assumes that there is a single entry point in the
module. When using the `lib` profile that is not true.

This commit modifies the code so that it groups the stage variables by
entry point, and runs the current code on each group separetly.

I hesistate to make this change because it will change the locations for
code that currently works, and will force users to update their
applications accordingly. Or they could modify their shaders
to use explicit locations attributes. Neither is great.

Fixes microsoft#6678
Fixes microsoft#5213
@s-perron s-perron requested a review from a team as a code owner June 11, 2024 18:17
@s-perron s-perron marked this pull request as draft June 11, 2024 18:18
@s-perron s-perron marked this pull request as ready for review June 11, 2024 19:01
Copy link
Collaborator

@cassiebeckley cassiebeckley left a comment

Choose a reason for hiding this comment

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

This seems reasonable to me.

tools/clang/lib/SPIRV/DeclResultIdMapper.cpp Outdated Show resolved Hide resolved
tools/clang/lib/SPIRV/DeclResultIdMapper.cpp Outdated Show resolved Hide resolved
tools/clang/lib/SPIRV/DeclResultIdMapper.h Outdated Show resolved Hide resolved
tools/clang/lib/SPIRV/DeclResultIdMapper.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@Keenuts Keenuts left a comment

Choose a reason for hiding this comment

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

LGTM. I agree with the behavior change, would expect each stage to behave independently too.

@s-perron s-perron enabled auto-merge (squash) June 12, 2024 14:24
@s-perron s-perron merged commit 4353db3 into microsoft:main Jun 12, 2024
12 checks passed
@s-perron s-perron deleted the i6678 branch September 12, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
3 participants