Commit Graph

3058 Commits

Author SHA1 Message Date
Ashley Hauck
edc3a24781
Add SPV_KHR_vulkan_memory_model to aggressive_dead_code_elim (#4320) 2021-06-10 08:36:59 -04:00
David Neto
bbc660edab
Support Intel extensions for fixed point and hls-float (#4321)
See https://github.com/KhronosGroup/SPIRV-Headers/pull/177

Assembly, disassembly should work, but are untested.
2021-06-09 16:20:39 -04:00
Mostafa Ashraf
9dbca316aa
spirv-fuzz: Improve TransformationAddBitInstructionSynonym to check integer signedness (#4312)
Fixes #4170, by checking the signedness of bitwise operands in
TransformationAddBitInstructionSynonym, to avoid an "Expected Base
Type to be equal to Result Type" validation error.
2021-06-09 19:56:56 +01:00
EGJ1996
c1a75bfabf
spirv-fuzz: Support bitwise or and xor in TransformationAddBitInstructionSynonym (#4310)
Fixes #4172.
2021-06-09 16:23:26 +01:00
Steven Perron
d07505c761
Update lodash (#4317)
Updating lodash from 4.17.19 to 4.17.21.  This was triggered by a bot
that cannot sign the CLA (#4276).
2021-06-08 16:26:59 -04:00
Jaebaek Seo
fb02131cb4
No error report for variable image offset when before-legal-hlsl is on (#4316)
PR #4118 (d71ac38b8e) let spirv-val report a validation error when we
use offset for an OpImage* instruction instead of ConstantOffset. Since
some compilers like DXC rely on spirv-opt for function inlining or loop
unrolling, the spirv-val change broke some working shaders when the
shader developers disable the optimization (spirv-opt).

For example, DXC recently got this issue from a few users e.g.,
https://github.com/microsoft/DirectXShaderCompiler/issues/3807

Since this error is reported only when the spirv-opt is disabled, it
looks like the exact case that we have to skip spirv-val when
`--before-legalize-hlsl` is given. Moreover, avoiding the error using
`--before-legalize-hlsl` on DXC is exactly what FXC and DXC's DXIL
do (they do not report the error if the offset becomes a constant after
function inlining or loop unrolling).
2021-06-08 09:35:27 -04:00
Greg Fischer
87a2867976
Add kInstErrorMax to instrument.hpp (#4315)
To allow for extending GPU-AV error codes outside of spirv-tools.
2021-06-07 08:06:10 -04:00
Shiyu Liu
c05f744154
Spirv-fuzz: Add tests for MaybeGet* functions in fuzzerutil (#4284)
Adds tests for all MaybeGet* functions in fuzzerutil.

Fixes #4179.
2021-06-05 00:36:23 +01:00
Steven Perron
6d5c5677e1
Remove VS2013 kokoro build (#4314)
We are longer supporting VS2013, so we can remove the information for the kokoro build.
2021-06-03 16:16:37 -04:00
Shiyu Liu
26cdce984f
spirv-fuzz: add tests for full coverage of TransformationAccessChain (#4304)
Fixes #4286 by achieving full coverage of the transformation.
2021-06-02 17:46:56 +01:00
EGJ1996
c853a91144
spirv-fuzz: Added test to increase coverage of the add_parameter transformation (#4305)
Fixes #4294 by achieving full coverage of this transformation.
2021-06-02 17:44:42 +01:00
Mostafa Ashraf
126a826d3a
Spirv-fuzz: Achieve coverage of TransformationAddDeadBlock test (#4306)
Fixes #4290, by enhancing the test to get 100% of the lines covered.
2021-06-02 17:16:44 +01:00
Ryan Harrison
8b3dc6bbed
Check that valid bitcasted constant was returned (#4311)
This call returns nullptr to indicate errors.

Fixes https://crbug.com/1213365
2021-06-01 09:09:31 -04:00
Alastair Donaldson
0861a8fa21
spirv-fuzz: Fix OutlineFunction in presence of unreachable blocks (#4308)
This change prevents TransformationOutlineFunction from outlining a
region of blocks if some block in the region has an unreachable
predecessor. This avoids a bug whereby the region would be outlined,
and the unreachable predecessors would be left behind, referring to
blocks that are no longer in the function.
2021-06-01 11:44:21 +01:00
Alastair Donaldson
9646c733e9
spirv-fuzz: Fix def-use update in PermutePhiOperands (#4309)
The def-use manager was being incorrectly updated in
TransformationPermutePhiOperands, and this was causing future
transformations to go wrong during fuzzing. This change updates the
def-use manager in a correct manner, and adds a test exposing the
previous bug.

Fixes #4300.
2021-06-01 08:37:45 +01:00
EGJ1996
ec1bc3e2e5
spirv-fuzz: Added extra tests for AddTypeFloat and AddTypeInt transformations (#4292)
Tests some edge cases of these transformations more thoroughly.
2021-05-27 08:36:39 +01:00
EGJ1996
94f570d7aa
spirv-fuzz: Increase test coverage of TransformationCompositeConstruct (#4301)
Brings this class up to 100% statement coverage.

Fixes #4288
2021-05-26 21:31:55 +01:00
Mostafa Ashraf
00ce2bb474
spirv-fuzz: Enhancing permute function variables and its testing (#4295)
Fixes the way instruction swapping is implemented.

Fixes #4257.
Fixes #4259.
2021-05-26 00:41:31 +01:00
Vasyl Teliman
e2ac64bdf0
spirv-fuzz: Move ApplyTransformation to .cpp file (#4258)
Sometimes, you need to change these functions during debugging (e.g.,
figure out why the transformation is inapplicable). When that happens,
you need to recompile the whole fuzzer just because these functions
are in the header file. This PR fixes the situation.
2021-05-26 00:39:51 +01:00
Mostafa Ashraf
91931ffcd2
spirv-fuzz: Enhance test to improve lines covered (#4289)
Fixes #4287 by enhancing the test to get 100% of lines covered.
2021-05-24 14:24:11 +01:00
Alastair Donaldson
0afe1f2b3f
spirv-fuzz: Cover protobuf message creation in tests (#4285)
The Transformation class tests did not cover the (trivial) ToMessage
methods of each transformation, nor the constructors that take a
protobuf message. This lac of coverage makes it hard to see which more
interesting pieces of code are not covered when looking at coverage
percentages. This change adapts the helper function for applying a
transformation and checking fresh ids so that it turns a
transformation into a protobuf message and back, thus covering
ToMessage and the protobuf constructor for every transformation. The
runtime overhead of doing this is very small.
2021-05-22 17:45:09 +01:00
Vasyl Teliman
f0d110e305
Invalidate analyses (#4260)
Some reduction opportunities don't invalidate all analyses. This PR
fixes the situation (although we might invalidate more analyses than
required).
2021-05-14 15:00:51 +01:00
Greg Fischer
18d45142e7
Fix crash when optimizing shaders with DebugPrintf (#4280)
Fixes #4219
2021-05-13 13:19:56 -04:00
alan-baker
010cd289db
Fix continue construct for single block loops (#4277)
Fixes https://crbug.com/tint/793

* When a loop has an empty loop construct, the loop construct and
  continue construct share the same header so don't disallow the loop
  header for the continue construct
2021-05-12 13:01:32 -04:00
Alastair Donaldson
f6b59599ae
spirv-fuzz: Respect control flow rules when merging returns (#4279)
Fixes #4278.

Some minor code cleanup is incorporated.
2021-05-12 10:45:58 -04:00
David Neto
de1cae069c
val test: Update capability dependency (#4268)
Private storage class is now also enabled by VectorComputeINTEL

This should fix the CI bots
2021-05-11 10:40:45 -04:00
Shiyu Liu
1020e394cb
spirv-fuzz: Fix underflow problem in fuzzer_pass_swap_two_functions (#4253)
Addresses a comment mentioned in #4236.

Simplifies implementation of GetFunctionIterator().
2021-05-04 09:40:55 +01:00
Steven Perron
8ec9f456e6
Fix export symbol test. (#4254)
* Fix export symbol test.

The symbol export test does not check weak symbols, even though they are
possibly exported.  It also does not allow functions in the standard
namespace even though it allows symbols on other namespaces.

I've modified the check to look at the name of weakly defined function,
and I've allowed functions in the standard namespace, functions in a local scope, and
weak definitions of new and delete operators.

Fixes #4250
2021-04-29 14:27:16 -04:00
ncesario-lunarg
f30465d2b5
build: Fix Android build (#4157) 2021-04-29 09:10:32 -04:00
Ben Clayton
f8c78cc534
Updates to the vscode SPIR-V extension (#4246)
* utils/vscode: Allow running install.sh from any CWD

* utils/vscode: Update schema to latest

* utils/vscode: Don't keep on adding trailing newlines

Repeatedly formatting the file will keep on appending newlines to the end of the file.
Don't do that.
2021-04-29 08:58:55 -04:00
Vasyl Teliman
f82f5af5e2
Invalidate DefUse analysis (#4255)
Fixes #4252.
2021-04-29 09:44:59 +01:00
Jaebaek Seo
089d716d25
Fix dangling phi bug from loop-unroll (#4239)
Fix dangling phi bug from loop-unroll

When unrolling the following loop:
```
%const0 = OpConstant ...
%const1 = OpConstant ...
...
%LoopHeader = OpLabel
%phi0 = OpPhi %float %const0 %PreHeader %phi1 %Latch
%phi1 = OpPhi %float %const1 %PreHeader %x    %Latch
...
%LoopBody = OpLabel
%x = OpFSub %float %phi1 %phi0
...
```

the loop-unroll pass sets the value of `%phi0` as `%phi1` for the second
copy of the loop body. For example, the second copy of
`%x = OpFSub %float %phi1 %phi0` will be
`%y = OpFSub %float %x %phi1`.

Since all phi instructions for inductions will are removed after the
loop unrolling, `%phi1` will be a dead dangling phi.

It happens only for the phi values of the first loop iteration. Replacing those
dangling phis with their initial values fixes this issue.

For example, the second copy of `%x = OpFSub %float %phi1 %phi0` should be
`%y = OpFSub %float %x %const1` because the value of `%phi1` from the
first loop iteration is `%const1`.
2021-04-27 16:27:09 -04:00
Jaebaek Seo
07ec4f83c5
Support folding OpBitcast with numeric constants (#4247)
Add constant folding rule for OpBitcast with numeric scalar or vector
constants.
2021-04-27 14:24:46 -04:00
Shiyu Liu
6cdf07d2b3
spirv-fuzz: Swap positions of two functions in a module (#4236)
Adds a new transformation class that swaps the syntactic position of
two functions in the module, and a fuzzer pass to apply it.

Fixes #4026.
2021-04-27 12:33:08 +01:00
Steven Perron
1b8341b8b1
Fix warning in python script. (#4251) 2021-04-26 15:37:38 -04:00
Ben Clayton
9f23457eef
GraphicsRobustAccessPass: Set module_status_.modified (#4167)
When calling `replace_index`.

Fixes: #4166
2021-04-26 17:14:35 +01:00
Mostafa Ashraf
8fe39ad581
spirv-fuzz: Permute the order of variables at function scope issue (#4248)
Fixes #4194.
2021-04-26 16:53:55 +01:00
Jakub Kuderski
22b82872b4 Start SPIRV-Tools v2021.2 2021-04-21 10:16:06 -04:00
Jakub Kuderski
c2d5375fa7 Finalize SPIRV-Tools v2021.1 2021-04-21 10:13:07 -04:00
Jakub Kuderski
dc72924cb3 Update CHANGES 2021-04-19 11:06:09 -04:00
sfricke-samsung
693d564db4
spriv-val: Fix clang-format bug for VUID string (#4238) 2021-04-16 08:52:48 -04:00
Alastair Donaldson
a02a9205ff
spirv-fuzz: Accept limitations in AddFunction (#4226)
There are some edge cases where adding livesafe functions does not
succeed, due to loop limiter edges breaking SPIR-V dominance rules. As
these edge cases are rare it does not seem worth implementing complex
additional logic to handle all cases. This change accepts that trying
to add a function in a livesafe manner may not succeed.
2021-04-13 09:45:30 +01:00
Shahbaz Youssefi
ae6a1e1d2f
Fix UWP build (#4235)
UWP doesn't support system(), so skip building spirv-reduce on it
similarly to iOS.
2021-04-12 13:17:44 -04:00
Paul Thomson
6210375e13
Fix clang-format-diff.py URL (#4233)
Also add the --fail flag so that kokoro/check-format/build.sh fails when it cannot download the clang-format-diff.py script.
2021-04-09 23:36:36 +01:00
Alastair Donaldson
8da800c4cb
spirv-reduce: Remove redundant r-value references (#4232) 2021-04-09 13:55:51 +01:00
Alastair Donaldson
212895d4c2
Typo fix (#4225) 2021-04-02 09:59:35 +01:00
Greg Fischer
48007a5c7f
Add interpolate legalization pass (#4220)
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-03-31 14:26:36 -04:00
Alastair Donaldson
61e256c9c4
spirv-fuzz: Efficiency improvements to fuzzer pass (#4188)
FuzzerPassConstructComposites is adapted to use AvailableInstructions
to manage available instructions, and to use zero constants when
trying to construct a composite for which not all fields can otherwise
be constructed. The change uncovered some cases where we create
structs and arrays with struct fields or components that are
block-decorated; these possibilities have been eliminated.
2021-03-27 12:15:59 +00:00
Alastair Donaldson
2ee21fbdee
spirv-fuzz: Avoid invalidating analyses when splitting blocks (#4218)
It is easy to avoid the need to invalidate the def-use analysis and
instruction to block mapping when splitting blocks, and profiling has
revealed that invalidation of def-use in particular is expensive when
splitting many blocks. This change avoids these invalidations.
2021-03-27 12:13:23 +00:00
Alastair Donaldson
22eb528f17
spirv-fuzz: Do not add too many dead blocks (#4217)
Profiling has shown that adding large numbers of dead block
transformations can be expensive because each on requires dominator
analysis information, and each one invalidates this information. There
is currently no obvious mechanism for incrementally updating the
dominator analysis. This change restricts the number of these
transformations that a single fuzzer pass will apply, to restrict this
performance bottleneck.
2021-03-27 10:30:23 +00:00