Rust-GPU / Rust-GPU/rust-gpu

SPIR-V codegen complains about capabilities despite understanding them properly

Aperta
#324 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Rust
Stelle
3.4k
Fork
126
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riproduci l’avviso con gli esempi di cfg dell’issue e ispeziona la gestione di target_arch e target_feature da parte del backend di generazione del codice SPIR-V. Confronta i valori di configurazione accettati con il controllo unexpected_cfgs; il lavoro è completato quando sia spirv sia Int64 vengono compilati senza avvisi, mentre il comportamento dimostrato di compile_error continua a funzionare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust
Ambito
compilers
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.