Commit Graph

658 Commits

Author SHA1 Message Date
Wooyoung Kim
9bd44d028e
Suppot for SPV_QCOM_image_processing2 (#5582) 2024-02-28 16:26:28 -05:00
alan-baker
fbc7a14b3e
Fix access chain struct checks (#5592)
* Fix access chain struct checks

Fixes https://crbug.com/oss-fuzz/66948

* Negative indices are invalid for struct access
* Fix typos

* formatting
2024-02-27 15:54:08 -05:00
Spencer Fricke
1b643eac5d
spirv-val: Make Constant evaluation consistent (#5587)
Bring 64-bit evaluation in line with 32-bit evaluation.
2024-02-21 17:52:13 -05:00
Jeff Bolz
b0a5c4ac12
SPV_NV_shader_atomic_fp16_vector (#5581) 2024-02-14 15:58:12 -05:00
Spencer Fricke
f9184c6501
spirv-val: Revert Validate PhysicalStorageBuffer Stage Interface (#5575) 2024-02-13 21:24:20 -05:00
Spencer Fricke
20ad38c18d
spirv-val: Multiple interface var with same SC (#5528) 2024-02-13 15:55:43 -05:00
Spencer Fricke
784b064f90
spirv-val: Validate PhysicalStorageBuffer Stage Interface (#5539)
Disallow PhysicalStorageBuffer pointers in Input and Output storage classes.
2024-02-12 09:51:38 -05:00
Spencer Fricke
61c51d4baf
spirv-val: Add Mesh Primitive Built-In validaiton (#5529) 2024-02-01 14:20:42 -05:00
ruiminzhao
b951948eaa
SPV_KHR_quad_control (#5547)
* SPV_KHR_quad_control

1. Add two new execute modes: RequireFullQuadsKHR and QuadDerivativesKHR
2. Add two opCodes: OpGroupNonUniformQuadAllKHR and
   OpGroupNonUniformQuadAnyKHR
3. Add one Capability: QuadControlKHR

* update DEPS

* Fixes

* Build fixes
* Formatting fixes
* Test fixes

* formatting

---------

Co-authored-by: Alan Baker <alanbaker@google.com>
2024-01-26 15:49:56 -05:00
alan-baker
ef2f432364
Add support for SPV_KHR_float_controls2 (#5543)
* Test asm/dis for SPV_KHR_float_controls2
* SPV_KHR_float_controls2 validation

---------

Co-authored-by: David Neto <dneto@google.com>
2024-01-25 10:22:09 -05:00
alan-baker
de3d5acc04
Add tooling support for SPV_KHR_maximal_reconvergence (#5542)
* Validation for SPV_KHR_maximal_reconvergence
* Add pass to add/remove maximal reconvergence execution mode
---------

Co-authored-by: David Neto <dneto@google.com>
2024-01-25 09:39:49 -05:00
Spencer Fricke
c96fe8b943
spirv-val: Re-enable OpControlBarrier VU (#5527) 2024-01-17 11:18:23 -05:00
Sajjad Mirza
246e6d4c68
spirv-val: Loosen restriction on base type of DebugTypePointer and DebugTypeQualifier (#5479)
* Allow base type for DebugTypePointer and DebugTypeQualifier to be any DebugType
2023-11-17 10:22:46 -05:00
Spencer Fricke
c87755bb9f
spirv-val: Add WorkgroupMemoryExplicitLayoutKHR check for Block (#5461) 2023-11-01 10:48:40 -04:00
Nathan Gauër
47b63a4d7d
val: re-add ImageMSArray validation (#5394)
This has been removed in #4752, but not added since.

* fixup! val: re-add ImageMSArray validation

clang-format
2023-09-07 09:39:28 -04:00
Wooyoung Kim
89ca3aa571
SPV_QCOM_image_processing support (#5223) 2023-08-15 15:15:21 -04:00
David Neto
8e3da01b45
Move token version/cap/ext checks from parsing to validation (#5370)
A token is allowed to parse even when it's from the wrong
version, or is not enabled by a capability or extension.
This allows more modules to parse.

Version/capability/extension checking is fully moved to
validation instead.

Fixes: #5364
2023-08-10 12:19:12 -04:00
David Neto
09b76c23ea
Update SPIRV-Headers; test some coop matrix enums (#5361)
Test:
  MatrixASignedComponentsKHR
  MatrixBSignedComponentsKHR
  MatrixCSignedComponentsKHR
  ResultSignedComponentsKHR
2023-08-04 14:50:54 -04:00
alan-baker
0530a532fc
Validate GroupNonUniform instructions (#5296)
Fixes #5283

* Validate group non-uniform instructions
2023-07-11 08:40:40 -04:00
alan-baker
310a67020a
Validate layouts for PhysicalStorageBuffer pointers (#5291)
* Validate layouts for PhysicalStorageBuffer pointers

Fixes #5282

* These pointers may not orginate from a variable so standard layout
  validation misses them
* Now checks every instructions that results in a physical storage
  buffer pointer
  * May not start from a Block-decorated struct so that part is fudged
    with a valid layout

* formatting
2023-06-23 19:17:55 +00:00
archimedus
04cdb2d344
SPV_KHR_cooperative_matrix (#5286)
* SPV_KHR_cooperative_matrix

* Update DEPS with headers

* Update according to review recommendations

* Bugfix and formatting

* Formatting missed or damaged by VS2022
2023-06-22 18:33:36 -04:00
alan-baker
59b4febd81
Allow OpTypeBool in UniformConstant (#5237)
See https://github.com/KhronosGroup/SPIRV-Registry/issues/72

* OpenGL allowed uniforms to be declared with boolean types, but the
  validator was overly strict in disallowing it
2023-06-06 18:05:04 -04:00
alan-baker
182fd9ebce
Allow physical storage buffer pointer in IO (#5251)
Follow up to #5249

* glslang tests that physical storage buffer pointers can be used as
  varyings in shaders
  * Allow physical storage buffer pointers in IO interfaces as a 64-bit
    type
2023-05-30 20:07:58 -04:00
alan-baker
cf62673e42
Error for invalid location type (#5249)
Fixes https://crbug.com/oss-fuzz/56754

* When checking locations, produce an error if the type cannot be
  assigned a location
2023-05-30 09:08:09 -04:00
Spencer Fricke
23cb9b96cc
spirv-val: Remove VUID from 1.3.251 spec (#5244) 2023-05-29 09:20:07 -04:00
Spencer Fricke
7c39951f6e
spirv-val: Label Interface Location/Component VUIDs (#5221) 2023-05-15 09:53:37 -04:00
janharaldfredriksen-arm
6f276e05cc
Add support for SPV_EXT_shader_tile_image (#5188)
* Update DEPS file to pull in header changes for SPV_EXT_shader_tile_image
2023-04-13 16:58:00 -04:00
James Price
1877a7f909
Fix vector OpConstantComposite type validation (#5191)
The constituent types much fully match, not just the opcode.
2023-04-13 12:50:16 -04:00
Spencer Fricke
d8a8af8e6d
spirv-val: Remove unused includes and code (#5176) 2023-03-28 14:18:19 -04:00
Spencer Fricke
8e6563b913
spirv-val: Label new Vulkan VUID 07951 (#5154) 2023-03-18 01:01:50 +00:00
Caio Oliveira
0ce2bc4ce0
spirv-val: Conditional Branch without an exit is invalid in loop header (#5069)
* Update fuzz tests to not use invalid combinations of LoopMerge + BranchConditional

New IDs were selected to make clear the transformation being done here, instead
of reordering all IDs in between or refactoring the SPIR-V in the test.

* spirv-val: Conditional Branch without an exit is invalid in loop header

From 2.16.2, for CFG:

    Selections must be structured. That is, an OpSelectionMerge
    instruction is required to precede:

    - an OpSwitch instruction

    - an OpBranchConditional instruction that has different True Label
      and False Label operands where neither are declared merge blocks
      or Continue Targets.
2023-02-06 10:31:47 -05:00
Maciej
fd1e650cfe
Validate decoration of structs with RuntimeArray (#5094)
Contributes to https://github.com/KhronosGroup/glslang/issues/2439

* When OpTypeStruct is used in Vulkan env and its last member
  is a RuntimeArray, check if the struct is decorated with
  Block or BufferBlock, as required by VUID-...-04680.
2023-02-03 08:58:51 -05:00
alan-baker
b230a7c7d1
Validate operand type before operating on it (#5092)
Fixes https://crbug.com/oss-fuzz/52921

* Validate the data operand of OpBitCount before trying to get its
  dimension
2023-01-31 15:40:22 -05:00
Steven Perron
5db6c38e65
Revert "spirv-val: Initial SPV_EXT_mesh_shader builtins (#5080)" (#5084)
This reverts commit f0b900ed9a.
2023-01-24 19:51:39 +00:00
Spencer Fricke
f0b900ed9a
spirv-val: Initial SPV_EXT_mesh_shader builtins (#5080) 2023-01-23 14:30:45 +00:00
alan-baker
7e8813bb4c
Validate version 5 of clspv reflection (#5050)
* Validate version 5 of clspv reflection

* Add validation for instructions in versions 2 through 5
* Change the instruction reported for remaining indices on an access
  chain to the access chain itself for clarity

* update spirv-headers
2023-01-11 16:58:53 -05:00
Caio Oliveira
f62e121b0d
spirv-val: Use more specific term 'switch header' in error message (#5048)
* spirv-val: Add tests for OpSwitch directly breaking/continuing outer loop

These are not valid, tests verify the validator catches the issue.
2023-01-09 18:39:02 -05:00
alan-baker
5a78d798f7
Fix layout validation (#5015)
* Fix layout validation

Fixes #5010

* Unless scalar block layout is enabled, no member can reside at an
  offset between the end of the previous member that is a struct or
  array and the next multiple of that alignment

* Remove a dead if that was introduced

Co-authored-by: David Neto <dneto@google.com>
2022-12-15 21:38:09 -05:00
Pankaj Mistry
6b2318aec8
Fix for bug https://github.com/KhronosGroup/SPIRV-Tools/issues/5017 (#5019)
open_quote value becomes npos when it fails to find '\'' and then is used to
compute the string length for writing to result. This causes crash in win32 builds of the test.
2022-12-15 21:13:12 -05:00
alan-baker
9c6a925c87
Fix infinite loop in validator (#5006)
Fixes https://crbug.com/oss-fuzz/53510

* Fix infinite loop that could occur in structured cfg validation due to
  an invalid cfg
2022-12-06 11:22:33 -05:00
Cassandra Beckley
40f5bf59c6
Revert "spirv-val: Multiple interface var with same SC (#4969)" (#5009)
This reverts commit 996d4c021f. This
commit is likely good, but it causes a failure in DXC tests. Will
un-revert once we fix the issue in DXC.
2022-12-05 12:31:01 -08:00
alelenv
f33d152400
Add validation support for SPV_NV_shader_invocation_reorder. (#4979)
Co-authored-by: Pankaj Mistry <pmistry@nvidia.com>
2022-11-24 09:50:45 -05:00
Spencer Fricke
996d4c021f
spirv-val: Multiple interface var with same SC (#4969)
* spirv-val: Multiple interface var with same SC

* spirv-val: Use C style headers
2022-11-10 12:32:58 -05:00
Spencer Fricke
a5e766b2b4
spirv-val: Add VUID label for 07703 (#4980) 2022-11-06 19:05:25 -05:00
alan-baker
d35a78db57
Switch SPIRV-Tools to use spirv.hpp11 internally (#4981)
Fixes #4960

* Switches to using enum classes with an underlying type to avoid
  undefined behaviour
2022-11-04 17:27:10 -04:00
alan-baker
4563d90934
Only validate full layout in Vulkan environments (#4972)
Fixes #4671
Fixes https://crbug.com/oss-fuzz/43265

* Only validate full layout in a vulkan environment
  * Universal validation still checks that the right decorations are
    present, but the values are only considered for vulkan
* One exception is that invalid overlaps are only checked for vulkan
  * This is a pragmatic choice as SPIR-V doesn't define the size of
    types so the amount of universal checking would be quite limited
* Removed redundant check for GLSLShared and GLSLPacked decorations
  * Should never have been validated as part of universal validation

* make conditionals independent
2022-10-28 11:52:28 -04:00
Spencer Fricke
9f3a4afae4
spirv-val: Label new Vulkan OpPtrAccessChain VUs (#4975) 2022-10-27 10:10:27 -04:00
alan-baker
7326b967a5
Prevent null pointer from being dereferenced (#4971)
Fixes https://crbug.com/oss-fuzz/48553

* Assign a reflexive dominator if no other dominator can be found using
  forward traversals
  * This prevents a null dereference of a pointer in the sorting of the
    output
2022-10-24 15:16:33 -04:00
Spencer Fricke
0ebf830572
spirv-val: Add OpPtrAccessChain Base checks (#4965) 2022-10-24 12:45:08 -04:00
Spencer Fricke
eb113f0fdf
spirv-val: Improve PR 4831 error message (#4968) 2022-10-20 10:51:43 -04:00