Rust-GPU / Rust-GPU/rust-gpu

SPIR-V codegen complains about capabilities despite understanding them properly

Offen
#324 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Rust
Sterne
3.4k
Forks
125
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere die Warnung mit den cfg-Beispielen des Issues und untersuche, wie das SPIR-V-Codegen-Backend target_arch und target_feature behandelt. Vergleiche seine akzeptierten Konfigurationswerte mit der unexpected_cfgs-Prüfung; abgeschlossen ist die Aufgabe, wenn sowohl spirv als auch Int64 ohne Warnungen kompiliert werden, während das demonstrierte compile_error-Verhalten weiterhin funktioniert.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust
Bereich
compilers
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.