-
-
Notifications
You must be signed in to change notification settings - Fork 218
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
[Feature Request] Consider adding a feature flag for enhanced determinism option of glam #789
Comments
Can you specify more precisely which operations currently suffer from non-determinism? The thing is that It would also add a significant maintenance level + test coverage to ensure determinism, which I'm not sure is justified unless multiple people benefit from it, and someone volunteers to put in the necessary work. |
My understanding is that the lack of cross platform determinism would come from functions such as: These are in glam and can be cross platform deterministic in case of the flag bevy also uses this flag for their cross platform deterministic exports.
I agree it is an implementation detail, and the workaround for me would be to fork gdext and add this flag (for my use cases). Not sure if it is justified to add this flag unless many people would use it, agree. So you decide. |
It's hard to make a decision right away, it depends on several factors:
And |
Cross platform determinism is hard to test. If the implementation you use for
I don't know if determinism is something that you should take very seriously, as in test it extensively, or just enable that flag and get it done with. For my use case that flag enabled should be enough. At least as a starting point. The thing is I use the gdext math functions a lot inside my lib logic, wether it is |
The thing is, we already have some "best-effort features" like In other words, if we add
then I want to know and document how it improves determinism, which APIs are covered and which aren't. It's probably just a matter of research, but what I want to avoid is just delegate the responsibility in a "may or may not improve determinism, but find out yourself" way. Also because some of our math may be rewritten in Rust without glam, and it would thus bypass any determinism guarantees.
Why? Can we not serialize the result of operations with known edge cases, and run CI on multiple platforms to make sure the results match the expectations? |
Why would we rewrite our own math instead of using glam? It offers a lot of things out of the box, this included. If we would write our own, what features might we target and what would be the reason to do so? We can do the last bit, but finding those edge cases is usually hard. |
This is not a hypothetical statement, a lot of gdext's vector math is hand-implemented. Sometimes because Godot has different semantics, sometimes because glam does extra logic we don't need, etc. See #721 for recent changes in that direction. And again: how does determinism generalize to
That's what I meant with "It would also add a significant maintenance level + test coverage to ensure determinism, which I'm not sure is justified unless multiple people benefit from it, and someone volunteers to put in the necessary work." Whether hard or not, it needs some time to research. But we're not the first to attempt this, there might even be existing test suites. |
Ok, to support this, we'd need the following:
1 without 2 makes no sense, as many operations would still be non-deterministic. Would you be interested in working on points 2 and/or 3? |
I would be interested, however it would come down to priorities. Possibly I will take this later on, as right now I have quite a few other things to implement on the rapier plugin, and there are also performance issues on gdext I am more interested in hacking if possible. I think we can even close this for now and I can reopen it at a more opportune time. |
Definitely, no worries! We can keep it open, I would remind you in a few months, and then we can still decide if we want to pursue it or not. |
@Ughuuu Do you still think this is something you're interested in? If there's no concrete plan on how we can achieve determinism with confidence, I would probably close this. As mentioned above, forwarding the |
Consider adding option:
For glam inside
godot-core/Cargo.toml
. This option would allow people that want to use the libm flag which would make the math lib cross platform determinism at the expense of speed be able to do so without needing to fork gdext.The text was updated successfully, but these errors were encountered: