Commit Graph

1906 Commits

Author SHA1 Message Date
David Neto
70404a96ab
Fix leaks in tests (#2295)
Generally, a test fixture in a method that can generate a binary
should release any previously cached binary.  Similarly for diagnostics.
2019-01-16 16:53:10 -05:00
Steven Perron
49b5b0abc6
Fix up bit shifts by 32. (#2292)
In C++, a bit shift of the same size as the type is undefined, but it is
defined in spir-v.  When folding those cases, we have to be careful.  We
cannot simply do the shift in C++.

Fixes https://crbug.com/917697.
2019-01-16 15:52:23 -05:00
Ryan Harrison
3109ca16b0 Add tests to validate allowed lengths of int and floats for WebGPU (#2289)
Fixes #2277
2019-01-16 11:24:48 -05:00
greg-lunarg
83bfdc976a Instrumentation: Add ArrayStride decoration to debug output buffer array (#2290) 2019-01-16 10:01:40 -05:00
Ryan Harrison
cb27ffdcd8
Ensure that required storage classes have initializer for WebGPU (#2285)
Fixes #2279
2019-01-15 10:24:58 -05:00
Ryan Harrison
9d8534e329
Enforce rules for OpTypeRuntimeArray on Vulkan (#2191)
Fixes #1936
2019-01-14 16:44:44 -05:00
Ryan Harrison
68f2af9f7d
Removing unused const version of id_decorations (#2283)
Fixes #2282
2019-01-14 13:52:50 -05:00
Ryan Harrison
16a0da370b
Ensure that entry point names are unique for WebGPU (#2281)
Fixes #2275
2019-01-14 13:52:28 -05:00
David Neto
6958d11bc2
Validate decorations from SPV_KHR_no_integer_wrap (#2271)
Validates NoSignedWrap, NoUnsignedWrap.

We are permissive by allowing any extended instruction.
2019-01-09 10:36:17 -05:00
David Neto
df5bd2d05a
Permit UConvert spec-constant op for SPV_AMD_gpu_shader_int16 (#2264)
See https://github.com/KhronosGroup/glslang/issues/848
2019-01-08 19:00:18 -05:00
Steven Perron
ee95ab15ce Start SPIRV-Tools v2019.2 2019-01-07 15:51:06 -05:00
Steven Perron
2297d4a3df Finalize SPIRV-Tools v2019.1 2019-01-07 15:48:55 -05:00
Jeff Bolz
5eab6df648 SPV_EXT_physical_storage_buffer (#2267) 2019-01-07 13:19:24 -05:00
alan-baker
06c9dc07bd
Upgrade modf and frexp (#2266)
Fixes #2138

* Modf and frexp are upgraded to use the struct version of the
instruction and generate an explicit store whose flags can be upgraded
separately
* Fixed major bug where availability and visibility were reversed for
non-copy memory instructions
* Fixed bug where availability and visibility scope operands were reversed for copy memory
* Upgraded all opt tests to use SPV_ENV_UNIVERSAL_1_3
* Upgrade tests moved into unified tests and removed standalone test
2019-01-07 12:36:38 -05:00
Steven Perron
04cc2b15bc Update CHANGES 2019-01-07 10:13:15 -05:00
Ehsan
2f004baa99 [kokoro] Fix usage of ERRORLEVEL in Windows script. (#2262) 2019-01-07 10:00:49 -05:00
David Neto
a87d3ce48e
Validate operation for OpSpecConstantOp (#2260) 2019-01-03 14:28:00 -05:00
alan-baker
a900bacb58 Broader check for ids that require a type (#2259)
Broader check for ids that require a type

Fixes https://crbug.com/911700

* Adds a broader check for when id operands require a type
* updated a few tests
* added a test to catch the original issue
2019-01-03 13:55:43 -05:00
Steven Perron
241644a5a3
Have replace load size handle extact with no index. (#2261)
Fixes https://crbug.com/917774
2019-01-03 13:02:10 -05:00
Steven Perron
9f36c8bb72
Handle CompositeInsert with no indices in VDCE (#2258)
* Handle CompositeInsert with no indices in VDCE

In the spec, there it nothing that forces an OpCompositeInsert to have
an index, but VDCE assumes there is at least 1 in a couple places.

This commit updates VDCE to handle these cases.
2019-01-02 14:00:04 -05:00
David Neto
64f2750e5d
Update copyright checker for 2019 (#2256) 2018-12-28 17:27:53 -05:00
kholtnv
980ae1d1cd Added NVIDIA ray tracing storage classes in ValidateVariable. (#2254)
* Added additional changes for the new AccelerationStructureNV type.

* Added NVIDIA ray tracing storage classes for checking in ValidateVariable.

* For NVIDIA ray tracing storage classes added test to load bool type (allowed) in new storage class.
2018-12-27 15:08:11 -05:00
Ankit Navik
f70e9e2a1f tools/lesspipe: Allow generic shell (#2255)
tools/lesspipe: Allow generic shell
2018-12-27 15:06:37 -05:00
dan sinclair
167f1270a9
Output disassembly line number for binary parse errors. (#2195)
This Cl changes the binary parser to keep track of the instruction count
being processed. The parser will then use that instruction number as the
error number, instead of the binary word.

This should make it easier to match the error up to what the
disassembler would output for the error.

Issue #2091
2018-12-21 16:24:15 -05:00
Steven Perron
bdc2ab9356
In LICM don't place code between merge instruction and branch. (#2252)
Fixes #2210.
2018-12-20 18:33:52 -05:00
Steven Perron
5e19d3febc
Add custom target to wrap around custom commands. (#2198)
In CMake, we are not suppose to have multiple targets depend on the same
custom command. To avoid this, we have to add a custom target around
the command.  Then we have add the appropriate dependencies.

Fixes #1941.
2018-12-20 20:02:53 +00:00
Steven Perron
d763469752
Process moer options when processing options file. (#2251)
When processing options in a file, it does have access to the
ValidatorOptions and OptimizerOptions object, so options that change
those do not work.  We just need to pass it in.

Fixes #2219.
2018-12-20 19:42:28 +00:00
Steven Perron
c2013e248b
Make the constant and type manager analyses. (#2250)
Currently it is impossible to invalidate the constnat and type manager.
However, the compact ids pass changes the ids for the types and
constants, which makes them invalid.  This change will make them
analyses that have to been explicitly marked as preserved by passes.
This will allow compact ids to invalidate them.

Fixes #2220.
2018-12-20 18:00:05 +00:00
kholtnv
e49bd96f2c Added additional changes for the new AccelerationStructureNV type. (#2218)
* Added additional changes for the new AccelerationStructureNV type.

* Added additional changes for the new AccelerationStructureNV type.  Change tabs to space...

* Added additional changes for the new accelerationStructureNV type -- add proper type name.

Fix TypeManager.TypeStrings test:
[----------] 29 tests from TypeManager
[ RUN      ] TypeManager.TypeStrings
[       OK ] TypeManager.TypeStrings (7 ms)
2018-12-19 21:42:39 +00:00
Steven Perron
68b69e16aa
Update the continue target in merge return. (#2249)
When we are predicating the continue target for a loop, it can no longer
be the continue target because it will have a branch that exits the loop
and is not the bach edge.  The continue target will have to be the
target of that branch that is still in the loop.

Fixes #2211.
2018-12-19 21:24:49 +00:00
Steven Perron
ac7feace90
Fix missing OpPhi after merge return. (#2248)
The function `UpdatePhiNodes` was being called inconsistently.  In one
case, the cfg had already been updated to include the new edge, and in
another place the cfg was not updated.  This caused the function to
miss flagging a block as needing new phi nodes.  I picked that the cfg
should not be updated before making the call.  I documented it, and
change the call sites to match.

Fixes #2207.
2018-12-19 18:17:42 +00:00
Steven Perron
9d04f82bef
Ensure SROA gets the correct pointer type. (#2247)
We initially assumed that if the type manager returned the correct id
for the pointee type, that we would get the correct pointer type back,
but that is not true.  See the unit test added with this commit.  We
need to fall back to the linear search any time we are looking for a
pointer to a type that may not be unique.

At the same time, SROA considered an OpName on a variable to be a use of
the entire variable.  That has been fixed.

Fixes #2209.
2018-12-19 17:07:29 +00:00
Steven Perron
9e81c337f9
Place load after OpPhi instructions in block. (#2246)
We currently place the load instructions at the start of the basic block
that dominates all of the loads.  If that basic block contains OpPhi
instructions, then this will generate invalid code.  We just need to
search for a location that comes after all of the OpPhi instructions.

Fixes #2204.
2018-12-19 15:18:22 +00:00
Paul Thomson
71aa48f91d spirv-reduce: add OperandToUndefReductionPass (#2200)
* Add OperandToUndefReductionPass.

Fixes #2115.

Also added some tests that are similar to those in OperandToConstantReductionPassTest.

In addition, refactor FindOrCreateGlobalUndef into reduction_util.cpp. Fixes #2184.

Removed many documentation comments that were identical or very similar to the overridden function's documentation comment.
2018-12-19 13:25:56 +00:00
Steven Perron
5ec2d1a8cd
Don't fold specialized branches in loop unswitch (#2245)
* Don't fold specialized branchs in loop unswitch

Folding branches can have a lot of special cases, and can be a little
error prone.  So I only want it in one place.  That will be in dead
branch elimination.  I will change loop unswitching to set the branches
that were being folded to have a constant condition.  Then subsequent
pass of dead branch elimination will be able to remove the code.

At the same time, I added a check that loop unswitching will not
unswitch a branch with a constant condition.  It is not useful to do it
because dead branch elimination will simple fold the branch anyway.
Also it avoid an infinite loop that would other wise be introduced by my
first change.

Fixes #2203.
2018-12-19 04:40:30 +00:00
Ryan Harrison
47c08a79c4
Implement initial --webgpu-mode flag (#2217)
Fixes #2166
2018-12-18 15:10:34 -05:00
Steven Perron
acd2781952
Handle id overflow in inlining. (#2196)
Have inlining return Failure if the ids overflow.

Part of #1841.
2018-12-18 19:34:03 +00:00
Ryan Harrison
7f57887e05
Remove check for SpvCapabilityAtomicStorage (#2243)
Per conversation on
https://github.com/KhronosGroup/glslang/issues/1618 and other places.
2018-12-18 13:34:30 -05:00
Steven Perron
1254335d13
Don't unswitch the latch block. (#2205)
Loop unswitching is unswitching the conditional branch that creates the
back-edge. In the version of the loop, where the bachedge is not taken,
there is no back-edge. This is what causes the validator to complain.

The solution I will go with will be to now unswitch a condition with a
back-edge. At this time we do not now if loop unswitching is used. We do
not include it in the optimization sets provided, nor is it used in
glslang's set. When there are opportunities and no breaks from the loop,
the loop with either be a single iteration loop, or an infinite loop.
There is no performance advantage to performing loop unswitching in
either of those cases. If there is a break, maintaining structured
control flow will be tricky. Unless we see a clear advantage to handling
these case, I would go with the safer simpler solution.

Fixes #2201.
2018-12-18 18:15:00 +00:00
Steven Perron
ff07c6df83
SSA-rewriter: make sure phi entries are unique. (#2206)
If there are multiple edges to a basic block, then the ssa rewriter will
create OpPhi instructions with duplicate entries.  This is invalid, and
it is fixed in this commit.

Fixes #2202.
2018-12-18 18:14:27 +00:00
Ryan Harrison
e0292c269d
Add --target-env flag to spirv-opt (#2216)
Fixes #2199
2018-12-17 16:54:23 -05:00
Steven Perron
c512c68640
Avoid GCC8 warning in text_handler.cpp. (#2197)
In the function `AssemblyContext::binaryEncodeString`, we want to copy
a nul terminated string to an instruction.  When coping the string, we
did not copy the nul at the end of the source.  It was added by setting
the entire last word to 0, which is mandated by the spir-v spec.  This
is not a bug, but it does trigger a warning in GCC8 when doing a release
build.

To avoid the warning, we will copy the nul character at the end of the
string too.

Fixes #1541.
2018-12-13 15:03:28 -05:00
Alastair Donaldson
2af6ffae82 Added test related to access chains, to be extended when issue 2183 is addressed. (#2192) 2018-12-12 09:06:54 -05:00
Alastair Donaldson
1cba9942bd Validate during reduction (#2194)
* Run validator during reduction.

* Added functionality to validate modules after each reduction step, and some tests to check this is working.  Also fixed an issue where reduction passes were not guaranteed to be executed at their minimum granularities.
2018-12-12 09:06:13 -05:00
Jeff Bolz
24328a0554 Recognize OpTypeAccelerationStructureNV as a type instruction (#2190) 2018-12-11 19:03:55 -05:00
Ryan Harrison
a719fc18a5 Disable checking that AtomicStorage capability is present (#2193)
There is inconsistencies between the different specs about whether or
not this capability is required/allowed, so tooling like glslang
currently ignores it. Once this is resolved the check and test can be
re-enabled.
2018-12-11 14:19:44 -05:00
Steven Perron
248debf55a Update CHANGES 2018-12-10 14:33:14 -05:00
Steven Perron
e07dabc25f
Invalidate the decoration manager at the start of ADCE. (#2189)
* Invalidate the decoration manager at the start of ADCE.

If the decoration manager is kept live the the contex will try to keep
it up to date.  ADCE deals with group decorations by changing the
operands in |OpGroupDecorate| instructions directly without informing
the decoration manager.  This puts it in an invalid state, which will
cause an error when the context tries to update it.  To Avoid this
problem, we will invalidate the decoration manager upfront.

At the same time, the decoration manager is now considered when checking
the consistency of the decoration manager.
2018-12-10 13:24:33 -05:00
Hugues Evrard
4aeadc0199 Add RemoveOpNameInstruction reduction pass (#2187)
Add a spirv-reduce pass which removes OpName and OpMemberName instructions.

This is useful to enable other reduction passes, e.g. RemoveUnreferencedInstruction may not be able to remove an instruction creating an id whose only usage is an OpName for this id.
2018-12-10 11:53:31 -05:00
Jeff Bolz
8fc8dfe4a5 Add PCH_FILE for upgrade_memory_model target. MSVC doesn't like building pass_utils.cpp twice in the same folder with different PCH settings. (#2186) 2018-12-10 10:54:19 -05:00