Commit Graph

1084 Commits

Author SHA1 Message Date
GregF
c5c233ba1e Opt: Add new size-reduction passes to usage message. 2017-08-02 13:21:16 -04:00
Andrey Tuganov
55b73a0365 Added C++ code generation to spirv-stats
The tool can now generate C++ code returning some of the historgrams and
Huffman codecs generated from those historgrams.
2017-08-01 15:41:42 -04:00
David Neto
65b180f451 Add Appveyor config that uses VS 2017 2017-08-01 11:44:33 -04:00
GregF
7954740d54 Opt: Delete names and decorations of dead instructions 2017-07-26 18:36:41 -04:00
Lei Zhang
9f6efc76c8 Opt: HasOnlySupportedRefs should consider OpCopyObject
This fixes test failure after merging the previous pull request.
2017-07-25 23:22:09 -04:00
Lei Zhang
4a539d77ef Revert "Revert "Opt: LocalBlockElim: Add HasOnlySupportedRefs""
This reverts commit df96e243c6.
2017-07-25 23:22:09 -04:00
GregF
1182415581 Add extension whitelists to size-reduction passes.
Currently only SPV_KHR_variable_pointers is disallowed in passes which
do pointer analysis. Positive and negative tests of the general extensions
mechanism were added to aggressive_dce but cover all passes.
2017-07-25 19:14:02 -04:00
Lei Zhang
df96e243c6 Revert "Opt: LocalBlockElim: Add HasOnlySupportedRefs"
This reverts commit 2d0f7fbc11.
2017-07-22 10:48:56 -04:00
greg-lunarg
2d0f7fbc11 Opt: LocalBlockElim: Add HasOnlySupportedRefs
Verifies that targeted variables have only access chain and direct
loads and stores as references.
2017-07-22 10:32:19 -04:00
GregF
adb237f3bd Fix handling of CopyObject in GetPtr and its call sites 2017-07-21 18:08:01 -04:00
Lenny Komow
e9e4393b1c Fix Visual Studio size_t cast compiler warning
Visual Studio was complaining about possible loss of data on 64-bit
builds, due to an implicit cast from size_t to int. This changes the
data to use an int with no cast.
2017-07-13 13:02:43 -06:00
Greg Fischer
fe24e0316f LocalMultiStore: Always put varId for backedge on loop phi function.
And always patch the backedge operand when patching phi functions. This
approach is more correct and cleaner. The previous code was generating
incorrect phis when the backedge block had no predecessors.
2017-07-12 16:42:07 -04:00
GregF
e2544ddc90 DeadBranchElim: Improve algorithm to only remove blocks with no predecessors
Must be careful not to remove blocks pointed at by unreachable blocks
2017-07-12 15:58:42 -04:00
David Neto
06d4fd52c2 Minor code review feedback on AggressiveDCE 2017-07-10 11:45:59 -04:00
GregF
9de4e69856 Add AggressiveDCEPass
Create aggressive dead code elimination pass
This pass eliminates unused code from functions. In addition,
it detects and eliminates code which may have spurious uses but which do
not contribute to the output of the function. The most common cause of
such code sequences is summations in loops whose result is no longer used
due to dead code elimination. This optimization has additional compile
time cost over standard dead code elimination.

This pass only processes entry point functions. It also only processes
shaders with logical addressing. It currently will not process functions
with function calls. It currently only supports the GLSL.std.450 extended
instruction set. It currently does not support any extensions.

This pass will be made more effective by first running passes that remove
dead control flow and inlines function calls.

This pass can be especially useful after running Local Access Chain
Conversion, which tends to cause cycles of dead code to be left after
Store/Load elimination passes are completed. These cycles cannot be
eliminated with standard dead code elimination.

Additionally: This transform uses a whitelist of instructions that it
knows do have side effects, (a.k.a. combinators).  It assumes other
instructions have side effects: it will not remove them, and assumes
they have side effects via their ID operands.
2017-07-10 11:30:25 -04:00
GregF
cc8bad3a5b Add LocalMultiStoreElim pass
A SSA local variable load/store elimination pass.
For every entry point function, eliminate all loads and stores of function
scope variables only referenced with non-access-chain loads and stores.
Eliminate the variables as well.

The presence of access chain references and function calls can inhibit
the above optimization.

Only shader modules with logical addressing are currently processed.
Currently modules with any extensions enabled are not processed. This
is left for future work.

This pass is most effective if preceeded by Inlining and
LocalAccessChainConvert. LocalSingleStoreElim and LocalSingleBlockElim
will reduce the work that this pass has to do.
2017-07-07 17:54:21 -04:00
GregF
52e247f221 DeadBranchElim: Add DeadBranchElimPass 2017-07-07 15:16:25 -04:00
David Neto
35a0695844 Include memory and semantics IDs when iterating over inbound IDs
Fixes Instruction::ForEachInId so it covers
SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID and SPV_OPERAND_TYPE_SCOPE_ID.
Future proof a bit by using the common spvIsIdType routine.

Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/697
2017-07-05 10:36:57 -04:00
Andrey Tuganov
abc6f5a672 MARK-V decoder supports extended instructions 2017-07-04 16:31:19 -04:00
David Neto
826d968a63 Update CHANGES to say we use GNUIntallDirs 2017-07-04 12:28:11 -04:00
d3x0r
fd70a1d7a0 Define variable to skip installation
If this is used as a static library in another project, this does not
need to be installed, and otherwise will just clutter the application's install.
To use, define SKIP_SPIRV_TOOLS_INSTALL which internally defines
ENABLE_SPIRV_TOOLS_INSTALL to control installation.

Also include GNUInstallDirs to get standard output 'lib' directory which is sometimes 'lib64' and not 'lib'
2017-07-04 12:24:44 -04:00
Chris Forbes
78338d5ba9 Convert pattern stack from deque to vector, and share it
Also move various vector::reserve calls to State ctor
Negligible perf benefit, but more tidy.
2017-07-04 12:02:26 -04:00
Andrey Tuganov
e842c17eb5 Added fixed width encoding to bit_stream
Fixed width encoding is intended to be used for small unsigned integers
when the upper bound is known both to the encoder and the decoder
(for example move-to-front rank).
2017-07-04 11:57:13 -04:00
Andrey Tuganov
73e8dac5b9 Added compression tool tools/spirv-markv. Work in progress.
Command line application is located at tools/spirv-markv
API at include/spirv-tools/markv.h

At the moment only very basic compression is implemented, mostly varint.
Scope of supported SPIR-V opcodes is also limited.

Using a simple move-to-front implementation instead of encoding mapped
ids.

Work in progress:
- Does not cover all of SPIR-V
- Does not promise compatibility of compression/decompression across
  different versions of the code.
2017-06-30 12:22:48 -04:00
Andrey Tuganov
8d3882a408 Added log(n) move-to-front implementation
The implementation is based on AVL and order statistic tree.

It accepts all kinds of values and the implementation
doesn't expect the behaviour to be consistent with id coding.

Intended by SPIR-V compression algorithms.
2017-06-29 16:16:18 -04:00
Andrey Tuganov
40a2829611 Added Huffman codec to utils
Attached ids to Huffman nodes for deterministic internal node
comparison.
2017-06-29 14:51:01 -04:00
Lei Zhang
65ea885234 Travis CI: stop requiring sudo and use make instead of ninja
This gives us shorter testing time since we can use the container
based testing environment, which starts faster. Also using make
means we don't need to install ninja separately.
2017-06-28 16:40:12 -04:00
Chris Forbes
d431b69c28 Don't do hash lookup twice in FindDef 2017-06-28 11:13:26 -04:00
Chris Forbes
c14966b882 Move spv_instruction_t's into vector
No need to incur another copy here. These guys have embedded vectors
we'd rather not copy.
2017-06-28 11:13:26 -04:00
Chris Forbes
1cd47d7af2 Reserve expected length of instructions vector 2017-06-28 11:13:26 -04:00
Chris Forbes
fcd991f081 Move some temp vectors into parser state
We don't need to churn the allocations for these every instruction.
2017-06-28 11:13:26 -04:00
GregF
ad1d0351a0 BlockMerge: Add BlockMergePass
Also, add BasicBlock::tail()
2017-06-27 11:31:33 -04:00
David Neto
0b0454c42c Update CHANGES
- Describe support for AMD extensions
- Describe recently added optimizer passes
2017-06-22 10:22:55 -04:00
Rex Xu
5fbbadca4e Add support for SPV AMD extensions 2017-06-21 15:08:07 -04:00
GregF
6136bf9e0b mem2reg: Add InsertExtractElimPass 2017-06-21 08:13:15 -04:00
David Neto
760789f58d Transform multiple entry points
Don't stop just after one because of short-circuiting logical-or.
2017-06-20 15:57:47 -04:00
GregF
0c5722fc01 mem2reg: Add LocalSingleStoreElimPass
Eliminate function scope variables with one store, if possible.
2017-06-19 10:43:02 -04:00
GregF
7c8da66bc2 mem2reg: Add pass to eliminate local loads and stores in single block. 2017-06-12 17:03:47 -04:00
rdb
1567cddc36 Don't install googletest and googlemock 2017-06-07 10:32:45 -04:00
GregF
aa7e687ef0 Mem2Reg: Add Local Access Chain Convert pass
- Supports OpAccessChain and OpInBoundsAccessChain
- Does not process modules with non-32-bit integer types.
2017-06-04 12:49:27 -04:00
Gabríel Arthúr Pétursson
d71d976875 Fix memory leak in ValidateBinaryUsingContextAndValidationState 2017-06-03 23:08:22 +00:00
Andrey Tuganov
66fc10564c Bots print output from timed out tests
Timeout set to 300 seconds. If no timeout, then ctest itself will be
timed out and terminated leaving no output.
2017-05-31 10:34:54 -04:00
Andrey Tuganov
e7aff807a0 Fixed misspelled ctest flag --output_on_failure 2017-05-29 13:26:46 -04:00
rdb
ddf4de61c9 Support building on FreeBSD 2017-05-28 23:20:18 +02:00
Greg Fischer
3bea99d378 CFA: Move TraversalRoots and ComputeAugmentedCFG into CFA 2017-05-25 11:43:24 -06:00
Greg Fischer
d6f2979068 CFA: Pull in CalculateDominators 2017-05-25 12:31:38 -04:00
GregF
df6537cee0 DefUseManager: Fix ReplaceAllUsesWith() to update inst_to_used_ids_ 2017-05-25 11:53:50 -04:00
Andrey Tuganov
20fe946666 Added extension SPV_VALIDATOR_ignore_type_decl_unique
If extension is present in the module, validator will ignore the "type
declaration must be unique" rule.
2017-05-25 11:36:48 -04:00
Lei Zhang
3492cc63b8 Remove unused this in lambda capture 2017-05-17 14:12:25 -04:00
David Neto
dbc2049aa3 Add SPIR-V 1.2 support, for OpenCL 2.2 2017-05-15 17:10:07 -04:00