Confusing "cannot use `AtomicOrdering::SeqCst` on Vulkan memory model"
まだ誰も着手していません。
評価
調査の方向性
まず crates/farmer/ab-proof-of-space-gpu/src/shader/find_matches_in_buckets.rs の 109 行目付近にある AtomicU32 fetch_add 呼び出しから始め、報告された SeqCst 診断と spirv_std::arch::atomic_i_add() を調査してください。Vulkan のアトミック順序がどのように処理されているか、また AtomicU32 のサポートに対応できるかどうかを判断してください。報告されたユースケースがコンパイルできるか、エラーがサポートされているアトミック操作へユーザーを明確に案内すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I'm getting the following error when trying to use AtomicU32:
error: cannot use `AtomicOrdering::SeqCst` on Vulkan memory model (check if `AcqRel` fits your needs)
--> /home/nazar-pc/.rustup/toolchains/nightly-2025-06-23-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/sync/atomic.rs:3984:23
|
3984 | SeqCst => intrinsics::atomic_xadd::<T, { AO::SeqCst }>(dst, val),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: used from within `core::sync::atomic::atomic_add::<u32>`
--> /home/nazar-pc/.rustup/toolchains/nightly-2025-06-23-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/sync/atomic.rs:3984:23
|
3984 | SeqCst => intrinsics::atomic_xadd::<T, { AO::SeqCst }>(dst, val),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: called by `<core::sync::atomic::AtomicU32>::fetch_add`
--> /home/nazar-pc/.rustup/toolchains/nightly-2025-06-23-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/sync/atomic.rs:3748:1
|
3748 | / atomic_int! {
3749 | | cfg(target_has_atomic = "32"),
3750 | | cfg(target_has_atomic_equal_alignment = "32"),
3751 | | stable(feature = "integer_atomics_stable", since = "1.34.0"),
... |
3764 | | u32 AtomicU32
3765 | | }
| |_^
note: called by `ab_proof_of_space_gpu::shader::find_matches_in_buckets::log_message`
--> crates/farmer/ab-proof-of-space-gpu/src/shader/find_matches_in_buckets.rs:109:34
|
109 | let write_at = debug_counter.fetch_add(message_length, Ordering::Relaxed);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The confusing part is that I'm not using SeqCst. Looks like the code that references SeqCst is technically compiled in and causes issues even though it is practically unreachable.
Would have been nice for it to compile successfully.
After above failure I tried spirv_std::arch::atomic_i_add(), which did work, but it has a bit strange syntax due to the need to provide not just ordering semantics, but also scope and it doesn't work on AtomicU32, only on u32. It is also unsafe for some reason.
Ultimately I think the error should say to use spirv_std::arch::atomic_i_add() (because I don't think hiding/guessing scope is a great idea) and spirv_std::arch::atomic_i_add() should support Atomic32, which has the same memory layout as regular u32.
- 主要言語
- Rust
- スター
- 3.4k
- フォーク
- 126
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Rust-GPU/rust-gpu のほかの issue
-
enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
-
bug
-
enhancement
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
Rust-GPU/rust-gpu の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
state:needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
zed-industries/zed#64680 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
RustPython/RustPython#8802 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
TheLarkInn/aipm#2390 ·