-
c9450135
by Shahbaz Youssefi
at 2022-06-02T11:32:38-04:00
spirv-val: Optimize struct field decoration lookup (#4809)
A std::set is used instead of std::vector, where the elements are
ordered by member index first. Decorations for fields are now looked up
by going over the range of decorations for the member only, instead of
the whole set.
In an ANGLE test that generates a struct with 4096 members, validation
goes down from ~140ms to ~90ms. On debug builds, the difference is more
pronounced, going down from ~2.5s to ~600ms.
-
044ff1aa
by Junda Liu
at 2022-06-08T08:36:32-04:00
spirv-val: Add support for SPV_AMD_shader_early_and_late_fragment_tests (#4812)
- Update SPIR-V headers.
- Add validator support.
- Add validator tests.
-
fad68a75
by strangewiz
at 2022-06-08T19:49:46+00:00
Fix usage of sprintf. (#4811)
-
8f7f5024
by David Neto
at 2022-06-10T17:55:45-04:00
Simplify invocation of snprintf (#4815)
-
76ebfb98
by Steven Perron
at 2022-06-14T13:06:38-04:00
Avoid replacing access chain with OOB access (#4819)
An access chain could have a constant index that is an out of bounds
access. This is valid spir-v, even if it can cause problems at runtime.
However, it is not valid to have an OpCompositeExtract with an out of
bounds access. This means we have to stop local-access-chain-convert
from making that change.
Fixes #4605
-
bfc611b0
by Spencer Fricke
at 2022-06-15T11:25:16-04:00
spirv-val: Label 06807 and 06808 VUID (#4817)
-
fbcb6cf4
by manas-kulkarni
at 2022-06-16T13:54:12-04:00
Ability to fold Constant Vector times Matrix and Matrix times vector instructions (#4818)
-
2eff41e7
by David Neto
at 2022-06-20T10:57:44-04:00
Remove stray output to stdout from tests (#4816)
-
4f321f86
by Steven Perron
at 2022-06-21T11:37:34-04:00
Avoid undefined divide-by-0 (#4821)
The Reciprocal function expects a divide-by-0 to return nan,and then Reciprocal will return 0.
Since the divide-by-0 is actually undefined, we will identify this case early, and return 0.
No new tests are needed because we already tests folding divide-by-0.
Fixes #4715
-
845d98d4
by Steven Perron
at 2022-06-21T19:58:21+00:00
Do not check if the binary changed if encoding is different (#4824)
There is an assert that verifies that the binary did not change when the
optimizer said that it did not. However, if the input binary is in big endian
format, the optimizer will encode the optimized binary in little endian. This
causes the assert to fail. Since we do not believe that anybody cares about a
big endien formate, we will disable the assert in that case.
Fixes #4722
-
76fe3521
by Steven Perron
at 2022-06-21T19:59:01+00:00
Fail validation when RelaxedPrecision is applied to a type. (#4823)
* Fail validation when RelaxedPrecision is applied to a type.
Fixes #4723
Fixes #4725
* Fixup invalid test
-
c4ed5157
by PENGUINLIONG
at 2022-06-23T16:01:44-04:00
Fixed crash unrolling loops with residual iterations (#4820)
-
3c9fd757
by Steven Perron
at 2022-06-24T15:28:06+00:00
Avoid if-conversion if both predecessors are the same (#4826)
If the predecessor blocks are the same, then there is only 1 value for the
OpPhi. The simplition pass will simplify it, and it causes problems for
if-conversion. In these cases, if-conversion can just punt.
Fixes #3554.
-
37d2396c
by Steven Perron
at 2022-06-24T12:33:45-04:00
Fix SplitLoopHeader to handle single block loop (#4829)
The code in `CFG::SplitLoopHeader` assumes the loop header is not the
latch. This leads to it not being able to find the latch block. This
has been fixed, and a test added.
Fixes #4527
-
f2dfa53a
by Alastair Donaldson
at 2022-06-29T09:12:09-04:00
Avoid unrolling large loops while fuzzing (#4835)
Uses a preprocessor macro to bail out of unrolling loops with large
iteration counts during fuzzing, to reduce the number of
timeouts/memouts that arise.
Related issue: #4728.
-
66d88508
by Steven Perron
at 2022-06-29T09:53:26-04:00
Build struct order only for the section needed when unrolling. (#4830)
We currently build the structured order for all nodes reachable from the
loop header when unrolling a loop. However, unrolling only needs the
nodes in the loop and possibly the merge node.
To avoid needless computation, I have implemented a search that will
stop at the merge node.
Fixes #4827
-
0b824324
by Mike
at 2022-06-29T12:05:00-04:00
Fix segfault in `SpirvTools::Disassemble` when printing (#4833)
When the `SPV_BINARY_TO_TEXT_OPTION_PRINT` option is specified, `spvtext` will not be created (see https://github.com/KhronosGroup/SPIRV-Tools/blob/37d2396cabe56b29d37551ea55d0d745d5748ded/source/disassemble.cpp#L117), and the attempt to dereference into its members (`spvtext->str` and `spvtext->length`) results in segmentation fault.
This is fixed by first checking if `spvtext` is nulll.
Co-authored-by: Steven Perron <stevenperron@google.com>
-
91572e76
by Steven Perron
at 2022-06-29T15:40:29-04:00
Write binary files to stdout in binary on windows. (#4834)
We currently do not set stdout to binary mode when writing a binary
file on Windows. This cause some extra characters to be written that
mess up the output. We try to fix that.
Fixes #4793
-
286e9c11
by alan-baker
at 2022-06-29T23:32:20-04:00
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
-
8ec4a077
by alan-baker
at 2022-06-30T13:52:50-04:00
Fix unreachable loop increment (#4836)
* ANGLE builds with -Werror,-Wunreachable-code-loop-increment which had
a problem with grabbing the first construct in a loop
* Change the code to just use begin instead
-
32622ba7
by Steven Perron
at 2022-07-05T12:23:32-04:00
DCE: clean up the cfg for all functions that were processed. (#4840)
Which functions are processed is determined by which ones are on the
call tree from the entry points before dead code is removed. So it is
possible that a function is process because it is called from an entry
point, but the CFG is not cleaned up because the call to the function
was removed.
The fix is to process and cleanup every function in the module. Since
all of the dead functions would have already been removed in an earlier
step of DCE, it should not make a different in compile time.
Fixes #4731
-
6803cc51
by Kevin Lubick
at 2022-07-05T13:54:59-04:00
use exec_tools instead of tools for better RBE compatibility (#4837)
-
d5a3bfcf
by Steven Perron
at 2022-07-05T14:14:29-04:00
Avoid undefined behaviour when getting debug opcode (#4842)
If the `instruction` operand in an extended instruction instruction is
too large, it causes undefined behaviour when that value is cast to the
enum for the corresponding set. This is done with the
NonSemanticDebug100 instruction set. We need to avoid the undefined
behaviour.
Fixes #4727
-
92fe420c
by Steven Perron
at 2022-07-05T16:16:50-04:00
Reduce load size does not work for array with spec const size (#4845)
Arrays do not have to have a size that is known at compile time. It
could be a spec constant. In these cases, treat the array
as if it is arbitrarily long. This commit will treat it like it is an
array of size UINT32_MAX.
Fixes https://crbug.com/oss-fuzz/47397.
-
5f4284aa
by Steven Perron
at 2022-07-05T20:12:58-04:00
Add limit for scalar replacment when fuzzing (#4843)
The fuzzer cretes code with very large array, and scalar replacement
times out. Adding a limit on the size of the composites that will be
split when fuzzing.
Fixes https://crbug.com/oss-fuzz/48630
-
dcee3a5d
by David Neto
at 2022-07-06T15:10:29-04:00
Update validator diagnostics with "structurally dominated" (#4844)
The updated rules in SPIR-V 1.6 Rev2 use structural dominance,
so update the messages to match
-
05de6503
by alan-baker
at 2022-07-06T17:43:32-04:00
Use structural reachability in CFG checks (#4849)
Fixes https://crbug.com/oss-fuzz48578
* Adds structural reachability to basic blocks
* calculated in same manner as reachability, but using structural
successors
* Change structured CFG validation to use structural reachability
instead of reachability
* Fix some invalid reducer cases
-
bc5c8760
by Spencer Fricke
at 2022-07-07T13:03:52-04:00
spirv-val: Add Vulkan decoration interface (#4831)
-
69e1deab
by Greg Fischer
at 2022-07-08T13:11:22-04:00
Fix small bug traversing users in interface_var_sroa (#4850)
Fix code that is traversing def-use user structure at the same time
that it is changing it. This is dicey at best and error prone at worst.
This was uncovered making a change to the id_to_user representation.
-
faa8d6a6
by Greg Fischer
at 2022-07-12T13:14:47-06:00
Revert "Optimize DefUseManager allocations (#4709)" (#4846)
This reverts commit d18d0d92e55f44da6af0dc87fb0e3c8034e9a3ac.
This is reverted because it causes a 7X slowdown when legalizing
SPIR-V with NonSemantic.Shader.DebugInfo.100 instructions.
This is due to the creation of very large UseLists for several
heavily used operands for this extension combined with the fact
that the original commit changed the performance of Uselists to O(n).
-
e2cf7693
by Spencer Fricke
at 2022-07-13T10:05:52-04:00
spirv-val: Label VUID 06925 (#4852)
-
93ebf698
by Spencer Fricke
at 2022-07-15T09:55:33-04:00
spirv-val: Add OpConvertUToAccelerationStructureKHR (#4838)
-
60615b8e
by Pankaj Mistry
at 2022-07-19T14:41:19-04:00
Implement SPV_NV_bindless_texture related changes (#4847)
* Add validation for SPV_NV_bindless_texture
-
e4cfa190
by Spencer Fricke
at 2022-07-20T10:12:58-04:00
spirv-val: Add SPV_KHR_ray_query (#4848)
-
388ce0ee
by Alastair Donaldson
at 2022-07-26T10:56:04-04:00
spirv-as: Avoid recursion when skipping whitespace (#4866)
Excessive whitespace can lead to stack overflow during parsing as each
character of skipped whitespace involves a recursive call. An
iterative solution avoids this.
Fixes #4729.
-
cc5fca05
by Spencer Fricke
at 2022-07-26T15:14:21-04:00
spirv-val: Fix Vulkan memory scope (#4869)
-
8dc0030e
by David Neto
at 2022-07-28T09:40:07-04:00
spirv-as: Avoid overflow when parsing exponents on hex floats (#4874)
* spirv-as: Avoid overflow when parsing exponents on hex floats
When an exponent is so large that it would overflow the int
type in the parser, saturate the exponent.
This allows extremely large exponents, and saturates
to infinity when the exponent is positive, and zero when the exponent
is negative.
Fixes #4721.
* Avoid unexpected narrowing conversions from arithmetic operations
Co-authored-by: Alastair F. Donaldson <alastair.donaldson@imperial.ac.uk>
-
4773879b
by alan-baker
at 2022-07-29T10:16:54-04:00
Update structure layout validation (#4876)
* Uniform block layout rules for matrices should use extended layouts by
default
-
a90ccc24
by Jamie Madill
at 2022-07-29T18:26:37+00:00
Remove default copy constructor in header. (#4879)
A recent libc++ roll in Chrome warned of a deprecated copy. We're
still looking if this is a bug in libc++ or a valid warning, but
removing the redundant line is a safe workaround or fix in either
case.
See discussion in https://crrev.com/c/3791771
-
b5d0bf28
by alan-baker
at 2022-07-29T15:08:48-04:00
Require ColMajor or RowMajor for matrices (#4878)
Fixes #4875
* Require that matrices in laid out structs have RowMajor or ColMajor
set as per SPIR-V section 2.16.2 (shader validation)
-
54cd5e19
by Pankaj Mistry
at 2022-07-29T19:28:27+00:00
spirv-opt : SPV_NV_bindless_texture related changes (#4870)
-
08c542d3
by Spencer Fricke
at 2022-08-03T10:42:13-04:00
spirv-val: Label VUID 06997 (#4881)
-
b362d2b7
by jeremyg-lunarg
at 2022-08-04T16:44:15+00:00
spirv-diff: Fix asserts in ComparePreambleInstructions() (#4872)
These asserts are not valid for string literals, which may
contain several words:
assert(a_operand.words.size() == 1);
assert(b_operand.words.size() == 1);
It looks like they only make sense for the default case, which
assumes that both operands contain a single word.
Running a debug version of spirv-diff on any shader containing
a string literal will hit the original asserts.
-
5e61ea20
by Nathan Gauër
at 2022-08-08T13:49:17-04:00
Update CHANGES (#4886)
-
f20e8d05
by Spencer Fricke
at 2022-08-08T14:45:04-04:00
spirv-val: Add SPV_KHR_ray_tracing instructions (#4871)
-
ed3b9c83
by Steven Perron
at 2022-08-09T17:33:04+00:00
Local access chain convert: check for negative indexes (#4884)
An access chain instruction interpretes its index operands as signed.
The composite insert and extract instruction interpret their index
operands as unsigned, so it is not possible to represent a negative
number.
This commit adds a check to the local-access-chain-convert pass to check
for a negative number in the access chain and to not do the conversion.
Fixes #4856
-
0ebcdc4d
by Nathan Gauër
at 2022-08-09T14:10:36-04:00
Allow spirv-opt print-all to show pretty IDs (#4888)
Disassembler was called with non-default params, loosing FRIENDLY_NAMES.
This commit changes the call options to allow the spirv-opt to show
friendly names instead of raw-ids. Might be more helpful when reading
the SPIRV-opt output.
Fixes #4882
Signed-off-by: Nathan Gauër <brioche@google.com>
-
0a43a84e
by Steven Perron
at 2022-08-10T09:04:35-04:00
Fix shuffle feeding shuffle with undef literal (#4883)
When folding a vector shuffle with an undef literal, it is possible that the
literal is adjusted so that it will then be interpreted as an index into
the input operands. This is fixed by special casing that case, and not
adjusting those operands.
Fixes #4859
-
409e1167
by Nathan Gauër
at 2022-08-11T16:25:53+00:00
Finalize SPIRV-Tools v2022.3
The previous amend to the CHANGES file mentioned v2022.4. That was a
mistake as v2022.3 was never released.
Signed-off-by: Nathan Gauër <brioche@google.com>