Commit Graph

24 Commits

Author SHA1 Message Date
Spencer Fricke
d8a8af8e6d
spirv-val: Remove unused includes and code (#5176) 2023-03-28 14:18:19 -04: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
286e9c1187
Use structural dominance to validate cfg (#4832)
* Structural dominance introduced in SPIR-V 1.6 rev2
* Changes the structured cfg validation to use structural dominance
  * structural dominance is based on a cfg where merge and continue
    declarations are counted as graph edges
* Basic blocks now track structural predecessors and structural
  successors
* Add validation for entry into a loop
* Fixed an issue with inlining a single block loop
  * The continue target needs to be moved to the latch block
* Simplify the calculation of structured exits
  * no longer requires block depth
* Update many invalid tests
2022-06-29 23:32:20 -04:00
luzpaz
65ecfd1093
Fix various source comment (doxygen) typos (#4680)
Found via `codespell -q 3 -L fo,lod,parm
2022-01-26 15:13:08 -05:00
alan-baker
912460e46a
Fix infinite loop in GetBlockDepth (#4519)
Fixes #4515

* Sets block depth to 0 if it encountered multiple times and leaves
  finding the real error for other code
2021-09-11 03:27:14 +00: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
b334829a91 Validate nested constructs (#3068)
* Validate that if a construct contains a header and it's merge is
reachable, the construct also contains the merge
* updated block merging to not merge into the continue
* update inlining to mark the original block of a single block loop as
the continue
* updated some tests
* remove dead code
* rename kBlockTypeHeader to kBlockTypeSelection for clarity
2019-11-27 16:45:57 -05:00
alan-baker
aea4e6b1b9 Fix block depth rule priority (#2755)
Fixes #2743

* Continue depth calculation should take precedence over merge calculation
2019-07-23 13:57:44 -04:00
Jeff Bolz
2c0111e6eb Add validation for SPV_EXT_fragment_shader_interlock (#2650) 2019-06-03 10:55:07 -04:00
Ryan Harrison
b12e7338ee
Implement WebGPU specific CFG validation (#2386)
In WebGPU all blocks are required to be reachable, unless they are one of two
specific degenerate cases for merge-block or continue-target. This PR adds in
checking for these conditions.

Fixes #2068
2019-03-08 13:01:09 -05:00
dan sinclair
eda2cfbe12
Cleanup includes. (#1795)
This Cl cleans up the include paths to be relative to the top level
directory. Various include-what-you-use fixes have been added.
2018-08-03 15:06:09 -04:00
dan sinclair
a5a5ea0e2d
Remove using std::<foo> statements. (#1756)
Many of the files have using std::<foo> statements in them, but then the
use of <foo> will be inconsistently std::<foo> or <foo> scattered
through the file. This CL removes all of the using statements and
updates the code to have the required std:: prefix.
2018-08-01 14:58:12 -04:00
dan sinclair
43144e36c1
Move the validation code into the val:: namespace (#1682)
This CL moves the validation code to the val:: namespace. This makes it
clearer which instance of the Instruction and other classes are being
referred too.
2018-07-09 23:18:44 -04:00
dan sinclair
3dad1cda11
Change libspirv to spvtools namespace (#1678)
This CL changes all of the libspirv namespace code to spvtools to match
the rest of the code base.
2018-07-07 09:38:00 -04:00
Eleni Maria Stea
045cc8f75b Fixes compile errors generated with -Wpedantic
This patch fixes the compile errors generated when the options
SPIRV_WARN_EVERYTHING and SPIRV_WERROR (that force -Wpedantic) are
set to cmake.
2018-03-22 09:40:11 -04:00
Andrey Tuganov
12e6860d07 Add barrier instructions validation pass 2018-02-05 13:14:55 -05:00
Diego Novillo
83228137e1 Re-format source tree - NFC.
Re-formatted the source tree with the command:

$ /usr/bin/clang-format -style=file -i \
    $(find include source tools test utils -name '*.cpp' -or -name '*.h')

This required a fix to source/val/decoration.h.  It was not including
spirv.h, which broke builds when the #include headers were re-ordered by
clang-format.
2017-11-27 14:31:49 -05:00
Andrey Tuganov
3e08a3f718 Add validation checks for Execution Model
Currently checks that these instructions are called from entry points
with Fragment execution model.
OpImageImplicit*
OpImageQueryLod
OpKill
2017-11-23 23:38:03 -05:00
Diego Novillo
d2938e4842 Re-format files in source, source/opt, source/util, source/val and tools.
NFC. This just makes sure every file is formatted following the
formatting definition in .clang-format.

Re-formatted with:

$ clang-format -i $(find source tools include -name '*.cpp')
$ clang-format -i $(find source tools include -name '*.h')
2017-11-08 14:03:08 -05:00
Greg Fischer
3bea99d378 CFA: Move TraversalRoots and ComputeAugmentedCFG into CFA 2017-05-25 11:43:24 -06:00
Greg Fischer
b25b330069 Inline: Create CFA class
Create class to encapsulate control flow analysis and share across
validator and optimizer. A WIP. Start with DepthFirstTraversal. Next
pull in CalculateDominators.
2017-05-08 15:02:59 -04:00
Ehsan Nasiri
109ce225c9 Fixes bug #517.
entry_block_to_construct_ maps an entry block to its construct. The key
in this map (the entry block) is not unique, and therefore the entry for
the continue construct gets overwritten when the selection construct is
discovered.

Since a given block may be the entry block of different types of
constructs, the (basic_block, construct_type) pair should be able to
uniquely identify the construct.

Adds test:
- In this test, a basic block is the entry block of a continue construct
  as well as the entry block of a selection construct.
  It can be shown that this unit test would crash without the fix in this
  PR and passes with the fix in this PR.
2017-01-06 14:23:17 -05:00
Ehsan Nasiri
6993fc413d Validation code for control flow nesting depth.
According to Section 2.17 (Universal Limits) of the SPIR-V Spec, the
control flow nesting depth may not be larger than 1023.

This is checked only when we are required to have structured
control flow.  Otherwise it's not clear how to compute control
flow nesting depth.
2016-12-23 14:14:50 -05:00
Lei Zhang
38036a7203 Rename validation source files to comply with Google style guide. 2016-11-08 17:19:56 -08:00