Stream: cranelift

Topic: Atomic ordering


view this post on Zulip Yorick Peterse (Dec 22 2023 at 15:03):

Cranelift's documentation states that the various atomic operations it has are sequentially consistent. Is there a way to use e.g. relaxed ordering instead?

view this post on Zulip Yorick Peterse (Dec 22 2023 at 15:12):

https://github.com/bytecodealliance/wasmtime/blob/b583c54fda13b53dea362861125dd1e2ced1381d/cranelift/codegen/src/isa/x64/lower.isle#L3213-L3223 suggests that on x86-64 it's at least a regular MOV, but it would be nice to have precise control over that; unless Cranelift always uses the equivalent of acquire/release

view this post on Zulip David Lloyd (Dec 22 2023 at 15:24):

this is part of the wasm threads specification unfortunately; it would be nice if wasm had support for some or all of the modes used by modern memory models (montonic/opaque/relaxed, acquire, release, sequentiually-consistent)

view this post on Zulip David Lloyd (Dec 22 2023 at 15:24):

right now it's just plain or full-blown sequential consistency

view this post on Zulip David Lloyd (Dec 22 2023 at 15:25):

and, of course none of these modes at all can interoperate with the host GC specification...

view this post on Zulip Yorick Peterse (Dec 22 2023 at 15:25):

Yikes :confused:

view this post on Zulip Yorick Peterse (Dec 22 2023 at 16:16):

I created https://github.com/bytecodealliance/wasmtime/issues/7722 to further discuss this :smile:

Feature Cranelift has instructions for atomic operations such as atomic_load and atomic_store. These instructions don't give control over the ordering guarantees of the atomic operations. Instead, ...

Last updated: Oct 23 2024 at 20:03 UTC