Skip to content

SPIR-V codegen complains about capabilities despite understanding them properly #324

Open
@nazar-pc

Description

@nazar-pc

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 #304

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions