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

Allow atomic operations on unshared memories #147

Merged
merged 2 commits into from
Jan 30, 2020

Conversation

tlively
Copy link
Member

@tlively tlively commented Dec 18, 2019

As discussed in the CG on November 12, 2019 and in #144. Specifically,
all atomic accesses are now allowed to validate and execute normally
on unshared memories and wait operations trap when used with unshared
memories.

The PR updates Overview.md and makes a best-effort
attempt at updating the spec, making no changes when there is
already a TODO for updating spec text. It also adds new TODO comments
to the reference interpreter where changes will have to be made.

As discussed in the CG on November 12, 2019 and in WebAssembly#144. Specifically,
all atomic accesses are now allowed to validate and execute normally
on unshared memories and wait operations trap when used with unshared
memories.

The PR updates Overview.md and makes a best-effort
attempt at updating the spec, making no changes when there is
already a TODO for updating spec text. It also adds new TODO comments
to the reference interpreter where changes will have to be made.
Copy link
Member

@rossberg rossberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, the changes look good to me, modulo comment. Personally, I'm fine with these semantics, but did the CG actually declare consensus on it? The Nov meeting was a bit inconclusive. Now that you re-clarified the options on the issue and everyone had enough time to dwell on it, it may be appropriate to bring it back to the CG to get official sign-off via a poll.

@@ -440,8 +440,6 @@ Atomic Memory Instructions

* Let :math:`\limits~\share` be the :ref:`memory type <syntax-memtype>` :math:`C.\CMEMS[0]`.

* The sharedness :math:`\share` must be |MSHARED|.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll also need to adjust the respective premise in the formal rule below to keep it in sync, e.g., by changing C.\CMEMS[0] = \limits~\MSHARED to C.\CMEMS[0] = \memtype (here and elsewhere).

@dtig dtig requested a review from binji January 7, 2020 18:24
Copy link
Member

@dtig dtig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From previous discussions, my conclusions were

  • Allowing plain atomic operations on non-shared memory was uncontroversial
  • There are still open questions about Atomics.wait semantics
  • It's unclear to me from the notes/discussions whether Atomics.notify always returning 0 was already agreed upon

The semantics as laid out in this PR lgtm, +1 to @rossberg's suggestion of adding explicit polls in an upcoming meeting.

@tlively
Copy link
Member Author

tlively commented Jan 7, 2020

Sounds good, I'll add a vote to the agenda for the next meeting 👍

tlively added a commit to WebAssembly/meetings that referenced this pull request Jan 7, 2020
dtig pushed a commit to WebAssembly/meetings that referenced this pull request Jan 7, 2020
@tlively
Copy link
Member Author

tlively commented Jan 23, 2020

@rossberg I just want to confirm that the latest changes are what you had in mind.

@tlively
Copy link
Member Author

tlively commented Jan 29, 2020

@rossberg ping!

@tlively
Copy link
Member Author

tlively commented Jan 30, 2020

I'll merge this now, but of course I am happy to fix any mistakes or holes in follow-up PRs.

@tlively tlively merged commit cbb6edc into WebAssembly:master Jan 30, 2020
Copy link
Member

@rossberg rossberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Sorry for the delay, I was out sick for a while.

pull bot pushed a commit to p-g-krish/v8 that referenced this pull request Jun 22, 2020
Adjust atomics.wait, atomics.notify semantics for when they are used
with non-shared Wasm memory to mirror the spec change introduced
in: WebAssembly/threads#147. This does not
need to be gated by the flag here, as this will only decode if
the flag is enabled.

Bug: v8:9921
Change-Id: I7f2e018fed6bd131ad4c386def1e838626c28a4d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2256863
Reviewed-by: Ben Smith <binji@chromium.org>
Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68468}
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

Successfully merging this pull request may close these issues.

None yet

4 participants