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

Fix volatile helper invocation in non-main functions #2360

Merged
merged 2 commits into from
Aug 20, 2024

Conversation

etang-cw
Copy link
Contributor

@etang-cw etang-cw commented Aug 5, 2024

One of our tests only passed because it operated out of the entry point and would fail if you tried to do the same thing from any other function. This makes it work no matter where it is.

Note: I couldn't think of any better names for the new variable than just adding an underscore. If anyone else has a better name, please use it.

spirv_msl.cpp Outdated Show resolved Hide resolved
@@ -8,18 +10,24 @@ struct main0_out
float FragColor [[color(0)]];
};

static inline __attribute__((always_inline))
void func(thread float& FragColor, volatile thread bool& gl_HelperInvocation)
Copy link
Contributor

Choose a reason for hiding this comment

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

volatile thread seems like it's asking for trouble with spilling. volatile thread is somewhat meaningless. I know this comes up because in later SPIR-V discard + helper lane is done through volatile StorageClassInput.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you think we should just avoid volatile on thread variables in general?

Copy link
Contributor

@HansKristian-Work HansKristian-Work left a comment

Choose a reason for hiding this comment

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

Nits.

Copy link
Contributor

@HansKristian-Work HansKristian-Work left a comment

Choose a reason for hiding this comment

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

Seems okay.

@HansKristian-Work HansKristian-Work merged commit 7af81ed into KhronosGroup:main Aug 20, 2024
6 checks passed
@etang-cw etang-cw deleted the VolatileHelperNonMain branch August 23, 2024 18:06
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.

2 participants