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

Code generation determinism #926

Open
Gui-Yom opened this issue Jul 18, 2023 · 1 comment
Open

Code generation determinism #926

Gui-Yom opened this issue Jul 18, 2023 · 1 comment

Comments

@Gui-Yom
Copy link
Contributor

Gui-Yom commented Jul 18, 2023

Currently, faust generates independent computation graph nodes in an unspecified order.
This causes generated code to vary between runs.

I suspect this has to do with the way graph nodes are stored, e.g., using things such as : std::set<CodeLoop*>.
Pointer values change between runs and as such, set ordering isn't stable between runs neither.

Then I may be completely mistaken about this, as I'm not particularly proficient with C++. But this seems like a good reason as to why sometimes struct fields and code loops are reordered between runs.

I might try to fix this in a PR in the following days.

@sletz
Copy link
Member

sletz commented Jul 18, 2023

We indeed have non-determinism in the compiler, basically because pointers are use as keys in the hash-consing system in tlib and possibly other places.

Fixed the non-determinism is certainly welcome, since if would also allow to have better automatic tests at several place in the compilation chain, up to the final code. But it was not so easy todo.

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

2 participants