Rust-GPU / Rust-GPU/rust-gpu

SPIR-V codegen complains about capabilities despite understanding them properly

オープン
#324 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Rust
スター
3.4k
フォーク
126
PR マージ指標
30日以内にマージされた PR はありません

説明

I was trying to do this:

#[cfg(all(target_arch = "spirv", not(target_feature = "Int64")))]

And despite I see similar code in spirv-std, I'm getting a warning:

  warning: unexpected `cfg` condition value: `Int64`
    --> ../src/shader.rs:13:15
     |
  13 | #[cfg(all(target_arch = "spirv", not(target_feature = "Int64")))]
     |                                      ^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: expected values for `target_feature` are: `10e60`, `2e3`, `3e3r1`, `3e3r2`, `3e3r3`, `3e7`, `7e10`, `a`, `aclass`, `adx`, `aes`, `altivec`, `alu32`, `amx-bf16`, `amx-complex`, `amx-fp16`, `amx-int8`, `amx-tile`, `atomics`, `avx`, `avx2`, `avx512bf16`, `avx512bitalg`, `avx512bw`, `avx512cd`, `avx512dq`, `avx512f`, `avx512fp16`, `avx512ifma`, `avx512vbmi`, `avx512vbmi2`, `avx512vl`, `avx512vnni`, `avx512vp2intersect`, and `avx512vpopcntdq` and 251 more
     = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
     = note: `#[warn(unexpected_cfgs)]` on by default

I did some more testing. SPIR-V codegen backend actually understands both target_arch = "spirv" and target_feature = "Int64", here is a simple test case:

#[cfg(all(target_arch = "spirv", target_feature = "Int64"))]
compile_error!("Hello");

Yet it only generates a warning for target_feature = "Int64" and not target_arch = "spirv".

Regular rustc, obviously, complains about either unless unexpected_cfgs is used to suppress the warning. I don't think this is supposed to happen, both should be accepted without warnings by SPIR-V codegen.

Originally posted by @nazar-pc in https://github.com/Rust-GPU/rust-gpu/discussions/304

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

issue の cfg の例で警告を再現し、SPIR-V コード生成バックエンドによる target_arch と target_feature の処理を調査します。受け入れられる設定値を unexpected_cfgs チェックと比較します。spirv と Int64 の両方が警告なしでコンパイルされ、同時に実証された compile_error の動作が引き続き機能すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust
領域
compilers
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。