-
Notifications
You must be signed in to change notification settings - Fork 474
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
Add preliminary support for loom #487
Conversation
/cc @cynecx since it seemed you were interested |
I think it would be nice if we could run some variant of the examples ( |
Should be quite possible! The easiest way would probably be to factor out the core of |
I added one! And interestingly enough, it fails with
|
@carllerche When I get the error above, how do I then find out where the violation happened? |
I chatted to Carl, and it looks like the cause for this is probably a bug in loom: tokio-rs/loom#124. Let's see when it is fixed whether it then passes! |
Oooh, with tokio-rs/loom#125, loom actually runs for the treiber stack example! Letting it go through the iterations now to see if it finds any problems. None so far :D |
And with tokio-rs/loom#128, it runs to completion without errors! 😮 |
CI doesn't like the patch in 08b37ab 😅 It will go away once loom gets another release. |
Hmm, how can I see what the errors were @taiki-e? All of them just say "This check failed" as far as I can tell? |
@jonhoo I restarted CI -- looks like it fixed the issue: https://github.com/crossbeam-rs/crossbeam/pull/487/checks |
The minimal version bump to 1.30 is a little awkward, but is needed to allow us to use paths for macro imports. While digging into it, I also noticed that technically 1.28 isn't the msrv at all for these crates. For example, the |
@jeehoonkang I believe this is now ready for review :) |
I think this is fine given that |
Ping. |
@cynecx I believe this is ready to merge once reviewed. I've pushed a rebased version now to make sure there aren't any conflicts. |
The two failures appear unrelated to this PR. I think CI is simply broken on |
Crossbeam has evolved quite a lot recently, so I wonder if the unrelated failures are gone. |
@jeehoonkang rebased! |
Hey, it works again! 🎉 |
Err, rebasing this will probably be pretty painful. Do you mean squash? I merged with master just now, and that went off without a hitch, so it should just be a matter of using GitHub's "squash and merge" button I think. |
Oh, I didn't notice about "squash and merge" worked. I'll use that. Thanks for pointing that out. |
@jeehoonkang: Do you want another chance at reviewing this before I merge it? |
Oh, I noticed that loom has a PR that seems to try to recommend the use of cfg like |
I don't feel strongly whether the name goes first or last, but I agree that crossbeam should probably follow whatever convention ends up being documented. |
I've filed #658 to rename cfg(loom_crossbeam) to cfg(crossbeam_loom). Also, I've approved tokio-rs/loom#159. |
658: Rename cfg(loom_crossbeam) to cfg(crossbeam_loom) r=jonhoo a=taiki-e It matches with the convention that *will* be documented in `loom`. See #487 (comment) for more. r? @jeehoonkang @jonhoo Co-authored-by: Taiki Endo <te316e89@gmail.com>
659: Prepare for the next release r=taiki-e a=taiki-e It's been over two months since the previous release. There are some improvements and deprecations in the master branch, and it would be nice to release them. Also, there is no breaking change that needs a major version bump. Changes: - crossbeam-epoch 0.9.1 -> 0.9.2 - Add `Atomic::compare_exchange` and `Atomic::compare_exchange_weak`. (#628) - Deprecate `Atomic::compare_and_set` and `Atomic::compare_and_set_weak`. (#628) - Make `const_fn` dependency optional. (#611) - Add unstable support for `loom`. (#487) - crossbeam-utils 0.8.1 -> 0.8.2 - Deprecate `AtomicCell::compare_and_swap`. (#619) - Add `Parker::park_deadline`. (#563) - Improve implementation of `CachePadded`. (#636) - Add unstable support for `loom`. (#487) Co-authored-by: Taiki Endo <te316e89@gmail.com>
Is Context: was wondering about
output when building rust-analyzer. |
Yes. see Alex's this comment.
As far as I know, it will be downloaded but not actually compiled. See also tokio-rs/bytes#400 and tokio-rs/bytes#411.
Unfortunately, as far as I know, (at least in the v1 resolver) the cargo feature doesn't provide enough functionality to support loom. See also #638 |
compilation is not the only cost: I read Cargo.lock from time to time, and I read .lock diffs regularly. I care a lot about keeping those as small as possible.
Can
|
Oh, I didn't know it works. I would like to switch to it if it works. |
cfg-ed deps issue will be fixed by #666 |
666: Make loom dependency optional r=jonhoo a=taiki-e The loom dependency will never compile unless users enable cfg, but the way cargo and crates.io handle cfg-ed dependencies is not very good and confuses users. This issue seems to work around by the way proposed by @matklad in #487 (comment). So this PR uses that workaround. Closes #665 r? @jeehoonkang @jonhoo Co-authored-by: Taiki Endo <te316e89@gmail.com>
This patch only adds support to parts of
utils
and toepoch
. Someparts of
utils
had to be left out, since they rely onAtomicUsize::new
beingconst
(which it is not inloom
). Otherparts had to be left out due to the lack of
thread::Thread
inloom
.All the parts needed for
epoch
were successfully moved to loom.The one loom test currently passes! I've added a loom pass on
crossbeam-epoch to CI.
Also, note that the uses of
UnsafeCell
inutils
have not been movedto
loom::cell::UnsafeCell
, as loom'sUnsafeCell
does not supportT: ?Sized
, whichAtomicCell
depends on.Fixes #486.