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

MSL: divergence in different code stages when relying on DecorationInvariant #2420

Open
mabaro opened this issue Nov 19, 2024 · 1 comment
Open

Comments

@mabaro
Copy link

mabaro commented Nov 19, 2024

The current implementation relies on adding the dependency chain of the invariant variable (i.e, position) to the forced_temporary group. This already splits a lot of operations reducing the chances of divergencies, but it's not enough for complex setups.
In our use case, the spirv-opt output has divergencies on different stages, splitting one particular operation on one stage (i.e., 961 - (_958 * dot(_961, _958))) into temporaries, while keeping it inlined on the other stage.
When passing the produced spirv through spirv-cross the invariant decoration current behaviour keeps the divergences generating glitches.
The only solution I came up to have some sort of working code is:

  • propagate decorationInvariant through the dependency chain
  • use decorationInvariant in the same sense as decorationNoContraction in emit_binary_op/emit_binary_op_func (i.e., the latter is used by spirv_msl when outputting spvXXX functions)

This is for sure not a complete solution, and I don't know if that approach could even be considered adequated for merging at certain point, or for further investigation.

I'd appreciate any hints/opinions.
Cheers.

@mabaro
Copy link
Author

mabaro commented Nov 19, 2024

related post -> #1022

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

No branches or pull requests

1 participant