mesa/src/compiler/spirv
Alyssa Rosenzweig 92f553bcff
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
vtn: remove spurious texel buffer warning
The spec text here is:

   Image Type must be an OpTypeImage. It is the type of the image in the
   combined sampler and image type. It must not have a Dim of SubpassData.
   Additionally, starting with version 1.6, it must not have a Dim of Buffer.

For older SPIR-V versions, there is no analogous requirement. It is implicitly
valid to use a Dim of Buffer (even though it doesn't make much sense). Should
apps do it anyway? Probably not, but it doesn't matter and they do.
glslang considers this requirement relevant only for 1.6+:

   if (glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_6 &&
       texType.getSampler().isBuffer()) {
       // SamplerBuffer is not supported in spirv1.6 so
       // `samplerBuffer(textureBuffer, sampler)` is a no-op
       // and textureBuffer is the result going forward
       constructed = arguments[0];
   } else
       constructed = builder.createOp(spv::OpSampledImage, resultType(), arguments);

That means SPIR-V with an older declared version will warn even with a glslang
new enough to know about the 1.6 requirement. That includes a *lot* of SPIR-V's
built with the CTS.

I see no compelling reason to keep the warning for older than 1.6. Removing the
spurious warning silences a *huge* amount of noise from dEQP-VK (plus a bit from
KHR-GL46). In exchange I see very little tradeoff, it's not really our job to
lint for best practices not in the spec.

I see two viable options:

1. Try to convince the whole ecosystem outside of Mesa to pivot to our pedantic
   reading of the spec and get them to update all the old SPIR-V binaries in the
   wild, in the case of CTS being changed at the glslang level and then
   trickling down into CTS.
2. Merge this patch, simplifying Mesa and immediately forget about this forever.

I'm spending all my FOSS political capital on kernel upstreaming so I have a
strong preference for #2, aka hitting Marge on this MR and then moving on with
all of our lives.

("Ignore the problem and make deqp-runner annoying to use" is the secret 3rd
option I'd rather not do.)

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34847>
2025-05-07 22:26:02 +00:00
..
tests spirv: Emit code for NonSemantic.DebugPrintf if supported 2025-04-10 19:31:37 +00:00
gl_spirv.c mesa: Use the new spirv_capabilities struct 2024-05-09 01:14:22 +00:00
GLSL.ext.AMD.h spirv: Update headers and grammer JSON 2023-08-18 16:57:22 +00:00
GLSL.std.450.h spirv: Update the JSON and headers 2024-05-09 01:14:22 +00:00
meson.build spirv/tests: add a test for force_ssbo_non_uniform 2025-03-05 19:56:50 +00:00
nir_spirv.h spirv: move workarounds to an inner struct in spirv_to_nir_options 2025-03-05 19:56:50 +00:00
NonSemanticShaderDebugInfo100.h spirv: Handle NonSemantic.Shader.DebugInfo.100 2025-01-30 20:14:01 +00:00
OpenCL.std.h spirv: Update the JSON and headers 2024-05-09 01:14:22 +00:00
spir-v.xml spirv: Update headers and metadata from latest Khronos commit 2025-03-25 02:29:26 +00:00
spirv.core.grammar.json spirv: Update the JSON and headers 2025-05-05 15:02:19 +00:00
spirv.h spirv: Update the JSON and headers 2025-05-05 15:02:19 +00:00
spirv2nir.c spirv: Get rid of the old caps struct 2024-05-09 01:14:23 +00:00
spirv_info_gen.py spirv: Update SPIR-V grammar to use aliases 2024-10-10 02:48:00 +00:00
spirv_to_nir.c vtn: remove spurious texel buffer warning 2025-05-07 22:26:02 +00:00
vtn_alu.c spirv: Use bfdot for SpvOpDot with BFloat16 2025-04-29 16:29:37 +00:00
vtn_amd.c nir: Drop nir_dest 2023-08-14 21:22:53 +00:00
vtn_bindgen2.c vtn_bindgen2: Fix memory corruption 2025-03-03 17:25:58 +00:00
vtn_cfg.c spirv: fix cooperative matrix by value function params 2025-04-07 07:53:44 +00:00
vtn_cmat.c spirv: Refactor to use glsl_type to pick ALU ops 2025-04-29 16:29:37 +00:00
vtn_debug.c vtn: Add a debug flag to dump SPIR-V assembly 2024-08-28 21:52:59 +00:00
vtn_gather_types_c.py spirv: OpAsmTargetINTEL is untyped 2025-03-08 19:54:19 +00:00
vtn_generator_ids_h.py util,vulkan,mesa,compiler: Generate source files with utf8 encoding from mako template 2023-12-07 12:41:07 +00:00
vtn_glsl450.c spirv: clamp/sign-extend non 32bit ldexp exponents 2025-04-03 12:35:59 +00:00
vtn_opencl.c nir: Turn the format string index into a const index 2025-04-10 19:31:37 +00:00
vtn_private.h spirv: Refactor to use glsl_type to pick ALU ops 2025-04-29 16:29:37 +00:00
vtn_structured_cfg.c spirv: move workarounds to an inner struct in spirv_to_nir_options 2025-03-05 19:56:50 +00:00
vtn_subgroup.c nir: remove rotate scope 2024-03-05 14:12:21 +00:00
vtn_variables.c compiler/types: add a bfloat16 type 2025-04-29 16:29:36 +00:00