-
ac434668
by David Neto
at 2018-03-07T22:13:18Z
Start v2018.3 development
-
314cfa29
by Rex Xu
at 2018-03-08T13:54:00Z
Add missing SPV extension strings
-
340370ed
by David Neto
at 2018-03-08T17:25:49Z
Remove extension whitelist from some transforms
Remove extension whitelists from transforms that are essentially
combinatorial (and avoiding pointers) or which affect only control flow.
It's very very unlikely an extension will add a new control flow construct.
Remove from:
- dead branch elimination
- dead insertion elimination
- insert extract elimination
- block merge
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1392
-
5bd55f10
by Pierre Moreau
at 2018-03-12T13:56:14Z
Reimplement the DecorationManager
This reimplementation fixes several issues when removing decorations associated
to an ID (partially addresses #1174 and gives tools for fixing #898), as well
as making it easier to remove groups; a few additional tests have been added.
DecorationManager::RemoveDecoration() will still not delete dead decorations it
created, but I do not think it is its job either; given the following input
```
OpCapability Shader
OpCapability Linkage
OpMemoryModel Logical GLSL450
OpDecorate %2 Restrict
%2 = OpDecorationGroup
OpGroupDecorate %2 %1 %3
OpDecorate %4 Invariant
%4 = OpDecorationGroup
OpGroupDecorate %4 %2
%uint = OpTypeInt 32 0
%1 = OpVariable %uint Uniform
%3 = OpVariable %uint Uniform
```
which of the following two outputs would you expect RemoveDecoration(2) to produce:
```
OpCapability Shader
OpCapability Linkage
OpMemoryModel Logical GLSL450
%uint = OpTypeInt 32 0
%1 = OpVariable %uint Uniform
%3 = OpVariable %uint Uniform
```
or
```
OpCapability Shader
OpCapability Linkage
OpMemoryModel Logical GLSL450
OpDecorate %4 Invariant
%4 = OpDecorationGroup
%uint = OpTypeInt 32 0
%1 = OpVariable %uint Uniform
%3 = OpVariable %uint Uniform
```
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/924
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1174
-
077249b6
by Greg Fischer
at 2018-03-13T02:06:23Z
Fix InsertFeedingExtract rule when extract remains.
-
4065adf0
by Alan Baker
at 2018-03-13T23:38:31Z
Fixes #1404. Don't DCE workgroup size
Added test.
-
43d16091
by Alan Baker
at 2018-03-13T23:45:20Z
Fixes #1407. Removing assertion against void pointer
Added test
-
7e03e76a
by Alan Baker
at 2018-03-14T02:16:17Z
Fixes #1402. Don't merge non-branch terminators into loop header.
Added tests
-
88493336
by David Neto
at 2018-03-14T02:18:33Z
Teach DecorationManager about OpDecorateStringGOOGLE
Also add more decoration manager test coverage for OpDecorateId.
Fixes #1396
-
9f3a1c85
by Alan Baker
at 2018-03-14T21:45:47Z
NFC: Speed up dead insert phi traversal on Windows.
-
2e3aec23
by David Neto
at 2018-03-15T15:16:20Z
Add recent Google extensions to optimizer whitelists
Optimizations should work in the presence of recent
SPV_GOOGLE_decorate_string and SPV_GOOGLE_hlsl_functionality1
SPV_GOOGLE_decorate_string:
- Adds operation OpDecorateStringGOOGLE to decorate an object with decorations
having string operands.
SPV_GOOGLE_hlsl_functionality1:
- Adds HlslSemanticGOOGLE, used to decorate an interface variable with
an HLSL semantic string. Optimizations already preserve those variables
as required because they are interface variables (with uses), independent
of whether they have HLSL decorations.
- Adds HlslCounterBufferGOOGLE, used to associate a buffer with a
counter variable.
Fixes #1391
-
844e186c
by David Neto
at 2018-03-16T01:20:42Z
Add --strip-reflect pass
Strips reflection info. This is limited to decorations and
decoration instructions related to the SPV_GOOGLE_hlsl_functionality1
extension.
It will remove the OpExtension for SPV_GOOGLE_hlsl_functionality1.
It will also remove the OpExtension for SPV_GOOGLE_decorate_string
if there are no further remaining uses of OpDecorateStringGOOGLE.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1398
-
1ef6b192
by Lei Zhang
at 2018-03-17T19:25:26Z
Migrate to use unified grammar tables
Previously we keep a separate static grammar table for opcodes/
operands per SPIR-V version. This commit changes that to use a
single unified static grammar table for opcodes/operands.
This essentially changes how grammar facts are queried against
a certain target environment. There are only limited filtering
according to the desired target environment; a symbol is
considered as available as long as:
1. The target environment satisfies the minimal requirement of
the symbol; or
2. There is at least one extension enabling this symbol.
Note that the second rule assumes the extension enabling the
symbol is indeed requested in the SPIR-V code; checking that
should be the validator's work.
Also fixed a few grammar related issues:
* Rounding mode capability requirements are moved to client APIs.
* Reserved symbols not available in any extension is no longer
recognized by assembler.
-
b3daa93b
by Steven Perron
at 2018-03-19T17:49:04Z
Change merge return pass to handle structured cfg.
We are seeing shaders that have multiple returns in a functions. These
functions must get inlined for legalization purposes; however, the
inliner does not know how to inline functions that have multiple
returns.
The solution we will go with it to improve the merge return pass to
handle structured control flow.
Note that the merge return pass will assume the cfg has been cleanedup
by dead branch elimination.
Fixes #857.
-
bdf421cf
by Victor Lomuller
at 2018-03-20T14:21:10Z
Add loop peeling utility
The loop peeler util takes a loop as input and create a new one before.
The iterator of the duplicated loop then set to accommodate the number
of iteration required for the peeling.
The loop peeling pass that decided to do the peeling and profitability
analysis is left for a follow-up PR.
-
735d8a57
by Diego Novillo
at 2018-03-21T00:56:55Z
SSA rewrite pass.
This pass replaces the load/store elimination passes. It implements the
SSA re-writing algorithm proposed in
Simple and Efficient Construction of Static Single Assignment Form.
Braun M., Buchwald S., Hack S., Leißa R., Mallon C., Zwinkau A. (2013)
In: Jhala R., De Bosschere K. (eds)
Compiler Construction. CC 2013.
Lecture Notes in Computer Science, vol 7791.
Springer, Berlin, Heidelberg
https://link.springer.com/chapter/10.1007/978-3-642-37051-9_6
In contrast to common eager algorithms based on dominance and dominance
frontier information, this algorithm works backwards from load operations.
When a target variable is loaded, it queries the variable's reaching
definition. If the reaching definition is unknown at the current location,
it searches backwards in the CFG, inserting Phi instructions at join points
in the CFG along the way until it finds the desired store instruction.
The algorithm avoids repeated lookups using memoization.
For reducible CFGs, which are a superset of the structured CFGs in SPIRV,
this algorithm is proven to produce minimal SSA. That is, it inserts the
minimal number of Phi instructions required to ensure the SSA property, but
some Phi instructions may be dead
(https://en.wikipedia.org/wiki/Static_single_assignment_form).
-
3b594e16
by Jaebaek Seo
at 2018-03-21T01:30:06Z
Add --time-report to spirv-opt
This patch adds a new option --time-report to spirv-opt. For each pass
executed by spirv-opt, the flag prints resource utilization for the pass
(CPU time, wall time, RSS and page faults)
This fixes issue #1378
-
2e644e45
by Diego Novillo
at 2018-03-21T01:44:17Z
Fix VS2013 build failures.
-
dbb35c42
by Steven Perron
at 2018-03-21T20:47:01Z
Fixed remaining review comments from #1380
-
045cc8f7
by Eleni Maria Stea
at 2018-03-22T13:40:11Z
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.
-
fe9121f7
by Andrey Tuganov
at 2018-03-23T18:02:42Z
Add Vulkan validation rules for BuiltIn variables
Added a framework for validation of BuiltIn variables. The framework
allows implementation of flexible abstract rules which are required for
built-ins as the information (decoration, definition, reference) is not
in one place, but is scattered all over the module.
Validation rules are implemented as a map
id -> list<functor(instrution)>
Ids which are dependent on built-in types or objects receive a task
list, such as "this id cannot be referenced from function which is
called from entry point with execution model X; propagate this rule
to your descendants in the global scope".
Also refactored test/val/val_fixtures.
All built-ins covered by tests
-
9cf87ecb
by Andrey Tuganov
at 2018-03-26T16:06:25Z
Add Vulkan specific atomic result type restriction
Atomic instructions must declare a scalar 32-bit integer type for the “Result Type”.
-
0a8b6a96
by Andrew Woloszyn
at 2018-03-26T17:15:22Z
Replace an undefined double->float cast with infinity.
This was caught by UBSan. The given double would overflow
the underlying float, which is undefined. Instead test
with an explicit float::infinity.
-
c4dc0463
by Steven Perron
at 2018-03-26T18:44:41Z
Copy propagate arrays
The sprir-v generated from HLSL code contain many copyies of very large
arrays. Not only are these time consumming, but they also cause
problems for drivers because they require too much space.
To work around this, we will implement an array copy propagation. Note
that we will not implement a complete array data flow analysis in order
to implement this. We will be looking for very simple cases:
1) The source must never be stored to.
2) The target must be stored to exactly once.
3) The store to the target must be a store to the entire array, and be a
copy of the entire source.
4) All loads of the target must be dominated by the store.
The hard part is keeping all of the types correct. We do not want to
have to do too large a search to update everything, which may not be
possible, do we give up if we see any instruction that might be hard to
update.
Also in types.h, the element decorations are not stored in an std::map.
This change was done so the hashing algorithm for a Struct is
consistent. With the std::unordered_map, the traversal order was
non-deterministic leading to the same type getting hashed to different
values. See |Struct::GetExtraHashWords|.
Contributes to #1416.
-
5e07ab13
by Steven Perron
at 2018-03-27T15:04:49Z
Handle more cases in copy propagate arrays.
When we change the type of an object that gets stored, we do not want to
change the type of the memory location being stored to. In order to
still be able to do the rewrite, we will decompose and rebuild the
object so it is the type that can be stored.
Fixes #1416.
-
95843d7b
by Andrey Tuganov
at 2018-03-27T16:29:50Z
New spirv-1.3 rules for control barrier
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1427
Adjusting validation to the new rule:
"Before version 1.3, it is only valid to use this instruction with
TessellationControl, GLCompute, or Kernel execution models.
There is no such restriction starting with version 1.3."
Also fixed wrong version numbers in source/spirv_target_env.cpp.
-
97c8fdcc
by Alan Baker
at 2018-03-27T21:26:26Z
Adding OpPhi validation rules.
* Added tests
* Fixes SSA check for unreachable phi parents
* Fixes invalid cfg cleanup test
-
0a2ee65f
by Alan Baker
at 2018-03-28T13:04:08Z
Fixes #1403.
Don't validate composite insert, extract and construct instructions
against spec constant sized arrays.
* Added predicate for spec constant opcodes
* Added tests
-
c26866ee
by Steven Perron
at 2018-03-28T14:38:52Z
Preserve analyses after copy propagate arrays
Contributes to #1430.
-
ad7e4b84
by Stephen McGroarty
at 2018-03-28T20:34:23Z
Initial patch for scalar evolution analysis
This patch adds support for the analysis of scalars in loops. It works
by traversing the defuse chain to build a DAG of scalar operations and
then simplifies the DAG by folding constants and grouping like terms.
It represents induction variables as recurrent expressions with respect
to a given loop and can simplify DAGs containing recurrent _expression_ by
rewritting the entire DAG to be a recurrent _expression_ with respect to
the same loop.
-
d8ca0982
by Steven Perron
at 2018-03-29T00:23:47Z
Handle non-constant accesses in memory objects (copy prop arrays)
The first implementation of MemroyObject, which is used in copy
propagate arrays, forced the access chain to be like the access chains
in OpCompositeExtract. This excluded the possibility of the memory
object from representing an array element that was extracted with a
variable index. Looking at the code, that restriction is not
neccessary. I also see some opportunities for doing this in some real
shaders.
Contributes to #1430.
-
cbceecea
by Steven Perron
at 2018-03-29T13:39:55Z
In copy-prop-arrays, indentify copies via OpCompositeInsert
When the original code copies an entire array or struct one element at a
time, this turns into a series of OpCompositeInsert instruction followed
by a store of the whole array. We currently miss opportunities in copy
propagate arrays because we do not recognize this as a copy.
This commit adds code to copy propagate arrays to identify this code
pattern.
Also updates the performance passed to run array copy propagation.
-
ddbaf324
by Lei Zhang
at 2018-03-29T16:06:54Z
Use standard SPIR-V version scheme for version requirement
Previously we use symbols in spv_target_env as the minimum version
requirements for features. That makes version check implicitly
relies on the order of entries in the spv_target_env enum, which
also contains client APIs. Instead, we should use the standard
scheme for constructing SPIR-V version; and by doing that we can
also map client API entries to universial SPIR-V versions.
-
fc9f621e
by Lei Zhang
at 2018-03-30T15:30:25Z
Add missing <iterator> header for std::back_inserter
-
6dd5e955
by James Jones
at 2018-04-03T14:10:43Z
Add missing function parameters in libspirv.h
When building C code with gcc and the
-Wstrict-prototypes option, function declarations
and definitions that don't specify their argument
types generate warnings. Functions that don't
take parameters need to specify (void) as their
parameter list, rather than leaving it empty.
Note this only applies to C, so only the functions
exported in C-compatible headers need fixing. In
C++ functions can't be declared/defined without a
parameter list, so C++ can safely allow an empty
parameter list to imply (void).
-
57a24417
by Neil Roberts
at 2018-04-03T16:53:10Z
hex_float: Use max_digits10 for the float precision
CPPreference.com has this description of digits10:
“The value of std::numeric_limits<T>::digits10 is the number of
base-10 digits that can be represented by the type T without change,
that is, any number with this many significant decimal digits can be
converted to a value of type T and back to decimal form, without
change due to rounding or overflow.”
This means that any number with this many digits can be represented
accurately in the corresponding type. A change in any digit in a
number after that may or may not cause it a different bitwise
representation. Therefore this isn’t necessarily enough precision to
accurately represent the value in text. Instead we need max_digits10
which has the following description:
“The value of std::numeric_limits<T>::max_digits10 is the number of
base-10 digits that are necessary to uniquely represent all distinct
values of the type T, such as necessary for
serialization/deserialization to text.”
The patch includes a test case in hex_float_test which tries to do a
round-robin conversion of a number that requires more than 6 decimal
places to be accurately represented. This would fail without the
patch.
Sadly this also breaks a bunch of other tests. Some of the tests in
hex_float_test use ldexp and then compare it with a value which is not
the same as the one returned by ldexp but instead is the value rounded
to 6 decimals. Others use values that are not evenly representable as
a binary floating fraction but then happened to generate the same
value when rounded to 6 decimals. Where the actual value didn’t seem
to matter these have been changed with different values that can be
represented as a binary fraction.
-
efb41541
by Jeff Bolz
at 2018-04-03T16:56:38Z
Add SPV_NV_shader_subgroup_partitioned to EXTENSIONS_FROM_SPIRV_REGISTRY
-
e64a4656
by Steven Perron
at 2018-04-04T17:42:35Z
Teach the private to local about OpImageTexelPointer.
OpImageTexelPointer acts like a special kind of load. It is still
safe to change the storage class of a variable used in a
OpImageTexalPointer instruction.
Contributes to #1445.
-
c33af632
by Steven Perron
at 2018-04-04T17:42:51Z
Teach array copy propagation about OpImageTexelPointer.
OpImageTexelPointer acts like a special kind of load. It is not an
array load, but it also cannot be removed the same way a regular
load can. The type of propagation that needs to be done is similar
to what we do for arrays, so I want to merge that code into that
optmization.
Contributers to #1445.
-
7c5d49bf
by Steven Perron
at 2018-04-04T17:45:29Z
Teach ADCE about OpImageTexelPointer
Currently OpImageTexelPointer operations are treat like a use of the
pointer, but it does
not look for the memory being referenced to make sure stores are not
removed.
This change teaches it so identify the memory being accessed, and
treats it as if that memory is loaded.
Fixes to #1445.
-
74245496
by Steven Perron
at 2018-04-05T02:24:10Z
OpName and decorations should not stop array copy prop.
-
da332cf3
by Andrey Tuganov
at 2018-04-05T15:55:42Z
Execution mode/model available in validation state
Refactored validate built-ins to make
GetExecutionModels(entry_point)
and
GetExecutionModes(entry_point)
available in validation state.
Entry points are allowed to have multiple execution modes and execution
models.
Finished the last missing feature in Vulkan built-ins validation:
FragDepth requires DepthReplacing.
-
691eed92
by Andrey Tuganov
at 2018-04-05T17:45:45Z
Fix major bug in validate_builtins
Fixed an early return in the loop, resulting in only one decoration
being checked.
-
d7fff408
by Andrey Tuganov
at 2018-04-05T17:55:18Z
Fix bug validate_builtins (additional def checks)
At every definition of a builtin id, run at-reference-check rules on the
defining instruction as well.
Previosly the validation was missing the case when invalid storage class
was defined in the instruction which defines the built-in, and not in
the instruction which references the built-in.
-
43ca2112
by Lei Zhang
at 2018-04-05T19:14:07Z
Stop asking for extensions if feature avaiable in core SPIR-V
Migrating to unified grammar means we sometimes have two fields
for a certain feature: version and extensions. It means the feature
in question can be used either in SPIR-V of advanced-enough
versions or in any SPIR-V with with the specified extensions.
Validator now respects the above rules.
-
082b8b08
by David Neto
at 2018-04-05T22:36:08Z
More automatic extension support
Update grammar table generation:
- Get extensions from instructions, not just operand-kinds
- Don't explicitly list extensions that come from the SPIR-V core
grammar or from a KHR extended instruction set grammar.
This makes it easier to support new extensions since the recommended
extension strategy is to add instructions to the core grammar file.
Also, test the validator has trivial support for passing through
the extensions SPV_NV_shader_subgroup_partitioned and
SPV_EXT_descriptor_indexing.
-
caf7da87
by Pierre Moreau
at 2018-04-06T13:55:54Z
linker: Properly remove FuncParamAttr from imported symbols
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/898
-
e66e305b
by Alan Baker
at 2018-04-06T14:51:57Z
Re-enabled checks for UConvert
-
6f80608b
by David Neto
at 2018-04-06T17:33:24Z
Test asm/dis support for SPV_NV_shader_subgroup_partitioned
-
e025145c
by David Neto
at 2018-04-06T17:33:34Z
Test asm/dis support for SPV_EXT_descriptor_indexing
-
6fbfe1c0
by GregF
at 2018-04-06T19:17:52Z
Fix SSA rewrite for nested loops.
>From the test case, the slice of the CFG that is interesting for the bug
is
25
|
v
30
|
v
31<-+
| |
v |
34--+
1. In block 25, we have a Phi candidate for %f with arguments
%47 = Phi[%float_0, %0]. This merges %float_0 and a yet unknown
argument from the external loop backedge.
2. We are now processing block 34:
i. The load %35 = OpLoad %f triggers a Phi candidate to be placed in
block 31.
ii. The Phi candidate %50 = Phi needs two arguments. The one coming
from block 30 is %47. But the one coming from block 34 (which we
are now processing and have marked sealed), finds %50 itself as
the reaching def for %f.
3. This wrongfully marks %50 as a copy-of Phi, which ultimately makes
both %47 and %50 copy-of Phis that get eliminated.
-
a91cbfbf
by David Neto
at 2018-04-06T19:56:20Z
Optimizer: update extension whitelists
Add two new extensions:
- SPV_NV_shader_subgroup_partitioned
- SPV_EXT_descriptor_indexing
-
5f53c42a
by David Neto
at 2018-04-06T20:42:56Z
Update CHANGES
-
26a698c3
by Lei Zhang
at 2018-04-07T02:38:32Z
Fix PrimitiveId builtin check for Vulkan
According to Vulkan spec 1.1.72:
> The PrimitiveId decoration must be used only within fragment,
> tessellation control, tessellation evaluation, and geometry shaders.
> In a tessellation control or tessellation evaluation shader, any
> variable decorated with PrimitiveId must be declared using the Input
> storage class.
We were enforcing that PrimitiveId can only be used with Output
storage class for TCS and TES before.
-
42840d15
by Alan Baker
at 2018-04-07T02:41:50Z
Fixes #1433. Validate binary version
* Validates SPIR-V binary version against target environment
-
3020104f
by Alan Baker
at 2018-04-09T13:02:50Z
Adding tests for OpenCL 1.2 and embedded profiles
-
53bc1623
by Steven Perron
at 2018-04-10T17:09:37Z
Fold OpDot
Adding three rules to fold OpDot (implemented as two).
- When an OpDot has two constants, then fold to the resulting const.
- When one of the inputs is the 0 vector, then fold to zero.
- When one of the inputs is a single 1 with 0s, then rewrite to an
OpCompositeExtract of the appropriate element. This will help find
even more folding opportunities.
Contributes to #709.
-
61b50b3b
by Alexander Johnston
at 2018-04-11T13:32:42Z
ZIV and SIV loop dependence analysis.
Provides functionality to perform ZIV and SIV dependency analysis tests
between a load and store within the same loop.
Dependency tests rely on scalar analysis to prove and disprove dependencies
with regard to the loop being analysed.
Based on the 1990 paper Practical Dependence Testing by Goff, Kennedy, Tseng
Adds support for marking loops in the loop nest as IRRELEVANT.
Loops are marked IRRELEVANT if the analysed instructions contain
no induction variables for the loops, i.e. the loops induction
variable is not relevent to the dependence of the store and load.
-
10e5d7cf
by Victor Lomuller
at 2018-04-11T14:41:29Z
Add a loop peeling pass.
For each loop in a function, the pass walks the loops from inner to outer most loop
and tries to peel loop for which a certain amount of iteration can be done before or after the loop.
To limit code growth, peeling will not happen if the growth in code size goes above a configurable threshold.
-
c584ac4f
by Steven Perron
at 2018-04-11T16:02:30Z
Don't allow an instance of a pass to be run multiple times.
-
bc648fd7
by Steven Perron
at 2018-04-11T19:40:33Z
Delete unused code in MemPass
Since the SSA rewriter was added, the code old phi insertion code is no
longer used. It is going stale and should be deleted.
-
c522b697
by Alan Baker
at 2018-04-12T13:22:34Z
Fixes #1470. Don't restrict WGS storage class
* Removed restriction that workgroup size can only be on Input storage
class
* added test
-
c3ee2105
by Alan Baker
at 2018-04-12T17:11:52Z
Fixes #1471. Adds missing environments to spriv-val help
* spirv-val: Added environments referenced in --version,
but not mentioned in --help
-
e805d1f8
by Alan Baker
at 2018-04-12T17:16:04Z
Fixes #1469. Allow subgroup memory scope for Vulkan 1.1
* New error that prevents CrossDevice memory scope for all vulkan
* Old error specifically references Vulkan 1.0
* New tests
-
8190c262
by Steven Perron
at 2018-04-13T13:53:37Z
Change parameter to Mempass::RemovePhiOperands
Pass a hashtable by const ref instead of by value. Big impact on
compile time.
-
d42f65e7
by Steven Perron
at 2018-04-13T20:38:02Z
Use a bit vector in ADCE
The unordered_set in ADCE that holds all of the live instructions takes
a very long time to be destroyed. In some shaders, it takes over 40% of
the time.
If we look at the unique ids of the live instructions, I believe they
are dense enough make a simple bit vector a good choice for to hold that
data. When I check the density of the bit vector for larger shaders, we
are usually using less than 4 bytes per element in the vector, and
almost always less than 16.
So, in this commit, I introduce a simple bit vector class, and
use it in ADCE.
This help improve the compile time for some shaders on windows by the
40% mentioned above.
Contributes to https://github.com/KhronosGroup/SPIRV-Tools/issues/1328.
-
e8814be7
by David Neto
at 2018-04-16T14:27:51Z
Add validator test for OpBranch
Add test for case where OpBranch branches to a value (a function value).
Previous tests only checked a label value (name of a block.).
Update validate_id.cpp to remove the TODO for OpBranch and say that it
is already checked in validate_cfg.cpp
-
a3bb7827
by Lei Zhang
at 2018-04-16T14:44:42Z
Travis CI: change to use the default email notification behavior
-
7fe18647
by Rex Xu
at 2018-04-16T14:49:01Z
Fix validation issues relevant to SPV_AMD_gpu_shader_int16.
Frexp/FrexpStruct allows exp to be either 16-bit or 32 bit integer if
SPV_AMD_gpu_shader_int16 is enabled.
-
0e80b86d
by Alan Baker
at 2018-04-16T16:58:35Z
Fixes #1472. Per-vertex variable validation fixes.
Relaxs checks for per-vertex builtin variables. If the builtin
decoration is applied to a variable, then those checks now allow a level
of arraying on the variable before checking the type consistency.
* Allows arrays of variables to be present for the per-vertex variables:
* Position
* PointSize
* ClipDistance
* CullDistance
* Updated tests
-
152b9a68
by David Neto
at 2018-04-17T14:24:30Z
ADCE: Remove OpDecorateStringGOOGLE
Also fix a few failures to set "modified" status when removing
global values.
Add OpDecorateStringGOOGLE to decoration ordering
Fixes #1492
-
38359ba8
by Alan Baker
at 2018-04-17T14:26:38Z
Fixes #1483. Validating Vulkan 1.1 barrier execution scopes
* Reworked how execution model limitations are checked
* Now OpFunction checks which entry points call it and checks its
registered limitations instead of building a call stack in the entry
point
* New tests
* Moving function to entry point mapping into VState
-
79491259
by Jaebaek Seo
at 2018-04-17T16:08:45Z
Add constant folding for FNegate
-
d8b9306a
by Jaebaek Seo
at 2018-04-17T16:08:45Z
Add more unit tests
-
ff92339f
by Jaebaek Seo
at 2018-04-17T16:12:48Z
Format
-
0f335cf8
by Toomas Remmelg
at 2018-04-17T17:57:02Z
Add support for MIV and Delta test dependence analysis.
GCD MIV test as described in Chapter 3 of "Optimizing Compilers for
Modern Architectures: A Dependence-Based Approach" by Randy Allen, and
Ken Kennedy.
Delta test as described in Figure 3 of "Practical Dependence Testing" by
Gina Goff, Ken Kennedy, and Chau-Wen Tseng from PLDI '91.
-
3c5bd266
by Jaebaek Seo
at 2018-04-17T18:13:19Z
Typo
-
0fa42996
by Jaebaek Seo
at 2018-04-18T17:46:10Z
Merge pull request #1461 from jaebaek/fnegate
Add constant folding for OpFNegate
Contributes to #709
-
c20a718e
by Steven Perron
at 2018-04-18T20:38:18Z
Rewrite local-single-store-elim to not create large data structures.
The local-single-store-elim algorithm is not fundamentally bad.
However, when there are a large number of variables, some of the
maps that are used can become very large. These large data structures
then take a very long time to be destroyed. I've seen cases around 40%
if the time.
I've rewritten that algorithm to not use as much memory. This give a
significant improvement when running a large number of shader through
DXC.
I've also made a small change to local-single-block-elim to delete the
loads that is has replaced. That way local-single-store-elim will not
have to look at those. local-single-store-elim now does the same thing.
The time for one set goes from 309s down to 126s. For another set, the
time goes from 102s down to 88s.
-
430a2933
by Jaebaek Seo
at 2018-04-19T13:36:10Z
Fix broken pointer of CommonUniformElimPass
-
df7f00f6
by Greg Fischer
at 2018-04-19T18:40:00Z
DeadInsertElim: Don't revisit select phi nodes during MarkInsertChain
Fixes #1487.
-
1c89da46
by GregF
at 2018-04-19T19:34:15Z
Test/DependencyAnalysis: Fix uninitialized variables
-
e7c2e91d
by David Neto
at 2018-04-19T20:33:12Z
Fix for old XCode: std::set has explicit ctor
-
09c206b6
by Alan Baker
at 2018-04-20T13:25:00Z
Fixes #1480. Validate group non-uniform scopes.
* Adds new pass for validating non-uniform group instructions
* Currently on checks execution scope for Vulkan 1.1 and SPIR-V 1.3
* Added test framework
-
0ec08c28
by Victor Lomuller
at 2018-04-20T13:45:15Z
Add register liveness analysis.
For each function, the analysis determine which SSA registers are live
at the beginning of each basic block and which one are killed at
the end of the basic block.
It also includes utilities to simulate the register pressure for loop
fusion and fission.
The implementation is based on the paper "A non-iterative data-flow
algorithm for computing liveness sets in strict ssa programs" from
Boissinot et al.
-
48802bad
by Jaebaek Seo
at 2018-04-20T17:43:04Z
Constant folding for OpVectorTimesScalar
-
efc50619
by Victor Lomuller
at 2018-04-20T19:41:59Z
Dominator analysis interface clean.
Remove the CFG requirement when querying a dominator/post-dominator from an IRContext.
Updated all uses of the function and tests.
-
7a592835
by David Neto
at 2018-04-20T19:58:01Z
Another fix for old XCode: std::set explicit ctor in test code
-
2c0ce872
by Steven Perron
at 2018-04-23T15:13:07Z
Vector DCE (#1512)
Introduce a pass that does a DCE type analysis for vector elements
instead of the whole vector as a single element.
It will then rewrite instructions that are not used with something else.
For example, an instruction whose value are not used, even though it is
referenced, is replaced with an OpUndef.
-
ee8cd5c8
by Steven Perron
at 2018-04-24T14:10:30Z
Add Dead insert elmination back in.
-
268be614
by Greg Fischer
at 2018-04-25T14:30:18Z
LocalSingleBlockElim: Add store-store elimination
Eliminate unused store to variable if followed by store to same
variable in same block.
Most significantly, this cleans up stores made unused by this pass.
These useless stores can inhibit subsequent optimizations, specifically
LocalSingleStoreElim. Eliminating them makes subsequent optimization more
effective.
The main effect of this pass is to simplify the work done by the SSA
rewriter. It catches many local loads/stores that help speeding up the
work done by the main rewriter.
-
72524db2
by Cort Stratton
at 2018-04-26T02:03:14Z
Fixes #1521: PadToWord() should use std::move() in && variant
-
28137229
by Steven Perron
at 2018-04-26T15:07:48Z
Improvements to vector dce.
Track live scalars in VDCE as if they were single element vectors.
Handle the extended instructions for GLSL in VDCE.
Handle composite construct instructions in VDCE.
Fixes #1511.
-
e1bcd2b2
by Steven Perron
at 2018-04-26T16:41:16Z
Fold OpVectorTimesScalar and OpPhi better.
If one of the operands to an OpVectorTimesScalar instruction is zero,
then the result will be the 0 vector. Currently we do not fold the
insturction unless both operands are constants. This change fixes that.
We also allow folding of OpPhi instructions where the incoming values
are either an OpUndef or the OpPhi instruction itself. As with other
cases, this can be simplified to the OpUndef.
-
4246abdc
by Alan Baker
at 2018-04-27T13:42:37Z
Fixes handling of kill and unreachable ops in inlining.
Fixes #1527
* Adds handling for copying OpKill and OpUnreachable and forces the
generation of a new basic block
* Adds tests to check
-
a00a0a09
by Steven Perron
at 2018-04-27T14:33:19Z
Revert "Improvements to vector dce."
This reverts commit 2813722993d17a827497b8f627858e687adebbda.
A regression was found. Undoing the change until it is fixed.
-
9ba0879d
by Steven Perron
at 2018-04-30T15:55:50Z
Improve Vector DCE
Track live scalars in VDCE as if they were single element vectors.
Handle the extended instructions for GLSL in VDCE.
Handle composite construct instructions in VDCE.
-
9a5dd6fe
by Stephen McGroarty
at 2018-05-01T19:15:10Z
Support loop fission.
Adds support for spliting loops whose register pressure exceeds a user
provided level. This pass will split a loop into two or more loops given
that the loop is a top level loop and that spliting the loop is legal.
Control flow is left intact for dead code elimination to remove.
This pass is enabled with the --loop-fission flag to spirv-opt.
-
1dc24580
by Toomas Remmelg
at 2018-05-01T19:40:37Z
Add a loop fusion pass.
This pass will look for adjacent loops that are compatible and legal to
be fused.
Loops are compatible if:
- they both have one induction variable
- they have the same upper and lower bounds
- same initial value
- same condition
- they have the same update step
- they are adjacent
- there are no break/continue in either of them
Fusion is legal if:
- fused loops do not have any dependencies with dependence distance
greater than 0 that did not exist in the original loops.
- there are no function calls in the loops (could have side-effects)
- there are no barriers in the loops
It will fuse all such loops as long as the number of registers used for
the fused loop stays under the threshold defined by
max_registers_per_loop.
-
98434847
by Diego Novillo
at 2018-05-01T21:46:47Z
Fix build.
-
70bb3c1c
by Steven Perron
at 2018-05-02T14:18:37Z
Fold divide and multiply by same value.
We want to fold code like (x*y)/x and other permutations of this.
Fixes #1531.
-
1c2cbaf5
by Stephen McGroarty
at 2018-05-03T18:30:41Z
Add GetContinueBlock to loop class.
Previously, the loop class used the terms latch and continue block
interchangeably. This patch splits the two and corrects and tests some
uses of the old uses of GetLatchBlock.
-
7d016431
by Steven Perron
at 2018-05-04T16:56:29Z
Allow hoisting code in if-conversion.
When doing if-conversion, we do not currently move code out of the side
nodes. The reason for this is that it can increase the number of
instructions that get executed because both side nods will have to be
executed now.
In this commit, we add code to move an instruction, and all of the
instructions it depends on, out of a side node and into the header of
the selection construct. However to keep the cost down, we only do it
when the two values in the OpPhi node compute the same value. This way
we have to move only one of the instructions and the other becomes
unused most of the time. So no real extra cost.
Makes the value number table an alalysis in the ir context.
Added more opcodes to list of code motion safe opcodes.
Fixes #1526.
-
0856997d
by Steven Perron
at 2018-05-05T13:15:28Z
Allow ADCE to remove more instructions.
At this time, DCE will only remove an instruction if it is a combinator.
However, there are certain non-combinator instructions that can be
safely removed if their results are not used. The derivative
instructions are on example.
We are also missing some instructions from the list of combinators
those are added as the same time.
-
9ec3f81e
by Steven Perron
at 2018-05-09T20:07:26Z
Remove dead Workgroup variables in ADCE.
If there is a shader with a variable in the workgroup storage class that
is stored to, but not loadeds, then we know nothing will read those
loads. It should be safe to remove them.
This is implemented in ADCE by treating workgroup variables the same
way that private variables are treated.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1550.
-
e9cda702
by Lei Zhang
at 2018-05-10T20:32:59Z
Adjust tests according to grammar change
* ConstOffsets now requires ImageGatherExtended
* Int8 does not require Kernel anymore
-
804e8884
by Steven Perron
at 2018-05-14T14:27:49Z
Fold fclamp feeding compare.
An FClamp instruction forces a values to be within a certain interval.
When the upper or lower bound of the FClamp is a constant and the value
being compared with is a constant, then in some case we can fold the
compared because the entire range is say less than the value.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1549.
-
af430ec8
by Steven Perron
at 2018-05-14T19:40:34Z
Add pass to fold a load feeding an extract.
We have already disabled common uniform elimination because it created
sequences of loads an entire uniform object, then we extract just a
single element. This caused problems in some drivers, and is just
generally slow because it loads more memory than needed.
However, there are other way to get into this situation, so I've added
a pass that looks specifically for this pattern and removes it when only
a portion of the load is used.
Fixes #1547.
-
f46f2d3e
by Steven Perron
at 2018-05-15T14:24:05Z
Remove redundant stores.
The code patterns generated by DXC around function calls can cause many
store to be storing the same value that was just loaded from the same
location:
```
%10 = OpLoad %type %var
OpStore %var %10
```
We want to clean these up very early on because they can cause other
transformations to do a lot of work. For the cases I see, they can be
removed during local-single-block-elim.
For one set of shaders the compile time goes from 248s to 182s. A 26%
improvement.
Part of https://github.com/KhronosGroup/SPIRV-Tools/issues/1494.
-
18ad1be7
by alan-baker
at 2018-05-15T16:23:27Z
Fixing MacOS compiler error
-
efcc33e8
by Lei Zhang
at 2018-05-16T12:43:50Z
Support SpvOpExecutionModeId in SPIR-V logical layout
-
0e1b7e5a
by Steven Perron
at 2018-05-16T13:34:43Z
Fix getting operand without checking opcode.
Fixes https://github.com/KhronosGhttps://github.com/KhronosGroup/SPIRV-Tools/issues/1559roup/SPIRV-Tools/issues/1559.
There is an load of an operand of an instruction that was suppose to be
only for the OpCompositeExtract case. However, an error caused it to
be loaded for every opcode, even those that do not have an operand in
that position.
We fix up that bug, and a couple other things noticed that the same
time.
-
9b1a938e
by Steven Perron
at 2018-05-16T14:48:25Z
SROA: Only create symbols that are loaded.
Currently in scalar replacement, we create a new variable for every
memeber of the composite being divided. It is often overkill, because
not all of those members will be used. This change will check which
elements are used and only create variable for the members that are
used.
This reduces the compile time for one set of shader from 248s to 165s.
Part of https://github.com/KhronosGroup/SPIRV-Tools/issues/1494.
-
b09e3ce8
by Lei Zhang
at 2018-05-16T17:16:27Z
Allow ViewportIndex & Layer to be used in VS/DS with extension
SPV_EXT_shader_viewport_index_layer enables using ViewportIndex
and Layer in vertex and tessellation shaders.
Also, as per the Vulkan spec:
> The ViewportIndex decoration must be used only within vertex,
> tessellation evaluation, geometry, and fragment shaders.
> In a vertex, tessellation evaluation, or geometry shader, any
> variable decorated with ViewportIndex must be declared using
> the Output storage class.
> In a fragment shader, any variable decorated with ViewportIndex
> must be declared using the Input storage class.
Similarly for Layer.
-
f1f7cc87
by Steven Perron
at 2018-05-16T17:50:47Z
Get ADCE to handle OpCopyMemory
ADCE does not treat OpCopyMemory as an instruction that references
memory. Because of that stores are removed that should not be.
This change teaches ADCE that OpCopyMemory and OpCopyMemorySize both
loads from and stores to memory. This will keep other stores live when
needed, and will allows ADCE to remove OpCopyMemory instructions as
well.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1556.
-
a579e720
by Steven Perron
at 2018-05-18T14:03:46Z
Remove the limit on struct size in SROA.
Removes the limit on scalar replacement for the lagalization passes.
This is done by adding an option to the pass (and command line option)
to set the limit on maximum size of the composite that scalar
replacement is willing to divide.
Fixes #1494.
-
3b87dac5
by dan sinclair
at 2018-05-23T12:17:39Z
Validate presence of OpMemoryModel.
According to the SPIR-V Spec, section 2.4 Logical Layout of a Module there
should be a single required OpMemoryModel instruction provided. This CL adds
validation that OpMemoryModel is provided to the SPIR-V validator.
Fixes #1207
-
0a14a1f7
by dan sinclair
at 2018-05-24T12:43:14Z
Validate that only a single OpMemoryModel is provided.
This CL adds validation that only a single OpMemoryModel is provided in the
SPIR-V binary.
Fixes #1574
-
f765d16b
by Arseny Kapoulkine
at 2018-05-25T13:19:43Z
Add external interface for creating a pass token
Currently it's impossible for external code to register a pass because
the only source file that can create pass tokens is optimizer.cpp. This
makes it hard to add passes that can't be upstreamed since you can't run
them from the usual pass sequence without reimplementing Optimizer.
This change adds a PassToken constructor that takes unique_ptr to
opt::Pass; if out-of-tree code implements opt::Pass it can register a
custom pass without having to add it to SPIRV-Tools source code.
-
745dd00a
by Steven Perron
at 2018-05-25T18:42:59Z
Fold FMix feeding Extract, and use the simplification pass.
We add a new rule to the folding rules to fold an FMix feeding an
extract when the alpha value for the element being extracted is either
0 or 1. In those case, we can simple extract from one of the operands
to the FMix.
With that change the simplification pass completely subsumes the
insert-extract elimination pass. So we remove the insert-extract
elimination passes and replce them with calls to the simplification
pass.
In a follow up PR, we should delete the insert-extract elimination pass.
Contributes to https://github.com/KhronosGroup/SPIRV-Tools/issues/1570.
-
6a986d02
by David Neto
at 2018-05-26T01:58:26Z
Update CHANGES
-
545d6ca2
by David Neto
at 2018-05-26T02:12:25Z
Finalize v2018.3
-
6b83643c
by David Neto
at 2018-05-26T02:14:30Z
Start v2018.4-dev
-
93c4c184
by Steven Perron
at 2018-05-30T19:48:38Z
Handle types with self references.
By using forward pointers, we are able to define a struct that has a
pointer to itself. This could be directly or indirectly. The current
implementation of the type manager did not handle this case. There are
three changes that are made in this commit inorder to handle this case:
1) Change the handling of OpTypeForwardPointer
The current handling of OpTypeForwardsPointer is broken if there is a
reference to the pointer before the real definition. When build the
type that contain the forward delared pointer, the type manager will ask
for the type for that ID, and will get a nullptr because it does not
exists. This nullptr is not handleded very well.
The change is to keep track of the incomplete types the first time
through all of the types. An incomplete type is a ForwardPointer or any
type that references an incomplete type.
Then we implement a second pass through the incomplete types that will
complete them.
2) Hashing types.
When hashing a type, we want to uses all of the subtypes as part of the
hash. However, with types that reference them selves, this creates an
infinite recursion. To get around this, we keep track of which types
have been seen on the path from the root type. If we have see the
current type already then we can stop the recursion.
3) Comparing types.
In order to check if two types are the same, we must check that all of
their subtypes are the same as well. This also causes an infinit
recursion. The solution is to stop comparing the subtypes if we are
trying to compare two pointer types that we are already in the middle of
comparing. The ideas is that if the two pointer are different, then in
progress compare will return false itself.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1578.
-
badcf73d
by Alan Baker
at 2018-05-31T13:14:38Z
Allow duplicate pointer types
Fixes #1577
* Remove validation requiring unique pointer types unless variable
pointers extension enabled
* Modified scalar replacement to always look for an undecorated pointer
-
9a008835
by Steven Perron
at 2018-06-01T13:44:42Z
Add store for var initializer in inlining.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1591.
-
fe2fbee2
by Steven Perron
at 2018-06-01T14:13:39Z
Delete the insert-extract-elim pass.
Replaces anything that creates an insert-extract-elim pass and create
a simplifiation pass instead. Then delete the implementation of the
pass.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1570.
-
a1f9e134
by Steven Perron
at 2018-06-04T17:48:30Z
Preserve inst-to-block and def-use in passes.
The following passes are updated to preserve the inst-to-block and
def-use analysies:
private-to-local
aggressive dead-code elimination
dead branch elimination
local-single-block elimination
local-single-store elimination
reduce load size
compact ids (inst-to-block only)
merge block
dead-insert elimination
ccp
The one execption is that compact ids still kills the def-use manager.
This is because it changes so many ids it is faster to kill and rebuild.
Does everything in
https://github.com/KhronosGroup/SPIRV-Tools/issues/1593 except for the
changes to merge return.
-
e3f1f3bd
by dan sinclair
at 2018-06-05T13:11:35Z
Disallow array-of-arrays with DescriptorSets when validating. (#1586)
* Disallow array-of-arrays with DescriptorSets when validating.
This CL adds validation to disallow using an array-of-arrays when attached to a
DescriptorSet.
Fixes #1522
-
f2c93c6e
by dan sinclair
at 2018-06-07T00:27:43Z
Revert "Disallow array-of-arrays with DescriptorSets when validating. (#1586)" (#1607)
This reverts commit e3f1f3bda51387626094b054a19973c3d25b62dc.
-
63c9bba5
by dan sinclair
at 2018-06-07T02:08:27Z
[val] Output id names along with numbers in validate_id (#1601)
This CL updates the validate_id code to output the name of the object along with
the id number. There were a few instances which already output the name, this
just extends to all of them. Now, the output should say 123[obj] instead of just
123.
Issue #1581
-
035afb89
by David Neto
at 2018-06-11T15:08:52Z
Update CHANGES
-
06de8686
by Alan Baker
at 2018-06-11T23:23:44Z
Check for invalid branches into construct body.
Fixes #1281
* New structured cfg check: all non-construct header blocks'
predecessors must come from within the construct
* New function to calculate blocks in a construct
* Fixed a bug in BasicBlock type bitset
Relaxing check to not consider unreachable predecessors
* Fixing broken common uniform elim test
-
363bfca2
by David Neto
at 2018-06-11T23:27:52Z
Operand lookup succeeds if it's enabled by a capability
- Fix tests for basic group operations (e.g. Reduce) to allow for
new capabilities in SPIR-V 1.3 that enable them.
- Refactor operand capability check to avoid code duplication and
to put all checks that don't need table lookup before any table
lookup.
- Test round trip assembly/disassembly support for extension
SPV_NV_viewport_array2
- Test assembly and validation of decoration ViewportRelativeNV
Fixes #1596
-
700ebd34
by David Neto
at 2018-06-12T13:48:42Z
Make fewer test executables
Try to reduce the amount of disk space used by especially by debug builds,
which may be contributing to AppVeyor failures.
Collapses tests in categories:
- validator
- loop optimizations
- dominator analysis
- linker
Contributes to #1615
-
1f7b1f1b
by Steven Perron
at 2018-06-12T17:41:08Z
Small vector optimization for operands.
We replace the std::vector in the Operand class by a new class that does
a small size optimization. This helps improve compile time on Windows.
Tested on three sets of shaders. Trying various values for the small
vector. The optimal value for the operand class was 2. However, for
the Instruction class, using an std::vector was optimal. Size of "0"
means that an std::vector was used.
Instruction size
0 4 8
Operand Size
0 489 544 684
1 593 487
2 469 570
4 473
8 505
This is a single thread run of ~120 shaders. For the multithreaded run
the results were the similar. The basline time was ~62sec. The
optimal configuration was an 2 for the OperandData and an
std::vector for the OperandList with a compile time of ~38sec. Similar
expiriments were done with other sets of shaders. The compile time still
improved, but not as much.
Contributes to https://github.com/KhronosGroup/SPIRV-Tools/issues/1609.
-
b49cbf09
by David Neto
at 2018-06-13T14:18:04Z
Fix buffer read overrun in linker
Fixes an ASAN failure.
Was occuring when generating the OpModuleProcessed instruction declaring
that this module was processed by the linker.
-
4f866abf
by Alan Baker
at 2018-06-13T14:56:14Z
Validate static uses of interfaces
Fixes #1120
Checks that all static uses of the Input and Output variables are listed
as interfaces in each corresponding entry point declaration.
* Changed validation state to track interface lists
* updated many tests
* Modified validation state to store entry point names
* Combined with interface list and called EntryPointDescription
* Updated uses
* Changed interface validation error messages to output entry point name
in addtion to ID
-
ea7239fa
by Alan Baker
at 2018-06-13T19:04:47Z
Structured switch checks
Fixes #491
* Basic blocks now have a link to the terminator
* Check all case sepecific rules
* Missing check for branching into the middle of a case (#1618)
-
d3ed9982
by dan sinclair
at 2018-06-19T13:32:20Z
Validate Ids before DataRules. (#1622)
Validate Ids before DataRules.
The DataRule validators call FindDefs with the assumption that they
definitions being looked at can be found. This may not be true if we
have not validated identifiers first.
This CL flips the IdPass and DataRulesPass to fix this issue.
-
c4304ea0
by dan sinclair
at 2018-06-19T19:14:17Z
Reland "Disallow array-of-arrays with DescriptorSets when validating. (#1586)"
This CL reverts the revert of 'Disallow array-of-arrays with DescriptorSets when
validating." Other changes have been committed which should aleviate the
AppVeryor resource constraints.
This reverts commit f2c93c6e124836797311facb8449f9a0b76fefc2.
This CL adds validation to disallow using an array-of-arrays when attached to a
DescriptorSet.
Fixes #1522
-
356193ea
by dan sinclair
at 2018-06-19T20:01:45Z
Reland "Disallow array-of-arrays with DescriptorSets when validating. (#1586)" (#1621)
This CL reverts the revert of 'Disallow array-of-arrays with DescriptorSets when
validating." Other changes have been committed which should aleviate the
AppVeryor resource constraints.
This reverts commit f2c93c6e124836797311facb8449f9a0b76fefc2.
This CL adds validation to disallow using an array-of-arrays when attached to a
DescriptorSet.
Fixes #1522
-
f80696ea
by dan sinclair
at 2018-06-19T20:02:44Z
[val] Add extra context to error messages. (#1600)
[val] Add extra context to error messages.
This CL extends the error messages produced by the validator to output the
disassembly of the errored line.
The validation_id messages have also been updated to print the line number of
the error instead of the word number. Note, the error number is from the start
of the SPIR-V, it does not include any headers printed in the disassembled code.
Fixes #670, #1581
-
8d65c896
by David Neto
at 2018-06-20T14:44:03Z
Instruction lookup succeeds if it's enabled by a capability
Also add a corresponding check for capabilities in the validator.
Update previously existing test cases where an instruction used to fail
assembling because of a version check, but now they succeed because the
instruction is also guarded by a capability. Now it should assemble.
Add tests to ensure that capabilities are checked appropriately.
The explicitly reserved instructions OpImageSparseSampleProj*
now assemble, but they fail validation.
Fixes #1624
-
e7ace1b2
by Alan Baker
at 2018-06-21T18:12:02Z
Add Vulkan 1.1 capability sets
Fixes #1597
* Classifies useable capabilities for Vulkan 1.1
* Updates tests
-
ba602c90
by Corentin Wallez
at 2018-06-21T19:53:15Z
Add a WIP WebGPU environment. It disallows OpUndef
Add SPV_ENV_WEBGPU_0 for work-in-progress WebGPU.
val: Disallow OpUndef in WebGPU env
Silence unused variable warnings when !defined(SPIRV_EFFCE)
Limit visibility of validate_instruction.cpp's symbols
Only InstructionPass needs to be visible so all other functions are put
in an anonymous namespace inside the libspirv namespace.
-
18540643
by dan sinclair
at 2018-06-21T20:08:14Z
Setup gclient and presubmit file.
This CL adds the necessary files to use gclient and the depot_tools with
the SPIRV-Tools directory. This allows doing things like `git cl format`
to format code pre-upload and `git cl presubmit -uf` to run presubmit
checks over the code.
The dependencies are all added to the DEPS file and will be
auto-downloaded. They are all pin'd to specific revisions so everyone
has the same checkout. Clang is included in the checkout so it will be
consistent over usages.
Use clang-format
-
4d99fcba
by David Neto
at 2018-06-21T21:08:49Z
Validator test: artificially lower limit on local var limit
We need this to reduce the test time on Visual Studio debug builds.
AppVeyor times out at 300s for a process.
Artificially lower the local variable limit check for testing purposes.
We don't get much value from using the full 500K+ variables.
Use a limit of 5000 instead.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1632
-
0d43e10b
by Alan Baker
at 2018-06-25T13:47:29Z
Use type id when looking up vector type
Fixes #1634
* Vector components of composite constructs used wrong accessor
-
29923409
by Ari Suonpaa
at 2018-06-26T18:23:18Z
Add validation for structs decorated as Block or BufferBlock.
Fixes #937
Stop std140/430 validation when runtime array is encountered.
Check for standard uniform/storage buffer layout instead of std140/430.
Added validator command line switch to skip block layout checking.
Validate structs decorated as Block/BufferBlock only when they
are used as variable with storage class of uniform or push
constant.
Expose --relax-block-layout to command line.
dneto0 modification:
- Use integer arithmetic instead of floor.
-
8ecd833d
by David Neto
at 2018-06-27T03:31:00Z
Block-decorated structs must list members in offset-order
Additionally, implmentes code review feedback.
Adds more detailed messages for Block and BufferBlock layout errors.
Fixes #1638
-
c2e3e67c
by David Neto
at 2018-06-27T13:54:40Z
validator: Fix storage buffer layout message
-
f393b0e4
by Steven Perron
at 2018-06-27T17:57:07Z
Don't merge types of resources
When doing reflection users care about the names of the variable, the
name of the type, and the name of the members. Remove duplicates breaks
this because it removes the names one of the types when merging.
To fix this we have to keep the different types around for each
resource. This commit adds code to remove duplicates to look for the
types uses to describe resources, and make sure they do not get merged.
However, allow merging of a type used in a resource with something not
used in a resource. Was done when the non resource type came second.
This could have a negative effect on compile time, but it was not
expected to be much.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1372.
-
878b3b40
by Greg Roth
at 2018-06-27T22:08:18Z
check_symbol_exports on Python3, Mac
subprocess.Popen returns byte data by default. Python2 was happy
to try to execute string operations on such data and hope for the
best, but python3 is more persnickety. Luckily, there's a simple
way to indicate to the Popen class that text data is wanted that
benefits the script. Just specifying universal_newlines will cause
the returned data to be text and also convert any system-specific
newlines to '\n' which the script relies on anyway.
Enabled on Mac as an incidental change after confirming that the
script works there just as well as it does on Linux.
It probably works on FreeBSD too, but I retired my BSD system years
ago. So I have no way to check.
Don't run it on Windows.
- It didn't work after all. It was just detecting non-posix and
returning success.
-
4717d24e
by Greg Roth
at 2018-06-27T23:29:08Z
Fix assert during compact IDs pass (#1649)
During the compact IDs optimization pass, the result IDs of some
basic blocks can change. In spite of this, GetPreservedAnalyses
indicated that the CFG was preserved. But the CFG relies on
the basic blocks having the same IDs. Simply removing this flag
resolves the issue by preventing the CFG check.
Also Removes combinators and namemap preserved analyses from
compact IDs pass.
-
7cc9f362
by Greg Roth
at 2018-06-28T14:48:34Z
Add test for CFG alteration by compact IDs
The Compact IDs pass can corrupt the CFG, but first the CFG has to
be setup. To do this, a test that builds the CFG, then performs the
compact IDs pass, then checks context consistency.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1648
-
b67beca7
by David Neto
at 2018-06-28T20:12:21Z
GLSL.std.450 Refract Eta can be any float scalar
This is a decision from Khronos-internal SPIR-V spec issue 337.
-
2eb9bfb5
by Steven Perron
at 2018-06-29T13:49:19Z
Remove stores of undef.
When storing an undef, any value is valid, including the one already in
that memory location. So we can avoid the store.
-
465f2815
by Steven Perron
at 2018-06-29T18:09:44Z
Revert change and stop running remove duplicates.
Revert "Don't merge types of resources"
This reverts commit f393b0e48014867eaada2044841cd7e0140b3d0d, but leaves
the tests that were added. Added new test. These test are the so that,
if someone tries the same change I made, they will see the test that
they need to handle.
Don't run remove duplicates in -O and -Os
Romve duplicates was run to help reduce compile time when looking for
types in the type manager. I've run compile time test on three sets
of shaders, and the compile time does not seem to change.
It should be safe to remove it.
-
51091045
by dan sinclair
at 2018-07-03T19:06:54Z
Produce better error diagnostics in the CFG validation. (#1660)
Produce better error diagnostics in the CFG validation.
This CL fixes up several issues with the diagnostic error line output
in the CFG validation code. For the cases where we can determine a
better line it has been output. For other cases, we removed the
diagnostic line and the error line number from the results.
Fixes #1657
-
30a9cefa
by David Neto
at 2018-07-03T19:53:19Z
Support SPV_KHR_8bit_storage
- Add asm/dis test for SPV_KHR_8bit_storage
- validator: SPV_KHR_8bit_storage capabilities enable declaration of 8bit int
TODO:
- validator: ban arithmetic on 8bit unless Int8 is enabled
Covered by https://github.com/KhronosGroup/SPIRV-Tools/issues/1595
-
4926f295
by Lei Zhang
at 2018-07-04T18:20:52Z
Let symbol export tests respect SPIRV_SKIP_TESTS
-
101a9bcb
by Steven Perron
at 2018-07-05T01:26:09Z
Add private to local to optimization and size passes.
Many optimization will run on function scope symbols only. When symbols
are moved from private scope to function scople, then these optimizations
can do more.
I believe it is a good idea to run this pass with both -O and -Os. To
get the most out of it it should be run ASAP after inlining and something
that remove all of the dead functions.
-
9ecbcf5f
by Steven Perron
at 2018-07-05T18:34:30Z
Make sure the constant folder get the correct type.
There are a few locations where we need to handle duplicate types. We
cannot merge them because they may be needed for reflection. When this
happens we need do some extra lookups in the type manager.
The specific fixes are:
1) When generating a constant through `GetDefiningInstruction` accept
and use an id for the desired type of the constant. This will make sure
you get the type that is needed.
2) In Private-to-local, make sure we to update the def-use chains when a
new pointer type is created.
3) In the type manager, make sure that `FindPointerToType` returns a
pointer that points to the given type and not a duplicate type.
4) In scalar replacment, make sure the null constants that are created
are the correct type.
-
a45d4cac
by Steven Perron
at 2018-07-05T21:52:43Z
Move folding routines into a class
The folding routines are currently global functions. They also rely on
data in an std::map that holds the folding rules for each opcode. This
causes that map to not have a clear owner, and therefore never gets
deleted.
There has been a request to delete this map. To implement this, we will
create a InstructionFolder class that owns the maps. The IRContext will
own the InstructionFolder instance. Then the global functions will
become public memeber functions of the InstructionFolder.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1659.
-
a0694990
by David Neto
at 2018-07-06T15:04:23Z
Fix layout checks for StorageBuffer and PushConstant storage classes
Fixes #1664 : PushConstant with Block follows storage buffer rules
PushConstant variables were being checked with block rules, which are
too strict.
Fixes #1606 : StorageBuffer with Block layout follows buffer rules
StorageBuffer variables were not being checked before.
Fix layout messages: say storage class and decoration
We need to provide more information about storage class and decoration.
-
fa78d3be
by dan sinclair
at 2018-07-06T15:21:12Z
Update SPIRV-Headers
-
c460f44f
by Alan Baker
at 2018-07-06T15:52:13Z
Add a check for invalid exits from case construct.
Fixes #1618.
Adds a check that validates acceptable exits from case constructs. Case
constructs may only exit to another case construct, the corresponding
merge, an outer loop continue or outer loop merge.
-
9795137c
by Ehsan
at 2018-07-06T17:01:22Z
Enable Kokoro buildbots. (#1625)
-
1a283f41
by David Neto
at 2018-07-06T17:11:07Z
Layout validation: Permit {vec3; float} tight packing
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1666
-
5e0276bd
by David Neto
at 2018-07-06T17:35:16Z
validator: use RowMajor, ArrayStride, MatrixStride
Implement rules for row-major matrices
Use ArrayStride and MatrixStride to compute sizes
Propagate matrix stride and RowMajor/ColumnMajor through array members of structs.
Fixes #1637
Fixes #1668
-
9836b05a
by dan sinclair
at 2018-07-06T20:38:41Z
Move comp code into comp namespace
This CL moves the code in the comp/ directories into the comp namespace.
-
76e0bde1
by dan sinclair
at 2018-07-06T20:47:46Z
Move utils/ to spvtools::utils
Currently the utils/ folder uses both spvutils:: and spvtools::utils.
This CL changes the namespace to consistenly be spvtools::utils to match
the rest of the codebase.
-
3dad1cda
by dan sinclair
at 2018-07-07T13:38:00Z
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.
-
9de00c95
by David Neto
at 2018-07-08T16:49:51Z
Update CHANGES
-
f508896d
by David Neto
at 2018-07-08T16:50:46Z
Finalize SPIRV-Tools v2018.4
-
50312ca1
by David Neto
at 2018-07-08T16:53:46Z
Start SPIRV-Tools v2018.5-dev
-
e6b95336
by dan sinclair
at 2018-07-09T15:32:29Z
Move the ir namespace to opt. (#1680)
This CL moves the files in opt/ to consistenly be under the opt::
namespace. This frees up the ir:: namespace so it can be used to make a
shared ir represenation.
-
48326d44
by dan sinclair
at 2018-07-09T18:32:31Z
Move link/ code to anonymous namespace (#1679)
Most of the link code is marked as static. This CL introduces an anonymous namespace
and removes the static methods. The last two methods are exposed in the public API and
have been left in the spvtools namespace.
-
43144e36
by dan sinclair
at 2018-07-10T03:18:44Z
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.
-
a3e38695
by dan sinclair
at 2018-07-10T14:57:52Z
Convert validation to use libspriv::Instruction where possible. (#1663)
For the instructions which execute after the IdPass check we can provide
the Instruction instead of the spv_parsed_instruction_t. This
Instruction class provides a bit more context (like the source line)
that is not available from spv_parsed_instruction_t.
-
9532aede
by Sean Purcell
at 2018-07-10T15:57:42Z
Fix unused param errors when Effcee not present
-
84846b7e
by dan sinclair
at 2018-07-10T17:09:46Z
Cleanup whitespace lint warnings. (#1690)
This CL cleans up the whitespace warnings and enables the check when
running 'git cl presubmit --all -uf'.
-
cbdbbe9a
by Steven Perron
at 2018-07-10T17:59:01Z
Fix up code to make ClangTidy happy.
Just a few changes to pass `std::function` objects by const reference
instead of by value.
-
6e550f41
by Ehsan Nasiri
at 2018-07-10T18:16:29Z
Disable Travis bots, and Appveyor Release bots.
Kokoro bots currently cover all Travis bots:
macos-clang-debug
macos-clang-release
ubuntu-clang-debug
ubuntu-clang-release
ubuntu-gcc-debug
ubuntu-gcc-release
ndk-build
android
check-format
Kokoro bots also cover all Windows Release builds:
windows-VS2013-release
windows-VS2015-release
windows-VS2017-release
Due to a compiler issue on the Kokoro Windows VM, we currently do not
run the Debug build on Kokoro.
Therefore, I am disabling all Travis jobs and the appveyor Release jobs.
-
ead54bbd
by Arseny Kapoulkine
at 2018-07-10T18:24:39Z
Use spv_result_t instead of bool
Using bool is confusing here, and results in an MSVC warning about an
implicit cast to bool.
-
eb48263c
by Jaebaek Seo
at 2018-07-10T18:31:15Z
Description for Android build
-
fec6315f
by David Neto
at 2018-07-10T21:16:54Z
Vulkan permits non-monotonic offsets for block members
Other environments do not.
Add tests for OpenGL 4.5 and SPIR-V universal 1.0 to ensure
they still check monotonic layout.
For universal 1.0, we're assuming it otherwise follows Vulkan
rules for block layout.
Fixes #1685
-
7d6c90c9
by David Neto
at 2018-07-10T21:49:07Z
Reopen stdin for binary as needed
Fixes #1688
-
2cce2c5b
by dan sinclair
at 2018-07-11T13:24:49Z
Move tests into namespaces (#1689)
This CL moves the test into namespaces based on their directories.
-
e70a4126
by dan sinclair
at 2018-07-11T14:27:34Z
Move validation files to val/ directory (#1692)
This CL moves the various validate files into the val/ directory with
the rest of the validation infrastructure. This matches how opt/ is
setup with the passes with the infrastructure.
-
c02d2166
by Ehsan Nasiri
at 2018-07-11T14:36:45Z
Update docs to reflect new bot status.
-
2c6185e6
by David Neto
at 2018-07-11T14:38:36Z
Enforce block layout rules even when relaxed
- Vulkan 1.0 uses strict layout rules
- Vulkan 1.0 with relaxed-block-layout validator option
enforces all rules except for the relaxation of vector
offset.
- Vulkan 1.1 and later always supports relaxed block layout
Add spot check tests for the relaxed-block-layout scenarios.
Fixes #1697
-
4470ff49
by David Neto
at 2018-07-11T17:51:01Z
Update CHANGES
-
e63551de
by Steven Perron
at 2018-07-11T18:44:46Z
Add folding rule to merge a vector shuffle feeding another one.
-
aee809d5
by Ehsan
at 2018-07-11T21:34:38Z
Update the check-format bot. (#1710)
-
4db9c789
by Lei Zhang
at 2018-07-11T22:00:54Z
Add option to skip verifying block layout
We need this to avoid emitting errors on DirectX layout rules.
-
f96b7f1c
by dan sinclair
at 2018-07-12T13:08:45Z
use Pass::Run to set the context on each pass. (#1708)
Currently the IRContext is passed into the Pass::Process method. It is
then up to the individual pass to store the context into the context_
variable. This CL changes the Run method to store the context before
calling Process which no-longer receives the context as a parameter.
-
4cc6cd18
by dan sinclair
at 2018-07-12T13:12:23Z
Pass the IRContext into the folding rules. (#1709)
This CL updates the folding rules to receive the IRContext as a paramter
instead of retrieving off of the Instruction.
Issue #1703
-
a5e4a532
by dan sinclair
at 2018-07-12T14:16:15Z
Remove context() method from opt::Function (#1700)
This CL removes the context() method from opt::Function. In the places
where the context() was used we can retrieve, or provide, the context in
another fashion.
-
6803e42b
by dan sinclair
at 2018-07-12T15:13:32Z
Cleanup some pass code to get context directly. (#1714)
Instead of going through the instruction we can access the context()
directly from the pass.
Issue #1703
-
3ded745f
by dan sinclair
at 2018-07-12T18:40:40Z
Cleanup CFG header. (#1715)
This CL removes some unused methods from CFG, makes the constructor
explicit and moves the using statement to the cpp file where it's used.
-
e477e757
by dan sinclair
at 2018-07-12T18:42:05Z
Remove the module from opt::Function. (#1717)
The function class provides a {Set|Get}Parent call in order to provide
the context to the LoopDescriptor methods. This CL removes the module
from Function and provides the needed context directly to LoopDescriptor
on creation.
-
c7da51a0
by dan sinclair
at 2018-07-12T19:14:43Z
Cleanup extraneous namespace qualifies in source/opt. (#1716)
This CL follows up on the opt namespacing CLs by removing the
unnecessary opt:: and opt::analysis:: namespace prefixes.
-
7603944a
by dan sinclair
at 2018-07-13T00:26:44Z
Remove dead code (#1720)
Remove commented out code from validate_id.
-
63c1d8fb
by Steven Perron
at 2018-07-13T15:20:02Z
Fix size error when folding vector shuffle. (#1721)
When folding a vector shuffle that feeds another vector shuffle causes
the size of the first operand to change, when other indices have to be
adjusted reletive to the new size.
-
95b4d47e
by Steven Perron
at 2018-07-13T16:43:00Z
Fix infinite loop while folding OpVectorShuffle (#1722)
When folding an OpVectorShuffle where the first operand is defined by
an OpVectorShuffle, is unused, and is equal to the second, we end up
with an infinite loop. This is because we think we change the
instruction, but it does not actually change. So we keep trying to
folding the same instruction.
This commit fixes up that specific issue. When the operand is unused,
we replace it with Null.
-
208921ef
by Steven Perron
at 2018-07-16T16:36:53Z
Fix finding constant with particular type. (#1724)
With current implementation, the constant manager does not keep around
two constant with the same value but different types when the types
hash to the same value. So when you start looking for that constant you
will get a constant with the wrong type back.
I've made a few changes to the constant manager to fix this. First off,
I have changed the map from constant to ids to be an std::multimap.
This way a single constant can be mapped to mutiple ids each
representing a different type.
Then when asking for an id of a constant, we can search all of the ids
associated with that constant in order to find the one with the correct
type.
-
8c7dab5c
by Dan Sinclair
at 2018-07-16T18:18:53Z
Fixup line number for OpVectorShuffle ID error.
This CL updates the code to pull a valid instruction for the line number
when outputting a component error in OpVectorShuffle. The error line
isn't the best at this point as it points at the component, but it's
better then a -1 (turning to max<size_t>) that was being output.
The error messages has been updated to better reflect what the error is
attempting to say.
Issue 1719.
-
85d37157
by David Neto
at 2018-07-18T14:58:22Z
Update CHANGES
-
ba40400c
by David Neto
at 2018-07-19T14:27:12Z
Don't check exports on Darwin
Android NDK build machines for OSX don't seem to have objdump.
-
28199b80
by Alan Baker
at 2018-07-19T15:17:57Z
Fix block ordering in dead branch elim
Fixes #1727
* If the pass finds any dead branches it can optimize then at the end of
the pass it reorders basic blocks to ensure they satisfy block ordering
requirements
* Added some new tests
* While investigating this issue, found and fixed a non-deterministic
ordering of dominators
* Now the edges used to construct the dominator tree are sorted
according to posorder traversal indices
-
3c196517
by Alan Baker
at 2018-07-19T18:43:59Z
Add variable pointer support to IsValidBasePointer
Fixes #1729
* Adds supported opcodes to IsValidBasePointer() enable by
VariablePointers and VariablePointersStorageBuffer capabilities
* Added tests
-
effafedc
by dan sinclair
at 2018-07-20T15:09:30Z
Replace opt::Instruction type and result cache with flags. (#1718)
Currentlty opt::Instruction class holds a cache of the result_id and
type_id for the instruction. That cache needs to be updated if the
underlying operand values are changes.
This CL changes the cache to being a flag if there is a type or result
id for the instruction. We then retrieve the value if needed from the
operands.
-
b49f76fd
by Alan Baker
at 2018-07-20T15:32:43Z
Handle undef literal value in vector shuffle
Fixes #1731
* Updated folding rules related to vector shuffle to account for the
undef literal value:
* FoldVectorShuffleFeedingShuffle
* FoldVectorShuffleFeedingExtract
* FoldVectorShuffleWithConstants
* These rules would commit memory violations due to treating the undef
literal value as an accessible composite component
-
a114e1f3
by Dan Sinclair
at 2018-07-24T15:31:14Z
Add support for Chromium GN build
Build test
Add Fuzzer group
Add libfuzzer
-
99fe61e7
by Diego Novillo
at 2018-07-27T19:10:08Z
Add API to create passes out of a list of command-line flags.
This re-implements the -Oconfig=<file> flag to use a new API that takes
a list of command-line flags representing optimization passes.
This moves the processing of flags that create new optimization passes
out of spirv-opt and into the library API. Useful for other tools that
want to incorporate a facility similar to -Oconfig.
The main changes are:
1- Add a new public function Optimizer::RegisterPassesFromFlags. This
takes a vector of strings. Each string is assumed to have the form
'--pass_name[=pass_args]'. It creates and registers into the pass
manager all the passes specified in the vector. Each pass is
validated internally. Failure to create a pass instance causes the
function to return false and a diagnostic is emitted to the
registered message consumer.
2- Re-implements -Oconfig in spirv-opt to use the new API.
-
fc2a719c
by dan sinclair
at 2018-07-30T14:31:28Z
Wrap bin group in conditional for BUILD.gn (#1738)
-
ee22928b
by dan sinclair
at 2018-07-30T17:06:03Z
Move CompositePass code into methods. (#1740)
This Cl splits the CompositePass switch to have one method per case
label. This makes the code a lot simpler to follow.
-
673483d6
by dan sinclair
at 2018-07-30T20:12:49Z
Move OpVectorShuffle check into validate_composites (#1741)
This CL moves the OpVectorShuffle ID check out of validate_id and into
validate_composites with the rest of the composite checks.
-
dcb0dc21
by dan sinclair
at 2018-07-30T20:59:29Z
Split ImagePass into individual methods. (#1742)
This CL splits the switch in ImagePass into individual validate
functions. The error messages have been updated to drop the
suffix/prefix of the opcode name since it will be displayed in the
disassembly.
-
dcea11fa
by dan sinclair
at 2018-07-31T13:52:14Z
Update error messages in validate_composites. (#1743)
This CL removes the redundant operator name from the error messages in
validate_composites. The operator will be printed on the next line with
the disassembly.
-
f28ed82f
by Dan Sinclair
at 2018-07-31T13:55:57Z
Make sure all instructions are in the ordered list.
Currently, some instructions will be missing from the list of
ordered_instructions. This will cause issues due to the debug change
which passed the last instruction into subsequent passes.
This CL moves the addition to the ordered list out of the
RegisterInstruction method into AddOrderedInstruction. This method is
called first in ProcessInstruction and the CapabilitiesPass and IdPass
are updated to take an Instruction parameter.
-
89901a8a
by Dan Sinclair
at 2018-07-31T14:38:18Z
Wrap entire timer.cpp in SPIRV_TIMER_ENABLED.
This CL moves the SPIRV_TIMER_ENABLED preprocesser guard to encompass
the includes along with the source. Currently we will try to pull in
sys/resource.h on machines which may not have the file available and the
build will fail. If we don't need timers, then we don't need the
includes as well.
-
8a0ec22f
by Alan Baker
at 2018-07-31T15:45:39Z
Fix bug determining next arg
-
755e5c94
by Alan Baker
at 2018-07-31T17:42:47Z
Transform to combine consecutive access chains
* Combines OpAccessChain, OpInBoundsAccessChain, OpPtrAccessChain and
OpInBoundsPtrAccessChain
* New folding rule to fold add with 0 for integers
* Converts to a bitcast if the result type does not match the operand
type
V
-
a9d8fcee
by dan sinclair
at 2018-07-31T18:19:34Z
Change ValidationState::diag to accept an Instruction. (#1749)
This CL changes the signature of diag() to accept an Instruction instead
of the instructions position.
A deprecated variant that accepts the position is available but will be
removed in the near future.
-
b7afe4e7
by dan sinclair
at 2018-07-31T18:53:10Z
Switch validate to use explicit diag() method. (#1750)
This CL changes validate.cpp to use diag providing an explicit
instruction. This changes the result of the function end checks to not
output a disassembly anymore as printing the last line of the module
didn't seem to make sense.
-
dfb53f9f
by dan sinclair
at 2018-07-31T19:31:09Z
Fix disassembly line for adjacency validations. (#1751)
Previously the adjacency messages would output the last line of the file
as the disassembly. This is incorrect, as we have an instruction they
can be attached too. This CL fixes the messages to attach to the correct
line number.
-
a4fe771d
by dan sinclair
at 2018-07-31T20:26:58Z
Pass the instruction to diag in arithmetic validation (#1752)
This CL updates the diag() calls in validate_arithmetics to explicitly
provide the instruction the diagnostic is attached too.
-
32ccf0d0
by dan sinclair
at 2018-07-31T21:20:43Z
Update diag() in validate_atomics (#1753)
This CL updates validate_atomics to explicitly provide the instruction
when caling diag().
-
11193353
by dan sinclair
at 2018-07-31T22:44:35Z
Update diag() in validate_barriers (#1754)
This CL updates validate_barriers to provide an explicit instruction
when calling diag().
-
12c1f2b6
by dan sinclair
at 2018-08-01T13:19:37Z
Update diag() usage in validate_bitwise. (#1757)
This Cl upldates the diag() calls to pass the instruction in
validate_bitwise.
-
3619de9a
by dan sinclair
at 2018-08-01T13:31:31Z
Update diag() use in validate_builtin. (#1758)
This CL updates the calls to diag() in vlidate_builtings to provide the
instruction.
-
2c5f1b01
by dan sinclair
at 2018-08-01T13:52:16Z
Update diag() calls in validate_cfg. (#1760)
This CL updates the diag() calls in validate_cfg to provide the
associated instruction. This fixes a couple places where we output the
last line of the file instead of the instruction as the disassembly.
-
eb03b152
by dan sinclair
at 2018-08-01T14:07:53Z
Update diag() calls in validate_composites. (#1761)
This CL updates the diag() calls in validate_composites to provide the
instruction directly.
-
5a59a06e
by dan sinclair
at 2018-08-01T14:18:06Z
Update diag() calls in validate_conversion. (#1762)
This CL updates validate_conversion to provide the instruction to diag()
calls.
-
0d8156ac
by David Neto
at 2018-08-01T14:29:43Z
Update CHANGES
-
fae987b4
by dan sinclair
at 2018-08-01T14:35:19Z
Update diag() calls in validate_datarules. (#1763)
This CL updates validate_datarules to provide the instruction to diag().
-
a504656d
by dan sinclair
at 2018-08-01T14:37:36Z
Remove std::deque in favour of std::vector. (#1755)
This CL removes the two deque's from ValidationState and converts them
into std::vectors. In order to maintain the stability of instructions we
walk over the binary and counter the instructions and functions in the
ValidationState constructor and reserve the required number of items in
the module_functions_ and ordered_instructions_ vectors.
Issue #1176.
-
83b7f2b6
by dan sinclair
at 2018-08-01T14:44:27Z
Update diag() calls in validate_decorations. (#1764)
Several of the diag() calls in validate_decorations do not provide the
line number, and will output the last line in the file. This CL updates
the diag() calls to provide the instruction of interest.
-
441c0190
by dan sinclair
at 2018-08-01T15:04:22Z
Update diag() calls in validate_derivatives. (#1765)
This CL updates diag() in validate_derivatives to provide the
instruction of interest.
-
c64bad70
by dan sinclair
at 2018-08-01T15:11:23Z
Update diag() calls in validate_ext_inst. (#1766)
This CL updates the diag() usage in validate_ext_inst to provide the
relevant instruction.
-
176cb5e5
by dan sinclair
at 2018-08-01T15:30:28Z
Update diag() calls in validate_image. (#1767)
This CL updates the diag() calls in validate_image to provide the
relvant instruction.
-
d792ccd1
by dan sinclair
at 2018-08-01T15:37:02Z
Update diag() calls in validate_instruction. (#1768)
This CL updates validate_instruction to pass the Instruction to diag().
-
f37e8d74
by dan sinclair
at 2018-08-01T15:58:37Z
Update diag() call in validate_interface. (#1769)
This CL upldates validate_interface to pass the instruction to the
diag() method.
-
e1e20f1a
by dan sinclair
at 2018-08-01T16:01:35Z
Update diag() calls in validate_layout. (#1770)
This CL updates the diag() calls in validate_layout to pass the relevant
instruction.
-
72766d9e
by dan sinclair
at 2018-08-01T16:41:46Z
Update diag() calls in validate_literals. (#1771)
This CL updates the diag() call in validate_literals to provide the
relevant instruction.
-
7c9a73fc
by dan sinclair
at 2018-08-01T16:41:57Z
Update diag() calls in validate_logicals. (#1772)
This CL updates the diag() calls in validate_logicals to provide the
Instruction.
-
6bb9ab48
by dan sinclair
at 2018-08-01T16:49:43Z
Update diag() calls in validate_non_uniform. (#1773)
This CL upldates diag() calls in validate_non_uniform to provide the
relevant instruction.
-
78335c92
by dan sinclair
at 2018-08-01T17:00:38Z
Update diag() calls in validate_primitives. (#1774)
This CL updates the diag() calls in validate_primitives to provide the
relevant instruction.
-
ab061afc
by dan sinclair
at 2018-08-01T17:13:44Z
Update diag() calls in validate_type_unique. (#1775)
This CL updates the diag() calls in validate_type_unique to pass the
relevant instruction.
-
c8c724cb
by Steven Perron
at 2018-08-01T17:47:09Z
Don't change decorations and names in merge return. (#1777)
When creating a new phi for a value in the function, merge return will
rewrite all uses of an id that are no longer dominated by its
definition. Uses that are not in a basic block, like OpName or
decorations, are not dominated, but they should not be replaced.
Fixes #1736.
-
aa81e62c
by dan sinclair
at 2018-08-01T17:48:16Z
Update diag() calls in validate_capability. (#1759)
This CL updates the diag() call in validate_capability to provide the
instruction.
-
a97c1d91
by dan sinclair
at 2018-08-01T18:28:10Z
Fixup BUILD.gn to use a group for SPIRV-Tools (#1779)
The SPIRV-Tools target doesn't build anything, it just depends on the other libraries. As such, there is no static_library generated and this should be a group() instead.
-
ebd6c75a
by dan sinclair
at 2018-08-01T18:55:20Z
Remove diag() overloads. (#1776)
This CL removes the two diag() overloads and leaves only the version
which accepts an Instruction. This is safer as we never use the
implicit location from the validation state.
-
a5a5ea0e
by dan sinclair
at 2018-08-01T18:58:12Z
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.
-
d49bedca
by Alan Baker
at 2018-08-01T20:10:11Z
Move memory class instructions to new pass
* Refactored the Memory class of instructions in the spec out Id
validation and into a new pass
* Tests unmodified
* some minor disassembly changes
* minor style changes
-
c9cd73b3
by dan sinclair
at 2018-08-01T20:12:07Z
Remove instruction_counter from ValidationState. (#1781)
The instruction counter is the same as the size of the
ordered_instruction list when we insert a new instruction. This Cl
removes instruction_counter_ and uses that instead.
-
53afb3b7
by dan sinclair
at 2018-08-02T14:00:52Z
Combine ordered_instruction loops in validation. (#1782)
There are several validation passes which loop over all ordered
instructions. This CL combines those into a single loop, calling each
pass as needed.
-
ce644d4a
by Steven Perron
at 2018-08-02T15:02:50Z
Update OpPhi instructions after splitting block. (#1783)
In the merge return pass, we will split a block, but not update the phi
instructions that reference the block. Since the branch in the original
block is now part of the block with the new id, the phi nodes must be
updated.
This commit will change this.
I have also considered other places where an id of a basic block could
be referenced, and I don't think any of them need to change.
1) Branch and merge instructions: These jump to the start of the
original block, and so we want them to jump to the block that uses the
original id. Nothing needs to change.
2) Names and decorations: I don't think it matters with block keeps the
name, and there are no decorations that apply to basic blocks.
Fixes #1736.
-
1946fb4d
by dan sinclair
at 2018-08-02T16:01:26Z
Remove ValidateInstructionAndUpdateValidationState (#1784)
This CL changes the stats aggregator to use
ValidateBinaryAndKeepValidationState to process the binary. This means
we can remove ValidateInstructionAndUpdateValidationState which expects
to be able to call ProcessInstruction in the validate anonymous
namespace. This decouples the stats aggregator from how validation
processes the binary.
-
e323529d
by Steven Perron
at 2018-08-02T16:04:35Z
Register passes in the spirv-opt fuzzer. (#1785)
The spirv-opt fuzzer is not registering any passes to run, so it is not
currently testing anything. For now we will just register the
performance passes.
We should add different fuzzers for the legalization pass
(RegisterLegalizationPasses()), and the size passes
(RegisterSizePasses()).
-
de9496e9
by dan sinclair
at 2018-08-02T18:36:43Z
Add more fuzzers for Optimizer. (#1788)
This Cl adds the legalization and size fuzzers for the optimizer. The
main optimizer is renamed to the performance optimizer.
-
6aa8a594
by dan sinclair
at 2018-08-02T19:12:06Z
Simplify validation ProcessInstruction (#1786)
This CL moves most of the logic out of validation ProcessInstruction and
groups it into validate. This places all of the validation logic in the
same place making it clearer what is running.
The Instruction class is changed to allow setting the function and block
after creation.
-
d38a0a3b
by dan sinclair
at 2018-08-02T20:58:45Z
Validation within function body when doing a FunctionCall. (#1790)
When validating a FunctionCall we can trigger an assert if we are not
currently within a function body. This CL adds verification that we are
within a function before attempting to add a function call.
Issue 1789.
-
aa53271b
by dan sinclair
at 2018-08-03T00:28:40Z
Script to fixup fuzzer results (#1792)
-
58a6876c
by dan sinclair
at 2018-08-03T12:05:33Z
Rewrite include guards (#1793)
This CL rewrites the include guards to make PRESUBMIT.py include guard
check happy.
-
7861df9b
by dan sinclair
at 2018-08-03T12:05:52Z
Remove using namespace commands. (#1794)
This CL removes the last two 'using namespace' commands.
-
c8e7bb1d
by dan sinclair
at 2018-08-03T12:06:07Z
Fixup Wno-self-assign warning (#1796)
The warning should only be applied for Clang builds, it was accidentally
also being included for GCC builds.
-
2d9a3252
by Corentin Wallez
at 2018-08-03T14:06:11Z
Refactor BUILD.gn so can easily be embedded in other projects
1.
BUILD.gn: Don't use the extra Chromium clang warnings
Also removes the unused .gn secondary_sources.
2.
Move fuzzers in test/ instead of testing/
This frees up testing/ to be the git subtree of Chromium's src/testing/
that contains test.gni, gtest, gmock and libfuzzer
3.
DEPS: get the whole testing/ subtree of Chromium
4.
BUILD.gn: Simplify the standalone gtest targets
These targets definitions are inspired from ANGLE's and add a variable
that is the path of the googletest directory so that it can be made
overridable in future commits.
6.
BUILD.gn: Add overridable variables for deps dirs
This avoids hardcoded paths to dependencies that make it hard to
integrate SPIRV-Tools in other GN projects.
-
eda2cfbe
by dan sinclair
at 2018-08-03T19:06:09Z
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.
-
9991d661
by dan sinclair
at 2018-08-07T13:09:47Z
Fix readbility/braces warnings (#1804)
-
05057c98
by dan sinclair
at 2018-08-07T13:10:03Z
Fixup readabilty/inheritance warnings (#1805)
This CL removes the un-needed virtual qualifiers from methods already
marked as override.
-
e3ea909e
by dan sinclair
at 2018-08-07T13:10:25Z
Simplify MoveToFront (#1806)
This CL removes the templating from the MoveToFront code as all non-test
code uses uint32_t as the variable.
-
508df9a3
by dan sinclair
at 2018-08-07T13:10:54Z
Remove unused bit stream methods. (#1807)
This CL deletes methods from bit stream which are never used and moves
several to the anonymous namespace in the bit_stream test file.
-
6fea4023
by shartte
at 2018-08-07T13:15:20Z
When clang is used as a MSVC frontend (clang-cl.exe) it does not behave exactly as GCC would. I.e. -Wall translates to /Wall, which is an alias for -Weverything. This causes massive C++98 compat warnings logspam. (#1808)
-
2896b8f0
by Alan Baker
at 2018-08-07T14:29:30Z
Refactor where opcodes are validated
* Replaced uses in opcode validation of current_function()
* Added non-const accessor to function lookup in ValidationState_t
* Updated a couple bad tests due to check reordering
-
3a20879f
by Alan Baker
at 2018-08-07T23:01:58Z
Unify validation of OpCopyMemory*
Fixes #1800
* Refactored duplication of code between OpCopyMemory and
OpCopyMemorySized validation
* Fixed some bugs in OpCopyMemorySized validation
* Replaced asserts with checks
* Added new tests
-
5c8b4f5a
by Steven Perron
at 2018-08-08T15:16:19Z
Validate the input to Optimizer::Run (#1799)
* Run the validator in the optimization fuzzers.
The optimizers assumes that the input to the optimizer is valid. Since
the fuzzers do not check that the input is valid before passing the
spir-v to the optimizer, we are getting a few errors.
The solution is to run the validator in the optimizer to validate the
input.
For the legalization passes, we need to add an extra option to the
validator to accept certain types of variable pointers, even if the
capability is not given. At the same time, we changed the option
"--legalize-hlsl" to relax the validator in the same way instead of
turning it off.
-
f2a99002
by Alan Baker
at 2018-08-08T16:55:39Z
Move type instruction validation into separate file
* Moved type instruction validation out of validation idUsage into a new
file
* Consolidate type unique pass into new file
* Removed one bad test
* Reworked validation ordering
-
ca7278cf
by Alan Baker
at 2018-08-08T17:47:09Z
Split debug opcode validation into new file
* Removes debug opcode validation from idUsage and puts it in a separate
file
* minor updates
-
983f8f02
by Alan Baker
at 2018-08-08T19:13:04Z
Replace asserts with returns
* Changes to satisfy fuzzer
-
7d4b0464
by Alan Baker
at 2018-08-08T19:43:11Z
Split annotation opcode validation into new file.
* Moves annotation opcode checks from idUsage into a new pass
* minor style updates
-
714bf84e
by Alan Baker
at 2018-08-08T19:45:53Z
Split mode setting opcode validation into new file.
* Moved mode setting opcode validation out of idUsage and into a new
pass
* minor style updates
-
b6319c3a
by dan sinclair
at 2018-08-09T21:07:19Z
Split MarkV into multiple files (#1809)
This CL breaks the monolithic markv_codec file into files for the base
class, encoder, decoder and logger.
-
70de4a35
by dan sinclair
at 2018-08-13T14:40:55Z
Remove codegen related code. (#1819)
This CL removes the code related to code generation from the stats
module.
-
6cd4441c
by Alan Baker
at 2018-08-13T15:30:08Z
Move cfg opcode validation to another file.
* Moved cfg opcode validation out of idUsage and into validate_cfg.cpp
* minor style updates
-
da0f1dcc
by dan sinclair
at 2018-08-13T15:48:25Z
Move spirv_stats into tools/stats. (#1826)
The spirv_stats code is only used by the tools/stats module. This CL
moves the code to that module.
-
bcb0b693
by Steven Perron
at 2018-08-13T17:18:46Z
Reenable --skip-validation. (#1820)
In previous changes, the option `--skip-validation` was disabled. This
change is to reenable it.
-
397e0244
by Alan Baker
at 2018-08-13T19:23:30Z
Fixing heap overflow in validation.
* Changed entry point validation to check storage class of variable
instead of pointer
* added a test
* Moved several checks after opcode validation
* These checks should be able to guarantee individual instructions are
ok
* Updated tests due to reordered checks
-
967bfa2d
by dan sinclair
at 2018-08-13T20:45:39Z
Remove unused stats maps and parameters (#1828)
-
e7fdcdba
by Alan Baker
at 2018-08-13T21:04:57Z
Split function opcode validation into new files.
* Moved function opcode validation out of idUsage and into new files
* minor style changes
* General opcode checking is in validate_function.cpp
* Execution limitation checking is in
validate_execution_limitations.cpp
* Execution limitations was split into a new pass as it requires other
validation to register those limitations first.
-
ce4547bd
by alan-baker
at 2018-08-14T12:55:49Z
Disallow void types in structs (#1832)
Fixes #1831
* Adds validation check that void is not a member of a struct
* added a test
-
5fc011b4
by dan sinclair
at 2018-08-14T13:52:05Z
Move bit_stream, move_to_front and huffman_codec. (#1833)
bit_stream, move_to_front and huffman_codec are only used by
source/tools. Move into that directory to make the usage clearer.
-
8cb949ad
by Alan Baker
at 2018-08-14T14:13:06Z
Validate correct opcode uses of OpFunction
Fixes https://crbug.com/873457
* Filed Khronos SPIR-V issue 352
* Updated bad tests
* Added new test
-
bf24d9b4
by Steven Perron
at 2018-08-14T15:26:14Z
Don't copy decorations twice when rebuilding a type. (#1835)
In `TypeManager::RebuildType`, the base cases call `Clone`, which will
copy the decorations for the type. After that it breaks out of the
switch statement and copies the decorations again.
This has not causes any real problems yet because none of those types
are allowed to have decorations. However to make the code more robust
it is best to not copy twice because it should be empty.
This way if a new base type or decoration is added that changes this
rule the code will be correct.
-
1553025f
by dan sinclair
at 2018-08-14T16:44:54Z
Move make_unique to source/util. (#1836)
This MakeUnique code is used in places other then source/opt so move it
to source/utils.
-
1963a2db
by dan sinclair
at 2018-08-14T19:01:50Z
Use MakeUnique. (#1837)
This CL replaces instances of reset(new ..) with MakeUnique.
-
ef678672
by dan sinclair
at 2018-08-14T19:41:21Z
Remove source/message.h (#1838)
The code in source/message was only used in a single set of tests to
format the output results. This CL changes the test to verify the
message instead of all the error values and removes the source/message
code.
-
e065cc20
by Steven Perron
at 2018-08-15T13:14:21Z
Keep decorations when replacing loads in access-chain-convert. (#1829)
In local-access-chain-convert, we replace loads by load the entire
variable, then doing the extract. The extract will have the same value
as the load. However, if the load has a decoration on it, the
decoration is lost because we do not copy any them to the new id.
This is fixed by rewritting the load into the extract and keeping the
same result id.
This change has the effect that we do not call DCEInst on the loads
because the load is not being deleted, but replaced. This could leave
OpAccessChain instructions around that are not used. This is not a
problem for -O and -Os. They run local_single_*_elim passes and then
dead code elimination. The dce will remove the unused access chains,
and the load elimination passes work even if there are unused access
chains. I have added test to them to ensure they will not loss
opportunities.
Fixes #1787.
-
36d675a4
by Steven Perron
at 2018-08-15T17:18:47Z
Change when instruction is registered in validator. (#1840)
When doing the validator checks, an instruction is currently registered
at the end of IdPass. This creates an inconsistency. In IdPass, an
instruction that uses its own result will treat that use as a forward
reference. Then in the following passes it will not because the
definition can be found.
It seems best to update the state after all of the check have been done
for the current instruction. This makes it consistent for all of the
passes.
This makes a different when trying to verify OpTypeStruct.
Fixes https://crbug.com/874372.
-
1bdade77
by dan sinclair
at 2018-08-15T19:26:28Z
Add GN rules to build spriv-as (#1842)
-
03000a3a
by Diego Novillo
at 2018-08-17T19:03:14Z
Add testing framework for tools.
This forks the testing harness from https://github.com/google/shaderc
to allow testing CLI tools.
New features needed for SPIRV-Tools include:
1- A new PlaceHolder subclass for spirv shaders. This place holder
calls spirv-as to convert assembly input into SPIRV bytecode. This is
required for most tools in SPIRV-Tools.
2- A minimal testing file for testing basic functionality of spirv-opt.
Add tests for all flags in spirv-opt.
1. Adds tests to check that known flags match the names that each pass
advertises.
2. Adds tests to check that -O, -Os and --legalize-hlsl schedule the
expected passes.
3. Adds more functionality to Expect classes to support regular
_expression_ matching on stderr.
4. Add checks for integer arguments to optimization flags.
5. Fixes #1817 by modifying the parsing of integer arguments in
flags that take them.
6. Fixes -Oconfig file parsing (#1778). It reads every line of the file
into a string and then parses that string by tokenizing every group of
characters between whitespaces (using the standard cin reading
operator). This mimics shell command-line parsing, but it does not
support quoting (and I'm not planning to).
-
87f36363
by Diego Novillo
at 2018-08-20T14:44:11Z
Ignore *.pyc files in git commands.
-
45c235d4
by Steven Perron
at 2018-08-21T15:49:56Z
Have dead-branch-elim handle conditional exits from selections. (#1850)
When dead-branch-elim folds a conditional branch, it also deletes the
OpSelectionMerge instruction. If that construct contains a
conditional branch to the merge node, it will not have its own
OpSelectionMerge. When the headers merge instruction is deleted, the
the inner conditional branch will no longer be legal. It will be a
selection to a node that is not a merge node.
We fix this up by moving the OpSelectionMerge to a new location if it is
still needed.
-
d693a83e
by Steven Perron
at 2018-08-21T15:54:44Z
Handle breaks from structured-ifs in DCE. (#1848)
* Handle breaks from structured-ifs in DCE.
dead code elimination assumes that are conditional branches except for
breaks and continues in loops will have an OpSelectionMerge before them.
That is not true when breaking out of a selection construct.
The fix is to look for breaks in selection constructs in the same place
we look for breaks and continues for loops.
-
197b4597
by Alan Baker
at 2018-08-21T15:59:00Z
Fix EvalInt32IfConst to fail on type instructions.
Fixes https://crbug.com/875842
* EvalInt32IfConst dereferenced a null pointer if a type instruction was
sent as the id
-
19264ef4
by Steven Perron
at 2018-08-21T16:04:08Z
Have PredicateBlocks jump the existing merge blocks. (#1849)
* Refactor PredicateBlocks
Refactor PredicateBlocks so that we know which constructs a return
is contained in. Will be used later.
* Have PredicateBlocks jump the existing merge blocks.
In PredicateBlocks, we currently skip instructions with side effects,
but it still follows the same control flow (sort-of). This causes a
problem, when we are trying to predicate code in a loop. We skip all
of the code with side effects (IV increment), but still follow the
same control flow (jump back the start of the loop). This creates an
infinite loop because the code will keep jumping back to the start of
the loop without changing the values that effect the exit condition.
This is a large change to merge-return. When predicating a block that
is in a loop or merge construct, it will jump to the merge block of the
construct. Once out of all constructs we will generate code as we did
before.
-
d91d34e1
by Steven Perron
at 2018-08-21T17:50:47Z
Fix VS2013 build break. (#1853)
-
8bed4462
by Ehsan
at 2018-08-21T18:34:44Z
[kokoro] Stop building and running tests for VS2013 (#1852)
-
c5b38062
by Alan Baker
at 2018-08-21T21:30:26Z
Moving constant opcode validation into a new file
* Split constant opcode validation out of idUsage and into
validate_constants.cpp
* minor style fixes
* reduced duplication
* fixed an issue with array sizing
-
7f4e09ab
by Karl Schultz
at 2018-08-22T14:12:07Z
spirv-as: Fix error in help text.
The assembler always reads assembly text, not binaries.
-
6c73b1fb
by Steven Perron
at 2018-08-23T16:59:31Z
Update the order when predicating blocks. (#1859)
When doing predicate blocks, we need to traverse every block in
structured order in order to keep track of which construct a block is
contained in. The standard way of traversing code in structured order
is to create a list with all of the nodes in order. However, when
predicating blocks, new blocks are created, and those blocks are missed.
This causes branches that go too far.
The solution is to update the order as new blocks are created. Since
we are using an std::list, we do not have to worry about invalidation of
iterators when changing the list.
-
b4d3618f
by Steven Perron
at 2018-08-23T18:38:25Z
Don't "break" from selection constructs. (#1862)
If seems like at least 1 driver does not like a condition jump to the end
of a selection construct. We are generating these in the merge return
pass. This change stops merge return from generating this sequence.
Part of #1861.
-
6d27a835
by Alan Baker
at 2018-08-23T18:49:10Z
Fixing instances of iteration over unordered containers
* There were several instances found in the validator
* validate_id.cpp
* validate_decorations.cpp
* validate_interfaces.cpp
-
d746681f
by Steven Perron
at 2018-08-24T15:55:39Z
Copy decorations when creating new ids. (#1843)
* Copy decorations when creating new ids.
When creating a new value based on an old value, we need to copy the
decorations to the new id. This change does this in 3 places:
1) The variable holding the return value of the function generated by
merge return should get decorations from the function.
2) The results of the OpPhi instructions should get decorations from the
variable they are replacing in the ssa writer.
3) In local access chain convert the intermediate struct (result of
OpCompositeInsert) generated for the store replacement should get its
decorations from the variable being stored to.
Fixes #1787.
-
b938b74b
by Steven Perron
at 2018-08-24T19:08:12Z
Have the constant manager take ownership of constants.
Right now the owner of an object of type contant that is in the
|const_pool_| of the constant manager is unclear. The constant
manager does not delete them, there is no other reasonable owner. This
causes memory leaks.
This change fixes the memory leaks by having the constant manager
take ownership of the constant that is stores in |const_pool_|. Other
changes include interface changes to make it explicit that the constant
manager takes ownership of the object when a constant is registered
with the constant manager.
-
47ee776a
by Steven Perron
at 2018-08-24T19:12:49Z
Revert "Have the constant manager take ownership of constants."
This reverts commit b938b74bacee59cf065d4f36bf1a02585ca7ea47.
-
416b1ab4
by Steven Perron
at 2018-08-27T13:53:47Z
Have the constant manager take ownership of constants. (#1866)
* Have the constant manager take ownership of constants.
Right now the owner of an object of type contant that is in the
|const_pool_| of the constant manager is unclear. The constant
manager does not delete them, there is no other reasonable owner. This
causes memory leaks.
This change fixes the memory leaks by having the constant manager
take ownership of the constant that is stores in |const_pool_|. Other
changes include interface changes to make it explicit that the constant
manager takes ownership of the object when a constant is registered
with the constant manager.
Fixes #1865.
-
d94a2077
by alan-baker
at 2018-08-27T15:06:09Z
Remove idUsage
* Moved remaining validation out of idUsage and deleted it
* Deleted unused functions
-
06b42949
by Steven Perron
at 2018-08-27T15:41:25Z
Validate uses of OpTypeFunction. (#1867)
In the specification of `OpTypeFunction`, it says
> OpFunction is the only valid use of OpTypeFunction.
This commit add a check in the validator for this rule.
A test started to fail because the new check happens before the check
the test case is testing. Updated the test case to still fail the
check it was suppose to fail originally.
http://crbug.com/874571
-
482b1744
by Steven Perron
at 2018-08-28T03:45:32Z
Validate all type ids. (#1868)
* Validate all type ids.
The validator does not check if the type of an instruction is actually
a type unless the OpCode has a specific requirement. For example,
OpFAdd is checked, but OpUndef is not.
The commit add a generic check that if there is a type id then the id
defines a type.
http://crbug.com/876694
* Merge other checks for type into new one.
There are a couple check that the type id is a type for specific
opcodes. Those have been mereged into 1.
Small changes to other test cases to make them valid enough for the
purpose of the test.
-
cb0f1f56
by Alan Baker
at 2018-08-31T13:45:45Z
Remove struct member offset monotonicity check
Fixes #1822
* Remove check that struct member offsets must be monotonic
* All environments match Vulkan behaviour now
* updated offending tests
-
58e53ea8
by Tobin Ehlis
at 2018-08-31T21:51:43Z
Fix sign mismatch warning
Cast negative ints to uint32_t to avoid int/uint comparison warning.
-
3cddf913
by Corentin Wallez
at 2018-09-05T17:37:12Z
BUILD.gn: Make a better interface with dependents. (#1875)
This splits the spvtools_config into a public and private part to avoid
leaking internal bits to dependents. A new target is added for the
public headers so that "gn check" works for dependents.
-
b27d084b
by dan sinclair
at 2018-09-05T18:21:01Z
Revert "BUILD.gn: Make a better interface with dependents. (#1875)" (#1876)
This reverts commit 3cddf9131d21b5b48da2c638ae181489213cb2a6.
This breaks the Chrome roll:
ERROR Unresolved dependencies.
//third_party/SPIRV-Tools/src/test/fuzzers:fuzzer_config(//build/toolchain/linux:clang_x64)
needs //third_party/SPIRV-Tools/src:spvtools_config(//build/toolchain/linux:clang_x64)
GN gen failed: 1
-
21bcb9d8
by Corentin Wallez
at 2018-09-06T14:50:27Z
BUILD.gn: Make a better interface with dependents. (#1877)
This splits the spvtools_config into a public and private part to avoid
leaking internal bits to dependents. A new target is added for the
public headers so that "gn check" works for dependents.
Also formats test/fuzzers/BUILD.gn
-
571251c8
by David Neto
at 2018-09-06T17:30:32Z
Support SPV_KHR_vulkan_memory_model rev2
Support collapsed into one commit:
- Asm/Dis support for SPV_KHR_vulkan_memory_model
- Add Vulkan mem model image operands to switch
- Add TODO for source/validate_image.cpp
- val: Image operands NonPrivateTexelKHR, VolatileTexelKHR have no operands
This is required for memory model tests to pass SPIR-V validation.
- Round trip tests: Test new flags on OpCopyMemory*
-
7600fc0e
by David Neto
at 2018-09-06T17:41:31Z
Update Dim capabilities
Corresponds to grammar changes for SPIR-V 1.3 Rev4.
-
03896b05
by David Neto
at 2018-09-07T15:40:14Z
Update CHANGES
-
b4cb01c7
by David Neto
at 2018-09-07T15:40:56Z
Finalize SPIRV-Tools v2018.5
-
3e38c99f
by David Neto
at 2018-09-07T15:42:12Z
Start SPIRV-Toosl v2018.6-dev
-
40a68547
by dan sinclair
at 2018-09-07T16:58:32Z
Roll spirv-headers in DEPS (#1884)
-
f62d7978
by Steven Perron
at 2018-09-10T13:21:32Z
Add validation check for arrays of void type. (#1880)
In the definition of an array
(https://www.khronos.org/registry/spir-v/specs/1.2/SPIRV.html#Array),
it specfically mentions that array elements have non-void type. I've
added a check for that in this PR.
http://crbug.com/879016
-
75c1bf28
by Steven Perron
at 2018-09-10T15:49:41Z
Add option for the max id bound. (#1870)
* Create a new entry point for the optimizer
Creates a new struct to hold the options for the optimizer, and creates
an entry point that take the optimizer options as a parameter.
The old entry point that takes validator options are now deprecated.
The validator options will be one of the optimizer options.
Part of the optimizer options will also be the upper bound on the id bound.
* Add a command line option to set the max value for the id bound. The default is 0x3FFFFF.
* Modify `TakeNextIdBound` to return 0 when the limit is reached.
-
2c2fee79
by Jaebaek Seo
at 2018-09-10T17:33:13Z
Validator: check OpTypeBool inside Blocks (#1405)
OpTypeBool can only be used with non-externally visible shader
Storage Classes: Workgroup, CrossWorkgroup, Private, and Function.
-
324be76b
by dan sinclair
at 2018-09-11T13:34:42Z
Fixup BUILD.gn file (#1886)
-
0f4c772e
by Lei Zhang
at 2018-09-12T17:41:50Z
Respect --skip-validation in spirv-opt (#1887)
Previously a field in OptimizerOptions was set for --skip-validation,
but the OptimizerOptions was never used when calling optimizer.Run().
-
6d5f1bc2
by Steven Perron
at 2018-09-14T17:37:18Z
Allow merge blocks to merge two header blocks in some cases. (#1890)
In merge blocks, we do not allow the merging of two blocks with merge
instructions. This is because if the two block are merged only 1 of
those instructions can exists. However, if the successor block is the
merge block of the predecessor, then we can delete the merge instruction
in the predecessor. In this case, we are able to merge the blocks.
-
63265097
by Lei Zhang
at 2018-09-14T18:07:25Z
Add support for VK_KHR_shader_atomic_int64 in validator
-
4a463226
by Diego Novillo
at 2018-09-14T18:28:34Z
Add IR dumping functions to use during debugging.
When using lldb and/or gdb I frequently get odd std::string failures
when using the IR printing instructions we have now. This adds the
methods Instruction::Dump(), BasicBlock::Dump() and Function::Dump() to
emit the output of the pretty print to stderr.
With this I can now reliably print IR from gdb and lldb sessions.
-
5f599e70
by Steven Perron
at 2018-09-17T17:00:24Z
Fix infinite loop in dead-branch-elimination (#1891)
* Create structed cfg analysis.
There are lots of optimization that have to traverse the CFG in a
structured order just because it wants to know which constructs a
basic block in contained in. This adds extra complexity to these
optimizations, for causes too much refactoring of older optimizations.
To help with this problem, I have written an analysis that can give this
information.
* Identify branches breaking from loops.
Dead branch elimination does a search for a conditional branch to the
end of the current selection construct. This search assumes that the
only way to leave the construct is through the merge node. But that is
not true. The code can jump to the merge node of a loop that contains
the construct.
The search needs to take this into consideration.
-
7075c499
by Steven Perron
at 2018-09-18T12:52:47Z
Add dummy loop in merge-return. (#1896)
The current implementation of merge return can create bad, but correct,
code. When it is not in a loop construct, it will insert a lot of
extra branch around code. The potentially large number of branches are
bad. At the same time, it can separate code store to variables from
its uses hiding the fact that the store dominates the load.
This hurts the later analysis because the compiler thinks that multiple
values can reach a load, when there is really only 1. This poorer
analysis leads to missed optimizations.
The solution is to create a dummy loop around the entire body of the
function, then we can break from that loop with a single branch. Also
only new merge nodes would be those at the end of loops meaning that
most analysies will not be hurt.
Remove dead code for cases that are no longer possible.
It seems like some drivers expect there the be an OpSelectionMerge
before conditional branches, even if they are not strictly needed.
So we add them.
-
7f0a8877
by Steven Perron
at 2018-09-18T12:53:09Z
Move the registration of decorations. (#1895)
We currently register decorations in the first pass through the
instructions. This is a problem because the validator has not even
checked if the decoration instructions are valid yet. This can lead to
unexpected behaviour from these side table. For example, in
https://github.com/KhronosGroup/SPIRV-Tools/issues/1882, we use 5GB of
data to store 1 decoration for ids that are not even defined.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1882.
-
0cd3e599
by Jaebaek Seo
at 2018-09-18T14:16:46Z
Validator: correct out of bound check for OpMemberDecorate (#1881)
The number that indicates a member in OpMemberDecorate must be less
than the number of total members of struct.
-
9e99d8b6
by Jaebaek Seo
at 2018-09-18T14:35:28Z
Specified clang-format version in README.md
-
9fbcce4c
by Steven Perron
at 2018-09-19T20:40:09Z
Add unrolling to the legalization passes (#1903)
Adds unrolling to the legalization passes.
After enabling unrolling I found a bug when there is a self-referencing
phi node. That has been fixed.
The test that checks for that the order of optimizations is correct also
needed to be updated.
-
6e2dab2f
by Chao Chen
at 2018-09-20T00:46:14Z
Add support for Nvidia Turing extensions
-
9bfe0eb2
by Lei Zhang
at 2018-09-20T15:51:40Z
Wrap tests needing effcee inside SPIRV_EFFCEE
-
575af7ec
by Lei Zhang
at 2018-09-21T12:25:26Z
[kokoro] Add test job for disabling effcee (#1911)
-
14921113
by Alan Baker
at 2018-09-22T01:50:20Z
Validate vulkan mem model capabilty
* Check that if the VulkanMemoryModelKHR capability is specified that
the memory model must be VulkanKHR
* added tests
-
90a12b3d
by Alan Baker
at 2018-09-22T01:55:01Z
Decoration validation for Vulkan memory model
* Adds a check that using Coherent or Volatile decorations with the
Vulkan memory model is a validation error
* Adds tests
-
b85fb4a3
by Steven Perron
at 2018-09-25T16:57:44Z
Get KillNameAndDecorates to handle group decorations. (#1919)
It seems like the current implementation of KillNameAndDecorates does
not handle group decorations correctly. The id being removed is not
removed from the OpGroupDecorate instructions. Even worst, any
decorations that apply to that group are removed.
The solution is to use the function in the decoration manager that will
remove the decorations and update the instructions instead of doing the
work itself.
-
903514f9
by dan sinclair
at 2018-09-25T18:04:51Z
Roll DEPS for spirv-headers (#1920)
-
0e5fc7d7
by Steven Perron
at 2018-09-26T13:58:28Z
Allow 0 as argument to scalar replacement. (#1917)
A limit of 0 for the scalar replacement options it used to indicate that
there is no limit. The current implementation does not allow 0. This
should be fixed.
-
7249506b
by dan sinclair
at 2018-09-26T17:32:05Z
Remove stats use of internal API (#1924)
Instead of using the source/table.h methods, this CL switches the stats
tool to use the spvtools::Context class and assign the message consumer
through the public API.
-
b07993eb
by dan sinclair
at 2018-09-26T17:33:16Z
Remove SetContextMessageConsumer from markv_codec_test (#1926)
This CL removes the use of SetContextMessageConsumer from
markv_codec_test and replaces it with a spvtools::Context instead.
-
bfcdc913
by Lei Zhang
at 2018-09-26T19:19:54Z
[ci] Checkout a specific Google Test commit (#1931)
-
026309ab
by Jaebaek Seo
at 2018-09-26T19:52:39Z
Validator: OpGroupNonUniformBallotBitCount validation (#1486)
-
45784eb2
by dan sinclair
at 2018-09-26T20:17:36Z
Remove use of SetContextMessageConsumer from binary_parse_test (#1925)
This CL removes the use of SetContextMessageConsumer from the
binary_parse_test tests and creates a Context object and uses
SetMessageConsumer instead.
-
1225324a
by Lei Zhang
at 2018-09-26T20:45:37Z
VK_KHR_shader_atomic_int64 covers OpAtomic{Load|Store}
-
80564a56
by Steven Perron
at 2018-09-26T21:36:27Z
Keep analyses live in unrolling (#1929)
Add code to keep the def-use manger and the inst-to-block mapping up-to-date. This means we do not have to rebuild them later.
To make this work, we will have to have to find places to update the
def-use manager. Updating the def-use manager is not straight forward
because we are unrolling loops, and we have circular references.
This forces one pass to register all of the definitions. A second one
to analyze the uses. Also because there will be references to the new
instructions in the old code, we want to register the definitions of the
new instructions early, so we can update the uses of the older code as
we go along.
The inst-to-block mapping is not too difficult. It can be done as instructions are created.
Fixes #1928.
-
a78fa097
by alan-baker
at 2018-09-27T13:44:01Z
Set the C++ version to C++11 (#1933)
This reverts commit bfcdc913c4184430e4fca6923683c62723bf5956.
-
4b4bd4c5
by Jaebaek Seo
at 2018-09-27T13:53:30Z
Validator: Validate OpImageTexelPointer (#487)
Checked all instructions whose object is OpTypeSampledImage or
OpTypeImage as suggested in #487. OpImageTexelPointer instruction
is missing and others look good. This commit adds only
OpImageTexelPointer.
-
d3738be3
by Steven Perron
at 2018-09-27T14:11:52Z
Update CHANGES
-
ad0232de
by alan-baker
at 2018-09-27T16:34:14Z
Unify memory instruction validation style (#1934)
* Rename ValidateMemoryInstructions to MemoryPass
* Changed functions to take pointer to an instruction instead of
reference
-
6ff2f647
by Khronos Group Webmaster
at 2018-09-27T20:38:01Z
Update LICENSE
Change Apache 2.0 to Khronos Apache 2.0 CLA
-
f0aa6f4e
by Jaebaek Seo
at 2018-09-28T16:40:57Z
Fixed Validator adjacency bug for OpPhi (#1922)
OpPhi instruction must appear before all non-OpPhi instructions
except for OpLine. Without this commit, Validator does not check
the case that an OpPhi is preceeded by an OpLine and the OpLine is
preceeded by a non-OpPhi instruction that is not OpLine.
-
32381e30
by Steven Perron
at 2018-09-28T18:16:04Z
Handle decoration groups with no decorations. (#1921)
In DecorationManager::RemoveDecorationsFrom, we do not remove the id
from a decoration group if the group has no decorations. This causes
problems because KillNamesAndDecorates is suppose to remove all
references to the id, but in this case, there is still a reference.
This is fixed by adding a special case.
Also, there is the possibility of a double free because
RemoveDecorationsFrom will delete the instructions defining |id| when
|id| is a decoration group. Later, KillInst would later write to memory
that has been deleted when trying to turn it into a Nop. To fix this,
we will only remove the decorations that use |id| and not its definition
in RemoveDecorationsFrom.
-
ddc70593
by Steven Perron
at 2018-09-28T18:39:06Z
Analyze uses for all instructions. (#1937)
* Analyze uses for all instructions.
The def-use manager needs to fill in the `inst_to_used_ids_` field for
every instruction. This means we have to analyze the uses for every
instruction, even if they do not have any uses.
This mistake was not found earlier because there was a typo in the
equality check for def-use managers. No new tests are needed.
While looking into this I found redundant work in block merge. Cleaning
that up at the same time.
* Fix other transformations
Aggressive dead code elimination did not update the OpGroupDecorate
and the OpGroupMemberDecorate instructions properly when they are
updated. That is fixed.
Dead branch elimination did not analyze the OpUnreachable instructions
that is would add. That is taken care of.
-
fe90a1d2
by Jeff Bolz
at 2018-10-01T14:47:39Z
Enable /MP4 (parallel build across 4 cores for MSVC) for SPIRV-Tools/source[/opt] (#1930)
-
146eb3bd
by Steven Perron
at 2018-10-01T18:45:44Z
Fix erroneous uses of the type manager in copy-prop-arrays. (#1942)
There are a few spots where copy propagate arrays is trying
to go from a Type to an id, but the type is not unique. When generating
code this pass needs specific ids, otherwise we get type mismatches.
However, the ambigous types means we can sometimes get the wrong type
and generate invalid code.
That code has been rewritten to not rely on the type manager, and just
look at the instructions instead.
I have opened https://github.com/KhronosGroup/SPIRV-Tools/issues/1939 to
try to get a way to make this more robust.
-
a77bb2e5
by Alan Baker
at 2018-10-02T14:22:23Z
Add validation for execution modes
* Check rules from Execution Mode tables, 2.16.2 and the Vulkan
environment spec
* Allows MeshNV execution model with the following execution modes
* LocalSize, LocalSizeId, OutputPoints and OutputVertices
* Done to not break their validation
-
2a88bcba
by Steven Perron
at 2018-10-02T15:28:17Z
Update CHANGES
-
37c99ab7
by Jaebaek Seo
at 2018-10-02T19:53:52Z
Validator: OpImageQuerySize validation (#1538)
Validation of OpImageQuerySize is missing that is a TODO. This
commit implements its validation based on the spec.
-
d73b9d8d
by Jaebaek Seo
at 2018-10-02T20:06:13Z
[Validator] AMD_gpu_shader_half_float_fetch allow float16 (#1393)
SPV_AMD_gpu_shader_half_float_fetch extension should implicitly
allow declaring 16bit float.
-
a8697b06
by Khronos Group Webmaster
at 2018-10-03T14:11:31Z
Revert LICENSE to Apache 2.0
-
19c07731
by Steven Perron
at 2018-10-03T19:59:40Z
Change handling of unknown extentions in validtor. (#1951)
This commit will change the message for unknown extensions from an error
to a warning.
Code was added to limit the number of warning messages so that consummer
of the messages are not overwhelmed. This is standard practice in
compilers.
Many other issues were found at while looking into this. They have been
documented in #1950.
Fixes http://crbug.com/875547.
-
c4c68712
by Steven Perron
at 2018-10-04T14:00:11Z
Make EFFCEE required (#1943)
Fixes #1912.
Remove the non-effcee build as EFFCEE is now required.
-
3b596017
by Alan Baker
at 2018-10-04T15:58:23Z
Don't scalarize spec constant sized arrays
Fixes #1952
* Prevent scalarization of arrays that are sized by a specialization
constant
-
ebcc58b5
by Jaebaek Seo
at 2018-10-04T19:05:47Z
Validator: function scope variable at start of entry block #1923
All OpVariable instructions in a function must be the first
instructions in the first block.
-
497958d8
by Steven Perron
at 2018-10-05T12:23:09Z
Removing HLSLCounterBuffer decorations when not needed. (#1954)
The HlslCounterBufferGOOGLE that was introduced changed the OpDecorateId
so that is can now reference an id other than the target. If that other
id is used only in the decoration, then the definition of the id will be
removed because decoration do not count as real uses.
However, if the target of the decoration is still live the decoration
will not be removed. This leaves a reference to an id that is not
defined.
There are two solutions to consider. The first is that is the decoration
is kept, then the definition of the id should be kept live. Implementing
this change would be involved because the way ADCE handles decorations
will have to be reimplemented.
The other solution is to remove the decoration the id is otherwise dead.
This works for this specific case. Also this is the more desirable
behaviour in this case. The id will always be the id of a variable that
belongs to a descriptor set. If that variable is not bound and we do
not remove it, the driver will complain.
I chose to implement the second solution. The first will be left to when
a case for it comes up.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1885.
-
03cbf33a
by Jaebaek Seo
at 2018-10-05T17:33:03Z
Validator: FPRoundingMode decoration (#1482)
This commit checks the following when Shader capability exists:
"The FPRoundingMode decoration can be applied only to a width-only
conversion instruction that is used as the Object operand of an
OpStore storing through a pointer to a 16-bit floating-point object
in the StorageBuffer, Uniform, PushConstant, Input, or Output
Storage Classes.".
-
d3f88b08
by Ben Ashbaugh
at 2018-10-09T15:33:01Z
allow atomics on Function pointers for OpenCL (#1955)
-
fae1e61a
by alan-baker
at 2018-10-10T15:14:01Z
Fix bug in construct block calculation (#1964)
Fixes #1960
* Only allows blocks that are dominated by the header
* Fixed a bad loop fusion test
* Added a test derived from the reported bug
-
4e266f77
by Steven Perron
at 2018-10-10T15:17:26Z
Fold divisions by 0. (#1963)
The current implementation in the folder when seeing a division by zero
is to assert. In the release build, the compiler will attempt to
compute the value, which causes its own problems.
The solution I will go with is to fold the division, and just give it
the value of 0. The same goes for remainder and mod operations.
Fixes #1961.
-
bc09f53c
by alan-baker
at 2018-10-10T17:25:48Z
Fix calculation of case fall through (#1965)
Fixes #1959
* Code erroneously concluded that the target's fall through was itself
* Added a test
-
82663f34
by Steven Perron
at 2018-10-10T19:18:15Z
Check for unreachable blocks in merge-return. (#1966)
Merge return assumes that the only unreachable blocks are those needed
to keep the structured cfg valid. Even those must be essentially empty
blocks.
If this is not the case, we get unpredictable behaviour. This commit
add a check in merge return, and emits an error if it is not the case.
Added a pass of dead branch elimination before merge return in both the
performance and size passes. It is a precondition of merge return.
Fixes #1962.
-
68ad72ca
by Khronos Group Webmaster
at 2018-10-10T19:50:08Z
Create CODE_OF_CONDUCT.md
-
1c128aa9
by Alan Baker
at 2018-10-11T21:47:18Z
Validating for new image operands
* Validation checks for new image operands MakeTexelAvailableKHR and
MakeTexelVisibleKHR
* added tests
* Tests that NonPrivateTexelKHR is accepted for all image operands
Updating test environments
* fixed build errors
* changed image types for *FetchSuccess tests to use a type defined in
1.3 shader body
-
e5455648
by greg-lunarg
at 2018-10-12T12:46:35Z
Consider atomics that load when analyzing live stores in ADCE (#1956) (#1958)
Consider atomics that load when analyzing live stores in ADCE.
Previously it asserted that the base of an OpImageTexelPointer should
be an image. It is actually a pointer to an image, so IsValidBasePointer
should suffice.
-
bdecee8c
by David Neto
at 2018-10-12T12:54:52Z
Validator: TaskNV can use LocalSize or LocalSizeId (#1970)
Correponds to the update to Rev2 of SPV_NV_mesh_shader
Fixes #1968
-
5bc30788
by Nuno Subtil
at 2018-10-12T14:22:25Z
Fix gtest.h include in test/opt/pass_utils.h
Fixes builds where googletest is outside the SPIRV-Tools tree.
-
72bac04d
by alan-baker
at 2018-10-15T13:30:47Z
Memory access checks for vulkan mem model (#1909)
* MakePointerVisibleKHR cannot be used with OpStore
* MakePointerAvailableKHR cannot be used with OpLoad
* MakePointerAvailableKHR and MakePointerVisibleKHR both require
NonPrivatePointerKHR
* NonPrivatePointerKHR is limited to a subset of storage classes
* many tests
-
339d2327
by Jeff Bolz
at 2018-10-15T15:12:02Z
Enable precompiled headers for MSVC (#1969)
-
eea449a1
by David Neto
at 2018-10-15T21:22:50Z
validator: FPRoundingMode can apply to vector conversions
Fixes #1972
-
ab45d691
by greg-lunarg
at 2018-10-16T12:00:07Z
Fix ADCE liveness to include all enclosing control structures. (#1975)
Was removing control structures which didn't have data dependency
with enclosed live loop and otherwise did not contain live code.
An example is a counting loop around a live loop.
Fixes #1967.
-
b407163e
by Steven Perron
at 2018-10-16T18:57:55Z
Checks for variable pointers (#1976)
In logical addressing mode, we are not allowed to generate variables
pointers. There is already a check for OpSelect. However, OpPhi
and OpPtrAccessChain are not checked to make sure it does not
generate an variable pointer. I've added those checks.
Fixes #1957.
-
9aa14a38
by alan-baker
at 2018-10-17T17:45:05Z
OpGroupDecorate may not target OpDecorationGroup (#1977)
Fixes https://crbug.com/896200
* Adds a check to validation of OpGroupDecorate that OpDecorationGroup
cannot be targeted
-
0e68bb36
by Steven Perron
at 2018-10-18T12:48:27Z
Only run merge-returnon reachable functions. (#1983)
We currently run merge-return on all functions, but
dead-branch-elimination only runs on function reachable from an entry
point or exported function. Since dead-branch-elimination is needed for
merge-return, they have to match.
Fixes #1976.
-
c4687889
by greg-lunarg
at 2018-10-19T14:16:35Z
Fix ADCE to treat OpUnreachable correctly during liveness analysis (#1984)
ADCE liveness algorithm should treat OpUnreachable at least like other
branch instructions. It was being treated as always live which was
preventing useless structured constructs from being eliminated.
OpUnreachable is generated by dead branch elimination which is now
being required by merge return, so this fix should accompany that
change.
-
67ebe3f7
by Steven Perron
at 2018-10-19T14:17:47Z
Add custom target to wrap around custom commands. (#1986)
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.
Fixes #1941.
-
c5a6d259
by Steven Perron
at 2018-10-19T15:59:01Z
Increase the template nesting depth for clang. (#1995)
We started hitting this limit, so increaseing from 256 to 1024.
Fixes #1994.
-
715afb0c
by Steven Perron
at 2018-10-19T16:53:40Z
Add a nullptr check to array copy propagation. (#1987)
We are missing a check for a nullptr that is causing things to fail.
Added an extra test case, and fixed up others.
This is the fix for https://github.com/Microsoft/DirectXShaderCompiler/issues/1598.
-
d29a1f98
by Neil Henning
at 2018-10-19T17:45:26Z
Add validaton for SPV_KHR_8bit_storage + convert to/from floats. (#1990)
The SPV_KHR_8bit_storage extension does not permit 8-bit integers to be
cast directly to floating point types. We are seeing shaders in the
wild, being produced by toolchains like glslang, that are generating
invalid SPIR-V.
This change adds validation to check for the patterns not permitted, and
some tests that expose the failure.
-
8edf3557
by Steven Perron
at 2018-10-19T18:05:19Z
Revert "Add custom target to wrap around custom commands. (#1986)" (#1996)
Breaks the build when using makefiles. The ninja build is fine.
This reverts commit 67ebe3f7aebe73426a3bf9718dba56f051d75db5.
-
dd1e837e
by Jeff Bolz
at 2018-10-19T18:58:26Z
Use per-configuration location for pch file (#1989)
-
6e85d1a6
by alan-baker
at 2018-10-19T19:16:46Z
Fix restrictions in if conversion (#1998)
Fixes #1991
* Improved identification of potential conditional branches
* Pass changed to only work for shaders
* added a test to catch the bug
-
89b8e238
by alan-baker
at 2018-10-22T12:47:56Z
Better checking of the index operand (#1992)
Fixes https://crbug.com/897069
* Code previously assumed the index instruction had a type
* Added a test to reproduce
-
20bbfb6f
by alan-baker
at 2018-10-22T12:50:45Z
Layout checks should recurse through runtime arrays (#1999)
Fixes #1985
* Added test to catch bug
* Tested aginst Vulkan CTS
-
0ba35798
by Steven Perron
at 2018-10-22T17:59:20Z
Fix dead branch elim infinite loop. (#1997)
When looking for a break from a selection construct, we do not need to
look inside nested constructs. However, if a loop header has an
unconditional branch, then we enter the loop. Entering the loop causes
an infinite loop because we keep going through the loop.
The solution is to look for a merge block, if one exsits, even for block
terminated by an OpBranch.
Fixes #1979.
-
07d0f9df
by Steven Perron
at 2018-10-22T19:10:53Z
Update CHANGES
-
18fe6d59
by Steven Perron
at 2018-10-24T13:10:30Z
Fix dead branch elim infinite loop. (#2009)
When looking for a break from a selection construct, we do not realize
that a jump to the continue target of a loop containing the selection
is a break. This causes and infinit loop, or possibly other failures.
Fixes #2004.
-
1c1e749f
by alelenv
at 2018-10-25T18:07:46Z
Add support for nv-raytracing-final (#2010)
Add support for nv-raytracing (non-experimental)
-
6647884a
by Steven Perron
at 2018-10-30T20:17:35Z
Remove MemberDecorateStringGOOGLE during stript-refect. (#2021)
The strip-reflect pass is not removing the reflection decorations that
are decorating members. With this commit, they will now be removed.
Fixes #2019.
-
fb996dce
by Jeff Bolz
at 2018-10-31T11:59:43Z
Add /Zm flag as a workaround for VS2013 build (#2023)
-
9e6f5134
by dan sinclair
at 2018-11-01T14:19:37Z
Reduce number of test targets (#2024)
This CL takes the various opt unit tests and makes a single executable
instead of one per test. This reduces the number of build targets by
~125 when building with ninja.
-
f2cc71e5
by Steven Perron
at 2018-11-02T17:42:45Z
Handle OpMemberDecorateStringGOOGLE in ACDE (#2029)
Add missing case to the switch statement for the annotation
instructions.
See https://github.com/KhronosGroup/glslang/issues/1561.
-
60fac96c
by Jeff Bolz
at 2018-11-06T14:26:23Z
Enable precompiled headers for spirv-tools(-shared) and some unit tests (#2026)
-
398f37a2
by James Jones
at 2018-11-06T16:12:26Z
Add explicit void parameter in libspirv.h again (#2032)
When building C code with gcc and the
-Wstrict-prototypes option, function declarations
and definitions that don't specify their argument
types generate warnings. Functions that don't
take parameters need to specify (void) as their
parameter list, rather than leaving it empty.
Note this only applies to C, so only the functions
exported in C-compatible headers need fixing. In
C++ functions can't be declared/defined without a
parameter list, so C++ can safely allow an empty
parameter list to imply (void).
-
91f33503
by Steven Perron
at 2018-11-06T16:30:19Z
Validate the id bound. (#2031)
* Validate the id bound.
Validates that the id bound for the module is not larger than the max id
bound. Also adds an option to set the max id bound. Allows the
optimizer option to set the max id bound to also set the id bound for
the validation run done by the optimizer.
Fixes #2030.
-
c06a35b9
by Jeff Bolz
at 2018-11-07T14:15:04Z
Rename PCH macro to spvtools_pch to avoid conflicts with other projects. Also add pch to test/opt. (#2034)
-
e8f22d14
by Steven Perron
at 2018-11-07T14:39:14Z
Update CHANGES
-
9d699f6d
by Steven Perron
at 2018-11-07T14:39:51Z
Finalize SPIRV-Tools v2018.6
-
e121da84
by Steven Perron
at 2018-11-07T14:40:35Z
Start SPRIV-Tools v2018.7
-
4e6c54b6
by Steven Perron
at 2018-11-08T02:08:59Z
Fix up comment for |ParseFlags|. (#2037)
Fixes #2033.
-
6721478e
by greg-lunarg
at 2018-11-08T14:11:20Z
Don't assume one return means function can be inlined. (#2018) (#2025)
If there is only 1 return and it is in a loop, then the function cannot be inlined.
Fix condition when inlined code needs one-trip loop wrapper. The dummy loop is needed when there is a return inside a selection construct. Even if there is only 1 return.
-
1e9fc1aa
by greg-lunarg
at 2018-11-08T18:54:54Z
Add base and core bindless validation instrumentation classes (#2014)
* Add base and core bindless validation instrumentation classes
* Fix formatting.
* Few more formatting fixes
* Fix build failure
* More build fixes
* Need to call non-const functions in order.
Specifically, these are functions which call TakeNextId(). These need to
be called in a specific order to guarantee that tests which do exact
compares will work across all platforms. c++ pretty much does not
guarantee order of evaluation of operands, so any such functions need to
be called separately in individual statements to guarantee order.
* More ordering.
* And more ordering.
* And more formatting.
* Attempt to fix NDK build
* Another attempt to address NDK build problem.
* One more attempt at NDK build failure
* Add instrument.hpp to BUILD.gn
* Some name improvement in instrument.hpp
* Change all types in instrument.hpp to int.
* Improve documentation in instrument.hpp
* Format fixes
* Comment clean up in instrument.hpp
* imageInst -> image_inst
* Fix GetLabel() issue.
-
75999d9b
by dan sinclair
at 2018-11-12T19:24:47Z
Remove asserts around environment determination. (#2040)
This CL removes several asserts around determining the SPIR-V
environment. In each case we already return a default value if
assertions are compiled out, so just return the default value.
-
f343a157
by dan sinclair
at 2018-11-12T20:11:32Z
Add missing overrides (#2041)
-
2b1f6b37
by Neil Henning
at 2018-11-13T14:22:48Z
Validate that VertexId and InstanceId are not allowed in Vulkan. (#2036)
The Vulkan specification does not permit use of the VertexId and
InstanceId BuiltIn decorations, so add a check to ensure they are not
being used when the target environment is Vulkan.
-
5beeee15
by Ryan Harrison
at 2018-11-14T15:30:20Z
Add fuzzer for spvBinaryParser (#2045)
Add fuzzer for spvBinaryParser
-
ec5574a9
by Steven Perron
at 2018-11-14T17:42:25Z
Instruction::GetBaseAddress to handle OpPtrAccessChain (#2050)
That function currently only handled OpPtrAccessChain if it was in the
middle of the chain, but not at the start. Fixing that up.
Fixes crbug.com/905271.
-
a6150a3f
by Steven Perron
at 2018-11-14T17:43:43Z
Don't assert on void function parameters. (#2047)
The type manager in spirv-opt currently asserts if a function parameter
has type void. It is not exactly clear from the spec that this is
disallowed, even if it probably will be disallowed. In either case,
asserts should be used to verify assumptions that will actually make a
difference to the code. As far as the optimizer is concerned, a void
parameter does not matter. I don't see the point of the assert. I'll
just remove it and let the validator decide whether to accept it or not.
No test was added because it is not clear that it is legal, and should
not force us to accept it in the future unless the spec make it clear
that it is legal.
Fixes crbug.com/903088.
-
dc9d155d
by Steven Perron
at 2018-11-14T18:52:18Z
Fix folding of volatile store. (#2048)
When looking for the Volatile mask on a store, the instruction folder
accesses an out-of-bounds element. We fix that up.
Fixes crbug.com/903530.
-
a362e60d
by Ryan Harrison
at 2018-11-14T20:00:03Z
Validate variable types for UniformConstant storage in Vulkan (#2008) (#2044)
Validate variable types for UniformConstant storage in Vulkan (#2008)
>From the Vulkan 1.1 spec 14.5.2:
Variables identified with the UniformConstant storage class are used
only as handles to refer to opaque resources. Such variables must be
typed as OpTypeImage, OpTypeSampler, OpTypeSampledImage, or an array
of one of these types.
Fixes #2008
-
5c334514
by alan-baker
at 2018-11-14T20:03:40Z
Allow InstanceId for NV ray tracing (#2049)
* Allow InstanceId for NV ray tracing
Fixes #2046
* Allows InstanceId in the Vulkan environment if RayTracingNV
capability is specified
-
d4a10590
by Greg Fischer
at 2018-11-14T22:25:51Z
Fix Instruction::IsFloatingPointFoldingAllowed()
Was looking for decorations based on opcode. Should use result_id.
-
a29a9947
by David Neto
at 2018-11-15T02:50:09Z
UniformConstant variables can have RuntimeArray, TypeAccelerationStructureNV
-
ab76e332
by fjhenigman
at 2018-11-15T18:42:17Z
Validate uniform variable type in Vulkan (#1949) (#2055)
>From the Vulkan 1.1 spec 14.5.2:
Variables identified with the Uniform storage class are used to access
transparent buffer backed resources. Such variables must be typed as
OpTypeStruct, or an array of this type.
Fixes #1949
-
c37388f1
by greg-lunarg
at 2018-11-15T19:06:17Z
Add passes to propagate and eliminate redundant line instructions (#2027). (#2039)
These are bookend passes designed to help preserve line information
across passes which delete, move and clone instructions. The propagation
pass attaches a debug line instruction to every instruction based on
SPIR-V line propagation rules. It should be performed before optimization.
The redundant line elimination pass eliminates all line instructions
which match the previous line instruction. This pass should be performed
at the end of optimization to reduce physical SPIR-V file size.
Fixes #2027.
-
6a7b164f
by alan-baker
at 2018-11-16T14:14:22Z
Add shaderc smoketest configuration (#2057)
* Build scripts to build shaderc against specific SPIRV-Tools
* Kokoro configuration files
-
d7cd1203
by Ryan Harrison
at 2018-11-16T16:22:11Z
Ensure for OpVariable that result type and storage class operand agree (#2052)
>From SPIR-V spec, section 3.32.8 on OpVariable:
Its Storage Class operand must be the same as the Storage Class
operand of the result type.
Fixes #941
-
28d8d7bc
by alan-baker
at 2018-11-16T19:22:42Z
Fix min base alignment (#2075)
Fixes #2073
* Added a test
-
8e9be303
by David Neto
at 2018-11-16T20:55:30Z
Validator: Support VK_EXT_scalar_block_layout
Adds validator option to specify scalar block layout rules.
Both VK_KHR_relax_block_layout and VK_EXT_scalar_block_layout can be
enabled at the same time. But scalar block layout is as permissive
as relax block layout.
Also, scalar block layout does not require padding at the end of a
struct.
Add test for scalar layout testing ArrayStride 12 on array of vec3s
Cleanup: The internal getSize method does not need a round-up argument,
so remove it.
-
cd22b315
by Alan Baker
at 2018-11-16T21:40:39Z
Catch branch condition being a type
Fixes https://crbug.com/903691
* Added a test
-
d652ed30
by Alan Baker
at 2018-11-19T16:44:20Z
Vulkan memory model: semantics validation
Ban sequentially consistent with VulkanKHR
* Added validation check that SequentiallyConsistent memory semantics
are not used if the memory model is VulkanKHR
* Added tests
* Fixed a bug in evaluating constant 32-bit integers and updated some
handling to avoid inferring a value from a spec constant default
Remaining memory semantics validation
* Adds checks that OutputMemoryKHR, MakeAvailableKHR and MakeVisibleKHR
are only used if the VulkanMemoryModelKHR capabailty is present
* Added checks that MakeAvailableKHR requires release semantics
* Added checks that MakeVisibleKHR requires acquire semantics
* Added checks that MakeAvailableKHR and MakeVisibleKHR require a
storage class
-
8cd2a9d1
by Ryan Harrison
at 2018-11-19T19:32:18Z
Validate component literals for OpVectorShuffle in WebGPU environment (#2077)
Validate component literals for OpVectorShuffle in WebGPU environment
Fixes #2072
-
f5b4a8ee
by alan-baker
at 2018-11-19T20:08:38Z
Catch invalid input type to OpConvertUToPtr (#2078)
Fixes https://crbug.com/906426
* Fails validation if the input operand is a type
* Added a test
-
b0c143c8
by Ryan Harrison
at 2018-11-19T22:04:03Z
Add tests for matrix type data rule validation (#2082)
Add tests for matrix type data rule validation
This covers the data rules for matrix types specified in the SPIR-V
spec, section 2.16.1, and the WebGPU SPIR-V Execution Environment
spec.
Fixes #2065
Fixes #2080
-
15fdcf94
by dan sinclair
at 2018-11-20T00:24:48Z
Add missing override to ProcessLinesPass
-
101c113f
by Steven Perron
at 2018-11-20T02:46:07Z
Remove long running cfg limit test.
We had a test that checks that a spirv binary where the depth of the
deepest nested construct is just below the default limit. This test
would take a long time causing a timeout in some builds. We are
questioning the value of the test since we already have a test that can
tell us if we are within a custom limit. We will remove the test.
-
66f8f645
by Hugues Evrard
at 2018-11-20T16:10:19Z
Update build instructions: add effcee, re2 (#2085)
Both effcee and re2 are now required dependencies, add their checkout in build instructions.
-
d41ff27f
by alan-baker
at 2018-11-20T17:41:03Z
Add support for VK_EXT_Transform_feedback capabilities (#2088)
* Added support for Transform Feedback capabilities.
* Fix tests
-
11c7a9e0
by Ryan Harrison
at 2018-11-20T21:12:28Z
Validate that debugging instructions are not present for WebGPU (#2089)
Validate that debugging instructions are not present for WebGPU
For WebGPU execution environments, check that all of the debug
instructions have already been stripped before validation.
Fixes #2063
-
3adb7977
by Ryan Harrison
at 2018-11-20T21:40:38Z
Check forbidden Annotation instructions for WebGPU env (#2090)
Check forbidden Annotation instructions for WebGPU env
>From the WebGPU SPIR-V Execution Enviroment spec:
OpDecorationGroup, OpGroupDecorate, OpGroupMemberDecorate are not
allowed.
Fixes #2062
-
fe39a6f3
by Ryan Harrison
at 2018-11-21T16:13:28Z
Add tests coverage for OpTypeVector column count validation (#2087)
Add tests coverage for OpTypeVector column count validation
Fixes #2064
Fixes #2086
-
f3acb955
by Alastair Donaldson
at 2018-11-21T19:03:09Z
Initial commit for spirv-reduce. (#2056)
Creates a new tool that can be used to reduce failing testcases, similar to creduce.
-
981763ec
by Ryan Harrison
at 2018-11-21T21:41:59Z
Ensure correct Addressing and Memory model set for WebGPU (#2093)
Adding validation that the addressing declared by OpMemoryModel is
Logical and the memory model declared is VulkanKHR. Updating a bunch
of tests that were broken by this.
Fixes #2060
-
7a3493e8
by Ryan Harrison
at 2018-11-22T17:52:04Z
Make sure that initialized variable have correct storage class (#2092)
Make sure that initialized variable have correct storage class
For WebGPU and Vulkan environments, variables must have the storage
class; Output, Private, or Function, if they have an initializer.
Fixes #2071
-
78c951b3
by dan sinclair
at 2018-11-22T19:35:40Z
Add newline at end of file (#2098)
-
095cc672
by Minmin Gong
at 2018-11-22T23:00:08Z
Fix the missing pch files in spirv-reduce (#2097)
-
3b210d6a
by Daniel Koch
at 2018-11-23T15:21:19Z
Add basic support for EXT_fragment_invocation_density (#2100)
Whitelisting the extension in optimizations
* copying what was done for NV_shading_rate
-
9e71de13
by Baldur Karlsson
at 2018-11-23T16:47:37Z
Add cmake option to turn off SPIRV_TIMER_ENABLED (#2103)
-
d543f7df
by Michał Janiszewski
at 2018-11-26T15:37:30Z
Don't use CMake's own property as variable name (#2112)
```
$ cmake --help-property-list | grep ^VERSION$
VERSION
```
-
72d4e541
by Steven Perron
at 2018-11-26T20:47:48Z
Change HexFloat to work with gcc8. (#2109)
When we want to set a the value of a HexFloat to inf or nan, we
construct the specific bit pattern in an appropriately sized integer.
That integer is copied to a FloatProxy object through a memcpy. GCC8
complains about the memcpy because it is overwriting a private member of
the class.
The original solution worked well because the template to the HexFloat
could be anything. However, we only used some instantiation of FloatProxy,
which has a construction from that takes its uint_type, so I decided to use
that constructor instead of the memcpy. This puts an extra requirement
on the templace for HexFloat, but it will be fine for us.
Part of #1541.
-
e799bfb9
by alan-baker
at 2018-11-26T21:58:09Z
Prevent diagnostic memory leak (#2110)
Fixes https://crbug.com/906669
* Don't free diagnostics in spvBinaryParse
* When invoking the parser we wish to ignore the error messages from,
instead create a hijacked context and replace the message consumer with
a null consumer
-
3b13040c
by Alastair Donaldson
at 2018-11-26T22:06:21Z
New spirv-reduce reduction pass: operand to dominating id. (#2099)
* Added a reduction pass to replace ids with ids of the same type that dominate them.
* Introduce helper method for querying whether an operand type is an input id.
-
4e22b601
by Steven Perron
at 2018-11-27T00:46:08Z
Add validation for OpArrayLength. (#2117)
The validation rules for OpArrayLength are not checked by the validator.
This with add them.
Fixes https://crbug.com/907451.
-
f989b2db
by alelenv
at 2018-11-27T13:35:29Z
Add precise check for allowing use of gl_InstanceID for specific vulkan raytracing stages . (#2096)
* Checks that gl_InstanceID is only used in specific execution models
-
48d92390
by Ryan Harrison
at 2018-11-27T14:39:37Z
Restrict capabilities to WebGPU spec (#2113)
Restrict capabilities to WebGPU spec
This covers whitelisting Matrix, Shader, Sampled1D, Image1D,
DerivativeControl, and ImageQuery. These are the allowed capabilities
that don't require an extension. Whitelisting VulkanMemoryModelKHR
will be handled by whitelisting its extension in a seperate patch.
Fixes #2101
-
dab634da
by Ryan Harrison
at 2018-11-27T14:40:19Z
Ensure that function parameter's type is not void (#2118)
Fixes #2094
-
4759082b
by Ryan Harrison
at 2018-11-27T21:20:01Z
Ensure that imported extended instructions for WebGPU are only "GLSL.std.450" (#2119)
Ensure that imported extended instructions for WebGPU are GLSL.std.450
Fixes #2059
-
3d56cddb
by alan-baker
at 2018-11-27T21:47:10Z
Validate pointer variables (#2111)
Fixes #2104
* Checks the rules for logical addressing and variable pointers
* Has an out for relaxed logical pointers
* Updated PassFixture to expose validator options
* enabled relaxed logical pointers for some tests
* New validator tests
-
525e36d1
by Ryan Harrison
at 2018-11-27T22:05:54Z
Move OpExtInst validation into validate_extensions.cpp (#2124)
Fixes #2123
-
af3dc70a
by dan sinclair
at 2018-11-28T14:13:38Z
[ndk-build] Make SPIRV-Headers location configurable (#2126)
-
703305b1
by dan sinclair
at 2018-11-28T14:17:13Z
Fixup BUILD.gn file (#2129)
-
3ee605d7
by Ryan Harrison
at 2018-11-28T15:49:05Z
Ensure that only whitelisted extensions are used in WebGPU (#2127)
Fixes #2058
-
8ce3dbab
by Ryan Harrison
at 2018-11-29T18:48:42Z
Merge two implementations of ValidateExecutionScope (#2131)
-
2d2a5126
by Steven Perron
at 2018-11-29T19:24:58Z
Don't inline recursive functions. (#2130)
* Move ProcessFunction* function from pass to the context.
There are a few functions that are used to traverse the call tree.
They currently live in the Pass class, but they have nothing to do with
a pass, and may be needed outside of a pass. They would be better in
the ir context, or in a specific call tree class if we ever have a need
for it.
* Don't inline recursive functions.
Inlining does not check if a function is recursive or not. This has
been fine as long as the shader was a Vulkan shader, which forbid
recursive functions. However, not all shaders are vulkan, so either
we limit inlining to Vulkan shaders or we teach it to look for recursive
functions.
I prefer to keep the passes as general as is reasonable. The change
does not require much new code in inlining and gives a reason to refactor
some other code.
The changes are to add a member function to the Function class that
checks if that function is recursive or not.
Then this is used in inlining to not inlining a function call if it calls
a recursive function.
* Add id to function analysis
There are a few places that build a map from ids to Function whose
result is that id. I decided to add an analysis to the context for this
to reduce that code, and simplify some of the functions.
* Add missing file.
-
2cd040b0
by Ryan Harrison
at 2018-11-29T19:51:17Z
Merging two ValidateMemoryScope implementations (#2132)
Fixes #2125
-
625db389
by Ryan Harrison
at 2018-11-30T17:52:31Z
Add check for QueueFamilyKHMR memory scope (#2144)
This also fixes a small typo that was causing my test case to fail.
Fixes #2136
-
b8e2a9f2
by Alejandro Lopez
at 2018-11-30T18:12:05Z
Validate PushConstants annotation and type (#2140)
* Validate PushConstants have Block annotation and are struct or array of structs
* Add passing test and split into universal/vulkan environment tests
-
6af3c5cb
by alan-baker
at 2018-11-30T19:00:56Z
Clean uses of EvalInt32IfConst (#2145)
Fixes #2133
* Don't return OpSpecConstant* as constants in that method
* cleaned up uses
* added tests to catch shader semantics and scope bugs
-
e510b1ba
by alan-baker
at 2018-11-30T19:15:51Z
Update memory model (#1904)
Upgrade to VulkanKHR memory model
* Converts Logical GLSL450 memory model to Logical VulkanKHR
* Adds extension and capability
* Removes deprecated decorations and replaces them with appropriate
flags on downstream instructions
* Support for Workgroup upgrades
* Support for copy memory
* Adding support for image functions
* Adding barrier upgrades and tests
* Use QueueFamilyKHR scope instead of device
-
67b2e155
by dan sinclair
at 2018-12-03T14:11:56Z
Fixup BUILD.gn from addtion of upgrade_memory_model (#2152)
-
b9f9a3bc
by Ryan Harrison
at 2018-12-03T15:56:55Z
Add WebGPU Execution scope check (#2148)
Fixes #2069
-
d80259d3
by alan-baker
at 2018-12-03T16:03:52Z
Strict validation of where type ids are acceptable (#2142)
Fixes https://crbug.com/910239
* IdPass catches many instances of invalid references to types
* Test updates
* Added test to catch OpArrayLength issue
-
3596b383
by David Neto
at 2018-12-03T17:48:51Z
Set expected version number for cpp interface test (#2154)
-
ae182615
by Steven Perron
at 2018-12-03T17:49:27Z
Validate uses of ids defined in unreachable blocks. (#2146)
* Validate uses of ids defined in unreachable blocks.
For some reason we do not make sure the uses of ids that are defined
in unreachable blocks are dominated by their def. This is causing
invalid code to pass the validator.
Fixes #2143
* Add test for unreachable code after a return.
We want to allow code like:
```
void foo() {
a = ...;
...
return; // for debugging
<use of a>;
...
}
```
I added a test to make sure that something like this is still accepted
by the validator.
* Add test for unreachable def used in phi.
-
0c172a6b
by David Neto
at 2018-12-03T17:50:12Z
Allow Float16/Int8 for Vulkan 1.0 (#2153)
-
d835d664
by dan sinclair
at 2018-12-03T22:01:30Z
[val] Fixup id name output (#2158)
This CL changes the id/name output from the validator to always use a
consistent id[%name] style. This removes the need for getIdOrName. The
name lookup is changed to use the NameMapper so the output is consistent
with what the disassembler will produce.
Fixes #2137
-
b1ff8ba5
by alan-baker
at 2018-12-03T22:15:47Z
Check device scope for Vulkan memory model (#2149)
Fixes #2147
* Checks that device scope is not used for availability and visibility
operations unless VulkanMemoryModelDeviceScopeKHR capability is present
* implemented for atomics, barriers and memory instructions currently
-
d81a0c0e
by David Neto
at 2018-12-04T13:35:08Z
Fix WebGPU barrier test: Use QueueFamilyKHR scope (#2162)
-
17cba469
by Steven Perron
at 2018-12-04T15:04:02Z
Remove undefined behaviour when folding shifts. (#2157)
We currently simulate all shift operations when the two operand are
constants. The problem is that if the shift amount is larger than
32, the result is undefined.
I'm changing the folder to return 0 if the shift value is too high.
That way, we will have defined behaviour.
https://crbug.com/910937.
-
a1439604
by Alejandro Lopez
at 2018-12-04T15:05:41Z
Check binding annotations in resource variables (#2151)
Fixes #2007
Add checks that all uniform, uniform constant and storage buffer variables have descriptor set and binding decorations
-
a0816d03
by Steven Perron
at 2018-12-04T18:35:49Z
Validate OpForwardPointer (#2156)
* Validate OpForwardPointer
The validator does not have a a check that OpForwardPointer is giving
a forward reference to a pointer type. We add that check.
https://crbug.com/910852
* Remove more specialized check.
There was a check that the forward pointer is actually a poiner type,
but it was only done if it was used in a struct. This was too specific.
Remove it in favour of the more general check that was added.
* Format
* Check the storage type in OpTypeForwardPointer
* Fix typo is test case epxected results.
-
68d1dc66
by alan-baker
at 2018-12-05T13:10:02Z
Loosen binding and descriptor check (#2167)
* Only check for binding and descriptor set on variables that are
statically used by an entry point
* updated tests and added a couple new ones
* new method for collecting entry points that statically reference an
id
-
3e645b9d
by Ryan Harrison
at 2018-12-05T16:47:24Z
Check that if A calls B, B is defined before A for WebGPU (#2169)
Fixes #2067
-
2f5f5308
by Alejandro Lopez
at 2018-12-05T18:30:04Z
Validate that there is at most one push constant block (#2163)
Fixes #2006
Validates that there is at most one PushConstant interface per entry point for Vulkan environment.
-
378b7f3a
by Ryan Harrison
at 2018-12-05T18:58:43Z
Check for recursion in Vulkan and WebGPU entry points (#2161)
Fixes #2061
Fixes #2160
-
d9a97221
by Ryan Harrison
at 2018-12-05T20:33:55Z
Fix broken recurison validation tests (#2174)
This fixes tests that were broken by adding in validation of the order
of function definitions.
-
03afee3b
by Alejandro Lopez
at 2018-12-05T21:34:57Z
Test for WorkgroupId not being a uvec3 (#2173)
Test for WorkgroupId not being a uvec3
Fixes #1545
Make %workgroup_id an Input variable as required by spec
-
2e4563d9
by Steven Perron
at 2018-12-06T14:07:00Z
Document in the context what happens with id overflow. (#2159)
Added documentation to the ir context to indicates that TakeNextId()
returns 0 when the max id is reached. TODOs were added to each call
sight so that we know where we have to start to handle this case.
Handle id overflow in |SplitLoopHeader|.
Handle id overflow in |GetOrCreatePreHeaderBlock|.
Handle failure to create preheader in LICM.
Part of https://github.com/KhronosGroup/SPIRV-Tools/issues/1841.
-
aa270e56
by Steven Perron
at 2018-12-06T16:31:47Z
Be more explicit about SPIRV_WERROR option. (#2141)
There was some confusion about the SPIRV_WERROR option when it is turned
off. When the option is off nothing is done. That is, we do not add
-Wno-error. This means that if the parent project added -Werorr to the
C flags or CXX flags, then warnings will still be treated as errors.
I've updated the README.md to make this explicit.
Fixes #2121.
-
cf37ab72
by Ryan Harrison
at 2018-12-06T19:38:15Z
Merge two implementations of ValidateMemorySemantics (#2175)
Fixes #2170
-
6df6194d
by David Neto
at 2018-12-07T14:32:57Z
Validate Uniform decoration (#2181)
-
7c38fee6
by Ryan Harrison
at 2018-12-07T15:38:52Z
Restrict mask bits for memory semantics in WebGPU (#2180)
Fail to validate memory semantics value if it includes set bits that
are not on the whitelist from the spec.
Fixes #2070
-
6679d5df
by Alastair Donaldson
at 2018-12-07T17:44:46Z
Replace loop with selection (#2164)
Add a pass for spirv-reduce that will turn a loop into a selection.
-
de797ddc
by Alejandro Lopez
at 2018-12-07T17:46:27Z
Check that certain decorations cannot be used more than once and/or are mutually exclusive (#2171)
Fixes #1636
* Add a hash functor for decoration types for c++11 compliance
* Change non-POD static variables and add test for Block+BufferBlock
-
0bc66a8b
by Steven Perron
at 2018-12-07T19:10:30Z
Fix invalid OpPhi generated by merge-return. (#2172)
* Fix invalid OpPhi generated by merge-return.
When we create a new phi node for a value say %10, we have to replace
all of the uses of %10 that are no longer dominated by the def of %10
by the result id of the new phi. However, if the use is in a phi node,
it is possible that the bb contains the use is not dominated by either.
In this case, needs to be handled differently.
* Split loop headers before add a new branch to them.
In merge return, Phi node in loop header that are also merges for loop
do not get updated correctly. Those cases do not fit in with our
current analysis. Doing this will simplify the code by reducing the
number of cases that have to be handled.
-
aab6f407
by Steven Perron
at 2018-12-07T19:11:15Z
Add documentation for licm option to the spirv-opt help. (#2179)
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/2165.
-
8fc8dfe4
by Jeff Bolz
at 2018-12-10T15:54:19Z
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)
-
4aeadc01
by Hugues Evrard
at 2018-12-10T16:53:31Z
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.
-
e07dabc2
by Steven Perron
at 2018-12-10T18:24:33Z
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.
-
248debf5
by Steven Perron
at 2018-12-10T19:33:14Z
Update CHANGES
-
a719fc18
by Ryan Harrison
at 2018-12-11T19:19:44Z
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.
-
24328a05
by Jeff Bolz
at 2018-12-12T00:03:55Z
Recognize OpTypeAccelerationStructureNV as a type instruction (#2190)
-
1cba9942
by Alastair Donaldson
at 2018-12-12T14:06:13Z
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.
-
2af6ffae
by Alastair Donaldson
at 2018-12-12T14:06:54Z
Added test related to access chains, to be extended when issue 2183 is addressed. (#2192)
-
c512c686
by Steven Perron
at 2018-12-13T20:03:28Z
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.
-
e0292c26
by Ryan Harrison
at 2018-12-17T21:54:23Z
Add --target-env flag to spirv-opt (#2216)
Fixes #2199
-
ff07c6df
by Steven Perron
at 2018-12-18T18:14:27Z
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.
-
1254335d
by Steven Perron
at 2018-12-18T18:15:00Z
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.
-
7f57887e
by Ryan Harrison
at 2018-12-18T18:34:30Z
Remove check for SpvCapabilityAtomicStorage (#2243)
Per conversation on
https://github.com/KhronosGroup/glslang/issues/1618 and other places.
-
acd27819
by Steven Perron
at 2018-12-18T19:34:03Z
Handle id overflow in inlining. (#2196)
Have inlining return Failure if the ids overflow.
Part of #1841.
-
47c08a79
by Ryan Harrison
at 2018-12-18T20:10:34Z
Implement initial --webgpu-mode flag (#2217)
Fixes #2166
-
5ec2d1a8
by Steven Perron
at 2018-12-19T04:40:30Z
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.
-
71aa48f9
by Paul Thomson
at 2018-12-19T13:25:56Z
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.
-
9e81c337
by Steven Perron
at 2018-12-19T15:18:22Z
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.
-
9d04f82b
by Steven Perron
at 2018-12-19T17:07:29Z
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.
-
ac7feace
by Steven Perron
at 2018-12-19T18:17:42Z
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.
-
68b69e16
by Steven Perron
at 2018-12-19T21:24:49Z
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.
-
e49bd96f
by kholtnv
at 2018-12-19T21:42:39Z
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)
-
c2013e24
by Steven Perron
at 2018-12-20T18:00:05Z
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.
-
d7634697
by Steven Perron
at 2018-12-20T19:42:28Z
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.
-
5e19d3fe
by Steven Perron
at 2018-12-20T20:02:53Z
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.
-
bdc2ab93
by Steven Perron
at 2018-12-20T23:33:52Z
In LICM don't place code between merge instruction and branch. (#2252)
Fixes #2210.
-
167f1270
by dan sinclair
at 2018-12-21T21:24:15Z
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
-
f70e9e2a
by Ankit Navik
at 2018-12-27T20:06:37Z
tools/lesspipe: Allow generic shell (#2255)
tools/lesspipe: Allow generic shell
-
980ae1d1
by kholtnv
at 2018-12-27T20:08:11Z
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.
-
64f2750e
by David Neto
at 2018-12-28T22:27:53Z
Update copyright checker for 2019 (#2256)
-
9f36c8bb
by Steven Perron
at 2019-01-02T19:00:04Z
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.
-
241644a5
by Steven Perron
at 2019-01-03T18:02:10Z
Have replace load size handle extact with no index. (#2261)
Fixes https://crbug.com/917774
-
a900bacb
by alan-baker
at 2019-01-03T18:55:43Z
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
-
a87d3ce4
by David Neto
at 2019-01-03T19:28:00Z
Validate operation for OpSpecConstantOp (#2260)
-
2f004baa
by Ehsan
at 2019-01-07T15:00:49Z
[kokoro] Fix usage of ERRORLEVEL in Windows script. (#2262)
-
04cc2b15
by Steven Perron
at 2019-01-07T15:13:15Z
Update CHANGES
-
06c9dc07
by alan-baker
at 2019-01-07T17:36:38Z
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
-
5eab6df6
by Jeff Bolz
at 2019-01-07T18:19:24Z
SPV_EXT_physical_storage_buffer (#2267)
-
2297d4a3
by Steven Perron
at 2019-01-07T20:48:55Z
Finalize SPIRV-Tools v2019.1