Commit Graph

422 Commits

Author SHA1 Message Date
sfricke-samsung
3b85234542
spirv-val: Add last TessLevelOuter and TessLevelInner VUID (#4055) 2020-12-08 14:38:55 -05:00
sfricke-samsung
171290703a
spirv-val: Add last ClipDistance and CullDistance VUID (#4054) 2020-12-08 14:37:24 -05:00
sfricke-samsung
1a6b4053fa
spirv-val: Add last ViewportIndex and Layer VUID (#4053) 2020-12-08 14:34:51 -05:00
sfricke-samsung
9df5225e67
spirv-val: Add last Position VUID (#4052) 2020-12-08 14:31:40 -05:00
alan-baker
862d44a86e
Allow forward pointer to be used in types generally (#4044)
Fixes #4042

* Allow types to have forward declarations as long as that declaration
  is an OpTypeForwardPointer
2020-12-08 08:46:47 -05:00
Daniel Koch
32573bb216
Add validation support for the ray tracing built-in variables (#4041)
* Add validation for ray tracing builtins

- Remove existing InstanceId testing that was combined with VertexId in awkward ways.
- Rather than adding a new set of functions for each ray tracing builtin, add
  an error table that maps the builtin ID to the 3 common VUIDs for each builtin
  (I could see this being extended for other builtins in the future).
- add F32 matrix validation function
- augment existing PrimitiveId validation to verify Input storage class for the
  RT stages this is accepted in, and correct the list of stages that it is actually
  accepted in (only Intersection / Any Hit / Closest Hit)

* add testing for ray tracing builtins

- remove exising InstanceId testing as it was tangled in with VertexId in now weird ways
  and combine it with the new tests
- add testing for ray tracing builtins
- builtins accepted in the same stages and of the same types are combined into test functions
- add some new matrix types to the code generator so they can be used for testing
2020-12-01 11:42:37 -05:00
Alastair Donaldson
1299436c8f
Reject SPIR-V that applies void to OpUndef, OpCopyObject, OpPhi (#4036)
Fixes #4035.
2020-11-27 16:31:04 +00:00
David Neto
cd590fa334
Update MeshShadingNV dependencies (and land Ray tracing updates) (#4028)
* Update to final ray tracing extensions

Drop Provisional from ray tracing enums
    sed -ie 's/RayQueryProvisionalKHR/RayQueryKHR/g' **/*
    sed -ie 's/RayTracingProvisionalKHR/RayTracingKHR/g' **/*
Add terminator support for SpvOpIgnoreIntersectionKHR and SpvOpTerminateRayKHR
Update deps for SPIRV-Headers

* Update capability dependencies for MeshShadingNV

Accommodate https://github.com/KhronosGroup/SPIRV-Headers/pull/180

MeshShadingNV: enables PrimitiveId, Layer, and ViewportIndex

Co-authored-by: Daniel Koch <dkoch@nvidia.com>
2020-11-23 12:23:54 -05:00
David Neto
1cda495274
Use less stack space when validating Vulkan builtins (#4019)
Don't pass a constructed string as an argument to
ValidateNotCalledwithExecutionModel. That method is captured via
std::bind and it ends up using lots of stack space.
Instead, pass in:
- a Vulkan validation unique ID as an integer instead,
  (with -1 meaning no VUID), and
- the const char* for the explanator text.
2020-11-11 13:29:28 -05:00
sfricke-samsung
a61d07a727
spirv-val: Fix SPV_KHR_fragment_shading_rate VUID label (#4014)
in 3943 the new tests should have failed, but didn't due to the AnyVUID
check not handling case with trailing whitespace. Added trimming to handle
it as easily might happen again in future
2020-11-05 13:04:47 -05:00
sfricke-samsung
650acb575b
spirv-val: Label Layer and ViewportIndex VUIDs (#4013) 2020-11-05 13:04:07 -05:00
Sidney Just
5edb328e81
spirv-val: Allow the ViewportIndex and Layer built-ins on SPIR-V 1.5 (#3986)
* spirv-val: Allow the ViewportIndex and Layer built-ins when their corresponding SPIR-V 1.5 capabilities are present
* Added tests for OpCapability ShaderViewportIndex and OpCapability ShaderLayer
2020-10-28 14:05:06 -04:00
Tobski
ebe0ea09f0
Add SPV_EXT_shader_image_int64 (#3852)
* Add SPV_EXT_shader_image_atomic_int64
* Added 64-bit image tests


Co-authored-by: Arkadiusz Sarwa <arkadiusz.sarwa@amd.com>
2020-10-20 11:55:26 -04:00
Tobski
a1d38174b1
Support SPV_KHR_fragment_shading_rate (#3943) 2020-10-20 08:00:13 -04:00
Alastair Donaldson
6fac705e76
spirv-val: Fix validation of OpPhi instructions (#3919)
Fixes #3918.
2020-10-19 17:36:21 +01:00
dan sinclair
11d5924227
Update val to handle reversed instruction sections. (#3887)
Currently the validator, when checking an instruction is in the correct
section, always advances the current section. This means if we have an
instruction from a previous section we'll end up reporting it as invalid
in a function definition. This error is confusing.

This CL updates the validator to check if the given opcode is from a
previous layout section before advancing the current section. If it is
from a previous layout section an error is emitted.
2020-10-08 13:10:12 -04:00
Maksim Ivanov
446adb05ff
Fix use-after-move in val/validate.cpp (#3848)
Fix a use-after-move (potential) bug found by the
"bugprone-use-after-move" clang-tidy check.

This is part of a Chromium-related effort (see
https://crbug.com/1122844).
2020-09-28 10:49:24 -04:00
sfricke-samsung
937a757f04
spirv-val: Add DeviceIndex (#3812) 2020-09-17 08:27:40 -04:00
sfricke-samsung
5df9300549
spirv-val: Add BaseInstance, BaseVertex, DrawIndex, and ViewIndex (#3782)
* spirv-val: Add BaseInstance and BaseVertex

* spirv-val: Add DrawIndex

* spirv-val: Add ViewIndex
2020-09-14 10:23:44 -04:00
sfricke-samsung
2c60d16a64
spirv-val: Add Vulkan VUID labels to BuiltIn (#3756)
The Vulkan 1.2.152 headers/spec now include Valid Usage IDs (VUID)
for every BuiltIn. This change adds labeling to help aid tracking
the coverage gap in Vulkan targeted validation. This is done with
a script in the Validation Layers that parses the source for VUID
strings, both that there is an implementation and a test for it.

There are 2 main changes:

1. A VUID string is added where applicable. It is wrapped in a function
that at runtimes checks if Vulkan is the target so that other targets
will not be effected as the output error only changes for Vulkan and
the overhead only occurs if there is an error at all.

2. For unit test, a new parameter value was added to allow make sure
that for each VUID there is a matching test. There are cases where the
same unit test checks multiple VUs via the parameter feature of gtest.
For this, I added a custom gMock Matcher to simply loop over a list
of VUID strings
2020-09-02 14:02:13 -04:00
Jaebaek Seo
b8de4f57e9
Allow DebugTypeTemplate for Type operand (#3702)
Some OpenCL.DebugInfo.100 instructions such as DebugGlobalVariable
and DebugLocalVariable have the Type operand. This commit allows them to
use DebugTypeTemplate for the Type operand.
2020-08-16 23:42:59 -04:00
Jaebaek Seo
0d629b903a
Validate more OpenCL.DebugInfo.100 instructions (#3684)
- DebugTypeTemplate
- DebugTypeTemplateParameter
- DebugGlobalVariable
- DebugInlinedAt
- DebugValue
2020-08-12 09:37:32 -04:00
alan-baker
13a65b1aee
Only validation locations for appropriate execution models (#3656)
Fixes #3653

* Only validate locations for fragment, vertex, geometry and
  tessellation shaders
2020-08-11 18:51:49 -04:00
Jaebaek Seo
5fd92a7e0c
OpenCL.DebugInfo.100 DebugTypeArray with variable size (#3549)
The updated OpenCL.DebugInfo.100 spec says that we can use
variable for "Component Count" operand of DebugTypeArray i.e.,
DebugLocalVariable or DebugGlobalVariable. This commit updates spirv-val
based on the spec update.
2020-08-05 17:08:37 -04:00
alan-baker
50300450af
Validator support for non-semantic clspv reflection (#3618)
* Generate ext inst table for reflection
* Change build to use grammar files from SPIRV-Headers instead of
  SPIRV-Tools
* Add enum for clspv reflection extended instruction set
  * count it as non-semantic
* validate clspv reflection extended instruction set
* Remove local extended inst sets
* update headers deps
* Update nbuilds to use grammars from SPIRV-Headers instead of
  local duplicates
2020-07-30 12:08:53 -04:00
dan sinclair
a1ea15c902
Update some language usage. (#3611)
This CL updates various bits of language in line with the guidelines
provided by Android
(https://source.android.com/setup/contribute/respectful-code)
2020-07-29 13:50:58 -04:00
Pierre Moreau
2796840d20
Update OpenCL capabilities validation (#3149)
* spirv-val: Pipes are no longer required for OpenCL 1.2 EP

This was removed from the OpenCL SPIR-V Environment Specification via
https://github.com/KhronosGroup/OpenCL-Docs/pull/56.

* spirv-val: Sort headers according to clang-format

* spirv-val: Groups capability is required since OpenCL 2.0
2020-07-27 13:01:45 -04:00
alan-baker
f3cec93665
Support SPV_KHR_terminate_invocation (#3568)
Covers:
- assembler
- disassembler
- validator
- optimizer

Co-authored-by: David Neto <dneto@google.com>
2020-07-22 11:45:02 -04:00
vkushwaha-nv
e4aebf99fa
Add changes for SPV_EXT_shader_atomic_float (#3562) 2020-07-21 10:31:05 -04:00
alan-baker
717e7877ca
Store location values sparsely (#3488)
Fixes http://crbug.com/1102149

* Switch from boolean vectors to unordered sets for location storage
2020-07-17 12:25:39 -04:00
David Neto
d5766f2801
Permit Simple and GLSL450 memory model in WEBGPU_0 (#3463)
Now that WebGPU ingests WGSL instead of SPIR-V,
there is no need to be so strict about the memory model.

Allow any memory model that is already allowed by Vulkan 1.0,
either directly or via an existing.
2020-07-17 12:23:11 -04:00
alan-baker
7221ccf85e
Fix reachability in the validator (#3541)
Fixes #3529

* Make BasicBlock::reachable() only consider static reachability
* Fix reachability calculation to be independent of block order
* add tests
2020-07-15 21:27:03 -04:00
alan-baker
a1fb255a2a
Validate location assignments (#3308)
* Add validation that input/output locations are assigned correctly
* Account for component assignment
* Account for 4 components per location and track the combined
coordinate
* Account for multiple output indexes
* handle specifically arrayed variables
* Arrayed variables that specify a component get locations determined
per index of the array for the sub type
  * Added tests that check locations and components can be assigned
  to interleave an array's locations and components
* Fix up which interfaces are allowed to be arrayed for various shader
stages based on glslang
2020-06-25 13:22:45 -04:00
Jaebaek Seo
9cb2571a18
spirv-val: allow DebugInfoNone for DebugTypeComposite.Size (#3374) 2020-05-25 10:02:39 -04:00
Ricardo Garcia
4386ef4234
Add validation support for ImageGatherBiasLodAMD (#3363)
ImageGatherBiasLodAMD makes it possible to use the Bias and Lod image
operands with OpImageGather and OpImageSparseGather. This commit makes
sure the validator checks for that capability before reporting errors
and adds a few positive tests.
2020-05-25 09:41:34 -04:00
Anastasia Stulova
b0264b87ff
Fix validation failure on OpDecorationGroup (#3365) 2020-05-21 13:15:41 -04:00
Jeff Bolz
d2b4862194
Validate ShaderCallKHR memory scope (#3332) 2020-05-05 13:08:28 -04:00
alan-baker
2a2bdbd5d7
Remove implicit fallthrough (#3298)
Fixes #3296

* Make OpReturn its own case fully
2020-04-14 12:57:48 -04:00
Caio Marcelo de Oliveira Filho
c37c94929b
Validate Buffer and BufferBlock apply only to struct types (#3259) 2020-03-31 10:06:29 -04:00
alan-baker
1346dd5de1
Disallow phis of images, samplers and sampled images (#3246)
* Disallow phis of sampled images always
* Disallow phis of samplers and images for shaders
* Add tests
* Gate check to only occur post-legalization
2020-03-23 16:59:37 -04:00
Daniel Koch
5a97e3a391
Add support for KHR_ray_{query,tracing} extensions (#3235)
Update validator for SPV_KHR_ray_tracing.

* Added handling for new enum types
* Add SpvScopeShaderCallKHR as a valid scope
* update spirv-headers

Co-authored-by: alelenv <alele@nvidia.com>
Co-authored-by: Torosdagli <ntorosda@amd.com>
Co-authored-by: Tobias Hector <tobias.hector@amd.com>
Co-authored-by: Steven Perron <stevenperron@google.com>
2020-03-17 15:30:19 -04:00
Jeff Bolz
dd3d91691f
Allow sampledimage types as operand of OpCopyObject (#3222) 2020-03-09 15:03:39 -04:00
Ryan Harrison
661e79eec8
Adding WebGPU specific Workgroup scope rule (#3204)
Fixes #3075
2020-02-28 16:42:49 -05:00
Jaebaek Seo
70f888131e
Add validation rules for OpenCL.DebugInfo.100 extension (#3133)
Add validation rules for DebugCompilationUnit, DebugSource,
DebugTypeBasic, DebugTypeVector, DebugTypeArray, DebugTypedef,
DebugTypeFunction, DebugTypeEnum, DebugTypeComposite,
DebugTypeMember, DebugTypeInheritance, DebugFunction,
DebugFunctionDeclaration, DebugLexicalBlock, DebugScope,
DebugLocalVariable, DebugDeclare, DebugExpression.
2020-02-25 16:47:03 -05:00
Nico Weber
8910ea5f1c
Fix Wrange-loop-analysis warnings in SPIRV-Tools. (#3201) 2020-02-23 18:50:59 -05:00
Samuel Iglesias Gonsálvez
4d912f4e60
spirv-val: Add support for SPV_AMD_shader_image_load_store_lod (#3186)
According to SPV_AMD_shader_image_load_store_lod spec, Lod operand is
valid with OpImageRead, OpImageWrite, or OpImageSparseRead if the
extension is enabled.
2020-02-18 08:23:41 -05:00
alan-baker
6729c4a7ce
Fix structured exit validation (#3141)
Fixes #3139

* If the header of the construct is also a merge block, jump to the
associated header instead of the immediate dominator
  * prevents spurious failures from unrelated constructs
* new tests
2020-01-23 18:04:21 -05:00
Jaebaek Seo
dd37d73c5e Handle conflict between debug info and existing validation rule (#3104)
* Allow OpExtInst for DebugInfo between secion 9 and 10

Fixes #3086

* Handle spirv-opt errors on DebugInfo Ext

* Add IR Loader test

* Fix ir loader bug

* Handle DebugFunction/DebugTypeMember forward reference

* Add test cases (forward reference to function)

* Support old DebugInfo extension

* Validate local debug info out of function
2020-01-23 17:04:30 -05:00
Alan Baker
323a81fc5e Validate Vulkan 1.2 capabilities 2020-01-14 20:06:19 -05:00
David Neto
d46a1b0487 Add basic support for Vulkan 1.2: SPV_ENV_VULKAN_1_2 2020-01-14 20:06:19 -05:00