Aliasing-motivated concurrency optimizations
まだ誰も着手していません。
評価
調査の方向性
Start with the test0-test4 examples in the issue, then read the linked LLVM, C++, and concurrency references to understand the aliasing and ordering claims. Done would require a project-level decision about whether these executions should be allowed or forbidden; the payload names no repository files or runnable tests.
索引モデルが issue の本文から書いたものです。
説明
The following tests capture some of the interactions between aliasing and concurrency.
While the optimizations below may introduce a data-race, any such execution is undefined due to aliasing violations: they'd need to access memory through a reference that's not derived from the &mut.
I don't see any immediate harm in these being allowed, but I found these being allowed by Rust and LLVM-IR interesting, to say the least.
The comments capture what I believe is the "status-quo", everyone should decide for themselves whether they think those executions should be allowed or forbidden:
pub fn test0(b: &mut u32){
loop {
let a = AtomicU32::from_mut(b);
if a.load(Ordering::Relaxed) != 0 { // may be downgraded to non-atomic access
break;
}
}
*b = 42;
}
pub fn test1(b: &mut u32) -> u32 {
let x = *b;
fence(Ordering::Release); // may be re-ordered above load; analogous for store-release
x
}
pub fn test2(b: &mut u32) {
*b = 42;
fence(Ordering::Release); // may be re-ordered above store; analogous for store-release
}
pub fn test3(b: &mut u32) {
fence(Ordering::Acquire); // analogous for load-acquire
*b = 42; // may be re-ordered above fence
}
pub fn test4(b: &mut u32) -> u32 {
fence(Ordering::Acquire); // analogous for load-acquire
*b // may be re-ordered above fence
}
The examples above are very simple and don't involve allocation APIs.
The following references include many other examples, some of which may be interesting to adapt to Rust.
Particularly interesting are those involving concurrency and "lifetime start"/"end" (memory being allocated/deallocated).
- Sung-Hwan Lee reported: https://github.com/llvm/llvm-project/issues/64188
- Hans Boehm: memory_order_relaxed and optimizations
- David Goldblatt: P3292
- Stephen Dolan: https://www.youtube.com/watch?v=cILLfXBBITg
- 主要言語
- 言語のデータがありません
- スター
- 760
- フォーク
- 68
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rust-lang/unsafe-code-guidelines のほかの issue
-
I-opsem-nominated
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
rust-lang/unsafe-code-guidelines#634 · コメント 5 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 12/100
rust-lang/unsafe-code-guidelines#632 · コメント 8 件 · リアクション 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
rust-lang/unsafe-code-guidelines#631 · コメント 7 件 ·
-
I-opsem-nominated
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
rust-lang/unsafe-code-guidelines#630 · リアクション 1 件 ·
rust-lang/unsafe-code-guidelines の issue をすべて見る
似ている issue
-
bug core-lang
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Call-argument syntax diagnostic needs example spacing and removal of confusing trailing sentenceオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
mw00/project-maya#1368 ·
メンテナーはふだん 2 日以内に返信
-
test(bind-json): legacy Solidity fixture requires an unavailable solc on Linux ARM64対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
foundry-rs/foundry#18828 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信