-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Merged by Bors] - bevy_ecs: Use 32-bit entity ID cursor on platforms without AtomicI64 #4452
[Merged by Bors] - bevy_ecs: Use 32-bit entity ID cursor on platforms without AtomicI64 #4452
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also worth noting that (as far as I know) we don't plan to make any guarantees about weird platforms at this point in time. That is, if you want it to keep working, you'll likely need to keep patching yourself.
Additionally, I wouldn't be super surprised if this didn't land. I'd say that this probably shouldn't be merged without cart's sign off, since it is definitely a weird hack.
That being said, I'm reasonably happy with the implementation of the change, barring the few corner cases which need additional thought applied.
Yeah, I figured this might be the case, but the change was relatively small in scope so I thought I'd see if it would be accepted into mainline. I realize it's not a stated goal of the project to maintain compatibility for unusual platforms like this, but if there is a commit hash I can pin to and use Bevy with I will be pretty happy with that :) I will look to see if I can at least address your initial concerns / comments and we can go from there (if/when cart has a chance to look over it as well). |
Our stated latest supported release is "latest stable", so no worries there :) This is an interesting and not very intrusive change 🤔 Needs some cleanup, but I personally don't mind including small tweaks like this for compatibility if they're well-documented and unobtrusive. Well down the road, I think we should consider something like Rust's platform tiers. You could obviously maintain a fork of Bevy with these minimal changes, but that becomes rather frustrating in the context of the ecosystem, so it would be nice to be able to upstream this. |
Ok, thanks for the helpful feedback! Just to clarify, am I missing anything requested for changes here?
Is that everything? It sounded like maybe the unwrap could go into a different PR, but maybe it it belongs in this one since the risk of overflow is greater on these kinds of platforms? |
Yep, that sounds correct :) Final call on whether we want this sort of compatibility change at all belongs to @cart as a matter of controversial engine-level policy, but I think that those changes should make this PR mergeable if he decides to pry open that particular can of worms. Just to double-check @ian-h-chamberlain: this was the only change you needed to get |
@alice-i-cecile yes, actually with this change and a custom nightly I was able to compile the whole I have only tested on the I'll try to update the PR later this evening with the requested changes. |
Updated with the requested changes, let me know if there's anything else needed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM now. Still going to punt on the "should we do this" call though :)
@alice-i-cecile Based on the recent Discord announcement regarding "controversial" PRs (and your previous comments), should this be labeled with |
Good call, thanks. |
- Rename to [Atomic]IdCursor - Add comments documentating behavior on non-64-bit-atomic platforms - try_from().unwrap() in cases that can only fail with 32-bit AtomicIsize
4f2ff40
to
5864605
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The side effects are a bit controversial, but the code looks good to me.
@alice-i-cecile I think this has passed the 45-day mark since you marked it as ready for review, is there anything else (a final pass of reviews maybe) needed to get it merged? |
@alice-i-cecile You've got the wrong Rob Swain I'm afraid. I definitely don't have anything to do with this project 😄 |
Indeed. cc @superdump |
This PR looks good, but there is no way to guarantee it's still working. Another PR could break the support and we would never know until someone complains. What kind of guarantee do we want to provide? @ian-h-chamberlain would you be happy with having to fix it occasionally? Do we want to setup a CI job that would cross compile to a target without 64 bits atomics? |
In terms of support – for the However, it might be reasonable to add CI for a tier 1 target like Edit: I need to check that |
We want the smallest signed integer big enough to contain That is The reason not to use isize everywhere is that it's wasteful on 128 bit platforms. Admittedly, I don't know of any 128 bit platforms, but I'd rather keep it as the condition explained in my first paragraph. And I think the consensus is that we don't guarantee it works. We just don't intentionally stand in the way of it not working (without good reason, anyway). In rustc parlance, these are tier 3 targets, i.e. it might be supported, and you can bring PRs to fix the support, but we don't try and ensure it is. |
Thanks for the explanation!
If GitHub had better support for actions on cron, maybe, but as it is for the moment it's pretty useless. And I would rather not add it to the main CI jobs, they are already long enough. |
It is my intention to create a |
Yep, we're on board with that setup for now. This is still controversial though, so I've started the timer to merge :) |
Hello name-sharer! Much love to you! |
It looks like this has reached the 45-day mark, based on the project page. Is there anything else needed to merge now that we've hit the timer? |
I have no further objections :) I'm on vacation though, so I'll merge this at the start of September if no one else beats me to it. |
If this change was any more invasive than it is, I'd probably block it. But its just scoped enough that I'm willing to squeeze it in. It makes me just a little bit uncomfortable and we're catering to a pretty niche crowd here (3ds is effectively dead at this point, so this is enabling homebrew stuff? And I haven't seen this issue come up on any other platforms). Getting bevy working on a 3ds is definitely fun and cool though, and we should encourage doing fun and cool things, within reason. But for the person (or AI) years in the future reading this thread and writing future Bevy ECS code: if you need to drop this support for any legitimate reason ... I think you should do it. |
bors r+ |
…4452) # Objective - Fixes #4451 ## Solution - Conditionally compile entity ID cursor as `AtomicI32` when compiling on a platform that does not support 64-bit atomics. - This effectively raises the MSRV to 1.60 as it uses a `#[cfg]` that was only just stabilized there. (should this be noted in changelog?) --- ## Changelog - Added `bevy_ecs` support for platforms without 64-bit atomic ints ## Migration Guide N/A
Pull request successfully merged into main. Build succeeded: |
…evyengine#4452) # Objective - Fixes bevyengine#4451 ## Solution - Conditionally compile entity ID cursor as `AtomicI32` when compiling on a platform that does not support 64-bit atomics. - This effectively raises the MSRV to 1.60 as it uses a `#[cfg]` that was only just stabilized there. (should this be noted in changelog?) --- ## Changelog - Added `bevy_ecs` support for platforms without 64-bit atomic ints ## Migration Guide N/A
…evyengine#4452) # Objective - Fixes bevyengine#4451 ## Solution - Conditionally compile entity ID cursor as `AtomicI32` when compiling on a platform that does not support 64-bit atomics. - This effectively raises the MSRV to 1.60 as it uses a `#[cfg]` that was only just stabilized there. (should this be noted in changelog?) --- ## Changelog - Added `bevy_ecs` support for platforms without 64-bit atomic ints ## Migration Guide N/A
…evyengine#4452) # Objective - Fixes bevyengine#4451 ## Solution - Conditionally compile entity ID cursor as `AtomicI32` when compiling on a platform that does not support 64-bit atomics. - This effectively raises the MSRV to 1.60 as it uses a `#[cfg]` that was only just stabilized there. (should this be noted in changelog?) --- ## Changelog - Added `bevy_ecs` support for platforms without 64-bit atomic ints ## Migration Guide N/A
Objective
Solution
Conditionally compile entity ID cursor as
AtomicI32
when compiling on a platform that does not support 64-bit atomics.This effectively raises the MSRV to 1.60 as it uses a
#[cfg]
that was only just stabilized there. (should this be noted in changelog?)Changelog
bevy_ecs
support for platforms without 64-bit atomic intsMigration Guide
N/A