aboutsummaryrefslogtreecommitdiff
path: root/source/val/validate_extensions.cpp
AgeCommit message (Collapse)Author
2024-06-04spirv-val, core: add support for OpExtInstWithForwardRefs (#5698)Nathan Gauër
* val, core: add support for OpExtInstWithForwardRefs This commit adds validation and support for OpExtInstWithForwardRefs. This new instruction will be used for non-semantic debug info, when forward references are required. For now, this commit only fixes the code to handle this new instruction, and adds validation rules. But it does not add the pass to generate/fix the OpExtInst instruction when forward references are in use. Such pass would be useful for DXC or other tools, but I wanted to land validation rules first. This commit also bumps SPIRV-Headers to get this new opcode. --------- Signed-off-by: Nathan Gauër <brioche@google.com>
2024-02-21spirv-val: Make Constant evaluation consistent (#5587)Spencer Fricke
Bring 64-bit evaluation in line with 32-bit evaluation.
2023-11-17spirv-val: Loosen restriction on base type of DebugTypePointer and ↵Sajjad Mirza
DebugTypeQualifier (#5479) * Allow base type for DebugTypePointer and DebugTypeQualifier to be any DebugType
2023-03-28spirv-val: Remove unused includes and code (#5176)Spencer Fricke
2023-01-11Validate version 5 of clspv reflection (#5050)alan-baker
* 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
2022-11-24Add validation support for SPV_NV_shader_invocation_reorder. (#4979)alelenv
Co-authored-by: Pankaj Mistry <pmistry@nvidia.com>
2022-11-04Switch SPIRV-Tools to use spirv.hpp11 internally (#4981)alan-baker
Fixes #4960 * Switches to using enum classes with an underlying type to avoid undefined behaviour
2022-09-01Implement tool changes for SPV_EXT_mesh_shader. (#4915)Pankaj Mistry
- Added validation rule to support EXT_mesh_shader from SPIRV 1.4 onwards
2022-03-04spirv-val: Validate DebugTypeMatrix (#4732)Jeremy Hayes
2022-02-09[spirv-val] Allow 0 Component Count for DebugTypeArray for Shader (#4706)Greg Fischer
Rev 7 of NonSemantic.Shader.DebugInfo.100 was updated to allow zero component count for for DebugTypeArray to represent runtime array.
2022-01-26Fix various source comment (doxygen) typos (#4680)luzpaz
Found via `codespell -q 3 -L fo,lod,parm
2021-12-15Basic support for SPIR-V 1.6 (#4663)alan-baker
* Basic support for SPIR-V 1.6 * Update SPIRV-Headers deps * Add new environment enum for SPIR-V 1.6 * Make default environment 1.6 for most tools * Update tests * Disallow conditional branch with duplicate labels * Disallow Dim=Buffer with sampled images * Do not require the non-semantic extension after SPIR-V 1.5
2021-12-08Fix endianness of string literals (#4622)Marius Hillenbrand
* Fix endianness of string literals To get correct and consistent encoding and decoding of string literals on big-endian platforms, use spvtools::utils::MakeString and MakeVector (or wrapper functions) consistently for handling string literals. - add variant of MakeVector that encodes a string literal into an existing vector of words - add variants of MakeString - add a wrapper spvDecodeLiteralStringOperand in source/ - fix wrapper Operand::AsString to use MakeString (source/opt) - remove Operand::AsCString as broken and unused - add a variant of GetOperandAs for string literals (source/val) ... and apply those wrappers throughout the code. Fixes #149 * Extend round trip test for StringLiterals to flip word order In the encoding/decoding roundtrip tests for string literals, include a case that flips byte order in words after encoding and then checks for successful decoding. That is, on a little-endian host flip to big-endian byte order and then decode, and vice versa. * BinaryParseTest.InstructionWithStringOperand: also flip byte order Test binary parsing of string operands both with the host's and with the reversed byte order.
2021-09-15spirv-opt: Switch from Vulkan.DebugInfo to Shader.DebugInfo (#4493)Greg Fischer
Includes: - Shift to use of spirv-header extinst.nonsemantic.shader grammar.json - Remove extinst.nonsemantic.vulkan.debuginfo.100.grammar.json - Enable all optimizations for Shader.DebugInfo Also fixes scalar replacement to only insert DebugValue after all OpVariables. This is not necessary for OpenCL.DebugInfo, but it is for Shader.DebugInfo. Likewise, fixes Private-to-Local to insert DebugDeclare after all OpVariables. Also fixes inlining to handle FunctionDefinition which can show up after first block if early return processing happens. Co-authored-by: baldurk <baldurk@baldurk.org>
2021-08-23spirv-val: Validate vulkan debug info similarly to opencl debug info (#4466)Greg Fischer
Co-authored-by: baldurk <baldurk@baldurk.org>
2021-07-29Fix validator crash (#4418)alan-baker
Fixes #4411 * Some GLSL.std.450 validation didn't handle an operand without a type
2021-07-02add tests for SPV_KHR_bit_instructions (#4350)Ben Ashbaugh
2021-03-31Add interpolate legalization pass (#4220)Greg Fischer
This pass converts an internal form of GLSLstd450 Interpolate ops to the externally valid form. The external form takes the lvalue of the interpolant. The internal form can do a load of the interpolant. The pass replaces the load with its pointer. The internal form is generated by glslang and possibly other frontends for HLSL shaders. The new pass is called as part of HLSL legalization after all propagation is complete. Also adds internal interpolate form to pre-legalization validation
2021-01-27Validate SPV_KHR_workgroup_memory_explicit_layout (#4128)Caio Marcelo de Oliveira Filho
* Validate SPV_KHR_workgroup_memory_explicit_layout * Check if SPIR-V is at least 1.4 to use the extension. * Check if either only Workgroup Blocks or only Workgroup non-Blocks are used. * Check that if more than one Workgroup Block is used, variables are decorated with Aliased. * Check layout decorations for Workgroup Blocks. * Implicitly use main capability if the ...8BitAccess or ...16BitAccess are used. * Allow 8-bit and 16-bit types when ...8BitAccess and ...16BitAccess are used respectively. * Update SPIRV-Headers dependency Bump it to include SPV_KHR_workgroup_memory_explicit_layout. * Add option to validate Workgroup blocks with scalar layout Validate the equivalent of scalarBlockLayout for Workgroup storage class Block variables from SPV_KHR_workgroup_memory_explicit_layout. Add option to the API and command line tool.
2021-01-14Remove WebGPU support (#4108)Ryan Harrison
Leaves SPV_ENV_WEBGPU_0 enum in place, but marked deprecated, so users of the library are not broken by an API enum being removed. Fixes #4101
2020-08-16Allow DebugTypeTemplate for Type operand (#3702)Jaebaek Seo
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-12Validate more OpenCL.DebugInfo.100 instructions (#3684)Jaebaek Seo
- DebugTypeTemplate - DebugTypeTemplateParameter - DebugGlobalVariable - DebugInlinedAt - DebugValue
2020-08-05OpenCL.DebugInfo.100 DebugTypeArray with variable size (#3549)Jaebaek Seo
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-07-30Validator support for non-semantic clspv reflection (#3618)alan-baker
* 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-05-25spirv-val: allow DebugInfoNone for DebugTypeComposite.Size (#3374)Jaebaek Seo
2020-02-25Add validation rules for OpenCL.DebugInfo.100 extension (#3133)Jaebaek Seo
Add validation rules for DebugCompilationUnit, DebugSource, DebugTypeBasic, DebugTypeVector, DebugTypeArray, DebugTypedef, DebugTypeFunction, DebugTypeEnum, DebugTypeComposite, DebugTypeMember, DebugTypeInheritance, DebugFunction, DebugFunctionDeclaration, DebugLexicalBlock, DebugScope, DebugLocalVariable, DebugDeclare, DebugExpression.
2019-12-18Add support for SPV_KHR_non_semantic_info (#3110)David Neto
Add support for SPV_KHR_non_semantic_info This entails a couple of changes: - Allowing unknown OpExtInstImport that begin with the prefix `NonSemantic.` - Allowing OpExtInst that reference any of those sets to contain unknown ext inst instruction numbers, and assume the format is always a series of IDs as guaranteed by the extension. - Allowing those OpExtInst to appear in the types/variables/constants section. - Not stripping OpString in the --strip-debug pass, since it may be referenced by these non-semantic OpExtInsts. - Stripping them instead in the --strip-reflect pass. * Add adjacency validation of non-semantic OpExtInst - We validate and test that OpExtInst cannot appear before or between OpPhi instructions, or before/between OpFunctionParameter instructions. * Change non-semantic extinst type to single value * Add helper function spvExtInstIsNonSemantic() which will check if the extinst set is non-semantic or not, either the unknown generic value or any future recognised non-semantic set. * Add test of a complex non-semantic extinst * Use DefUseManager in StripDebugInfoPass to strip some OpStrings * Any OpString used by a non-semantic instruction cannot be stripped, all others can so we search for uses to see if each string can be removed. * We only do this if the non-semantic debug info extension is enabled, otherwise all strings can be trivially removed. * Silence -Winconsistent-missing-override in protobufs
2019-08-15Update remquo validation to match the OpenCL Extended Instruction Set ↵Toomas Remmelg
Specification (#2791)
2019-05-22Update vloadn and vstoren validation to match the OpenCL Extended ↵Toomas Remmelg
Instruction Set Specification (#2599)
2018-11-28Ensure that only whitelisted extensions are used in WebGPU (#2127)Ryan Harrison
Fixes #2058
2018-11-27Move OpExtInst validation into validate_extensions.cpp (#2124)Ryan Harrison
Fixes #2123
2018-11-27Ensure that imported extended instructions for WebGPU are only ↵Ryan Harrison
"GLSL.std.450" (#2119) Ensure that imported extended instructions for WebGPU are GLSL.std.450 Fixes #2059